feat(p2p): fan out catch-up sync across all lagging peers concurrently - #131
Open
secretnamebasis wants to merge 3 commits into
Open
feat(p2p): fan out catch-up sync across all lagging peers concurrently#131secretnamebasis wants to merge 3 commits into
secretnamebasis wants to merge 3 commits into
Conversation
trigger_sync's chain.Sync path now dispatches missing blocks across every currently-eligible peer at once instead of fetching sequentially from a single peer. Assignment is Pruned-aware per block, retries a different peer on a fetch failure, and scales concurrency to real peer availability each tick. Falls back to the original single-connection sync_chain() when fewer than 2 eligible peers are available, so the existing path stays intact as a safety net. Fast-sync (bootstrap_chain) is untouched. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmRAFW3ZtNqNLHr3NZh4xH
Comments referenced internal planning cycle numbers ("kata cycle #N",
"test item N") and session-narrative framing ("caught live", "this
session") that don't belong in durable source comments. Rewritten to
keep the technical why, dropped the process narration. No behavior,
signature, or test-assertion changes - build, vet, and the full race
test suite are unaffected.
Same fix as on feat/torrent-and-pipeline-merge: bootstrap_chain() writes topo-store placeholder entries with BLOCK_ID=zerohash but a non-zero State_Version, which TopoRecord.IsClean() treats as "not clean" - so while bootstrap is mid-write, Get_Top_ID() can return the zero hash literally, and fill_common's ReadBlockSnapshotVersion lookup on that hash panics (maps to a shard directory that legitimately never exists). Treat a zero Get_Top_ID() as "chain not ready yet" and skip the lookup instead of panicking. Same signature, no call-site changes.
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.
Description
trigger_sync's default catch-up path now fans out fetching missing blocks across every currently-eligible lagging peer concurrently, instead of fetching sequentially from a single peer one block at a time.Add_Complete_Block's parent-chain check), with panic recovery around the commit call so a bad block can't take down the daemon.sync_chain()when fan-out's own preconditions aren't met (fewer than 2 eligible peers, the chain-request call fails, or no missing blocks are found), so current behavior remains the safety net.--fastsync/bootstrap_chain) is a separate mechanism and is untouched.Tested against real mainnet peers: multiple consecutive sync ticks each committed full batches with zero regressions, and peer diversity per tick scaled correctly with real peer availability once the concurrency fix landed.
Fixes # (issue)
No linked issue — this is a proactive sync-performance improvement, not a bug report.
Type of change
Which part is impacted ?
Checklist:
License
Im am contributing & releasing the code under DERO Research License (which can be found here).
Let me know if you want me to actually open the PR (targeting dev on deroproject/derohe) with this, or if you'll paste it in yourself.