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

Make eth_gasPrice aware of the base fee market #7102

Merged
merged 7 commits into from
May 22, 2024

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented May 14, 2024

PR description

The eth_gasPrice is not taking in account the base fee market values, when the network supports them, so it is possible that it returns values that are not good for pricing a tx for inclusion in the next block.
Specifically the calculation of gas price lower bound only rely on the runtime value of minGasPrice, but on base fee market networks, it could be that baseFee for the next block is higher than the minGasPrice, for example for devnets using the default, the minGasPrice=1kwei and the genesis sets baseFee=1gwei and the result is that senders thinks the can just price the gas at 1kwei to the the tx included, which is not the case.

This PR takes in consideration the baseFee value when calculating the lower bound, along with the fix I did some refactoring to move the gas price calculation into BlockchainQueries and continue to directly use MiningParameters to get the gas market info.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@fab-10 fab-10 force-pushed the eth-gas-price-basefee-aware branch 4 times, most recently from d8d1abd to b6bc833 Compare May 17, 2024 14:16
@fab-10 fab-10 marked this pull request as ready for review May 17, 2024 14:18
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some commented out code hanging around, overall looks good

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the eth-gas-price-basefee-aware branch from 1e49136 to 3145d91 Compare May 20, 2024 12:21
@fab-10 fab-10 enabled auto-merge (squash) May 20, 2024 12:22
@fab-10 fab-10 requested a review from macfarla May 20, 2024 14:10
@fab-10 fab-10 merged commit 8df6bca into hyperledger:main May 22, 2024
37 checks passed
@fab-10 fab-10 deleted the eth-gas-price-basefee-aware branch May 22, 2024 06:42
jflo pushed a commit to jflo/besu that referenced this pull request May 28, 2024
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
jflo pushed a commit to jflo/besu that referenced this pull request Jun 10, 2024
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
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 this pull request may close these issues.

2 participants