fix(eip-8037): exclude floor and refund from block_regular_gas_used#3719
Merged
Conversation
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.
Merging this PR will not alter performance
Comparing Footnotes
|
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
14 tasks
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
Updates
block_regular_gas_usedto the pre-refund regular component of execution per EIP-8037 + EIP-7778:Refund and floor are scalar adjustments on the combined
state + regulartotal — they only affect the receipt'stx_gas_used, not the block-level split.Before:
max(total_gas_spent - state_gas_spent, floor_gas)— floor was applied as amax(...)against the regular component, which incorrectly attributed floor charge to regular block gas.Test plan
cargo nextest run --workspace— 348/348 passcargo nextest run -p revm-ee-tests— 60/60 EIP-8037 tests passcargo clippy -p revm-context-interface --all-targets— cleancargo fmt --all --check— cleantest_block_regular_gas_used_no_floor_no_refundconfirms refund and floor never affect block_regular_gas_used, only tx_gas_used