Skip to content

statement-store: reject statement peers during major sync#11477

Open
peter941221 wants to merge 3 commits intoparitytech:masterfrom
peter941221:peter/statement-store-major-sync-core
Open

statement-store: reject statement peers during major sync#11477
peter941221 wants to merge 3 commits intoparitytech:masterfrom
peter941221:peter/statement-store-major-sync-core

Conversation

@peter941221
Copy link

@peter941221 peter941221 commented Mar 24, 2026

Summary

Fixes #11411 by preventing statement peers from remaining half-connected during major sync.

  • reject inbound statement substreams while major syncing
  • disconnect streams that still open during that window
  • disconnect already-connected peers that send during that window
  • keep reconnect + initial sync as the recovery path
  • keep initial-sync telemetry consistent on these disconnect-driven cleanup paths

This also includes the stream-open snapshot fix so a peer admitted just before major sync starts still queues initial sync correctly instead of falling into the same broken state through a race.

Why this shape

Silently ignoring statements keeps the broken middle state alive:

  • the statement stream looks open,
  • live statements are not accepted,
  • and there is no clean replay trigger later.

Disconnecting is the smallest safe repair because it reuses the existing lifecycle instead of adding new sync-transition machinery.

Tests

  • rejecting inbound statement substreams while major syncing
  • disconnecting streams that open while major syncing
  • disconnecting already-connected peers that send during major sync
  • reconnecting after sync exit and re-queuing initial sync
  • preserving initial sync if major sync starts mid stream-open
  • not recording major-sync disconnect cleanup as a completed initial sync
  • decrementing initial_sync_peers_active when flooding cleanup removes pending sync state

Validation

  • git diff --check refs/remotes/upstream/master..HEAD -- substrate/client/network/statement/src/lib.rs
  • cargo test -p sc-network-statement --lib major_sync -- --nocapture

Note: the full lib suite on this narrowed branch still hits the older sustained-flooding test that 7bfd50e later stabilizes, so that test-only stabilization can remain a separate follow-up if preferred.

- reject inbound statement substreams while major syncing
- disconnect statement streams that open during the sync window
- disconnect already-connected peers that send during major sync
- add regression tests for reconnect and initial-sync recovery paths
@cla-bot-2021
Copy link

cla-bot-2021 bot commented Mar 24, 2026

User @peter941221, please sign the CLA here.

@peter941221
Copy link
Author

Quick note on the follow-up commit:

  • the third commit does not widen the behavioral scope beyond the core major-sync fix
  • it only keeps initial-sync telemetry consistent on disconnect-driven cleanup paths
  • specifically, it avoids counting aborted initial sync as completed, and keeps initial_sync_peers_active balanced when pending sync state is removed during disconnect cleanup

So the main slice is still the same narrow one:

  • reject / disconnect statement peers during major sync
  • preserve reconnect + initial sync as the recovery path
  • keep the stream-open transition race closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant