Repository navigation
docs(adr): allow client-initiated zero-voucher close - #424
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the payment protocol documentation to make the zero-voucher close mechanism symmetric, allowing both clients and providers to initiate a channel close when no vouchers have been submitted. This change addresses potential liquidity locks for clients during node failures and ensures providers can still clear abandoned channels. The review feedback identified technical inconsistencies in the description of the closeChannel parameters and corrected a broken internal anchor link.
3 of 4 tasks
alpergundogdu
added a commit
that referenced
this pull request
May 6, 2026
…nd §Channel close lifecycle Address PR #424 review: 1. §Fee Routing on Disputed Closes (line 114) was inconsistent with the more detailed §Channel close lifecycle bullet (line 381). The Fee Routing description omitted bytesDelivered from both the recorded fields and the zero-voucher gate, and omitted bytesDelivered != 0 from the exclusion list of normal-verification calls. Now matches the lifecycle bullet exactly. 2. §Voucher Nonce Convention had a broken anchor #contract-stablepaymentchannel. The actual section header is `### StablePaymentChannel`, which GFM slugifies to #stablepaymentchannel. Fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
4 of 5 tasks
alpergundogdu
added a commit
that referenced
this pull request
May 6, 2026
…427) * docs(adr): add ChannelOpened event so wallets can enumerate channels (#426) A channel that has been opened but never had any subsequent on-chain action (no closeChannel, no topUp, no dispute) is invisible to log scans today — there's no ChannelOpened event in the spec. Wallets, CLI tools, and indexers cannot list a client's or provider's open channels without parsing the full transaction history of every candidate address. Add ChannelOpened with three indexed fields (channelId, client, provider — the EVM maximum) so: - Clients enumerate via eth_getLogs(topics=[ChannelOpened, *, paddedClient]) - Providers enumerate via the third topic - Indexers key on channelId for full history reconstruction Non-indexed payload carries `token, deposit, expiresAt`. The token field is USDC for the PoC and an arbitrary governance-approved ERC-20 in production (per ADR 010), so the same event signature carries through the multi-token migration without a wire-format break. Cost: one LOG3 per openChannel (~1,150 gas) — negligible relative to the SSTORE and safeTransferFrom already in the function (~80k gas). Three sites updated: - §Function table: openChannel description now mentions the emit - §Events table: ChannelOpened added as the chronologically-first row - New paragraph below the events table explaining the off-chain enumeration use case the event enables This unblocks operationally useful CLI tooling on top of the symmetric zero-voucher close (#424): `decdn channel list` enumerates open channels via log scan, `decdn channel close <id>` triggers recovery when a node has failed before any voucher boundary. Closes #426 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): drop historical narrative from ChannelOpened paragraph Replace "Without this event, ... forcing wallets to walk the client's entire transaction history" with positive framing of current behavior, per gemini-code-assist review on #427. --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
May 6, 2026
…nd §Channel close lifecycle Address PR #424 review: 1. §Fee Routing on Disputed Closes (line 114) was inconsistent with the more detailed §Channel close lifecycle bullet (line 381). The Fee Routing description omitted bytesDelivered from both the recorded fields and the zero-voucher gate, and omitted bytesDelivered != 0 from the exclusion list of normal-verification calls. Now matches the lifecycle bullet exactly. 2. §Voucher Nonce Convention had a broken anchor #contract-stablepaymentchannel. The actual section header is `### StablePaymentChannel`, which GFM slugifies to #stablepaymentchannel. Fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
force-pushed
the
fix/client-zero-voucher-close
branch
from
May 6, 2026 12:48
949112f to
a3170c9
Compare
The provider-only restriction on the zero-voucher close path locks client deposits for up to 90 days when a node fails before the first 1 MB voucher boundary. Their only escape is reclaimExpired after maxChannelDuration — a routine ops failure with no malicious actor. Drop the msg.sender == provider gate so either party can call closeChannel(amount=0, nonce=0, signature.length==0) when claimedNonce == 0. The 48h dispute window plus permissionless disputeChannel handle the symmetric griefing attack surface (client signing vouchers off-chain and then repudiating via zero-voucher close) the same way they handle the analogous stale-close attack today — no new attack surface. Three sites in ADR 003 updated: - §"Channel close lifecycle" §1 closeChannel description (line 114) - §"Channel griefing" "Resolved" subsection (lines 172-174) - §"Channel close lifecycle" closeChannel bullet (line 381) Plus a new "Why symmetric" subsection explaining the rationale and attack-surface analysis. The §"Voucher Nonce Convention" reference to "provider-initiated zero-voucher close" is also retitled to match. Closes #423 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…nd §Channel close lifecycle Address PR #424 review: 1. §Fee Routing on Disputed Closes (line 114) was inconsistent with the more detailed §Channel close lifecycle bullet (line 381). The Fee Routing description omitted bytesDelivered from both the recorded fields and the zero-voucher gate, and omitted bytesDelivered != 0 from the exclusion list of normal-verification calls. Now matches the lifecycle bullet exactly. 2. §Voucher Nonce Convention had a broken anchor #contract-stablepaymentchannel. The actual section header is `### StablePaymentChannel`, which GFM slugifies to #stablepaymentchannel. Fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
force-pushed
the
fix/client-zero-voucher-close
branch
from
May 6, 2026 13:28
a3170c9 to
df2cbe0
Compare
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.
Closes #423.
Drops the
msg.sender == providerrestriction on the zero-voucher close path in ADR 003 so the client can also callcloseChannel(amount=0, nonce=0, signature.length==0)whenclaimedNonce == 0.The gap (from #423)
A client opens a 10 USDC channel, the node fails (crash, deregistration, network loss) before the first 1 MB voucher boundary, and the client has no way to close the channel. Their only escape is
reclaimExpiredafterexpiresAt— default 90 days.The provider-only restriction was originally an escape hatch for providers tracking abandoned channels; the mirror-image client need was missed. The fix surfaces it.
Why this is safe
The attack surface reduces to exactly the existing stale-close attack surface (ADR 003 §Stale close). The defenses are reused, no new ones are needed:
disputeChannel— any address with a higher-nonce voucher can disputeChannelCloseInitiatedfiresA griefing client who signs vouchers off-chain and then tries to repudiate them via zero-voucher close gets disputed by the online node within 48h — same protection as today's stale-close attack with a low-amount voucher.
What changes
Three edit sites in ADR 003:
closeChanneldescription — "when either party calls" instead of "when the provider calls"closeChannelbullet — same widening, plus framing covering both use cases (provider releasing abandoned channel, client recovering deposit on node failure)Plus an updated cross-reference in §Voucher Nonce Convention.
Implementation cost
One access-control line in
StablePaymentChannel's zero-voucher branch:```solidity
// before
require(msg.sender == channel.provider, "zero-voucher close is provider-only");
// after
require(
msg.sender == channel.client || msg.sender == channel.provider,
"zero-voucher close requires party authorization"
);
```
PoC contract not yet implemented, so this is a spec-level change before the contract gets written.
Refs
Test plan
cargo buildcleanpre-commit run --files adr/003-payments.md— markdownlint + cargo deny passNote: this PR is independent of #422 (the watchtower → fraud-detection refactor). The two touch overlapping prose in ADR 003; whichever lands second will need a small rebase but no structural conflict.
🤖 Generated with Claude Code