Repository navigation
feat: add --skip-historical-state - #81
Conversation
| // 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 |
There was a problem hiding this comment.
🔴 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).
Adds an opt-in
--skip-historical-stateflag that skips the checks reading account state at a past block:eth_call,eth_estimateGas,eth_createAccessList,debug_traceCall,trace_call,tempo_simulateV1,eth_simulateV1and the Tempo fee replayseth_getCodeandeth_getStorageAton the contract a sampled transaction touchesThis 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) andcargo testpass. A live run against a Tempo testnet RPC with--use-tempo --skip-historical-statepasses and sends none of the skipped calls.