Stop repeatedly syncing from peers that don't extend our best chain - #476
Conversation
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Partial heavier forks can be suppressed, and concurrent relay notifications can be lost.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Prevents repeated downloads from peers whose fork batches do not advance the local best chain.
Changes:
- Marks non-advancing peers as synced.
- Adds fork and multi-batch synchronization tests.
- Documents the bandwidth fix in a changeset.
| File | Description |
|---|---|
syncer/syncer.go |
Detects unchanged tips after synchronization. |
syncer/syncer_test.go |
Tests fork suppression and continued useful syncing. |
.changeset/stopped_repeatedly_syncing_from_peers_whose_blocks_do_not_extend_our_best_chain.md |
Records the user-facing fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f7c937324
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4f47544 to
bb03582
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Legacy difficulty calculations use an invalid timestamp, and the implementation can retain unbounded header batches across peers.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (3)
Resolved since last review (2)
bb03582 to
349c239
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Historical difficulty calculation and peer-chain race conditions can cause incorrect synchronization decisions or stalled peers.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
349c239 to
606ece3
Compare
d9bc70d to
89672cc
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Critical replay validation and several consensus-state and timeout issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
Resolved since last review (1)
89672cc to
bdbed8e
Compare
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
bdbed8e to
a555403
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The tests do not compile, and header-state calculation may misclassify peer chain work.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
Resolved since last review (2)
0ae05d3
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
0ae05d3 to
6679b80
Compare



Nick has reported excessive bandwidth usage from the syncer and shared his logs with us.
In 15 hours or so his node downloaded a few hundred thousand blocks from peers that seem to be stuck on a different fork. So syncing with them doesn't actually extend our best chain. We end up syncing the same batch of blocks every 5 seconds because
r.remainingnever reaches0.The implemented solution is to check if a peer's chain is more heavy than our own based off the headers rather than fetching actual blocks.