fix(l1): charge EIP-8141 intrinsic gas over payload bytes only - #7044
Closed
AnkushinDaniil wants to merge 1 commit into
Closed
fix(l1): charge EIP-8141 intrinsic gas over payload bytes only#7044AnkushinDaniil wants to merge 1 commit into
AnkushinDaniil wants to merge 1 commit into
Conversation
This was referenced Jul 28, 2026
FrameTransaction::total_gas_limit previously RLP-encoded the whole frames and signatures lists and charged calldata gas over every byte, including RLP length prefixes and structural fields (frame gas_limit, value, to, etc.). EIP-8141 defines the intrinsic calldata cost over the payload byte-set only: each frame's data plus each signature's signer, msg, and signature bytes. This over-charging surfaced in cross-client interop replay against Nethermind: for the reference 162-byte low-s type-0x06 transaction ethrex computed intrinsic 20662 vs the spec-correct 19778 (delta 884), causing exact-gas block rejection. Replace whole-RLP charging with per-field charging over the payload byte arrays, preserving saturating arithmetic. Add regression tests pinning the exact reference-tx intrinsic and asserting insensitivity to structural frame fields (gas_limit, value). Verified: 2/2 focused, 80/80 EIP-8141 regression, cargo fmt --check, cargo clippy -D warnings, git diff --check.
AnkushinDaniil
force-pushed
the
daniil/eip8141-intrinsic-payload-bytes
branch
from
July 29, 2026 06:12
176d0a9 to
e8b361c
Compare
Contributor
|
Superseded by #7004, which changed the calldata charge to Worth salvaging though: main has no intrinsic-gas-accounting tests, so the |
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 accounting) defines the calldata component of a frame transaction's intrinsic gas over the payload byte strings only:
with
calldata_costper standard EIP-7623 rules (4 per zero byte, 16 per nonzero byte).FrameTransaction::total_gas_limitinstead RLP-encoded the wholeframesandsignatureslists and charged calldata gas over every byte of the encoding, including RLP length prefixes and structural fields (gas_limit,value,to,mode,flags,scheme). That over-charges every frame transaction. In devnet interop replay against Nethermind, the 162-byte reference type-0x06 transaction came out at intrinsic 20662 in ethrex vs the spec value 19778 (delta 884), which makes ethrex reject exact-gas blocks other clients accept.Change
Replace whole-RLP charging with per-field charging over the payload byte arrays (
frame.data, and each signature'ssigner,msg,signature), keeping saturating arithmetic. Adds regression tests that pin the reference transaction's exact intrinsic gas and assert the intrinsic cost is insensitive to structural frame fields (gas_limit,value).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), #7045 (arbitrary-scheme verification gas), #7046 (frame gas refunds), #7047 (frame receipt storage encoding), #7048 (skipped-frame status 2), #7049 (EIP-7623 calldata floor).Consensus risk / limits
Consensus-affecting: it lowers intrinsic gas for every frame transaction, changing gas accounting and block validity. Covered by unit tests pinning the reference vector; no cross-client conformance fixture yet.