Skip to content

contracts: FeeRouter pause freezes the client-refund leg of PaymentChannel.settleChannel #849

Closed

Description

@alpergundogdu

Severity: Medium

Summary

PaymentChannel's pause design deliberately keeps every channel-exit path open so funds are never trapped. But settleChannel calls into FeeRouter.routeSettlement, which is whenNotPaused. When FeeRouter is paused, settling a Closing channel that has a non-zero provider amount reverts the entire transaction — including the client refund that executes earlier in the same call.

Where

  • PaymentChannel.settleChannel (contracts/src/PaymentChannel.sol:455-475): sets status = Closed, transfers clientRefund to the client, then _route(...) → FeeRouter.routeSettlement when settleAmount != 0.
  • FeeRouter.routeSettlement (contracts/src/FeeRouter.sol:195-201) is whenNotPaused.
  • _route (PaymentChannel.sol:648-655) has no pause-tolerant path; a revert there reverts the whole settleChannel.

Impact

A channel already in Closing cannot be settled while FeeRouter is paused, and the client refund is blocked along with it. reclaimExpired is not an escape hatch — it requires Status.Open (PaymentChannel.sol:480-494). Impact is bounded (pause is emergency-multisig-gated and temporary), but it reintroduces a fund-freeze for already-closing channels, contrary to PaymentChannel's "exits always open" intent.

Suggested fix

Make the settle/refund path tolerate a paused router — e.g. pay the client refund unconditionally and let the provider-share routing be retried/settled separately, or allow a closing channel to fall back to a client-reclaim path when the router is paused.

Notes

Found during a full-repo audit; verified against the contract source.

Activity

  1. added
    kind:bug
    kind:security
    prio:medium
    on Jun 9, 2026
  2. github-actions commented on Jun 9, 2026

    @github-actions

    🎯 Triage report

    A medium-severity correctness bug in the PaymentChannel × FeeRouter interaction: when FeeRouter is paused, settleChannel reverts atomically — taking the already-executed client USDC refund with it — leaving a Closing channel with no escape hatch, since reclaimExpired requires Status.Open. This directly violates the stated "exits always open" invariant of PaymentChannel. The reporter has provided exact file/line references and verified against the contract source.

    📊 Assessment

    Dimension Value Reasoning
    Type Bug Correctness invariant violation with fund-freeze consequence
    Labels bug, security, medium Fund-freeze under emergency pause; reporter-stated Medium severity; directly ties to contract security invariants
    Coding agent Suitable Root cause is pinpointed to specific lines; fix scope is contained to PaymentChannel._route / settleChannel; two concrete fix strategies are provided; no design ambiguity beyond choosing between them

    🔗 Similar issues

    No open duplicates or closely related issues found.

    💡 Notes and suggestions

    Root cause path (confirmed in source):

    settleChannel (L455)
      → ch.status = Closed         ← state already committed
      → usdc.safeTransfer(client)  ← refund executes
      → _route(provider, ...)      ← L648: forceApprove + routeSettlement
          → FeeRouter.routeSettlement  ← `whenNotPaused` guard → REVERT
      ← entire call reverts; client refund also reverts
    

    reclaimExpired (L480-494) explicitly gates on ch.status == Open, so a Closing channel has zero exit options while FeeRouter is paused.

    Two fix approaches to choose between:

    1. Split the client refund from routing (recommended): Execute usdc.safeTransfer(ch.client, clientRefund) unconditionally and only attempt _route after. If the router is paused, either (a) skip routing and store the provider's owed amount for later claiming, or (b) emit an event and allow a separate retryRoute(channelId) function to drain it once FeeRouter unpauses. This preserves the "client exits always work" invariant at the cost of deferring provider payment.

    2. Pause-tolerant settlement escape hatch: Add a settleChannelEmergency(channelId) that is callable when FeeRouter is paused, returns the entire deposit to the client, and marks the channel closed. Provider foregoes their portion during the emergency window (or it's queued). Simpler to reason about atomicity, but less favourable to providers.

    Design questions to resolve before implementing:

    • Should deferred provider amounts accrue interest/penalties? (Probably not for a temporary pause.)
    • Should the stored provider payable be tracked in PaymentChannel or a separate escrow?
    • Is it acceptable for the provider to receive their share post-pause via a pull mechanism, or must it remain push?

    Suggested sub-tasks:

    • Decide which fix approach to adopt (team call / ADR note)
    • Implement the chosen fix in PaymentChannel.sol
    • Add a test: FeeRouter paused while channel is Closing → settleChannel must still successfully refund the client
    • Add a test: after FeeRouter unpauses, provider share is retrievable
    • Review whether withdraw has a similar pause-interaction issue (it also calls _route)
    • Confirm slither/aderyn are clean after the fix

    Scope note: Also worth checking withdraw (it calls _route as well) to see if a paused FeeRouter blocks mid-channel withdrawals in a similar way.

    Generated by Agentic Triage for issue #849 · sonnet46 638.4K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. added a commit that references this issue on Jun 13, 2026
  4. self-assigned this
    on Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugkind:securityprio:medium

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions