Skip to content

feat: add --skip-historical-state - #81

Merged
shekhirin merged 2 commits into
mainfrom
feat/skip-historical-state
Nov 17, 2026
Merged

shekhirin merged 2 commits into
mainfrom
feat/skip-historical-state

Conversation

@shekhirin

Copy link
Copy Markdown
Member

Adds an opt-in --skip-historical-state flag that skips the checks reading account state at a past block:

  • transaction replays at the parent block: eth_call, eth_estimateGas, eth_createAccessList, debug_traceCall, trace_call, tempo_simulateV1, eth_simulateV1 and the Tempo fee replays
  • eth_getCode and eth_getStorageAt on the contract a sampled transaction touches

This is for a node whose history index may not cover accounts unchanged since before its earliest changeset, such as one restored from a snapshot without its indices, so the rest of the comparison keeps running while that is fixed. Default behaviour is unchanged.

Checked: cargo fmt --check, cargo clippy (no new warnings) and cargo test pass. A live run against a Tempo testnet RPC with --use-tempo --skip-historical-state passes and sends none of the skipped calls.

@shekhirin
shekhirin merged commit 91721d1 into main Nov 17, 2026
10 checks passed
@shekhirin
shekhirin deleted the feat/skip-historical-state branch November 17, 2026 14:57
Comment on lines +254 to 262
// Replays and state reads at a past block are skipped with --skip-historical-state.
if !self.skip_historical_state {
tests.extend(exec_calls);
}

if self.use_tempo {
if self.use_tempo && !self.skip_historical_state {
// Replays with the transaction's own fees, fee token and authorizations, which
// the fee-free replays drop. Calls, estimates and traced calls still resolve
// and validate the fee token but skip fee collection, so only the simulation

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Operators using --skip-historical-state still get mismatches, because block and transaction re-execution traces read the same parent-block state and stay enabled. Only the call replays and the contract eth_getCode/eth_getStorageAt are gated. trace_block, debug_trace_block_by_* with prestate_tracer_opts() and trace_replay_block_transactions (tester.rs:175-180) are not. debug_trace_transaction, trace_replayTransaction and ots_* (tester.rs:401-415) are not either. Fix: gate every check that runs the EVM on, or reads accounts from, a past block, or narrow the flag's doc and README to what it skips. [also at: crates/rpc-tester/src/tester.rs:389 - Tempo operators using --skip-historical-state still get past-block reads of untouched accounts, so the target node keeps reporting mismatches.]

Why this was flagged

The trigger is a node restored from a snapshot without its history indices, which the flag's doc at main.rs:77-82 names as its target, run with --skip-historical-state. The per-block list at tester.rs:151-181 always includes trace_block, trace_replay_block_transactions with StateDiff, and debug_trace_block_by_number with prestate_tracer_opts(). It also always includes eth_getBalance at the tested block hash. The per-tx tx_hash_calls at tester.rs:396-416 replay each transaction on its parent state, including the prestate and diff tracers. These replays load the same old, unchanged contracts that the skipped eth_call/trace_call at the parent block would load. So the history-index divergence still shows up in these traces, and the comparison still reports failures. The flag claims to skip 'anything that reads account state at a past block', but nothing in the diff guards these calls. Base behaviour is unchanged, but the flag does not give the clean run it is meant to provide.

Verification: Severity: normal. On a node restored from a snapshot without its indices, --skip-historical-state does not keep the comparison clean, because re-execution traces still read parent-block state. The per-block list at tester.rs:151-181 is extended with no condition (tests.extend(block_calls); at 183). tx_hash_calls at 396-416 is gated only on !self.minimal (394).

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