Skip to content

feat(flashblocks): add canonical block reconciliation to cache and service (2)#18994

Merged
einar-oplabs merged 1 commit intoteddyknox/flashblock-sequencingfrom
teddyknox/fb-c-block-reconciliation
Feb 3, 2026
Merged

feat(flashblocks): add canonical block reconciliation to cache and service (2)#18994
einar-oplabs merged 1 commit intoteddyknox/flashblock-sequencingfrom
teddyknox/fb-c-block-reconciliation

Conversation

@teddyknox
Copy link
Copy Markdown
Contributor

@teddyknox teddyknox commented Jan 29, 2026

Summary

Integrates canonical block reconciliation into the flashblock service and sequence manager:

  • Adds CanonicalBlockNotification type for receiving canonical block events via channel
  • Adds process_canonical_block() to SequenceManager using validators from PR Clean Documentation #1
  • Service now accepts optional canonical_block_rx channel and processes notifications in the event loop
  • Clears pending state on CatchUp, HandleReorg, or DepthLimitExceeded
  • Adds reorg_count metric counter

New APIs

  • FlashBlockService::with_canonical_block_rx() - Sets the canonical block receiver
  • FlashBlockService::with_max_depth() - Configures max depth (default: 64 blocks)
  • SequenceManager::process_canonical_block() - Reconciles pending state with canonical
  • SequenceManager::earliest_block_number() / latest_block_number() - Query pending block range

Test plan

  • Test process_canonical_block with no pending state → NoPendingState
  • Test canonical catches up to pending → CatchUp, state cleared
  • Test canonical behind pending → Continue, state preserved
  • Test depth limit exceeded → DepthLimitExceeded, state cleared
  • Test earliest_block_number / latest_block_number tracking

@teddyknox teddyknox requested a review from a team as a code owner January 29, 2026 22:03
@teddyknox teddyknox changed the title feat(flashblocks): add canonical block reconciliation to clear stale pending state feat(flashblocks): add canonical block reconciliation to clear stale pending state (2) Jan 29, 2026
Comment thread op-reth/crates/flashblocks/src/cache.rs
Comment thread op-reth/crates/flashblocks/src/service.rs Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.7%. Comparing base (466c2b1) to head (b1f8c96).

Additional details and impacted files
@@                        Coverage Diff                         @@
##           teddyknox/flashblock-sequencing   #18994     +/-   ##
==================================================================
+ Coverage                             79.8%    81.7%   +1.8%     
==================================================================
  Files                                  133      133             
  Lines                                 6909     6909             
==================================================================
+ Hits                                  5519     5647    +128     
+ Misses                                1390     1262    -128     
Flag Coverage Δ
contracts-bedrock-tests 81.7% <ø> (+1.8%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@teddyknox teddyknox force-pushed the teddyknox/fb-c-block-reconciliation branch from b1f8c96 to ae54537 Compare January 29, 2026 22:38
@teddyknox teddyknox changed the title feat(flashblocks): add canonical block reconciliation to clear stale pending state (2) feat(flashblocks): add canonical block reconciliation to cache and service (2) Jan 30, 2026
@teddyknox teddyknox force-pushed the teddyknox/fb-c-block-reconciliation branch 3 times, most recently from d3b6784 to af89d39 Compare January 30, 2026 20:42
Comment thread op-reth/crates/flashblocks/src/service.rs
@teddyknox teddyknox force-pushed the teddyknox/fb-c-block-reconciliation branch from af89d39 to 5bd92e1 Compare January 30, 2026 21:06
@teddyknox teddyknox requested a review from joshklop January 30, 2026 21:24
Copy link
Copy Markdown
Contributor

@einar-oplabs einar-oplabs left a comment

Choose a reason for hiding this comment

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

Looks good.

@einar-oplabs einar-oplabs merged this pull request into teddyknox/flashblock-sequencing Feb 3, 2026
95 checks passed
@einar-oplabs einar-oplabs deleted the teddyknox/fb-c-block-reconciliation branch February 3, 2026 18:50
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