Repository navigation
fix(incentive,node): reject an under-folding voucher with the resume bundle - #2170
Merged
Merged
Conversation
…bundle (#2167) `advance_presigned` refused an under-folding rollover as `AmountRegression`, the same variant as a stale sibling voucher. `verify_voucher` treats every `AmountRegression` as already-satisfied and credits it 0 bytes. The node then waited for a proof the payer never sent, and the stream died at the 10s `VOUCHER_READ_TIMEOUT`. On the testnet every small bundle entry routed to an affected node cost ~10.9s. The fold check now returns its own `PoolError::UnderFold`. It maps to the wire `AmountRegression` reason, so the wire format and the client do not change. `verify_voucher`'s catch-all arm rejects it with the watermark bundle, which carries the live chain's `verified_index`. The client folds that frontier, reseeds, and resumes on the same provider, as ADR 003 §Chain length and rollover specifies. Tests: a `verify_voucher` unit test for the reject-with-bundle and the benign at-anchor case, and a `client_loopback` test that seeds a live chain and resumes from above its anchor inside an 8s budget. Both fail without the fix; the loopback one times out at 8s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Rollover validation must also protect the live byte frontier to avoid discarding already-proved bytes.
Review effort: Lite
Findings: 1
What changed in this PR
Fixes under-folding voucher stalls by rejecting with a watermark resume bundle so clients can reseed and resume.
Changes:
- Adds
PoolError::UnderFoldwhile preserving the existing wire reason. - Adds under-fold detection and recovery tests.
- Documents the user-visible fix.
Review findings:
- Critical: Rollover validation checks only the monetary claim, risking loss of bytes already proved by the live chain.
- Nit: ADR 005 should document the intentional shared wire-reason mapping.
| File | Description |
|---|---|
crates/protocol/src/client.rs |
Documents shared rejection semantics. |
crates/node/tests/client_loopback.rs |
Tests end-to-end recovery. |
crates/node/src/handlers/client/voucher.rs |
Rejects under-folds with watermark bundles. |
crates/incentive/src/lane.rs |
Detects under-folding rollovers. |
crates/incentive/src/client_bridge.rs |
Maps the new error to the existing wire reason. |
CHANGELOG.md |
Records the fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 751e777 in the Show a line coverage summary of the most impacted files.
Updated |
…and bind the byte axis Review follow-up on #2167. - The rollover fold check binds `bytes_delivered` as well as `amount` (ADR 003 §Rollover). A different-root voucher that paid the whole claim but signed fewer bytes than the live chain proved was adopted. It retired the proved chunks from the lane's byte claim. It is now refused `UnderFold`. `PoolError::UnderFold { axis, owed, got }` names the axis that falls short. - `VoucherRejectReason::UnderFold` is a new wire reason, appended at the end, and watermark-gated. `PoolError::UnderFold` maps to it one-to-one, as the ADR 005 mirror obligation requires. The client's reseed path reads `is_watermark_gated`, so it heals with no logic change. `voucher_verdict` puts it with the other drifted-accounting reasons. - ADR 005: enum listing, mirror text, bundle reasons (five), and a retry row. ADR 003: a reject-table row. The public API snapshot has the new variant. - Tests: lane and node cases for the byte axis. A lane rollover fixture that signed `bytes_delivered = 0` now folds its bytes. Wire-breaking: a peer built before the new variant cannot decode it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…an under-fold Multi-agent review follow-up on #2167. - A voucher at exactly the signed anchor under a different root (a sealed voucher included) took the benign `AmountRegression` arm. When the live chain had proved reveals, `adopt_chain` refused the root, the stream anchored to it anyway, every later reveal folded nothing, and the stream stalled for 10s with no bundle. A restart after a reveal whose send failed but reached the node opens exactly there. `advance_presigned` now returns `UnderFold` when the live claim is above the anchor. With nothing proved, the anchor voucher stays an ordering regression and `adopt_chain` takes the new root. - The client warns when an `UnderFold` bundle does not advance its ledger (a bytes-only shortfall) and leaves the rejection terminal. - `verify_voucher` logs the lane error (axis, owed, got) at `debug!` before it maps it to a wire reason. - Tests: a loopback resume at exactly the anchor, seeded with one proved reveal so lane headroom cannot mask the stall (fails at the 8s budget without the fix); lane and node cases for the anchor boundary; client heal cases for an advancing and a bytes-only `UnderFold`; a `voucher_verdict` pin. The node test that called a sealed voucher at the anchor benign now checks a same-root re-send. - Docs: ADR 003 §Rollover states the honest restart path and the terminal bytes-only case. ADR 005 fixes the signature-order claim and names under-fold in the bundle heading. The protocol, lane, client and node_origin docs match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 26, 2026
…g heals retry Second multi-agent review follow-up on #2167. - A sealed closing voucher at the signed anchor is a sibling's close that the node reads after a sibling opened the live chain at the same amount. The at-anchor under-fold rule now needs a voucher that opens a chain (non-zero root). The sealed close stays an ordering regression, already satisfied, as on main. - Concurrent streams on one lane get the same `UnderFold` bundle. The first reseeds. A later one whose ledger already covers the bundle on both axes now retries (`Healed::Stale`) instead of failing the stream and suppressing the upstream. The `warn!` is kept for the real bytes-only case. - Tests: a lane test for the late sealed close; the node at-anchor test covers the live-root re-send, the sealed close, and a fresh root; a client test for the second sibling heal; a loopback test with two concurrent multi-chunk pulls over two rounds that asserts zero voucher rejections. That test fails when rollovers over a proved frontier are rejected. - Docs: `UnderFold` is defined at or above the signed anchor in ADR 003, ADR 005 and the protocol doc. ADR 003 lists `SpendingCapExhausted` among the bundled reasons. ADR 005 groups `UnderFold` with the guards that have no on-chain revert and adds the sibling retry to its retry row. Doc wording and line widths are fixed across lane, client and node_origin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks done
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.

What
LaneState::advance_presignedreturnedPoolError::AmountRegressionfrom two different checks:verify_vouchertreated both cases as already-satisfied and credited 0 bytes. After an under-fold the node waited for a proof the payer never sent, and the stream died at the 10 sVOUCHER_READ_TIMEOUT. On the testnet every small bundle entry routed to an affected node took about 10.9 s.PoolError::UnderFold { axis, owed, got }. It now binds both axes of the fold (ADR 003 §Rollover):amountandbytes_delivered. Before, the check coveredamountonly, so a rollover could pay the whole claim, sign fewer bytes, and retire proved chunks from the lane's byte claim.UnderFoldwhen the live chain has proved reveals. That is where a restarted client opens after its last reveal reached the node but its own send failed. Before, it took the benign arm, and the stream adopted a root the lane refused, so it stalled the same way. With nothing proved, it stays an ordering regression, andadopt_chaintakes the new root. A sealed voucher at the anchor stays benign. It is a sibling's closing voucher that arrives after a sibling opened the live chain at the same amount.UnderFoldbundle. The first reseeds. A later one whose ledger already covers the bundle on both axes retries (Healed::Stale) instead of failing.VoucherRejectReason::UnderFoldis a new wire reason, appended at the end and watermark-gated.PoolError::UnderFoldmaps to it one-to-one (ADR 005 §Mirror obligation). Wire-breaking.Err(e)arm ofverify_voucherrejects it withwatermark_bundle_for_reject, which carriesverified_index,tipandchunk_price. The client'sresumable_watermarkreadsis_watermark_gated(), andCumulative::from(&WatermarkBundle)folds the frontier. So the client reseeds and resumes on the same provider with no logic change.node_origin::voucher_verdictgroupsUnderFoldwith the other drifted-accounting reasons.debug!before it maps it to a wire reason. The client logs awarn!when anUnderFoldbundle does not advance its ledger.Closes #2167
Reviewer notes
crates/incentive/src/lane.rsfirst (the fold check,UnderFold,FoldAxis), thencrates/protocol/src/client.rs. The node gains no new logic: its existing catch-all arm handles the variant.AmountRegressionarm andstale_resume_bundledo not change on purpose. They still cover only the at-or-below-watermark case.amount, soreseedrefuses it and the reject is terminal. An honest payer folds both axes from one accrual, so only a buggy payer gets here, and ADR 003 asks for a loud answer.bytes_delivered = 0, which is not an honest fold. It now folds its bytes. No production path was affected: the client ledger builds every voucher fromcommitted + accrued, and each release addsCHUNK_BYTES.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets -- -D warnings, pluscargo check --workspace --all-targets --features decdn-e2e/anvil-e2eRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemscargo nextest run --workspace: 4090 passed.honest_concurrent_rollovers_draw_no_voucher_rejection: two concurrent multi-chunk pulls over two rounds withvoucher_rejected == 0. A mutation that rejects every rollover over a proved frontier fails it.decdn-protocolregenerated (adds the twoUnderFoldlines);decdn-clientunchanged. Both pass.client_under_folding_a_live_chain_reseeds_and_resumeshits its 8 s budget.client_resuming_at_the_anchor_under_a_live_chain_reseeds_and_resumeshit the 8 s budget before the at-anchor fix. The seeded lane has one proved reveal, so lane headroom cannot finish the blob and hide the stall. With the fix both pass in about 0.6 s, withclient_declined == 0andvoucher_rejected == 1.contracts/changed: not applicableCHANGELOG.mdentry under Fixed, with the wire-breaking callout🤖 Generated with Claude Code