You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
area:clidecdn binary: get, gateway, pool, publish, origin, setupkind:featureNew capability or a change to current behaviorprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Follow-up to #947 (closed). The provider half is merged — the node signs a CooperativeClose waiver on request (#957) and the on-chain PaymentChannel.cooperativeClose(...) binding exists in crates/incentive/src/payment_channel.rs. Nothing calls it yet, so a client still has no fast-refund path; it falls back to closeChannel → 48h → settleChannel.
Scope (client / initiator side)
Wire the end-to-end client flow:
Send CooperativeCloseRequest { channel_id } over cdn/client/v1 and receive CooperativeCloseAuth { amount, nonce, bytes_delivered, signature } (variants already exist in protocol / client-pull).
Pair the provider waiver with the client's own voucher sig over the same (channelId, amount, nonce, bytesDelivered) tuple.
Submit cooperativeClose(...) on-chain via the payment_channel.rs binding (mirror the existing closeChannel/settleChannel send path in crates/node/src/payment_settlement.rs).
Fall back to closeChannel if the node declines / is offline / returns no auth (nonce 0).
Surface it as a decdn CLI subcommand (no channel/reconcile subcommand exists today).
Out of scope
Automatic/periodic reconcile — that's the node-as-buyer follow-up (separate issue).
Client-side implementation of the cooperative close flow for payment channels. The provider half is complete (#957 merged), wire types exist, and the on-chain binding is in place — this issue wires the call path that actually uses them, plus a new decdn CLI subcommand. No design uncertainty; this is pure plumbing across crates/incentive, crates/node, and crates/cli.
📊 Assessment
Dimension
Value
Reasoning
Type
Feature
New client-initiated cooperative close flow; no existing code handles this path
Labels
enhancement, technical, rust, cli, medium
Rust impl + new CLI subcommand; medium priority (eliminates 48h refund latency but client has working fallback via closeChannel)
Coding agent
Suitable
Requirements are fully specified in 4 steps, implementation pattern is explicitly documented (mirror closeChannel/settleChannel in payment_settlement.rs), all prerequisites merged
AmountRegression/NonMonotonicNonce: a stale provider waiver will revert on-chain; the fallback to closeChannel must trigger in this case too, not just on network absence.
area:clidecdn binary: get, gateway, pool, publish, origin, setupkind:featureNew capability or a change to current behaviorprio:mediumScheduledrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 22, 2026
🎯 Triage report
Client-side implementation of the cooperative close flow for payment channels. The provider half is complete (#957 merged), wire types exist, and the on-chain binding is in place — this issue wires the call path that actually uses them, plus a new
decdnCLI subcommand. No design uncertainty; this is pure plumbing acrosscrates/incentive,crates/node, andcrates/cli.📊 Assessment
enhancement,technical,rust,cli,mediumcloseChannel)closeChannel/settleChannelinpayment_settlement.rs), all prerequisites merged🔗 Similar issues
settleChannelrefund leg; same fallback path this issue must handle on node decline💡 Notes and suggestions
Key files to touch
crates/cli/src/...channel close(orchannel reconcile) subcommandcrates/node/src/payment_settlement.rscloseChannelsend path forcooperativeClosecrates/incentive/src/payment_channel.rscooperativeClosebinding — call it herecrates/protocol/src/...CooperativeCloseRequest/CooperativeCloseAuthvariants already exist; verify they're exportedSuggested implementation checklist
CooperativeCloseRequest { channel_id }overcdn/client/v1; deserializeCooperativeCloseAuth { amount, nonce, bytes_delivered, signature }response(channelId, amount, nonce, bytesDelivered)(EIP-712,COOPERATIVE_CLOSE_TYPEHASHper ADR 003 / feat(protocol,incentive): cooperative-close wire + EIP-712 foundation #949)payment_channel.rs::cooperativeClose(...)with both sigs; await receiptcloseChannelpathdecdn channel close <channel-id>(no reconcile subcommand exists today); print tx hash + settlement amountsWatch points
unwrap_used/expect_used— useResultcombinators throughout.CooperativeCloseAuth.AmountRegression/NonMonotonicNonce: a stale provider waiver will revert on-chain; the fallback tocloseChannelmust trigger in this case too, not just on network absence.settleChannel's defer branch (per contracts: FeeRouter pause freezes the client-refund leg of PaymentChannel.settleChannel #849) so a paused router doesn't freeze the client refund in the happy path either.Add this agentic workflows to your repo
To install this agentic workflow, run
feat(client-pull,cli): client-initiated cooperative close (#973)
feat(node): idle buyer-channel cooperative-close reconcile sweep (#987)