← Back to Pull requests

feat(l1): report EIP-8037 two-dimensional gas in callTracer output #7070

Closed
unknown closed this pull request without merging on Aug 27, 2026 23:13 UTC
View on GitHub
unknown unknown commented on Jul 30, 2026 13:44 UTC
Author

Motivation

execution-apis#852 defines the
gas-related part of the callTracer output, 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

CallTraceFrame gains three optional fields, emitted on the top-level frame only:

| field | meaning |
|---|---|
| regularGasUsed | gross pre-refund regular gas, the transaction's contribution to block_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_trace from the ExecutionReport when the fork is Amsterdam
or later. Before the fork all three stay None and are skipped during serialization, so
they 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, which
holds 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:

  • Frame transactions are skipped (greptile P1, confirmed real): an EIP-8141 frame transaction's ExecutionReport.gas_refunded holds unused frame gas, not the EIP-3529 refund gasRefund advertises, so tracing one would publish a wrong value and break the accounting identity. The report marks these transactions itself (frame_results is Some), and the three fields are now omitted for them — consistent with the spec defining no aggregate attribution for frame transactions.

  • The gas split asserts its invariant: state_gas_used ≤ gas_used holds by construction, and the saturating_sub would silently report a plausible-looking zero if it ever broke. A debug_assert! now turns that into a signal, mirroring the payload builder's pattern for the same split.
  • The doc claim questioned in review — regularGasUsed being the transaction's contribution to block_regular_gas_used — is confirmed literal: the payload builder accumulates report.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 rather
    than hand-built frames:

  • an Amsterdam transaction that writes a fresh slot and clears a pre-existing one, so both

  • stateGasUsed and gasRefund are non-zero, asserting the identity above and the hex
    wire values;
  • the same bytecode under an Osaka chain config, asserting all three are absent from the

  • serialized JSON;
  • a transaction whose contract CALLs a second account, asserting the sub-frame omits all

  • three while the top frame carries them.

    Also checked against a dev node on an Amsterdam genesis. A fresh SSTORE reports
    stateGasUsed of 97,920 (STATE_BYTES_PER_STORAGE_SET x CPSB) and satisfies the
    identity 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_ACCOUNT x CPSB)
    and is the documented floor-binding exception, with regularGasUsed equal to the floor.

    Diff: 468 lines (+351 / -117) across 5 files Reviewer: ElFantasma Review duration: 40889m
    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
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.6% (MEDIUM) · Higher = larger blast radius
    45.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%