← Back to Pull requests

fix(l1): reconcile an unrolled atomic batch's access list, gas and status #7068

Closed
unknown closed this pull request without merging on Aug 19, 2026 01:00 UTC
View on GitHub
unknown unknown commented on Jul 30, 2026 10:57 UTC
Author

Motivation

Two defects on the EIP-8141 atomic-batch unroll path. They are separate rules and are
called out separately below, because the second one is consensus-visible beyond the
receipts trie.

1. The unroll leaves the block access list holding writes the block does not contain.
An atomic batch with a reverting member halts block production. The unroll reverts the
batch's substate, state gas, approvals and logs — but not the EIP-7928 recorder. The
builder seals a block whose access list claims changes the block does not contain, and
import rejects it:

WARN BAL validation failed for tx 0: account 0x422a…373f storage slot 0
     mismatch at index 1: BAL=1, exec=Some(9)

BAL=1 is the in-batch write; exec=Some(9) is the prior value the unroll correctly
restored. The builder re-selects the same tx every slot, so it rebuilds the identical
rejected block forever. Nothing is logged above WARN.

2. The unroll re-prices every batch frame at its full gas_limit. The spec now
states the rule: "Logs emitted by frames that executed before the failure are discarded
together with their state changes. Those frame receipts retain their execution status and
gas used, with empty logs." ethrex instead rewrote each frame as FAILURE charged its
whole gas_limit, which over-bills the payer and mislabels frames that ran.

Description

The access list. Checkpoint the recorder at batch entry — where the substate backup
and approval snapshot are already taken — and restore it in the unroll, as the EIP-7906
body revert does a few lines above. BlockAccessListRecorder::restore is written for
this: it truncates changes made after the checkpoint, re-files a freshly-written slot as
a read, and leaves touched_addresses alone. Per EIP-7928 a reverted call's accesses
still belong in the list; only its changes do not.

The gas and status. Stop rewriting the batch's frame results; drop only their logs.
Frames that ran keep their status and their gas, the failing frame keeps what the
single-frame rule already gave it (actual gas_used for a REVERT, full gas_limit for
an exceptional halt), and the remaining members stay SKIPPED with their gas refunded.
total_gas_used therefore stands as executed.

This half is consensus-visible through more than the receipts trie: per-frame gas feeds
total_gas_used → the header gasUsed and the payer refund. docs/eip-8141.md §11
previously marked the choice UNRESOLVED, pending cross-client confirmation. That
confirmation has since arrived from the reference implementation: the
tests-frames-devnet@v0.0.0 release covers this shape in
atomic_batch_rollback, bal_atomic_batch_write and
bal_atomic_batch_skipped_frame_absent, and each of the three rejects the
full-gas_limit behaviour on the block header gasUsed — the exact quantity the old
note was worried about. §11 is updated to record that, and the two halves' status is no
longer a unilateral choice.

Scope is the batch-unroll path. A batch whose members all succeed is unaffected.

How to Test

cargo test -p ethrex-test --test ethrex_tests atomic_batch

atomic_batch_revert_drops_the_batch_writes_from_the_bal executes a frame tx whose batch
writes a slot then reverts, with BAL recording enabled as the builder and importer do. It
asserts both halves of the EIP-7928 rule: the reverted change is gone, and the
reverted access stays — the address is still in the list and the slot is re-filed as
a read. A slot in neither list is a slot the block accessed and the BAL omits, which
re-execution rejects; asserting only the first half would pass in that direction.

atomic_batch_unroll_keeps_frame_status_and_gas_but_drops_logs pins the second half:
the frame that ran keeps SUCCESS and its actual gas, the failing frame is charged less
than its gas_limit, the remaining member is SKIPPED at 0, and no log from the batch
reaches the transaction log set.

Both fail without the corresponding fix. The three spec fixtures named above also pass
with this branch and fail without it, on gasUsed.

On a local Amsterdam + Hegotá dev node the tx that previously stalled the chain now mines
with zero BAL failures.

eip8141 86, eip7928 57, eip8037 46, eip8038 39, eip7906 34, eip8272 8,
eip8250 3, ethrex-blockchain 30 — all passing. Clippy -D warnings and fmt clean in
both workspaces.

Checklist

  • Updated STORE_SCHEMA_VERSION (crates/storage/lib.rs) if the PR includes breaking changes to the Store requiring a re-sync. _(N/A — BAL recording and frame-receipt gas only.)_
  • Diff: 575 lines (+431 / -144) across 7 files Reviewer: ElFantasma Review duration: 28202m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 575 lines diff across 7 files
    0.50
    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.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7068"
    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: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    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: 19.7% · Safe to merge
    19.7%