Skip to content

Stop repeatedly syncing from peers that don't extend our best chain - #476

Merged
ChrisSchinnerl merged 5 commits into
masterfrom
chris/fix-excessive-egress
Sep 28, 2026
Merged

ChrisSchinnerl merged 5 commits into
masterfrom
chris/fix-excessive-egress

Conversation

@ChrisSchinnerl

@ChrisSchinnerl ChrisSchinnerl commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

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.remaining never reaches 0.

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.

@ChrisSchinnerl ChrisSchinnerl self-assigned this Sep 22, 2026
Copilot AI balanced review requested due to automatic review settings September 22, 2026 10:16

@claude claude Bot 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.

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T10:20:17.575824Z 7f7c937 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 1 Medium severity

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.

Comment thread syncer/syncer.go Outdated
Comment thread syncer/syncer.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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".

Comment thread syncer/syncer.go Outdated
Comment thread syncer/syncer.go Outdated
@ChrisSchinnerl
ChrisSchinnerl force-pushed the chris/fix-excessive-egress branch 3 times, most recently from 4f47544 to bb03582 Compare September 22, 2026 12:03
@ChrisSchinnerl
ChrisSchinnerl requested a balanced review from Copilot September 22, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 1 Medium severity · 1 Low severity

Open (3)
Resolved since last review (2)

Comment thread syncer/peer.go
Comment thread syncer/syncer.go
Comment thread .changeset/compared_header_chain_work_before_downloading_blocks_from_a_peer.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 1 Medium severity

Open (2)
Resolved since last review (3)

Comment thread syncer/syncer.go Outdated
Comment thread syncer/syncer.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Pre-Oak header walks can derive incorrect consensus state because required target timestamps are unavailable.

Review effort: Balanced
Findings: None

Resolved since last review (2)

Comment thread syncer/syncer.go Outdated
Comment thread syncer/syncer.go
@ChrisSchinnerl
ChrisSchinnerl requested a balanced review from Copilot September 23, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 1 Medium severity

Open (2)
Resolved since last review (1)

Comment thread syncer/syncer.go
Comment thread syncer/syncer.go Outdated
@ChrisSchinnerl
ChrisSchinnerl force-pushed the chris/fix-excessive-egress branch from 89672cc to bdbed8e Compare September 23, 2026 11:28

@claude claude Bot 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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity

Open (1)
Resolved since last review (2)

Comment thread syncer/syncer_test.go
peterjan
peterjan previously approved these changes Sep 24, 2026
lukechampine
lukechampine previously approved these changes Sep 24, 2026
Comment thread syncer/syncer.go Outdated
Comment thread syncer/syncer.go

@claude claude Bot 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.

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.

@ChrisSchinnerl
ChrisSchinnerl force-pushed the chris/fix-excessive-egress branch from 0ae05d3 to 6679b80 Compare September 28, 2026 15:33
@ChrisSchinnerl
ChrisSchinnerl merged commit 720128a into master Sep 28, 2026
11 checks passed
@ChrisSchinnerl
ChrisSchinnerl deleted the chris/fix-excessive-egress branch September 28, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants