Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CHANGELOG.sf.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,28 @@
* Added Firehose tracing-regression coverage for Base transactions: a prestate-driven test (block
invariants + JSON projection golden) plus an end-to-end `base-system-tests` integration test
tracing a B-20 precompile transfer. The chain-agnostic capture / invariants / projection / golden
framework lives in the shared `firehose-tracer-test` crate (`evm-firehose-tracer-rs` `5.3.0`).
framework lives in the shared `firehose-tracer-test` crate (`evm-firehose-tracer-rs` `5.4.1`).

* Added `base-firehose-prestate` (`etc/tools/firehose-prestate`), a thin Base wrapper around
`firehose-tracer-prestate` `5.4.1`, the chain-agnostic Rust port of
`streamingfast/go-ethereum`'s `generate-prestate`. `generate` turns any mined Base mainnet or
Sepolia transaction into a self-contained `prestate.json` that `run_prestate` replays through the
tracer with no node and no Docker. Base supplies the chain-specific seam: 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 OP L1-cost function reads outside the
EVM journal, and the chain id. Without those L1 slots a replay computes a zero L1 fee.

* Added a `base_mainnet_replay` prestate case replaying Base mainnet transaction
`0x32ecdb4e72df6ec331edb81256b58a768ba49d1e3e89a1a071b980a85d6b72c0` (block `49663794`, index
`159`). Its golden was seeded from StreamingFast's production Firehose by the tool's `reference`
subcommand (`sf.firehose.v2.Fetch/Block`), so the first run of the test compared the replay
directly against production — and matched. That validation is a one-off proving the generator and
the tracer agree with production; the golden is an ordinary `GOLDEN_UPDATE=1` one from then on,
and further cases only need `generate`. Both sides share the
`ProductionReplay` projection (`firehose-tracer-test`, re-exported from `base-firehose-tests`),
which excludes only block-wide positional fields (ordinals, transaction index, log block index,
cumulative gas used) and keeps gas accounting, the call tree, logs and absolute balance, nonce
and storage values verbatim.

### Changed

Expand Down
67 changes: 56 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,13 @@ ark-bls12-381 = { version = "0.5.0", default-features = false }
# Firehose tracer (defined by the streamingfast reth fork, firehose/2.x branch).
reth-firehose = { git = "https://github.com/streamingfast/reth.git", tag = "v2.3.0-fh-7" }
reth-firehose-tests = { git = "https://github.com/streamingfast/reth.git", tag = "v2.3.0-fh-7" }
firehose-tracer = "5.3.0"
firehose-tracer = "5.4.1"

# Shared tracing-regression framework (capture / invariants / projection / golden).
firehose-tracer-test = "5.3.0"
firehose-tracer-test = "5.4.1"

# Chain-agnostic generator for replayable Firehose prestate fixtures.
firehose-tracer-prestate = "5.4.1"

[patch.crates-io]
# SF fork of alloy-evm that routes system calls (EIP-4788, EIP-2935, etc.) through the
Expand Down
1 change: 1 addition & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ doc-valid-idents = [
"MEV",
"OP",
"Optimism",
"StreamingFast",
]
18 changes: 18 additions & 0 deletions crates/execution/firehose-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,21 @@ Assert on the captured `Block` with:
`VolatilePolicy` (`none()` for reproducible prestate replays, `live_node()` for system tests).

Regenerate every golden with `GOLDEN_UPDATE=1`.

## Cases replaying a real transaction

`tests/cases/base_mainnet_replay/` replays a real Base mainnet transaction. Its `prestate.json`
comes from `base-firehose-prestate generate` (`etc/tools/firehose-prestate`) against an archive
node, and its golden was *seeded* by `base-firehose-prestate reference` from StreamingFast's
production Firehose. The first run of the test was therefore a direct comparison against
production — which is the whole point of seeding it that way, and it matched.

That validation is deliberately a one-off. It established that the generator and the tracer agree
with production; from then on the golden is an ordinary one, regenerated with `GOLDEN_UPDATE=1`
like any other, and no test needs credentials or a production endpoint. Further cases only need
`generate`.

