statement-store: reject statement peers during major sync#11449
Open
peter941221 wants to merge 10 commits intoparitytech:masterfrom
Open
statement-store: reject statement peers during major sync#11449peter941221 wants to merge 10 commits intoparitytech:masterfrom
peter941221 wants to merge 10 commits intoparitytech:masterfrom
Conversation
- 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
|
User @peter941221, please sign the CLA here. |
Author
|
Quick update: I pushed two more reviewer-driven fixes on this branch:
Both are covered by the current Linux-native validation:
If you'd prefer the later hardening commits split into follow-up PRs, I'm happy to do that. |
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
This PR fixes #11411 and the adjacent statement-handler lifecycle holes it exposed by preventing peers from remaining in a half-connected statement-protocol state while the node is unavailable.
The core repair is still the original major-sync fix:
Follow-up reviewer passes then closed the same half-connected state in nearby paths:
Why this is needed
Today a peer can end up in a broader half-connected state:
That means statements can be missed permanently even though the peer still looks connected.
A key detail here is that gating only newly opening peers is not sufficient. Peers that were already connected before major sync starts can still hit the same loss window once sync state changes, and later reviewer passes found equivalent stale-state variants after send failures and reopen races.
Why disconnect instead of silently ignoring
Silently ignoring statements preserves the broken state: the peer stays connected on the statement protocol, but cannot contribute live statements and does not get a clean catch-up path.
Disconnecting is the smallest fix that reuses the existing lifecycle:
Tests
This branch now adds regression coverage for:
Validation
rustfmt --edition 2021 substrate/client/network/statement/src/lib.rsgit diff --check -- substrate/client/network/statement/src/lib.rscargo check -p sc-network-statement --libcargo test -p sc-network-statement --lib -- --nocaptureValidation was completed in a Linux-native WSL checkout with real symlinks preserved. Earlier Windows-backed checkout failures were environment-specific and are no longer the limiting factor for this branch.