fix(network): own GetBlocks reservations through request writes - #944
Conversation
And two more auto-invalidated findings. Analyzed seven files, diff |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This comment was marked as resolved.
This comment was marked as resolved.
b61384d to
cca3983
Compare
This comment was marked as resolved.
This comment was marked as resolved.
ead64bb to
438f1f1
Compare
|
The floor watchdog still penalizes requests that never started writing. In reactor.rs, run_floor_watchdog applies peer avoidance before request settlement determines whether the write started. With at least three servable peers, a queued request can expire, return its reservation, and still leave its peer excluded from the floor height. The peer-routine expiry path correctly skips that penalty, so behavior depends on which handler runs first. I reproduced this with an additional test against the running reactor. The test confirms that the request was skipped and its reservation reached zero, then fails because the registry still excludes the peer. Settlement should return the write disposition so the watchdog can withhold avoidance for unwritten requests. Checking the status before settlement would leave a race with writer startup. A few follow-ups:
|
429db8a to
a79b51d
Compare
73df768 to
dd23122
Compare
Motivation
GetBlocks reservations must settle exactly once when publication, expiry, reset, and transport writes race. A cold peer also needs enough time to deliver its first block. This outgoing-download chunk is extracted from #892 and stacked after #943.
Solution
Reserve queue capacity before taking work, publish the exact request owner atomically, and retain its claim until transport finishes or discards it. Expiry and receipt that invalidate a queued request share the same atomic settlement, immediately returning all its unsent heights and retiring its peer obligation before the writer reaches it. Cleanup preserves received bodies and replacement owners, discards committed heights, and destroys request claims outside queue locks. The floor watchdog uses the write disposition captured during settlement, so queued requests do not trigger peer avoidance even while the last owner is being dropped. Started writes retain per-height accounting and partial-write cancellation. Publication failures log the peer, generation, and range. Keep the approved initial-probe and queued-response deadline policy. The current wire layout and serving path remain active until the final chunk.
Testing
At
429db8a6d, all 393 selected block-sync, session, and transport tests pass without retries, including buffered response validation after remote failure and neutral cleanup after local resets.At
d6831f340, all 113 selected handler and block-sync session tests pass without retries, including duplicate rejection, capacity accounting, cleanup, reopening, and paired downloads. Network all-target Clippy with warnings denied, formatting, Markdown lint, and changelog checks pass.The receipt/liveness regression failed before its fix. The combined stack at
06fdcce37passes 3,484 tests under the workspace CI profile, excluding three macOS address-binding tests. Workspace Clippy with warnings denied, formatting, and changelog checks pass. Coverage includes receipt before writer startup, return of unsent work, preservation of received bodies, and started writes retaining their reservations. The final activation qualification is recorded in #945. Prepared with Codex assistance.Changelog
Added the reservation-correctness and slow-peer deadline fragment.