Repository navigation
docs(contracts): pin PaymentChannel.withdraw paused-router posture (#890) - #926
Conversation
) Resolve #890 (option a): keep `withdraw` reverting under a paused `FeeRouter` rather than deferring like `settleChannel`. Unlike the `settleChannel` fund-freeze fixed in #889, `withdraw` strands no client funds — the channel stays `Open` and a revert rolls back the claim- and withdrawal-watermark writes, so nothing is trapped; the provider simply re-submits the same voucher after unpause. Documents the deliberate asymmetry in NatSpec + the pause-control section comment, and adds a regression test pinning revert-under-pause (with zero state drift) followed by a clean identical-voucher retry. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request adds documentation and a unit test to clarify and verify the behavior of the withdraw function when the FeeRouter is paused. Specifically, it documents that withdraw will revert and roll back watermark writes rather than deferring settlement, ensuring no funds are trapped and allowing providers to retry once the router is unpaused. A new test case has been added to validate this behavior. There are no review comments to address, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Gas snapshotGas changes vs baseRun: 27668335337 |
Contracts coverageLine coverage: 89.73% (2098/2338 lines) |
There was a problem hiding this comment.
Pull request overview
Codifies the deliberate posture that PaymentChannel.withdraw continues to revert when FeeRouter is paused (provider retries post-unpause), by adding NatSpec documentation and a regression test that asserts zero state drift on the revert.
Changes:
- Document in
PaymentChannel.withdrawNatSpec that pause-tolerance is intentionally limited tosettleChannel(no behavior change). - Add a regression test ensuring
withdrawreverts under a paused router, rolls back all watermarks, and succeeds unchanged after unpause.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| contracts/src/PaymentChannel.sol | Comment-only NatSpec clarifying why withdraw does not defer when the FeeRouter is paused. |
| contracts/test/PaymentChannel.t.sol | Adds a regression test asserting revert + full rollback under pause, then successful retry after unpause. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Resolves #890. The decision (option a) is to keep
PaymentChannel.withdrawreverting when theFeeRouteris paused rather than extending the deferred-settlement tolerance to it. This PR codifies that deliberate posture with documentation + a regression test — no behavior change.Why not defer like
settleChannel?The deferral added in #889 (issue #849) exists because
settleChannelsends the client refund before the router interaction, so a revert would freeze an already-dispatched refund.withdrawis different:Open._route, so nothing is trapped.Option (b) (per-channel accumulating deferral state) was rejected as over-engineered for a path that strands no funds —
withdrawruns on a repeatableOpenchannel and can't reusesettleChannel'schannelId-keyed boolean_deferredSettlementsset.Changes
contracts/src/PaymentChannel.sol— comment-only:@devnote onwithdrawexplaining the no-defer posture, and an extended pause-control section comment. Bytecode unchanged.contracts/test/PaymentChannel.t.sol— newtest_withdraw_routerPaused_revertsThenSucceedsAfterUnpause: pauses the router, assertswithdrawreverts with zero state drift (callCount == 0;claimedAmount/claimedNonce/claimedBytes/withdrawnAmount/withdrawnBytesall still 0), then unpauses and asserts the same voucher withdraws and routes correctly.Verification
forge fmt --check(scoped to changed files) ✓FOUNDRY_PROFILE=ci forge build --sizes --deny warnings✓ (comment-only src — no size change)forge test→ 614 passed, 0 failed ✓Reviewed by code-reviewer, pr-test-analyzer, and comment-analyzer agents (all comment claims verified factually accurate against the implementation); their feedback (assert
claimedNoncerollback; pluralize the watermark wording) is incorporated.🤖 Generated with Claude Code