Conversation
Merging this PR will degrade performance by 3.31%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | EXTCODESIZE_50 |
39 µs | 40.3 µs | -3.31% |
Comparing devnet3 (517d9c8) with main (910c632)
17ce6d9 to
1e1d64d
Compare
cf4533f to
d537a3b
Compare
This reverts commit 1e1d64d.
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.
Summary
Implements EIP-8037 state gas using the reservoir model for Amsterdam devnet3. This is a major change to how gas accounting works in revm.
Core changes
context/interface/src/cfg/gas.rs): New centralized gas tracker withremaining,reservoir,state_gas_spent, andrefundedfields. The reservoir holds execution gas exceedingTX_MAX_GAS_LIMIT, creating a separate budget for state gas operations.interpreter/src/gas.rs): Delegates toGasTrackerinternally. Addsrecord_state_cost()(draws from reservoir first, then spills to remaining) alongside existingrecord_cost()for regular gas. TheGASopcode returns onlyremaining(excludes reservoir per EIP-8037).context/interface/src/cfg/gas_params.rs): New parameterized gas cost system withGasIdconstants (1-45) andGasParams::get(GasId)lookup, replacing some hardcoded gas values.context/interface/src/result.rs): Extended to carrystate_gas_spentandreservoirthrough execution results, enabling proper gas accounting in receipts and post-execution.Handler changes
handler/src/frame.rs): Child frames receive reservoir from parent. On return, parent absorbs child's reservoir and accumulatesstate_gas_spent.handler/src/pre_execution.rs): EIP-7702 auth list state gas split into separate accounting viasplit_eip7702_refund().handler/src/post_execution.rs): Floor gas (EIP-7623) and refund cap calculations updated to work with reservoir model. State gas spent excluded from regular refund caps.handler/src/validation.rs): Transaction validation updated for state gas budget.handler/src/system_call.rs): Gas handling updated for reservoir model.Instruction changes
interpreter/src/instructions/host.rs): State gas charging for storage writes.interpreter/src/instructions/contract.rs): State gas for code deposit and contract creation. Static call check ordering aligned with execution-specsgeneric_create().interpreter/src/instructions/contract/call_helpers.rs): State gas for account creation (value transfer to new accounts).interpreter/src/instructions/system.rs): State gas for beneficiary account creation.Precompile changes
precompile/src/interface.rs): Removedgas_limitfromPrecompileOutput, flattenedPrecompileError.handler/src/precompile_provider.rs): Updated for reservoir handling.op-revm
handler.rsandprecompiles.rsto work with the new gas model.Testing
ee-tests/src/eip8037.rs.Devnet3-specific adjustments
Two reverts from the full spec implementation to match devnet3 behavior:
Test plan
cargo nextest run --workspacecargo clippy --workspace --all-targets --all-featurescargo run -p revme statetestcargo test -p ee-tests eip8037