feat(l1): report EIP-8037 two-dimensional gas in callTracer output #7070
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 468 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7070"
general
weight: 0.35
ElFantasma
Motivation
execution-apis#852 defines the
gas-related part of the
callTraceroutput, and glamsterdam-devnet-8 lists it as required.It adds the EIP-8037 two-dimensional gas breakdown to the top-level frame, which ethrex
does not report, so a caller cannot see how a transaction's gas split between the
execution and state dimensions.
Description
CallTraceFramegains three optional fields, emitted on the top-level frame only:| field | meaning |
|---|---|
|
regularGasUsed| gross pre-refund regular gas, the transaction's contribution toblock_regular_gas_used(EIP-7778) ||
stateGasUsed| gross pre-refund state gas, net of source-based state-gas refunds ||
gasRefund| the applied EIP-3529 refund |They are stamped in
run_call_tracefrom theExecutionReportwhen the fork is Amsterdamor later. Before the fork all three stay
Noneand are skipped during serialization, sothey are absent from the JSON rather than present as zero, which #852 requires. Sub-frame
attribution is unspecified, so sub-frames are never stamped.
The spec states the identity
regularGasUsed + stateGasUsed == gasUsed + gasRefund, whichholds unless the EIP-7976 calldata floor binds.
Review follow-ups & rebase onto merged #6931 (2026-08-27)
#6931 has landed, so the stack note above is gone: main was merged in and every conflict resolved by taking main's version and re-applying this PR's own commit on top — the branch's net diff against main is now exactly this feature (+342/−3 across three files).
Two review findings are addressed:
ExecutionReport.gas_refundedholds unused frame gas, not the EIP-3529 refundgasRefundadvertises, so tracing one would publish a wrong value and break the accounting identity. The report marks these transactions itself (frame_resultsisSome), and the three fields are now omitted for them — consistent with the spec defining no aggregate attribution for frame transactions.state_gas_used ≤ gas_usedholds by construction, and thesaturating_subwould silently report a plausible-looking zero if it ever broke. Adebug_assert!now turns that into a signal, mirroring the payload builder's pattern for the same split.The doc claim questioned in review —
regularGasUsedbeing the transaction's contribution toblock_regular_gas_used— is confirmed literal: the payload builder accumulatesreport.gas_used.saturating_sub(report.state_gas_used)per transaction (crates/blockchain/payload.rs, the EIP-8037 gas-tracking block), the same expression this tracer stamps.Testing
Three cases in
test/tests/levm/trace_call_tests.rs, all driving a real execution ratherthan hand-built frames:
stateGasUsedandgasRefundare non-zero, asserting the identity above and the hexwire values;
serialized JSON;
CALLs a second account, asserting the sub-frame omits allthree while the top frame carries them.
Also checked against a dev node on an Amsterdam genesis. A fresh
SSTOREreportsstateGasUsedof 97,920 (STATE_BYTES_PER_STORAGE_SETxCPSB) and satisfies theidentity exactly; clearing the slot reports a 5,627 refund, the EIP-3529 cap, and again
satisfies it. A contract creation reports 183,600 (
STATE_BYTES_PER_NEW_ACCOUNTxCPSB)and is the documented floor-binding exception, with
regularGasUsedequal to the floor.