feat(flashblocks): add canonical block reconciliation to clear stale pending state#21083
Closed
teddyknox wants to merge 2 commits intoparadigmxyz:mainfrom
Closed
feat(flashblocks): add canonical block reconciliation to clear stale pending state#21083teddyknox wants to merge 2 commits intoparadigmxyz:mainfrom
teddyknox wants to merge 2 commits intoparadigmxyz:mainfrom
Conversation
…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
Author
|
Closing in favor of ethereum-optimism/optimism#18994 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rsearliest_block_number()andlatest_block_number()toSequenceManagerget_transaction_hashes_for_block()for reorg detectionprocess_canonical_block()that usesReorgDetectorandCanonicalBlockReconcilerto determine and apply reconciliation strategyclear_all()helperservice.rsCanonicalBlockNotificationtype with block number and transaction hashescanonical_block_rxreceiver field andwith_canonical_block_rx()builder methodmax_depthconfiguration withwith_max_depth()builder method (default: 64)process_canonical_block()reorg_countmetricTesting
Unit tests for:
process_canonical_block()with each reconciliation strategyearliest_block_number()/latest_block_number()tracking across pending and cached sequences