Skip to content

test(firehose): add prestate generator and mainnet replay case - #22

Open
maoueh wants to merge 1 commit into
release/1.xfrom
feature/port-replay-transaction-prestate-generator
Open

test(firehose): add prestate generator and mainnet replay case#22
maoueh wants to merge 1 commit into
release/1.xfrom
feature/port-replay-transaction-prestate-generator

Conversation

@maoueh

@maoueh maoueh commented Aug 13, 2026

Copy link
Copy Markdown

What

  • Adds base-firehose-prestate, a thin Base wrapper around firehose-tracer-prestate 5.4.1, that turns a mined Base mainnet or Sepolia transaction into a self-contained prestate.json the tracer can replay with no node and no Docker.
  • Adds a base_mainnet_replay prestate case for a real Base mainnet transaction. Its golden was seeded from production Firehose so the first run compared the replay against production; from here it is an ordinary GOLDEN_UPDATE=1 golden.
  • Re-exports ProductionReplay from base-firehose-tests so the replay projection (drop block-wide positional fields, keep gas, call tree, logs, balances, nonce, storage) is shared by the case and any follow-up.
  • Bumps firehose-tracer / firehose-tracer-test to 5.4.1 and adds the firehose-tracer-prestate workspace pin.

Base supplies only what the shared crate cannot know: the BaseTxEnvelope type, the genesis config re-projected from ChainConfig (the chain spec's own genesis drops every timestamped fork), the L1Block predeploy slots the L1-cost function reads outside the EVM journal, and the chain id. Those slots are listed locally in the tool from the existing L1BlockInfo constants so this does not grow the base-common-* public API.

Why

  • Hand-written prestate fixtures cannot cover a real mainnet transaction. Generating them from an archive node, then locking a production-seeded golden, is how we prove the tracer matches production without putting credentials or a live endpoint in CI.
  • Without the L1Block slots, a replay computes a zero L1 fee and every fee balance change comes out wrong.

Usage

$ export ARCHIVE_ENDPOINT=https://<archive-node>
$ cargo run -p base-firehose-prestate -- generate \
    --network base \
    --tx 0x32ecdb4e72df6ec331edb81256b58a768ba49d1e3e89a1a071b980a85d6b72c0 \
    --out crates/execution/firehose-tests/tests/cases/base_mainnet_replay

The endpoint must expose debug_traceTransaction with the prestateTracer over archive state.

How to validate

  • Generate a fixture for any mined Base transaction against an archive node that supports prestateTracer, then replay it with run_prestate and inspect the L1 fee / balance changes (they should be non-zero).
  • Open the base_mainnet_replay golden and confirm it is a production-shaped projection (gas, call tree, logs, absolute balances) without ordinals or transaction index.

Related links

Adds base-firehose-prestate to turn a mined Base transaction into a
replayable fixture, plus a base_mainnet_replay case whose golden was
seeded from production Firehose. L1Block slots are listed in the tool
from existing constants so the generator does not grow the common API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant