Skip to content

test(firehose): cover system calls, the pipeline path and more Amsterdam cases - #100

Merged
maoueh merged 1 commit into
streamingfast:release/reth-2.xfrom
valvecitydev:sf/tests
Nov 19, 2026
Merged

maoueh merged 1 commit into
streamingfast:release/reth-2.xfrom
valvecitydev:sf/tests

Conversation

@valvecitydev

Copy link
Copy Markdown

This PR adds tests only. It changes no code outside test files, and adds alloy-eip7928, alloy-signer and alloy-signer-local as dev-dependencies of reth-firehose-tests.

What the tests cover

  • crates/firehose-tests/tests/setup_guards.rs: a Cancun block must emit the EIP-4788 beacon root system call. When system-call inspection is not on, evm2 runs system calls without the inspector, the Firehose block has no system calls and every later ordinal shifts. A golden diff shows that only as an opaque mismatch. This guard fails with a message that names the cause.
  • crates/firehose-tests/tests/pipeline_trace.rs: the nop_transfer prestate block runs through FirehoseBlockExecutor::execute_and_trace_one with the process-wide tracer, as staged sync runs it. The emitted block must match the same golden as run_wrapped_block. This covers the deferred flush in into_state, which batch_executor.rs checks only by counting FIRE BLOCK lines.
  • crates/firehose-tests/tests/bal_pipeline.rs: an Amsterdam block with a transfer, a CREATE with a storage write, and a call that writes storage runs through the stock BasicBlockExecutor to get the reference block access list hash. Then it runs through run_wrapped_block. The rebuilt list must match that hash, and the emitted RLP must hash to the header's hash. The single-transaction fixture of staged_sync_bal.rs cannot catch a block access index that is wrong only for later transactions.
  • crates/engine/tree/tests/firehose_live_tracing_amsterdam_validation.rs: one node builds Amsterdam blocks and a second node validates them on the traced engine path, so the second node sees each block only through engine_newPayload. The blocks cover a plain transfer, a zero priority fee, nonzero, duplicate and zero-amount withdrawals, a revert and an out-of-gas CREATE, a CREATE, an empty block, CREATE with SELFDESTRUCT, and 64 transactions from one sender. For each block, the validator must return VALID, emit the block once, and emit the BAL hash, a BAL RLP that hashes to it, and the slot number.

I put the two-node test in its own file next to firehose_live_tracing_amsterdam.rs, not in that file. Each file installs the process-wide tracer, and init_tracer_with_buffer runs only once per process, so a second test in the same binary cannot install its own buffer.

Evidence

The new tests pass on release/reth-2.x, because they test existing behavior. To show that each one can fail, I ran negative controls:

  • set_inspect_system_calls(false) in FirehoseWrappedExecutor::with_hooks: setup_guards fails with its message, and pipeline_trace fails on the golden.
  • FirehoseBlockExecutor::into_state drops the pending tracer instead of mark_verified: pipeline_trace fails (no block emitted).
  • run_wrapped_block does not enable the BAL builder: bal_pipeline fails.
  • The payload validator does not patch block_access_list_rlp into the header: the two-node test fails with "emitted no BAL RLP".

cargo +nightly fmt --check is clean for the touched files. zepter run check and dprint check pass. cargo clippy -p reth-firehose-tests -p reth-engine-tree --all-targets -- -D warnings fails on release/reth-2.x already, on lines this PR does not touch (the reth-firehose lint set, type_repetition_in_bounds and needless_pass_by_ref_mut in payload_validator.rs, unused_mut in crates/rpc/rpc/src/debug.rs). With those lints allowed, clippy is clean.

Left out

  • Our fork also had a guard that checked Cargo.lock for the streamingfast/evm2 fork. Since reth-v2.11.0-fh3.1, evm2 comes from upstream, so I dropped it.
  • Our JIT guard test is not here, because bin/reth/src/firehose.rs already refuses --jit.

…dam cases

This adds tests only.

- setup_guards: a Cancun block must emit the EIP-4788 system call. It
  fails with a clear message when system-call inspection is not on,
  instead of an opaque golden diff.
- pipeline_trace: a prestate block run through
  FirehoseBlockExecutor::execute_and_trace_one with the process-wide
  tracer must match the run_wrapped_block golden. That covers the
  deferred flush in into_state.
- bal_pipeline: an Amsterdam block with a transfer, a CREATE with a
  storage write and a storage-writing call must rebuild the same block
  access list as the stock executor.
- firehose_live_tracing_amsterdam_validation: a second node validates
  Amsterdam blocks on the traced engine path, with a zero priority fee,
  duplicate and zero-amount withdrawals, a revert, an out-of-gas CREATE,
  a CREATE, an empty block, CREATE with SELFDESTRUCT and 64
  transactions from one sender.
@dfuse-bot
dfuse-bot requested a review from maoueh November 12, 2026 01:12
@maoueh
maoueh merged commit 7c0b026 into streamingfast:release/reth-2.x Nov 19, 2026
4 checks passed
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.

2 participants