Skip to content

IBD state management de-coupled from PeerManager#497

Open
Sansh2356 wants to merge 1 commit into
braidpool:devfrom
Sansh2356:ibd/sync-engine-framework
Open

IBD state management de-coupled from PeerManager#497
Sansh2356 wants to merge 1 commit into
braidpool:devfrom
Sansh2356:ibd/sync-engine-framework

Conversation

@Sansh2356

Copy link
Copy Markdown
Contributor
  • Introduces a sans-I/O sync engine for Initial Block Download (IBD) under a new node::sync module.
  • Decoupling sync state from PeerManager/PeerInfo and setting up to replace the current ibd_manager module. Single-peer sync target, wire protocol unchanged.
  • Adding Retry engine for each of the request being timed out after specific intervals but capped with maximum number of retries to avoid retry loop increasing overload on the executing thread .

Adding IBD state management separating the need for
coupling it with PeerManager instead keeping both the sync
state separated from the PeerInfo .

I have add a sync module comprising of `RetryPolicy`, `PeerState`
and `SyncEvent` that will emit `SyncActions` according to each
req/resp cycle in batched pages along with sequnetially forwarding
IBD state with respect to sync peer.

This will replace the current in account `IBD_MANAGER` module to into
more distributed modules as mentioned above for better management and coupling.
Copilot AI review requested due to automatic review settings July 9, 2026 19:22
@Sansh2356 Sansh2356 requested a review from zaidmstrr as a code owner July 9, 2026 19:22

Copilot AI 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.

Pull request overview

Adds a new sans-I/O IBD sync engine under node::sync, aiming to decouple IBD state from PeerManager/PeerInfo and introduce bounded retry/backoff behavior while keeping the wire protocol unchanged (single-peer sync target).

Changes:

  • Introduces SyncEngine state machine (SyncEventSyncAction) for IBD request/response driving, batching, and peer drop/retry scheduling.
  • Adds RetryPolicy exponential backoff + retry ceiling tracking, and SyncPeerState to hold per-sync-target cursors (tips, hash queue, offset).
  • Exposes the new sync module from node/src/lib.rs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
node/src/sync/mod.rs New IBD state machine (events/actions), batching rules, hash-page pruning, retry/exhaustion tracking.
node/src/sync/retry.rs Defines exponential backoff retry policy used by the engine.
node/src/sync/peer_state.rs Holds per-active-peer sync cursors (tips, queue, offset).
node/src/lib.rs Exports the new sync module.

Comment thread node/src/sync/mod.rs
Comment thread node/src/sync/mod.rs
Comment thread node/src/sync/mod.rs
Comment thread node/src/sync/mod.rs
Comment thread node/src/sync/retry.rs
Comment thread node/src/sync/mod.rs
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