Repository navigation
fix(node,client): heal a stale payer by lane headroom, not the stream count - #2175
Merged
Merged
Conversation
… count A reloaded lane now counts its whole claim, the signed bytes plus the proved chain frontier, as already credited (#2171). Crediting only the signed half handed each restart up to a chain of free headroom, which also masked the stall below. A stale proof must pay its chunk in full from lane headroom (#2173). An honest lagging sibling always finds its chunk there, because the proof that superseded it folded the payment and a metering voucher takes no whole chunk. A restarted payer that lost vouchers finds nothing. The node decides at the proof that pays the chunk: a sealed or closing voucher below the anchor, or a reveal that folds nothing. On a short headroom it rejects AmountRegression with the watermark bundle and commits no credit. This replaces the active_streams <= 1 gate on the #1946 resume bundle. The gate let a restarted payer beside a live sibling stall until VOUCHER_READ_TIMEOUT, and it tore down an honest sibling whose peer stream had already ended. The per-lane stream counter and LaneSlot had no other reader and are removed. A voucher at the signed amount with fewer bytes is now a BytesRegression too, not only one with more bytes. The client treats an AmountRegression whose bundle its ledger already covers as healed by a sibling stream, and retries, as it does for UnderFold. Closes #2171 Closes #2173 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups to the stale-proof heal. Client: PoolLedger::meter takes the stream's anchored root and returns Metered::Moved, sending nothing, when a sibling rolled the lane between the stream's anchor and the tick. The stream also records the root its own Open/Roll/closing voucher signed, not a post-send re-read that can already name a sibling's newer chain. Either race released a reveal the node placed against the wrong root, which folded nothing. Node: a voucher AT the signed anchor that pays its chunk is stale too. A restarted payer that re-signs the node's own watermark for a same-size transfer otherwise waited out VOUCHER_READ_TIMEOUT, on main as well. The stale reject logs the lane and the credit figures, at warn when no bundle can be built. Client heal logs say whether a sibling reseeded first or the ledger is already past the bundle. New end-to-end tests cover the voucher-path reject (sub-chunk transfer, one and two transfers behind) and a concurrent range set healing on one ledger. Stale LaneSlot references, the removed multi-stream exception in fetch.rs, and the ADR 003/005 wording (ignored/refuses nothing, strict-below, reveal bundles) are brought in line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Regenerate the public API snapshot and preserve the signed root during ambiguous voucher-write recovery.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes stale payer recovery using lane headroom and prevents client streams from using superseded chain roots.
Changes:
- Credits hydrated lanes from their full proved claim.
- Rejects underfunded stale proofs and supports watermark healing.
- Adds concurrent root tracking and updates tests and protocol documentation.
| File | Summary |
|---|---|
crates/node/tests/client_loopback.rs |
Adds stale-payer and concurrent recovery tests. |
crates/node/src/node_origin/mod.rs |
Updates voucher retry documentation. |
crates/node/src/handlers/client/voucher.rs |
Implements stale-proof headroom validation. |
crates/node/src/handlers/client/mod.rs |
Hydrates full claims and removes stream counting. |
crates/node/src/handlers/client/dispatch.rs |
Removes lane-slot admission tracking. |
crates/node/src/handlers/client/delivery.rs |
Updates reservation documentation. |
crates/client/src/lib.rs |
Adds root tracking and stale healing; ambiguous-write recovery still risks recording the wrong root. |
crates/client/src/ledger.rs |
Detects moved roots; the public API snapshot requires regeneration. |
crates/cli/src/commands/fetch.rs |
Updates watermark-resume documentation. |
adr/005-protocol.md |
Updates rejection and recovery semantics. |
adr/003-payments.md |
Documents stale-proof accounting and rollover behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The public API snapshot carries the anchored-root argument of PoolLedger::meter and the Metered::Moved variant. The write-failure recovery no longer re-reads the lane's chain root into the stream's anchor after a StreamEnd: the stream has ended, nothing meters on it again, and the re-read could name a sibling's newer chain. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 5671746 in the Show a line coverage summary of the most impacted files.
Updated |
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
Two credit-accounting bugs from the #2170 review, fixed together because the #2173 rule depends on the #2171 fix.
owed_bytes()= signed bytes + proved chain frontier), not only the signed bytes. Before this, each restart handed streams up to a chain of free headroom. That headroom also hid stalls.AmountRegressionwith the watermark bundle and credits nothing.active_streams <= 1gate on the feat(client-pull): persisted peer knowledge base for probe-less client fetch #1946 resume bundle. That gate let a restarted payer beside a live sibling stall untilVOUCHER_READ_TIMEOUT, and it could tear down an honest sibling. The stream counter andLaneSlotare removed.main): a restarted payer that re-signs the node's exact watermark for a same-size transfer is now treated as stale and heals, where it used to wait out the timeout.BytesRegression.PoolLedger::meterchecks the stream's anchored root under the issuance lock and returnsMetered::Movedwhen a sibling rolled the lane. The stream also records the root its own voucher signed, not one re-read after the send. Both races let a reveal go out under a root the node never matched to that stream.AmountRegressionbundle that the ledger already covers retries (Healed::Stale), asUnderFolddoes, so concurrent legs of one ledger all heal.Test plan
cargo nextest run -p decdn-node -p decdn-incentive -p decdn-client -p decdn-cli: 2894/2894-D warnings --all-targets,cargo doc -D warnings, pre-commita_restarted_payer_beside_a_live_sibling_heals_below_the_anchor(node: a sub-anchor voucher under a new root stalls a multi-stream lane with no resume bundle #2173 multi-stream)a_restarted_payer_heals_a_sub_chunk_transfer/…_transfer_that_repeats_the_anchor(voucher-path reject, at and below the anchor)a_restarted_payer_heals_a_concurrent_range_set(range set on one ledger)credit_stale, fewer-bytes divergence,Metered::Moved, siblingAmountRegression→Stalea_sibling_roll_does_not_take_a_retired_reveals_credit,lower_voucher_after_higher_sibling_is_already_satisfied,a_below_frontier_reveal_is_credited_from_lane_headroom,honest_concurrent_rollovers_draw_no_voucher_rejectionnode_origin_pulltests flake under load at the same rate onmain(23/90) and on this branch (24/90). Tracked in test(node): two node_origin_pull tests flake under load on main #2174.Closes #2171
Closes #2173
🤖 Generated with Claude Code