Skip to content

feat(flashblocks): add canonical block reconciliation to clear stale pending state#21083

Closed
teddyknox wants to merge 2 commits intoparadigmxyz:mainfrom
op-rs:teddyknox/fb-c-block-reconciliation
Closed

feat(flashblocks): add canonical block reconciliation to clear stale pending state#21083
teddyknox wants to merge 2 commits intoparadigmxyz:mainfrom
op-rs:teddyknox/fb-c-block-reconciliation

Conversation

@teddyknox
Copy link
Copy Markdown

Stacked on top of #21081, will rebase once that merges.

Summary

Wire up the validation module to handle canonical block notifications, enabling the service to detect reorgs and clear stale pending state.

Part of the speculative flashblock building design. Builds on PR 1.

Motivation

When the canonical chain advances or diverges from pending flashblock state, the service needs to reconcile. Without this, stale pending state persists until eventually overwritten, and there's no explicit signal to downstream consumers that a reorg occurred.

Changes

cache.rs

  • Add earliest_block_number() and latest_block_number() to SequenceManager
  • Add get_transaction_hashes_for_block() for reorg detection
  • Add process_canonical_block() that uses ReorgDetector and CanonicalBlockReconciler to determine and apply reconciliation strategy
  • Add clear_all() helper

service.rs

  • Add CanonicalBlockNotification type with block number and transaction hashes
  • Add canonical_block_rx receiver field and with_canonical_block_rx() builder method
  • Add max_depth configuration with with_max_depth() builder method (default: 64)
  • Handle canonical block notifications in the main loop, calling process_canonical_block()
  • Add reorg_count metric

Testing

Unit tests for:

  • process_canonical_block() with each reconciliation strategy
  • earliest_block_number() / latest_block_number() tracking across pending and cached sequences

…d reconciliation

Add stateless validators for flashblock processing:
- FlashblockSequenceValidator: validates consecutive indices within blocks
- ReorgDetector: detects chain reorgs via transaction hash comparison
- CanonicalBlockReconciler: determines strategy when canonical blocks arrive
…rvice

  Wire up validation module to handle canonical block notifications:
  - Add earliest/latest block number tracking to SequenceManager
  - Add process_canonical_block() for state reconciliation on new canonical blocks
  - Add CanonicalBlockNotification type and receiver to FlashBlockService
  - Add configurable max_depth for pending block limits
  - Track reorg_count metric
@teddyknox
Copy link
Copy Markdown
Author

Closing in favor of ethereum-optimism/optimism#18994

@teddyknox teddyknox closed this Jan 29, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Reth Tracker Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant