Skip to content

Update EIP-8037: clarify spillover state gas still increments execution_state_gas_used#11522

Merged
eth-bot merged 1 commit into
ethereum:masterfrom
qu0b:qu0b/eip-8037-spillover-classification
Apr 14, 2026
Merged

Update EIP-8037: clarify spillover state gas still increments execution_state_gas_used#11522
eth-bot merged 1 commit into
ethereum:masterfrom
qu0b:qu0b/eip-8037-spillover-classification

Conversation

@qu0b

@qu0b qu0b commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Clarify that when a state gas charge exceeds state_gas_reservoir and spills into gas_left, the charge still increments execution_state_gas_used in full — it does not increment execution_regular_gas_used. Counter classification is by cost type, not funding source.

Motivation

Discovered during bal-devnet-3 debugging. Three EL clients diverged on the same block because they disagreed on which counter a spilled state-gas charge increments:

  • geth: increments execution_state_gas_used (matches EELS charge_state_gas in forks/amsterdam/vm/gas.py).
  • erigon / reth / nethermind: incremented execution_regular_gas_used (read line 117 as "costs that were paid from the regular budget count toward regular gas").

Since block_gas_used = max(cum_regular_gas_used, cum_state_gas_used), the two interpretations produce block totals that differ by exactly the spilled amount (e.g. 131,488 = 112 × cpsb for a single GAS_NEW_ACCOUNT at 100M gas limit), splitting the chain.

The current paragraph at line 117 already implies the EELS / geth behaviour but does not state it explicitly. Adding one sentence at line 111, where spillover is introduced, removes the ambiguity at the point readers are most likely to lose the invariant.

Scope

Purely a clarification — no semantic change. Disjoint from:

EELS already implements this behaviour in charge_state_gas (src/ethereum/forks/amsterdam/vm/gas.py):

if evm.state_gas_left >= amount:
    evm.state_gas_left -= amount
elif evm.state_gas_left + evm.gas_left >= amount:
    remainder = amount - evm.state_gas_left
    evm.state_gas_left = Uint(0)
    evm.gas_left -= remainder
else:
    raise OutOfGasError

evm.state_gas_used += amount  # full amount, regardless of source

This PR brings the EIP text in line with the reference implementation.

@qu0b qu0b requested a review from eth-bot as a code owner April 13, 2026 12:16
@github-actions github-actions Bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Apr 13, 2026
@eth-bot

eth-bot commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

✅ All reviewers have approved.

@eth-bot eth-bot enabled auto-merge (squash) April 14, 2026 13:07

@eth-bot eth-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 2d31779 into ethereum:master Apr 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a-review Waiting on author to review c-update Modifies an existing proposal s-draft This EIP is a Draft t-core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants