Skip to content

fix(op-reth): surface pruned block bodies as a typed error instead of state-root mismatch#21495

Merged
sebastianst merged 9 commits into
developfrom
fix/op-reth-detect-pruned-block-body
Jun 23, 2026
Merged

fix(op-reth): surface pruned block bodies as a typed error instead of state-root mismatch#21495
sebastianst merged 9 commits into
developfrom
fix/op-reth-detect-pruned-block-body

Conversation

@dhyaniarun1993

Copy link
Copy Markdown
Contributor

Description

Replace the misleading StateRootMismatch that surfaces when reth has pruned a block we depend on with a dedicated BlockBodyPruned error variant. Detection sits in two places: the engine's tasks::execute_block::run (covers live sync
and any caller of EngineHandle::execute_block) and the backfill's compute_block_backfill_diff (covers the changeset-pruning path that backfill actually reads from).

Tests

Test cases added

Additional context

NA

Metadata

NA

@dhyaniarun1993 dhyaniarun1993 self-assigned this Jun 22, 2026
@dhyaniarun1993 dhyaniarun1993 requested a review from a team as a code owner June 22, 2026 07:44
@wiz-0f98cca50a

wiz-0f98cca50a Bot commented Jun 22, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@sebastianst sebastianst self-assigned this Jun 22, 2026
@sebastianst sebastianst self-requested a review June 22, 2026 11:29

@sebastianst sebastianst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤖 Claude says: Rust review of the pruned-body detection. The core approach is sound — both detection heuristics are logically correct (engine: transactions_root != EMPTY && empty body; backfill: empty per-block revert + state_root[N] != state_root[N-1], correctly guarded for genesis), and the engine + backfill paths are well tested.

Findings inline, by severity:

  • 🔴 High — the unwind.rs guard returns an error before unwinding, contradicting its own comment/message ("unwind proceeds") and turning a safe unwind into a hard failure. Likely meant to be a warn! + continue.
  • 🟠 Medium — the new alloy-trie dependency is unnecessary (alloy_consensus::EMPTY_ROOT_HASH is already in scope).
  • 🟡 LowCargo.toml tabs/trailing-comma; doc comments claim a (non-existent) mirrored check in advance_sync; the backfill test only covers v1 storage settings (acceptable, but worth noting v2 pruning isn't exercised).

Recommend addressing the High finding before merge; the rest are scope-hygiene cleanups.

Comment thread rust/op-reth/crates/cli/src/commands/op_proofs/unwind.rs Outdated
Comment thread rust/op-reth/crates/cli/src/commands/op_proofs/unwind.rs Outdated
Comment thread rust/op-reth/crates/cli/Cargo.toml Outdated
Comment thread rust/op-reth/crates/cli/Cargo.toml Outdated
Comment thread rust/op-reth/crates/trie/src/engine/tasks/execute_block.rs Outdated
Comment thread rust/op-reth/crates/cli/Cargo.toml
@sebastianst sebastianst added this pull request to the merge queue Jun 23, 2026
Merged via the queue into develop with commit 14234ff Jun 23, 2026
128 checks passed
@sebastianst sebastianst deleted the fix/op-reth-detect-pruned-block-body branch June 23, 2026 09:18
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