`ProductionReplay` is the projection both sides share; it lives in `firehose-tracer-test` and is
re-exported here. The replay runs the transaction alone in a synthetic single-transaction block, so
it excludes exactly the block-wide positional fields — ordinals, the transaction's index, each
log's block index, and the cumulative gas used — and keeps everything else verbatim.
13 changes: 7 additions & 6 deletions crates/execution/firehose-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![doc = include_str!("../README.md")]

mod prestate;
pub use prestate::run_prestate;

mod capture;
pub use capture::BaseFirehoseCapture;
// The tracing-regression framework is chain-agnostic and lives in `firehose-tracer-test`.
pub use firehose_tracer_test::{
BlockDiff, BlockInvariants, BlockProjection, FirehoseCapture, Golden, InvariantConfig,
SymbolTable, Violation, VolatilePolicy,
ProductionReplay, SymbolTable, Violation, VolatilePolicy,
};
pub use reth_firehose_tests::RunOutcome;

mod prestate;
pub use prestate::run_prestate;

mod capture;
pub use capture::BaseFirehoseCapture;
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"calls": [
{
"address": "0xec0e36a6060339694c618ffffcc9ec7da21cb0cc",
"balance_changes": [
{
"address": "0xabbac9becc5b171842ae47703dfa6640b23c9710",
"new_value": "0x054f62c0f2f516dc",
"old_value": "0x054f634d28dc754b",
"reason": "REASON_GAS_BUY"
},
{
"address": "0xabbac9becc5b171842ae47703dfa6640b23c9710",
"new_value": "0x054f632dc29791dc",
"old_value": "0x054f62c0f2f516dc",
"reason": "REASON_GAS_REFUND"
},
{
"address": "0x4200000000000000000000000000000000000019",
"new_value": "0x01e52f91908dcdaac0",
"old_value": "0x01e52f9171aaa6b5c0",
"reason": "REASON_REWARD_TRANSACTION_FEE"
},
{
"address": "0x420000000000000000000000000000000000001a",
"new_value": "0x16d824463b189260",
"old_value": "0x16d82445b7faa3f1",
"reason": "REASON_REWARD_TRANSACTION_FEE"
}
],
"call_type": "CALL",
"caller": "0xabbac9becc5b171842ae47703dfa6640b23c9710",
"executed_code": true,
"gas_consumed": 5280,
"gas_limit": 98748,
"index": 1,
"input": "0xd67704ad000000000000000000000000000000000000000000000000000000036948f05a",
"keccak_preimages": {
"String(\"647538f573622c2dc5ad534d3157795075362ce71b9944e2a4e56b07eac973fc\")": "000000000000000000000000abbac9becc5b171842ae47703dfa6640b23c97100000000000000000000000000000000000000000000000000000000000000000"
},
"nonce_changes": [
{
"address": "0xabbac9becc5b171842ae47703dfa6640b23c9710",
"new_value": 6989526,
"old_value": 6989525
}
],
"storage_changes": [
{
"address": "0xec0e36a6060339694c618ffffcc9ec7da21cb0cc",
"key": "0x647538f573622c2dc5ad534d3157795075362ce71b9944e2a4e56b07eac973fc",
"new_value": "0x000000000000000000000000000000000000000000000000000000036948f05a",
"old_value": "0x0000000000000000000000000000000000000000000000000000000367c0ba09"
}
]
}
],
"from": "0xabbac9becc5b171842ae47703dfa6640b23c9710",
"gas_limit": 120000,
"gas_price": "0x4c4b40",
"gas_used": 26532,
"hash": "0x32ecdb4e72df6ec331edb81256b58a768ba49d1e3e89a1a071b980a85d6b72c0",
"input": "0xd67704ad000000000000000000000000000000000000000000000000000000036948f05a",
"max_fee_per_gas": "0x1dcf2781",
"nonce": 6989525,
"r": "0x02f41d76d4d32a48ed9dc1cf0ea08e40ac40fabb2e5ec3be3d6906a296a7fc66",
"receipt": {
"logs_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
},
"s": "0x42f0f6ce0005056cea2f280e60d032efa10afa2dfb9928215a971d5269771812",
"status": "SUCCEEDED",
"to": "0xec0e36a6060339694c618ffffcc9ec7da21cb0cc",
"type": "TRX_TYPE_DYNAMIC_FEE"
}
Loading
Loading