Skip to content

fix(eip-8037): exclude floor and refund from block_regular_gas_used#3719

Merged
rakita merged 2 commits into
glam-devnet-5from
glam5-floor-handling
May 26, 2026
Merged

fix(eip-8037): exclude floor and refund from block_regular_gas_used#3719
rakita merged 2 commits into
glam-devnet-5from
glam5-floor-handling

Conversation

@rakita

@rakita rakita commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

Updates block_regular_gas_used to the pre-refund regular component of execution per EIP-8037 + EIP-7778:

block_regular_gas_used = total_gas_spent - state_gas_spent

Refund and floor are scalar adjustments on the combined state + regular total — they only affect the receipt's tx_gas_used, not the block-level split.

Before: max(total_gas_spent - state_gas_spent, floor_gas) — floor was applied as a max(...) against the regular component, which incorrectly attributed floor charge to regular block gas.

Test plan

  • cargo nextest run --workspace — 348/348 pass
  • cargo nextest run -p revm-ee-tests — 60/60 EIP-8037 tests pass
  • cargo clippy -p revm-context-interface --all-targets — clean
  • cargo fmt --all --check — clean
  • New unit test test_block_regular_gas_used_no_floor_no_refund confirms refund and floor never affect block_regular_gas_used, only tx_gas_used

Replace `max(total_gas_spent - state_gas_spent, floor_gas)` with the
conditional formula from EIP-8037 + EIP-7778 (PR ethereum/EIPs#11706):

- Floor-dominant (floor_gas >= total_gas_spent - refunded):
  block_regular = tx_gas_used - state_gas_spent
- Refund-dominant: block_regular = total_gas_spent - state_gas_spent
  (pre-refund, since refunds are excluded from block accounting)

Floor gas no longer participates as a `max(...)` against the regular
component; it only contributes through `tx_gas_used` when it dominates
the post-refund total.
@rakita rakita closed this May 26, 2026
@rakita rakita reopened this May 26, 2026
@codspeed-hq

codspeed-hq Bot commented May 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 176 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing glam5-floor-handling (73c1f6b) with glam-devnet-5 (ffb304e)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

Per EIP-8037 + EIP-7778, block-level regular gas accounting is the
pre-refund regular component of execution. Refund and floor are scalar
adjustments on the combined `state + regular` total and only affect the
receipt's `tx_gas_used`, not the block-level split.

block_regular_gas_used = total_gas_spent - state_gas_spent
@rakita rakita changed the title fix(eip-8037): apply EIP-7778 branching to block_regular_gas_used fix(eip-8037): exclude floor and refund from block_regular_gas_used May 26, 2026
@rakita rakita merged commit c92c196 into glam-devnet-5 May 26, 2026
2 checks passed
@rakita rakita deleted the glam5-floor-handling branch May 26, 2026 09:31
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