fix(network): preserve late block-sync response correlation#216
Closed
ValarDragon wants to merge 1 commit into
Closed
fix(network): preserve late block-sync response correlation#216ValarDragon wants to merge 1 commit into
ValarDragon wants to merge 1 commit into
Conversation
|
Note Complete: Audit complete. No review-worthy issues remain after automatic triage. One finding was auto-invalidated. Open the full results here. Analyzed two files, diff |
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.
Motivation
Sending
GetBlocksarms the peer's no-progress accounting. If another deliverypath commits that height first, floor GC removes the obsolete scheduling request
and its response correlation. The requested body can then arrive on the wire,
be discarded as an unmatched stale response, and leave the healthy peer capped
until it is parked or disconnected.
This is the Covered/floor-GC late-response case discussed in #192 and #209.
Solution
commit GC. Entries are one-shot, expire with the peer liveness window, are
cleared on destructive reset, and have a hard per-peer bound.
hash only after checking its size envelope, transaction-effects Merkle root,
and transaction uniqueness.
already-committed block or sampling it for BBR.
cold-start request.
response variants, and document the user-visible fix in both changelogs.
The implementation changes only private block-sync internals; it introduces no
puborpub(crate)API changes.Testing
cargo fmt --all -- --checkcargo clippy -p zakura-network --all-targets -- -D warningscargo test -p zakura-network --lib local_commit_gc— 2 passedcargo test -p zakura-network --lib zakura::block_sync::tests— 181 passedThe positive regression test forces floor GC, proves height 2 is not requested
before the late height-1 response, then verifies the response unlocks height 2
without resubmitting height 1. The negative test verifies that a different block
and a same-header body with a bad transaction Merkle root do not unlock the
peer.
Specifications & References
Related to #192 and #209. This is a focused alternative for the Covered/floor-GC
race; it does not supersede #209's broader retired-request, ownership, reset,
timeout, and terminator-correlation work.
Follow-up Work
This patch deliberately counts an already-committed correlated body as peer
progress. #209 instead distinguishes correlation from useful block progress.
Maintainers should choose that policy before this draft is marked ready: a peer
that consistently answers only after another path commits could otherwise reset
its no-progress accounting.
Because the stale body is never submitted, this path performs local structural
checks rather than full consensus authorization-data verification. Full NU5+
body authentication would require retaining the relevant authenticated metadata
or routing the body through consensus without committing it.
AI disclosure: OpenAI Codex was used to diagnose the CI failure, implement the
private block-sync correlation state and regression tests, run validation, and
draft this PR description. The contributor reviewed the changes and test
results.