Skip to content

fix(incentive): bound a same-root voucher's full claim by the cap - #2748

Merged
thiras merged 1 commit into
mainfrom
fix/2700-voucher-claim-cap
Oct 29, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/2700-voucher-claim-cap

Conversation

@thiras

@thiras thiras commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What

GHSA-jr93-46mf-88wx (low bundle). A voucher that repeats the live root keeps the verified frontier and adopts its own chunk_price, so its claim is amount + verified_index × chunk_price. LaneState::advance_presigned checked only amount against the cap, so a same-root bump just under the cap credited up to one chain of chunks past it (at most $0.255 per lane at MAX_RATE). The contract never pays that excess. The reveal path (advance_preimage) already checks the full claim; the voucher path now does the same and refuses with CapExceeded.

Closes #2700

Reviewer notes

  • The new check sits in the same-root branch of advance_presigned, after the price is adopted, so it values the kept frontier at the voucher's price. The existing amount > cap check stays: it covers the rollover branch, where the new epoch starts at index 0.
  • An honest payer is unaffected: it counts headroom against everything signed under its key (CredentialView::of), and a refusal maps to SpendingCapExhausted, the same recovery an over-cap voucher already takes.

Verification

  • Commit hooks (fmt, clippy, doc, deny: the existing RUSTSEC-2026-0387 crypto-bigint advisory, warn-only, already on main)
  • cargo clippy -p decdn-incentive --all-targets --all-features -- -D warnings
  • cargo nextest run --workspace: 6157 passed
  • PR title: fix(incentive): …, lowercase subject
  • CHANGELOG.md Security entry
  • Mutation check: with the new check disabled, a_same_root_voucher_whose_frontier_crosses_the_cap_is_refused fails.

🤖 Generated with Claude Code

A voucher that repeats the live root keeps the verified frontier and adopts
its own chunk_price, so its claim is amount + verified_index × chunk_price.
advance_presigned checked only amount against the cap, so a bump just under
the cap credited up to a chain of chunks past it. Check the full claim, as
advance_preimage does for a reveal.

Closes #2700

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 03:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change limiting same-root voucher claims to the lane’s spending cap.

No open issues 🎉

What changed in this PR

Fixes #2700 by bounding a same-root voucher’s full claim by the lane’s spending cap, preventing off-chain credit that the contract cannot pay.

Changes:

  • Rejects claims above the cap, including the retained verified frontier valued at the voucher’s adopted price.
  • Adds regression coverage for exact-cap acceptance, over-cap rejection, and repricing.
  • Documents the security fix in the changelog.
File Description
crates/​incentive/​src/​lane/​tests.rs Tests same-root claim limits and price changes.
crates/​incentive/​src/​lane.rs Enforces and documents the full-claim cap check.
CHANGELOG.md Records the security fix and associated advisory.

Review effort: Balanced

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 8473f6e fix/2700-voucher-cla... 598e74f +/-
77% 77% 0%
View coverage of the 3 most impacted files.
File main 8473f6e fix/2700-voucher-cla... 598e74f +/-
crates/node/src...nt/serve_leg.rs 91% 90% -1%
crates/incentive/src/lane.rs 96% 96% 0%
crates/node/src/dht/publish.rs 78% 80% +2%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@thiras
thiras merged commit 94e180d into main Oct 29, 2026
38 checks passed
@thiras
thiras deleted the fix/2700-voucher-claim-cap branch October 29, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incentive: a same-root voucher bump can credit a lane past its cap

2 participants