Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_feeHistory not supported #501

Open
CedarMist opened this issue Dec 29, 2023 · 2 comments · May be fixed by #502
Open

eth_feeHistory not supported #501

CedarMist opened this issue Dec 29, 2023 · 2 comments · May be fixed by #502
Assignees

Comments

@CedarMist
Copy link
Member

CedarMist commented Dec 29, 2023

The eth_feeHistory and eth_maxPriorityFeePerGas JSON-RPC calls are used by Web3.py when estimating gas

@ptrus ptrus self-assigned this Jan 1, 2024
@ptrus
Copy link
Member

ptrus commented Jan 3, 2024

While this is technically possible to implement, one possibility is also to just require the usage of the eth_gasPrice endpoint. I believe this is easy to configure in web3.py by setting the gas_price strategy.

The reasoning for this is that the gas-price returned by the oasis-web3-gateway is dynamically calculated and it should be a good estimate (see here for details). I believe this should generally return a good gas price value. Also note that the way oasis-sdk handles EIP1559 transactions base-fee is always zero.

Can you please comment on how high priority is adding the eth_feeHistory endpoint, or if is using eth_gasPrice an ok short-term solution?


As for implementation goes, seems somewhat straightforward with some caveats/simplification:

  • we should limit the query only to recent blocks. E.g. web3-js implementation mentions:

Transaction fee history Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available. The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older history are optional to support.

As per the above seems reasonable limiting to e.g. last 10 blocks.

  • Don't support queries for blocks in the past (past the last 10 blocks) - seems no reason to need this for estimating gas price.

  • The way oasis-sdk hanldles EIP1559 transactions BASEFEE is always zero.

So the implementation requires:

  • fetch last X blocks and calculate the provided percentiles and block gas used ratios

@ptrus ptrus linked a pull request Jan 5, 2024 that will close this issue
1 task
@ptrus
Copy link
Member

ptrus commented Jan 5, 2024

There's an initial implementation in #502 Seems to be working based on the simple unit test. Needs some more testing.

Feel free to try it out if you'll have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants