fix(anvil): track Amsterdam block gas accounting#14759
Open
Perico-perica46 wants to merge 1 commit into
Open
Conversation
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.
Motivation
AnvilBlockExecutorstill accumulatedtx_gas_used()as both the receipt cumulative gas and the block gas total. After Amsterdam/EIP-8037, revm splits regular gas and state gas, and the block header should use the maximum of the block regular gas and block state gas while receipts keep cumulative transaction gas.Anvil's node setup also set the hardfork directly on a default
CfgEnv, which left spec-dependent gas params and the Amsterdam EIP-8037 flag stale for explicit and auto-detected hardforks.Solution
Initialize and update Anvil's
CfgEnvthrough revm's spec-aware gas parameter APIs. Track receipt cumulative gas separately from regular/state block gas inAnvilBlockExecutor. Use the Amsterdam-aware gas accumulator for block availability and finalBlockExecutionResult::gas_used, and returnGasOutput::with_state_gasso downstream executor consumers preserve both gas components.Add an Amsterdam integration test that mines a contract creation transaction and checks the block header gas uses split block gas accounting instead of receipt cumulative gas.
PR Checklist