Skip to content

feat(evm-rpc): check trace replays cover every transaction - #599

Open
abernatskiy wants to merge 1 commit into
masterfrom
fix/trace-replay-completeness
Open

abernatskiy wants to merge 1 commit into
masterfrom
fix/trace-replay-completeness

Conversation

@abernatskiy

Copy link
Copy Markdown
Contributor

Problem

trace_replayBlockTransactions can come back empty or truncated for a block that has transactions. addTraceTxReplays accepted any list, so such a block went through with no state diffs (or traces) for the transactions the provider left out. The trace_block and debug paths already check per-transaction coverage; this path did not.

Change

  • @subsquid/evm-rpc: new RpcOptions.traceReplayCompleteness, off | observe | reject, off by default in the library.
    • observe logs the block (number, hash, transaction and replay counts, up to three missing hashes) and accepts it.
    • reject marks the block invalid, so the existing re-fetch retries it and fails once retries are exhausted.
    • Bor's state-sync transaction (Polygon, Amoy, Shibarium) is not expected to have a replay.
  • @subsquid/evm-dump: --trace-replay-completeness, default reject.
  • @subsquid/evm-data-service: --trace-replay-completeness, default observe (warning only, for now).

Rollout note

The dump default changes behaviour on upgrade: a dump on a chain whose trace API legitimately omits some transactions from trace_replayBlockTransactions will now retry and stop on that block instead of writing it. --trace-replay-completeness observe restores the old acceptance with a warning.

Tests

evm/evm-rpc/test/rpc.trace-replay-completeness.test.ts: complete, empty and truncated replay lists in each mode, off as the default, and the Bor state-sync exemption. Full evm-rpc suite passes; evm-dump and evm-data-service type-check.

🤖 Generated with Claude Code

Providers have answered trace_replayBlockTransactions with an empty or
truncated list for blocks with transactions. Nothing checked the count,
so such blocks were archived without state diffs for the transactions
left out. The trace_block and debug paths already check coverage.

New mode traceReplayCompleteness (off|observe|reject, off in the
library). observe logs the block with its missing replays and accepts
it; reject marks the block invalid so the existing re-fetch retries it.
Bor's state-sync transaction is not expected to have a replay.

CLI flag --trace-replay-completeness:
- evm-dump: default reject, so a dump retries and then fails rather than
  archive the block.
- evm-data-service: default observe, a warning for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation is consistent across consumers and covers the key success, failure, default, and chain-specific cases.

0 open findings

What changed in this PR

Adds configurable completeness checks for transaction trace replays across EVM ingestion tools.

Changes:

  • Adds off, observe, and reject validation modes.
  • Exempts Bor state-sync transactions.
  • Configures service defaults and adds coverage tests and release records.
File Description
evm/​evm-rpc/​src/​rpc.ts Implements replay completeness validation.
evm/​evm-rpc/​test/​rpc.trace-replay-completeness.test.ts Tests validation modes and Bor exemption.
evm/​evm-dump/​src/​dumper.ts Adds CLI option defaulting to reject.
evm/​evm-data-service/​src/​main.ts Adds CLI option defaulting to observe.
evm/​evm-data-service/​src/​data-source/​setup.ts Propagates the validation mode into RPC setup.
common/​changes/​@subsquid/​evm-rpc/​fix-trace-replay-completeness_2026-10-13-14-15.json Records the RPC package change.
common/​changes/​@subsquid/​evm-dump/​fix-trace-replay-completeness_2026-10-13-14-15.json Records the dump package change.
common/​changes/​@subsquid/​evm-data-service/​fix-trace-replay-completeness_2026-10-13-14-15.json Records the data-service package change.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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