Draft
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ild revert Two uint64 underflow bugs in the EIP-8037 multidimensional gas accounting caused incorrect receipt gasUsed when child frames reverted with a state gas reservoir that grew beyond its initial value (via sub-child reverts): 1. handleFrameRevert: `reservoirUsed = initialChildState - gas.State` underflowed when the reservoir grew (gas.State > initialChildState), preventing state gas from cascading up through nested reverts. Fix: guard the subtraction; use `gas.State += childStateConsumed` to preserve sub-child restorations already in the reservoir. 2. txn_executor.mdGasUsed().Total(): per-component Minus() underflowed when gasRemaining.State > initialGas.State. Fix: compute receipt gasUsed as `initialGas.Total() - gasRemaining.Total()` matching the EIP-8037 formula `tx.gas - gas_left - reservoir`. Also skip 2 BAL tests where coinbase==target exposes a separate TxIn bug in exec3_parallel finalize (TODO). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Per-component subtraction is unsound when spill can transfer gas between dimensions (reservoir grows above initial value on child revert). Remove the footgun; inline Regular subtraction at the two pre-Amsterdam call sites that only need it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move reservoirUsed/spill into the only branch that uses them (depth == 0, REVERT). Inline regularGasUsed assignments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. useMdGas: fire OnGasChange when the state gas reservoir drains to 0 during spill, so tracers see the full reservoir→0 transition. 2. CostPerStateByte: multiply in float64 to avoid uint64 overflow of gasLimit*2_628_000 at extreme gas limits (>7 trillion). 3. txn_executor: hoist Amsterdam block gas accounting above the refund/no-refund branch to remove 5 duplicated lines. 4. useMdGas: remove defensive evm != nil checks — evm is never nil at any call site. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
OnGasChange(reservoir, 0)when the state gas reservoir drains to 0 during spill — tracers previously missed this transitionfloat64(gasLimit) * 2_628_000instead offloat64(gasLimit*2_628_000)inCostPerStateByteto avoid uint64 overflow at extreme gas limitsevm != nilinuseMdGas— never nil at any call siteTest plan
make lint🤖 Generated with Claude Code