fix(levm): apply frame transaction gas refunds - #7046
Closed
AnkushinDaniil wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 28, 2026
Contributor
|
Superseded by #7004: frame-tx finalization on main applies |
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.
Problem
EIP-8141 (Gas refunds) requires EIP-3529 storage refunds to be applied to frame transactions:
with the refund counter accumulated across frames and the deltas of reverted frames (or frames unrolled by a failed atomic batch) discarded, and the refund "returned to the gas payer ... and added back to the block gas pool".
ethrex's frame-tx finalization ignored the accumulated
refunded_gascounter entirely: the payer was charged for the gross gas used, the coinbase fee was computed on gross gas, and the execution report'sgas_used/gas_spentwere gross. A frame transaction that clears storage therefore reports a highergas_usedthan a conformant client and charges the payer more, which breaks receipt cumulative-gas and block-gas accounting against other clients.gas_refundedin the report was also overloaded to mean "unused frame gas" rather than the EIP-3529 refund.Change
applied_refund = min(refunded_gas, total_gas_used / MAX_REFUND_QUOTIENT)at frame-tx finalization; substate checkpoints already discard refund deltas from reverted frames and unrolled batches.gas_used/gas_spentnet of the refund andgas_refundedas the applied EIP-3529 refund.Tests cover: a successful frame netting payer balance, coinbase fee and block gas; refund deltas of a reverted frame discarded; refund deltas of a reverted atomic batch discarded; and the
gas_used / 5cap binding.Evidence
Commands run on this branch:
Stack
Targets
frames-devnet-0. Part of a series of independent EIP-8141 fixes, one PR per logical change, each standing alone against the same base. Siblings: #7040 (canonical low-s), #7043 (recovery id at ecrecover boundary), #7044 (intrinsic gas over payload bytes), #7045 (arbitrary-scheme verification gas), #7047 (frame receipt storage encoding), #7048 (skipped-frame status 2), #7049 (EIP-7623 calldata floor).Consensus risk / limits
Consensus-affecting: it changes
gas_used(receipts, cumulative gas, block gas accounting) and payer/coinbase balances for any frame transaction that accrues EIP-3529 refunds. Covered by unit tests only; no cross-client conformance fixture yet.