Repository navigation
Description
Split out of #1122 item 4. The other three items of that issue are addressed (see the comment there); this one needs a wire change and was deliberately kept out of the memory/resume batch.
Problem
decdn channel coop-close hard-errors when the node's declared state exceeds the client's persisted record:
Error: provider over-claimed: waiver (1792, 182, 187522216) exceeds authorized (1162, 119, 121461928)
That guard is correct and load-bearing — without it a provider could inflate the payout toward the full deposit — but it has no reconciliation branch. A client whose watermark legitimately lags (it signed vouchers it did not durably persist before an unclean exit) has no way to settle, and the channel plus its deposit are stranded.
Why the existing self-heal does not cover it
#1481 added exactly the right primitive on the fetch path: a watermark-gated VoucherRejected carries a WatermarkBundle containing the client's own last-accepted voucher signature, so the client verifies the higher watermark against its own key and reseeds. It is non-terminal — mark_cooperative_close_signed is only called from the coop-close handler (crates/node/src/handlers/client/voucher.rs:575), never from the reject path.
Coop-close cannot use it, because CooperativeCloseAuth (crates/protocol/src/client.rs:671) carries only the provider's waiver signature:
pub struct CooperativeCloseAuth {
pub channel_id: [u8; 32],
pub amount: [u8; 32],
pub nonce: [u8; 32],
pub bytes_delivered: [u8; 32],
/// Provider's EOA secp256k1 EIP-712 `CooperativeClose` signature
pub signature: Vec<u8>,
}There is nothing in it the client can check against its own key, so prepare_close (crates/client-pull/src/cooperative_close.rs:212) can only refuse. Signing the provider's claim on trust instead would remove the drain guard.
Proposal
Carry the client's own last-accepted voucher signature alongside the waiver, and reconcile on over-claim exactly as the fetch path does.
- The node already holds it —
guard.stateis the same sourceWatermarkBundle.last_signatureis built from (crates/node/src/handlers/client/voucher.rs:582) — it just is not sent. - Client side: on over-claim, verify
last_signaturerecovers to our own voucher-signing address over the declaredamount/nonce/bytes_delivered; if it does, advance the local watermark and settle at the true state; if not, keep today's refusal.resumable_watermark(crates/client-pull/src/lib.rs) is the existing shape of that check and should be reused rather than reimplemented.
Scope notes
- Wire-breaking. Adding a field to a postcard-serialized message is not backward compatible; needs the ADR 005 message-layout treatment and a CHANGELOG wire-breaking callout. Operators cannot hot-upgrade across it.
- Touches
crates/protocol,crates/node/src/handlers/client/voucher.rs,crates/client-pull/src/cooperative_close.rs. - Worth an e2e: desync the client's watermark, then coop-close and assert it settles at the node's state rather than erroring.
Current severity
Lower than when #1122 was filed, but not zero. Any fetch on the channel now heals the watermark (#1481, plus the streaming path's own reseed loop), so reaching this dead-end requires a desync and the user never fetching again on that channel before closing.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
perf(cache,cli,node): bounded-memory blob delivery + resumable decdn …
refactor(protocol): carry the #1495 coop-close echo as a CooperativeC…
fix: close two money-path guards that had no correct branch (#1532, #…
fix: address multi-agent review of #1532/#1495
refactor(protocol): carry the #1495 coop-close echo as a CooperativeC…
fix: close two money-path guards that had no correct branch (#1532, #…
refactor(node): remove dead pairwise-channel dispute/close/settle met…
refactor(node): drop PaymentPool close monitor; lean on the redeem sw…