-
Notifications
You must be signed in to change notification settings - Fork 671
Estimate Gas fix #10559
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
Merged
Merged
Estimate Gas fix #10559
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4b55a86
Estimate Gas fix
svlachakis 3b443c4
format
svlachakis 0d723b1
format
svlachakis ae86a8f
test fix
svlachakis 82cd069
Merge branch 'master' into 10552-estimategas
svlachakis d8720cc
Update src/Nethermind/Nethermind.Blockchain.Test/TransactionProcessor…
smartprogrammer93 b97a07d
Update src/Nethermind/Nethermind.Evm.Test/Tracing/GasEstimationTests.cs
smartprogrammer93 1b6fa2c
fix shared method
svlachakis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Can_estimate_with_destroy_refund_and_below_intrinsic_pre_berlintest previously expected an estimate of 59307. With the nesting-aware OutOfGas fix, it now returns 54225 — a lower, more accurate estimate.At this gas level, the inner
CALLto theSELFDESTRUCTcontract runs out of gas, but the top-levelCREATEtransaction still succeeds. The old estimate was inflated because the binary search rejected54225due to the inner OOG, even though the transaction completes successfully.This matches Geth's behavior. Geth’s binary search implementation:
https://github.com/ethereum/go-ethereum/blob/master/eth/gasestimator/gasestimator.go
uses
result.Failed()to decide whether to raise or lower the gas bound.Failed()is defined in: https://github.com/ethereum/go-ethereum/blob/master/core/state_transition.goas:
Errreflects only the top-level EVM outcome. An inner call Out-Of-Gas is handled internally by theCALLopcode (which pushes0onto the stack) and does not propagate toresult.Err. Therefore, Geth would accept54225as a valid estimate.The test validation was changed from
ConfirmEnoughEstimate(which usesGethLikeTxTracerand asserts no OOG at any call depth) to inlineCallOutputTracer.StatusCodechecks that verify the top-level transaction succeeds at the estimate and fails below it — matching what Geth actually validates.From Geth’s
gasestimator.go:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to confirm this against geth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm, geth returns the same exact value as the new implementation we have here.