ApeWorX / ApeWorX/web3.py

Gas estimates on l2 (specifically optimism)

Open
#3,079 0 comments 8 reactions 1 assignee Claimed by @kclowes View on GitHub
L2 priority: p3 nice to have
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
2

Description

* Version: 5.28.0
* Python: 3.x
* OS: linux
* `pip freeze` output

```
aiohttp==3.8.3

aiosignal==1.3.1

appdirs==1.4.4

APScheduler==0.0.0

async-timeout==4.0.2

attrs==22.2.0

base58==2.1.1

bitarray==2.6.2

Brlapi==0.8.2

certifi==2020.6.20

chardet==4.0.0

charset-normalizer==2.1.1

chrome-gnome-shell==0.0.0

cliapp==1.20180812.1

cmdtest==0.32+git

cupshelpers==1.0

cytoolz==0.12.1

dbus-python==1.2.16

distlib==0.3.1

distro==1.5.0

distro-info==1.0

eth-abi==2.2.0

eth-account==0.5.9

eth-hash==0.5.1

eth-keyfile==0.5.1

eth-keys==0.3.4

eth-rlp==0.2.1

eth-typing==2.3.0

eth-utils==1.9.5

filelock==3.0.12

frozenlist==1.3.3

hexbytes==0.3.0

httplib2==0.18.1

idna==2.10

importlib-metadata==1.6.0

ipfshttpclient==0.8.0a2

jsonschema==3.2.0

louis==3.16.0

lru-dict==1.1.8

Mako==1.1.3

Markdown==3.3.4

MarkupSafe==1.1.1

more-itertools==4.2.0

multiaddr==0.0.9

multidict==6.0.4

netaddr==0.8.0

parsimonious==0.8.1

pipenv==11.9.0

protobuf==3.20.3

pycairo==1.16.2

pycryptodome==3.16.0

pycups==2.0.1

pycurl==7.43.0.6

Pygments==2.7.1

PyGObject==3.38.0

pyrsistent==0.19.3

PySimpleSOAP==1.16.2

pysmbc==1.0.23

python-apt==2.2.1

python-debian==0.1.39

python-debianbts==3.1.0

python-dotenv==0.19.2

pytz==2021.1

pyxdg==0.27

PyYAML==5.3.1

reportbug==7.10.3+deb11u1

requests==2.25.1

rlp==2.0.1

six==1.16.0

termcolor==1.1.0

toolz==0.12.0

tqdm==4.66.1

ttystatus==0.38

tzlocal==2.1

unattended-upgrades==0.1

urllib3==1.26.5

varint==1.0.2

virtualenv==20.4.0+ds

virtualenv-clone==0.3.0

web3==5.28.0

websockets==9.1

xdg==5

yarl==1.8.2

zipp==1.0.0

```

### What would be nice?

estimate_gas on Op doesn't include underlying l1 costs

https://optimistic.etherscan.io/address/0x420000000000000000000000000000000000000F#readProxyContract

The above link has
rawhex = signed_tx.rawTransaction.hex()
l1BaseFee = opGas.functions.l1BaseFee().call()
overhead = opGas.functions.overhead().call()
scalar = opGas.functions.scalar().call()/1000000
gasPrice = opGas.functions.gasPrice().call()
l1Fee = opGas.functions.getL1Fee(rawhex).call()
l1GasUsed = opGas.functions.getL1GasUsed(rawhex).call()

Would be dope if instead of users having to delve deep into l2 developer docs and track down the in's and outs
of how this stuff worked, you guys could work your wizardry and simplify things a bit.

I'm guessing the same goes for arb and any other l2's but the only one I'm wrestling with is Op.
Perhaps estimate_gas could look for chain id, and then magic the appropriate information out
respectively.

Please include any of the following that are applicable:

* The code which produced the error
* The full output of the error
* What type of node you were connecting to.

### How can it be fixed?

Fill this section in if you know how this could or should be fixed.

---
**Note:** We prefer to use issues to track our work. If you think you've encountered a bug in web3py or
have a feature request, you're in the right place. If you have implementation or usage questions,
please refer to our [documentation](https://web3py.readthedocs.io/en/latest/) and/or join the conversation
on [discord](https://discord.gg/GHryRvPB84).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.