Skip to content

core: fix EIP-7778 receipt vs block gas separation#33756

Closed
qu0b wants to merge 2 commits intoethereum:bal-devnet-2from
qu0b:qu0b/fix/eip-7778-dual-gas-path
Closed

core: fix EIP-7778 receipt vs block gas separation#33756
qu0b wants to merge 2 commits intoethereum:bal-devnet-2from
qu0b:qu0b/fix/eip-7778-dual-gas-path

Conversation

@qu0b
Copy link
Copy Markdown
Contributor

@qu0b qu0b commented Feb 4, 2026

Summary

  • Separates post-refund gas (for receipt CumulativeGasUsed) from pre-refund gas (for block header.GasUsed) in EIP-7778 (Block Gas Accounting Without Refunds)
  • ApplyTransactionWithEVM now returns (receipt, blockGasUsed, error) — receipt uses post-refund gas, blockGasUsed uses pre-refund for Amsterdam
  • All callers updated: state_processor, chain_makers, parallel_state_processor, miner/worker, t8ntool, simulate, tracers

Problem

EIP-7778 requires block-level gas to exclude refunds, but receipts must continue using post-refund CumulativeGasUsed. The previous fix changed state_transition.go to return MaxUsedGas (pre-refund), but this single value was used for both block gas and receipt gas, causing receipt root hash mismatches when validating blocks from other clients (e.g., Besu).

Test plan

  • Tested locally with Kurtosis: lighthouse+geth supernode + lodestar+besu×2
  • Verified geth and besu agree on block hashes through 100+ slots with spamoor transactions (evm-fuzz, eoatx, uniswap-swaps)
  • No receipt root hash mismatches after the fix

🤖 Generated with Claude Code

qu0b and others added 2 commits February 4, 2026 11:24
The miner accumulates result.UsedGas (post-refund) into the block
header's GasUsed via ApplyTransactionWithEVM, but the validator
accumulates receipt.GasUsed (which is result.MaxUsedGas = pre-refund
for Amsterdam) into its local gas total. This causes every proposed
block containing refund-generating transactions to be rejected with
"invalid gas used" after the Gloas fork.

Use result.MaxUsedGas (pre-refund gas) for block gas accumulation
when Amsterdam is active, matching EIP-7778's requirement that block
gas accounting excludes refunds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…for EIP-7778

EIP-7778 requires block-level gas accounting to exclude refunds, but
receipts must continue using post-refund CumulativeGasUsed. The previous
fix only changed state_transition.go but left all callers using a single
gas value for both purposes, causing receipt root mismatches with other
clients (e.g., Besu).

This commit introduces a dual return from ApplyTransactionWithEVM:
- receipt: contains post-refund CumulativeGasUsed (unchanged behavior)
- blockGasUsed: pre-refund gas for Amsterdam, post-refund otherwise

All callers updated: state_processor, chain_makers, parallel processor,
miner/worker, t8ntool, simulate, tracers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@qu0b
Copy link
Copy Markdown
Contributor Author

qu0b commented Feb 4, 2026

Closing in favor of #33754 which contains the same fix.

@qu0b qu0b closed this Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant