Skip to content

made blocksync send StatusRequest after statesync completes (CON-350)#3574

Merged
pompon0 merged 3 commits into
mainfrom
gprusak-blocksync-fix
Jun 12, 2026
Merged

made blocksync send StatusRequest after statesync completes (CON-350)#3574
pompon0 merged 3 commits into
mainfrom
gprusak-blocksync-fix

Conversation

@pompon0

@pompon0 pompon0 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

The point is to make sure that blocksync pool is immediately aware of the already connected peers, rather than wait for the first StatusRequest broadcast. This has been achieved by delaying processPeerUpdates to after pool is created, which sends the request when a peer has been discovered.
Additionally, nullable consensusReactor field is an Option now.

@cursor

cursor Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes blocksync concurrency and peer height discovery timing on the state-sync→block-sync path; mistakes could delay catch-up or mishandle consensus handoff, but scope is limited to sync controller lifecycle.

Overview
Blocksync peer discovery after state sync is fixed by starting processPeerUpdates only after blocksyncReady and the BlockPool exist, instead of at the beginning of syncController.run. Peer-up handling still sends StatusRequest per peer, but that loop now runs alongside requestRoutine once catch-up actually starts, so peers already connected during state sync are queried immediately instead of waiting for the periodic broadcast.

ConsReactor is modeled as utils.Option[ConsensusReactor] (exported interface) instead of a nullable pointer, with wiring updated in node.go and tests.

Several blocksync background tasks (processBlockSyncCh, requestRoutine, processPeerUpdates) now return error for scope/service shutdown. The query-responder test no longer expects an unsolicited StatusRequest on connect when block sync is disabled, since peer-update-driven status requests only run during active sync.

Reviewed by Cursor Bugbot for commit b5ea71a. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 11, 2026, 2:30 PM

Comment thread sei-tendermint/internal/blocksync/reactor.go Outdated
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.42105% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.33%. Comparing base (09c70ba) to head (b5ea71a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-tendermint/internal/blocksync/reactor.go 67.56% 11 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3574      +/-   ##
==========================================
- Coverage   59.17%   58.33%   -0.85%     
==========================================
  Files        2215     2141      -74     
  Lines      183370   174810    -8560     
==========================================
- Hits       108512   101970    -6542     
+ Misses      65047    63738    -1309     
+ Partials     9811     9102     -709     
Flag Coverage Δ
sei-chain-pr 68.31% <68.42%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-tendermint/node/node.go 64.23% <100.00%> (ø)
sei-tendermint/internal/blocksync/reactor.go 68.19% <67.56%> (-1.08%) ⬇️

... and 75 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pompon0 pompon0 enabled auto-merge June 11, 2026 14:30

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b5ea71a. Configure here.

pool := NewBlockPool(startHeightForState(res.state), s.router)
s.pool.Store(pool)
sc.SpawnNamed("requestRoutine", func() error { return s.requestRoutine(ctx, pool) })
sc.SpawnNamed("processPeerUpdates", func() error { return s.processPeerUpdates(ctx, pool) })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Request routine survives blocksync end

Medium Severity

requestRoutine is now started as an outer-scope main task before scope.Run1, instead of a background task inside the blocksync session. After poolRoutine finishes and the node switches to consensus, it keeps handling pool.Requests(), pool.Errors(), and periodic StatusRequest broadcasts for the rest of the process lifetime.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b5ea71a. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

WAI, autorestartIfBehind relies on this.

@pompon0 pompon0 added this pull request to the merge queue Jun 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 11, 2026
@pompon0 pompon0 added this pull request to the merge queue Jun 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 11, 2026
@pompon0 pompon0 added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit 0a2c388 Jun 12, 2026
60 checks passed
@pompon0 pompon0 deleted the gprusak-blocksync-fix branch June 12, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants