Make gas estimation strict by default#8629
Merged
fab-10 merged 7 commits intobesu-eth:mainfrom May 23, 2025
Merged
Conversation
3768971 to
1cb6e75
Compare
macfarla
approved these changes
May 22, 2025
Contributor
macfarla
left a comment
There was a problem hiding this comment.
LGTM maybe an update to the docs required
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>
63d8f3a to
7c6c9b7
Compare
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
Second PR of the series that improves gas estimation.
Besu implementation of
eth_gasEstimationaccepts the non standard parametersstrict, that by default isfalse.This parameters tells Besu that when processing the tx to estimate the gas used, the sender is allowed to exceeds his balance, and this is achieved setting to
0all the gas price related field in the tx and in the block header.This approach is not the standard, and could cause wrong gas estimations for some txs, so this PR set the default value of the
strictparameter totrue.It is still possible to force the previous behavior, explicitly passing the
strictparameter in the request, set tofalse.Since
strictmode does not alter gas pricing parameters, there is the need to calculate the gas limit upper bound that the sender is able to afford according to his balance, and use that upper bound in case it is lower than the block gas limit, when starting the binary search, to avoid tx upfront cost exceed balance errors.Always in
strictmode, since the gas pricing parameters are absent, then we need to permit underpriced tx, to skip checks on baseFee and blobBaseFee.Comparing this PR with current main branch, using https://github.com/Consensys/compate-estimate-gas-plugin, there are less under estimations:
BesuPR8629 3399
BesuNightly 3426
Fixed Issue(s)
fixes #8146
Thanks for sending a pull request! Have you done the following?
doc-change-requiredlabel to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply./gradlew build./gradlew acceptanceTest./gradlew integrationTest./gradlew ethereum:referenceTests:referenceTests