Repository navigation
fix(client,cli): stop a fetch on a spent capability signer instead of retrying - #2349
Merged
Merged
Conversation
… retrying A node refuses a registered signer whose cap - spent cannot cover its serve floor at admission, and answers with the same NotFound code as a cache miss. A delegated `decdn fetch` / `bundle pull` cooled the holder and retried until its stop policy gave up: in the cli_fetch_delegated clamp journey every retry hung for the 60 s test timeout. PeerSource takes an optional SignerRegistry (with_signer_check). On an open-stage NotFound whose signed body carries a non-zero rate, it reads the signer's getAuthorization row, bounded by the open deadline. A registration that cannot pay one chunk at that rate becomes SignerCapDrained: - expired, or nothing left of the cap: no node can serve the signer, so the command ends; - some headroom below one chunk at this rate: only the refusing node is barred for the blob, since a cheaper node can still serve. Once every node is barred the item ends with NoSourceServesSigner. A failed or slow read leaves the refusal as it was and logs at info, sanitized. The CLI wires the check on delegated lanes only, and names the remedy a write-once registration leaves: a capability for a new signer key (also for a mid-stream SignerCapExhausted, and for a registered signer's SpendingCapExhausted). SignerAuthorization moves from decdn-node to decdn_incentive::payment_pool, so the client and the node test a registration with one predicate. ADR 003, 005 and 016 describe the client confirm. No wire change. Closes #2338 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The recovery guidance overstates what provider-specific and mixed refusals prove.
Review effort: Balanced
Findings: 1
What changed in this PR
Addresses #2338 by detecting spent capability signers during delegated downloads without changing the wire protocol.
Changes:
- Confirms admission refusals against on-chain signer authorization.
- Distinguishes provider-specific failures from item- and command-wide stops.
- Shares authorization logic and adds CLI guidance, tests, and documentation.
| File | Description |
|---|---|
crates/node/tests/client_loopback.rs |
Tests admission-refusal confirmation. |
crates/node/src/pool_view.rs |
Uses shared authorization type. |
crates/node/src/payment_settlement.rs |
Updates authorization import. |
crates/node/src/handlers/client/dispatch.rs |
Updates authorization import. |
crates/incentive/src/payment_pool.rs |
Houses shared authorization logic and tests. |
crates/e2e/tests/cli_fetch_delegated.rs |
Tests prompt failure for spent signers. |
crates/client/tests/snapshots/public_api__public_api.snap |
Records new public APIs. |
crates/client/src/source.rs |
Adds bounded signer checks. |
crates/client/src/source_set.rs |
Tracks signer-specific provider exclusions. |
crates/client/src/lib.rs |
Exports new types. |
crates/client/src/fault.rs |
Classifies signer-exhaustion scope. |
crates/cli/src/commands/fetch.rs |
Enables delegated checks and recovery guidance. |
crates/cli/src/commands/bundle_pull.rs |
Tests bundle failure scope. |
CHANGELOG.md |
Documents user-visible behavior. |
adr/016-contract-interactions.md |
Documents client authorization reads. |
adr/005-protocol.md |
Clarifies refusal handling and remedies. |
adr/003-payments.md |
Defines client confirmation behavior. |
💡 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 8011c0c in the Show a line coverage summary of the most impacted files.
Updated |
…one rate A SignerCapDrained read at one provider's rate, a mid-stream SignerCapExhausted, and the NoSourceServesSigner stop prove only that the refusing provider's floor is not covered; other providers may be barred for absence or size. The remedy said no node could be paid for any of them. Only an expired registration, or one with nothing left of its cap, is now named as shutting out every provider. Every other drain says a provider at a lower rate may still serve while headroom remains, and names a new signer key as the way to raise the limit. The stop's Display no longer claims every provider refused the signer. Failure scopes are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
A delegated
decdn fetch/bundle pullwhose signer had spent its registered cap retried until its stop policy gave up. A node refuses such a signer at admission (SignerCapExhausted) and answers with the sameNotFoundcode as a cache miss, so the client cooled the holder and tried again. This implements the issue's Option 1: no wire change.PeerSource::with_signer_check(&dyn SignerRegistry): on an open-stageNotFoundwhose signed body carries a non-zero rate, the lane reads its signer'sgetAuthorizationrow, bounded by the open deadline, and turns a registration that cannot pay one chunk at that rate intoSignerCapDrained.Fatal(Command);NoSourceServesSigner(Fatal(Item)), carrying the drained cause.annotate_delegated_exhaustionnames the remedy a write-once registration leaves: a capability for a new signer key. The same text now covers a mid-streamSignerCapExhaustedand a registered signer'sSpendingCapExhausted.SignerAuthorizationmoves fromdecdn-nodetodecdn_incentive::payment_pool, so the node's admission gate and the client's check share onecoverspredicate.Closes #2338
Reviewer notes
confirm_refusal/signer_cap_drainedincrates/client/src/source.rs, then thesigner_drainedbar insource_set.rsandclassifyinfault.rs.spenthigh can refuse a signer with more headroom; the lane then keeps the plainNotFound, as before.eth_callper ratedNotFound).SignerRegistry,SignerCapDrained,NoSourceServesSigner,PeerSource::with_signer_check(snapshot regenerated).NotFoundexception,SignerCapExhaustedrow), ADR 016 (caller column).Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-incentive -p decdn-client -p decdn-cli -p decdn-node— 3409 passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-client --features public-api-test --test public_api(snapshot regenerated)cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(cli_fetch_delegated)'on rebuilt binaries — 3/3 passes. The new clamp-journey step (re-fetch on the spent signer must fail within 30 s with the new-key remedy) fails without the fix: it hits the 30 s timeout.a_drained_signer_refused_at_admission_is_named_by_the_signer_check: a real handler refuses, and the checked lane yieldsSignerCapDrainedwhile an unchecked one keepsNotFound.contracts/changed — n/aCHANGELOG.mdentry added🤖 Generated with Claude Code