chore: log peer count in WaitForSync to diagnose sync flakes#7149
Open
chore: log peer count in WaitForSync to diagnose sync flakes#7149
Conversation
Widens WaitForSync's client parameter from rpcclient.StatusClient to rpcclient.Client so NetInfo() can be called alongside Status(). The per-tick log line now includes Peers=N to make it easier to correlate sync throughput with peer connectivity when TestSyncToTipMocha fails on mocha. NetInfo errors are tolerated (logged as Peers=-1). Refs #7138
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
cmwaters
reviewed
Apr 21, 2026
auto-merge was automatically disabled
April 21, 2026 22:31
Pull request was converted to draft
Address review feedback from @cmwaters: replace the `-1` peer sentinel with two distinct log lines so a NetInfo error is obvious in test output instead of cryptic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
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.
Summary
WaitForSync's client parameter fromrpcclient.StatusClienttorpcclient.ClientsoNetInfo()can be called alongsideStatus().Peers=NalongsideHeightandCatchingUp.NetInforeturns an error, the log line omitsPeersand includes the error instead; polling continues either way.Why
TestSyncToTipMochaintermittently fails either because block sync doesn't finish inside the 10m KPI window (#7138) or becauseChain.Start()can't dial any mocha peer (#7147). In both modes, the current log line (Height=X, CatchingUp=Y) doesn't tell us whether the node actually has peers to sync from. LoggingNumPeerson each tick will let us distinguish "slow peer" from "no peers" the next time this flakes, without having to reproduce the failure locally.This is diagnostic — it doesn't resolve #7138 by itself, but it makes the next failure actionable.
Test plan
go vet ./...passes intest/docker-e2ego test -count=0 ./...(compile-only) passes intest/docker-e2emake buildsucceedsPeers=Nin log outputRelated
Chain.Start()peer-dial failures (same logging would help here, but the error happens beforeWaitForSyncis called)Refs #7138