Skip to content

Update EIP-8037: more state gas accounting changes#11532

Merged
eth-bot merged 5 commits into
ethereum:masterfrom
spencer-tb:eip8037-devnet4-state-gas-accounting
Apr 17, 2026
Merged

Update EIP-8037: more state gas accounting changes#11532
eth-bot merged 5 commits into
ethereum:masterfrom
spencer-tb:eip8037-devnet4-state-gas-accounting

Conversation

@spencer-tb
Copy link
Copy Markdown
Contributor

@spencer-tb spencer-tb commented Apr 16, 2026

Summary

Clarifies EIP-8037 state gas accounting based on outcomes from the gas repricings call (2026-04-16), following @misilva73's state gas accounting review.

Covers points 2 through 6. Points 1 and 7 have their own PRs:

Changes

2) SSTORE 0 to x to 0 refunds state gas to reservoir, 8356e2e

On SSTORE restoration, the state gas portion is refunded directly to state_gas_reservoir at the X to 0 SSTORE (not via refund_counter). This avoids the 20% refund cap preventing full state gas refunds at high cost_per_state_byte. The regular gas write-cost refund still goes through refund_counter.

3) CREATE failure refunds account state gas to reservoir, c01515e

CREATE/CREATE2 keeps "pay-before-execute". On silent failure (insufficient balance, nonce overflow, stack depth, address collision) or child revert/halt, the account-creation state gas is refunded to the reservoir. No account was created, so no state gas should be paid.

4) SELFDESTRUCT same-tx refunds state gas at end of tx, a2a4e16

When an account is created and self-destructed in the same transaction (EIP-6780), at end of tx the following state gas is refunded to state_gas_reservoir:

  • Account creation: 112 * cost_per_state_byte
  • Created storage slots: 32 * cost_per_state_byte per non-zero slot
  • Code deposit: len(code) * cost_per_state_byte

The refund is applied before tx_gas_used_before_refund is computed so the sender is not charged for destroyed state. No double refund with point 2: 0 to X to 0 slots have final value 0 and are not counted.

5) CALL with value to selfdestructed account in the same transaction, no change (clarification), f5410b7

Clarifies that a CALL with value to an account that was selfdestructed in the same transaction does not charge GAS_NEW_ACCOUNT state gas. The account is still present in the state with a nonce of 1 from the CREATE until the end of the transaction destruction, so it is neither empty nor nonexistent and the new account creation gate does not apply. Any value transferred to the account is burned when the end of the transaction destruction runs. Combined with point 4, the net state gas across the CREATE, SELFDESTRUCT, and CALL with value lifecycle is zero, matching the zero persisted state. No spec change.

6) Immutable intrinsic_state_gas for EIP-7702, 8f7e203

intrinsic_state_gas is immutable after transaction validation. When an EIP-7702 authorization targets an existing account, the 112 * cost_per_state_byte refund goes directly to state_gas_reservoir. Block accounting uses the original worst-case intrinsic_state_gas. Also fixes the misleading heading as the section is about EIP-7702 authorizations, not EIP-2780.

@github-actions github-actions Bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Apr 16, 2026
@eth-bot
Copy link
Copy Markdown
Collaborator

eth-bot commented Apr 16, 2026

✅ All reviewers have approved.

Copy link
Copy Markdown
Contributor

@misilva73 misilva73 left a comment

Choose a reason for hiding this comment

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

Looks good.

@spencer-tb spencer-tb force-pushed the eip8037-devnet4-state-gas-accounting branch from 77df4a8 to 8f7e203 Compare April 17, 2026 14:49
@eth-bot eth-bot enabled auto-merge (squash) April 17, 2026 14:50
Copy link
Copy Markdown
Collaborator

@eth-bot eth-bot left a comment

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 4f03327 into ethereum:master Apr 17, 2026
20 of 22 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.

3 participants