Skip to content

node: stop a stream whose pool closes mid-stream #2805

Closed

Description

@yigitdot

Found while reviewing #2789 (#2630).

The mid-stream pool-solvency re-check in both serve loops (crates/node/src/handlers/client/delivery.rs deliver, crates/node/src/handlers/client/serve_leg.rs) keeps serving a stream whose pool can no longer pay for it:

  • Closed pool. Admission puts every admitted stream's pool in the projection, and PoolProjection::forget drops it only on PoolReclaimed (crates/node/src/payment_settlement.rs fold) or when a re-anchor read finds it Closed. A later cached_status then returns None, and the re-check fails open. fix(node): count a skipped mid-stream pool re-check and test the serve-miss PoolExhausted stop #2789 counts this (decdn_serve_pool_recheck_skipped_total) and logs a throttled warn!, but the stream continues. redeemMany reverts PoolClosed on a closed pool (contracts/src/PaymentPool.sol redeemMany), so the node is not paid for those bytes. On a serve miss it also keeps paying its upstream for them.
  • Forgotten signer. ResolvingPoolView::signer_spent_cached falls back to projection.signer_spent, which reads 0 for a pool the projection no longer holds, so the signer cap-headroom re-check also passes.
  • Closing pool past its dispute deadline. Neither loop reads status.lifecycle. Admission refuses a Closing pool (dispatch.rs), but a stream admitted while the pool was Open keeps running after initiateClose. redeemMany also reverts when Closing && block.timestamp >= disputeDeadline, and the redeemer drops lanes inside the landing slack.

Proposal: with a pool view wired, treat a None from cached_status and a Closing pool at or past disputeDeadline - REDEEM_LANDING_SLACK_SECS as a stop, in-band, like PoolExhausted. The exact reject reason and the counter it lands in are part of the design. With no pool view wired (dev/test), keep failing open.

Done when both loops stop such a stream in-band, a loopback test covers each case in each loop, and the ADR observability row for decdn_serve_pool_recheck_skipped_total is updated or the counter replaced.

Activity

  1. added
    kind:security
    prio:medium
    area:node
    area:payments
    on Oct 31, 2026
  2. moved this from Backlog to In progress in deCDNon Nov 1, 2026
  3. moved this from In progress to Done in deCDNon Nov 1, 2026
  4. added a commit that references this issue on Nov 3, 2026
    68f4884
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:nodearea:paymentskind:securityprio:medium

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions