Skip to content

feat: support multiple flashblock websockets as fallback#202

Closed
limyeechern wants to merge 4 commits intosync-developfrom
feat/multi-fb-ws
Closed

feat: support multiple flashblock websockets as fallback#202
limyeechern wants to merge 4 commits intosync-developfrom
feat/multi-fb-ws

Conversation

@limyeechern
Copy link
Collaborator

Summary

  • Add MultiSourceFlashBlockStream that wraps multiple WebSocket flashblock streams with deduplication,
    cross-validation, and per-source error backoff
  • Change --flashblocks-url to --flashblocks-urls to accept multiple comma-separated URLs for redundancy
  • First-arriving flashblock for each (payload_id, index) wins; duplicates are dropped with hash cross-validation
  • Per-source backoff (500ms) on errors so healthy sources continue serving while a failed source recovers

@limyeechern limyeechern marked this pull request as draft February 27, 2026 11:09
use tracing::warn;

/// Backoff duration applied per-source when a stream error occurs.
const PER_SOURCE_BACKOFF: Duration = Duration::from_millis(500);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i was wondering if we should implement exponential backoff instead, but i'm not too sure which is better

Copy link

@sieniven sieniven left a comment

Choose a reason for hiding this comment

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

Nice work. Closing this PR because we will re-open this fixes and cherry-pick them to xlayer-reth directly, once new flashblocks RPC revamp layer is completed.
PR ref: okx/xlayer-reth#176

We no longer need to add this on the op-reth crates anymore since we are revamping the entire flashblocks RPC layer. Note that the new configurable flashblocks websocket url will be xlayer.flashblocks-url

@sieniven sieniven closed this Mar 12, 2026
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