Skip to content

fix(consensus): do not cache rejections caused by unhashed payload fields - #219

Merged
panos-xyz merged 3 commits into
mainfrom
fix/transient-unhashed-field-errors
Nov 11, 2026
Merged

panos-xyz merged 3 commits into
mainfrom
fix/transient-unhashed-field-errors

Conversation

@panos-xyz

Copy link
Copy Markdown
Contributor

Summary

  • NextL1MsgIndex is excluded from the header hash (headerHashing in morph-geth, hash_slow here) and the withdraw trie root travels in ExecutableL2Data, so neither is covered by the block hash or the sequencer signature: any peer can relay a validly signed block with either field corrupted.
  • reth rejected such a copy with a plain ConsensusError and recorded the block hash in invalid_headers. That hash also identifies the honest block, so the follower afterwards refused the honest block as links to previously rejected block without executing it, until the entry was hit 128 times or the node restarted. Re-submitting the honest block or rebuilding it from L1 (newSafeL2Block) hit the same cache. geth re-derives the field and accepts the honest block (measured in the audit: same input sequence, geth stops at N, reth at N−1).
  • Report both mismatches as typed MorphConsensusError variants (InvalidNextL1MessageIndex, new WithdrawTrieRootMismatch) and classify them as transient in MorphConsensus::is_transient_error by downcasting ConsensusError::Other, so reth still rejects the corrupted copy but keeps the hash out of the cache. Error messages are unchanged; the node's retryableError classifier still matches invalid block.NextL1MsgIndex.

Tests

  • invalid_payload_recovery::corrupted_next_l1_msg_index_does_not_poison_the_honest_block (two nodes): the follower rejects the corrupted copy naming the field and then accepts the honest block with the same hash. With the previous is_transient_error this test fails with newPayload returned INVALID: links to previously rejected block.
  • Unit: MorphConsensusError::is_unhashed_field_error classification; is_transient_error is true for both mismatches and false for TimestampIsInPast and InvalidL1MessageOrder.
  • make lint, cargo test --doc --all, make test (909 passed), make test-e2e (129 passed).

Notes

  • The withdraw trie root check only runs when the block touches the message-passer slot, so an e2e for that variant needs an L2→L1 message; it is covered by the unit tests here.
  • The CL-side hardening from the audit is still worth doing: with hash-keyed dedup in the broadcast reactor, a corrupted copy that arrives first still stalls the CL until it restarts, on geth as well as reth. This PR removes reth's additional stickiness, after which a CL restart or L1 derivation recovers the node.

https://claude.ai/code/session_013oN3EyKzA7m5ykYdT5g6WL

…elds

NextL1MsgIndex is excluded from the header hash and the withdraw trie root
travels in the engine payload, so neither is covered by the block hash or the
sequencer signature. A peer can relay a validly signed block with either field
corrupted; reth rejected it and recorded the hash in its invalid-header cache,
and since that hash also identifies the honest block, the follower then refused
the honest block as "links to previously rejected block" until the entry was
hit 128 times or the node restarted. Neither re-submitting the honest block nor
deriving it from L1 could recover; geth re-derives the field and accepts the
honest block.

Report both mismatches as typed MorphConsensusError variants and classify them
as transient in MorphConsensus::is_transient_error, so reth still rejects the
corrupted copy but leaves the hash out of the cache. Messages are unchanged,
so the node's retry classifier keeps matching them.

Claude-Session: https://claude.ai/code/session_013oN3EyKzA7m5ykYdT5g6WL
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8c3587d3-65fc-40c9-95e2-7dce9f3c4f38
Commits

Reviewing files that changed from the base of the PR and between 0f60520 and a118a69.

Files selected for processing: 4

  • crates/consensus/src/error.rs
  • crates/consensus/src/validation.rs
  • crates/node/src/validator.rs
  • crates/node/tests/it/invalid_payload_recovery.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@panos-xyz
panos-xyz requested a review from dylanCai9 November 9, 2026 13:40

@dylanCai9 dylanCai9 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

review 48ac4ba

@curryxbo curryxbo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@panos-xyz
panos-xyz merged commit 6f2edac into main Nov 11, 2026
12 checks passed
@panos-xyz
panos-xyz deleted the fix/transient-unhashed-field-errors branch November 11, 2026 03:41
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.

3 participants