Repository navigation
csnode: forward sync paces its requests to responders with an anti-duplicate log (order 35) - #136
Conversation
…plicate log (order 35) A responder with special order 35 active refuses a request whose last sequence is not above the last one it logged for the same requester, while that entry lives (5 s after its reply), and for ever after it accepted a request (AwaitAnswer) and had nothing to send. A node syncing from block 0 has not applied order 35 yet: Node::getSyncroMessage dropped the responders' SyncroMsg, and the synchronizer kept no request log, so it went on asking a full peer for blocks 1..100 right after blocks 301..400, refused every time (pruned-peers-join: a joiner that never got blocks 1..100 in 75 minutes, seen once). - Node::getSyncroMessage passes every SyncroMsg to the synchronizer, whatever this node knows of order 35 (a responder sends them only when its order 35 is active). - cs::SyncroPacing (new): a peer that sent a SyncroMsg is active; a request to it whose last sequence is at or below its live entry, or below an AwaitAnswer-then-NoSuchBlocks entry, is not sent: the range goes to the next neighbour. A peer that never sent one is asked as before. - PoolSynchronizer keeps its request log for active peers even before order 35 applies here (synchroLogFor); logs once per peer when it becomes active. Nothing changes where no responder sends SyncroMsg (order 35 not issued). Tests: syncropacing_tests.cpp. robustness.yml: pruned-peers-join-official (valid with node_alt_ref=official: official full responders serve the low blocks). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…took it) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
CI: Linux run 41072773657 green; Windows/macOS run 41072773437: Windows green, macOS cancelled for lack of a runner, re-run in progress. Robustness: pruned-peers-join green three times (runs 41072763928, 41072782217, 41072800045), pruned-peers-join-official green in a normal run (41072763928) and with node_alt_ref=official (41072818530: the even nodes are official 4.2.532 responders with order 35). Not merged: it changes forward sync and waits for review. |
|
macOS re-run of run 41072773437: green. All CI green on #136; not merged, waiting for review (it changes forward sync). |
Node::getSyncroMessage: the bound check first, then the backfill and the forward sync both read every SyncroMsg, whatever this node knows of order 35. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- M2: the backfill and the forward sync both read every SyncroMsg now. An answer counts for the forward sync only while a forward request to that peer is in flight (SyncroPacing::inFlight); any other one marks the peer active and changes neither the pacing nor synchroLog_. - M3: every forward request is recorded, also to a peer that has not sent a SyncroMsg yet, so that AwaitAnswer then NoSuchBlocks on the first request counts. A refusal the responder does not log (NoSuchBlocks without AwaitAnswer, DuplicatedRequest, IncorrectRequest) leaves the entry it held. - L1: a neighbour removed is forgotten. - L2: "for ever" (NoSuchBlocks after AwaitAnswer) lasts an hour here. - L4: an AwaitAnswer entry of synchroLog_ (order 35 known) expires after 30 s, as a forward request in flight does, so that a peer whose reply was lost is asked again. Tests: a request sent before the peer's first SyncroMsg; a DuplicatedRequest with no request recorded; answers to the backfill leave the forward state alone; a request without an answer expires; the hour of "for ever". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review fixes (Fable): master merged in (bb6b3a4: Node::getSyncroMessage bound-checks first, then the backfill and the forward sync both read every SyncroMsg), M2/M3/L1/L2/L4 in b95abcd (an answer counts for the forward sync only while a forward request to that peer is in flight; every forward request recorded; refusals the responder does not log leave its entry; neighbour removal forgets; 'for ever' = 1 h; AwaitAnswer entries of synchroLog_ expire after 30 s). L3 not done (optional). L5 (getRequiredBlocks re-requesting a contiguous cache) left as a follow-up. |
Changes forward sync: to be reviewed before merging. Not consensus-relevant: no block, hash, signature or round rule changes. Only which neighbour a sync request goes to, and when, changes, and only toward responders that send SyncroMsg.
The problem
A responder with special order 35 active keeps an anti-duplicate log of requests (
Node::checkSynchroRequestsLog).A node syncing from block 0 has not applied order 35 yet (
Consensus::syncroChangeRoundis unset), so:Node::getSyncroMessagedropped the responders' SyncroMsg;PoolSynchronizerkept no request log.The result: it asked a full peer for blocks 1..100 right after 301..400, was refused every time, and never learnt it. Seen once in
pruned-peers-join, run 41020112883: the joiner had 600 blocks cached and never got blocks 1..100 in 75 minutes, while only 2 of 7 peers were full. It is intermittent; it passed on master and other runs.Change
Node::getSyncroMessagepasses every SyncroMsg to the synchronizer, whatever this node knows of order 35. A responder sends them only when its own order 35 is active.cs::SyncroPacing(new,csnode/syncropacing.hpp):PoolSynchronizer:synchroLogFor);SyncroPacingbefore each request;SYNC: <peer> keeps an anti-duplicate log of requests (special order 35): requests to it are paced.Where nothing changes: no responder sends SyncroMsg while order 35 is not issued, so forward sync is unchanged there. Whether mainnet has issued it is unknown (see the backward sync design).
Tests
tests/csnode/syncropacing_tests.cpp:robustness.yml, new rowpruned-peers-join-official: valid withnode_alt_ref=official. NODES=8; the even nodes are official full responders with order 35 serving the low blocks; the joiner, n9, runs this build.pruned-peers-jointhree times,pruned-peers-join-officialin a normal run and withnode_alt_ref=official, plus the Linux and Windows/macOS builds. The runs are posted in the comments.🤖 Generated with Claude Code