Skip to content

node: a delegated lane's unredeemed tail is forfeit when its capability expires between sweeps #2233

Closed

Description

@yigitdot

What

The seller redeemer does not look at a lane's capability expiry. Whatever a lane holds unredeemed when its capability expires is lost for good.

Why

PaymentPool pays nothing on a voucher whose capability has expired. _redeemLane returns (0, 0, 0) once block.timestamp >= a.expiry (contracts/src/PaymentPool.sol), and a redeem sent later cannot recover it. On the node side, nothing lines up redemption with that deadline:

  • The seller accepts vouchers right up to expiry: crates/node/src/handlers/client/voucher.rs rejects with CapabilityExpired only once now >= expiry. So a lane's last accruals land at the deadline itself.
  • The hint path (redeem_one in crates/node/src/payment_settlement.rs) redeems a lane at voucher time only if that single lane clears the per-chunk floor (blockchain.redeem_threshold_micro_usdc, default 1 USDC).
  • Everything else waits for the self-tick sweep (blockchain.redeem_interval_secs, default 5 min, capped at 6 h), which packs lanes into chunks. Neither plan_lanes nor redeem_sweep reads LaneState::expiry.

So two kinds of value are forfeit when the capability expires before the next sweep:

  1. The tail of an above-floor lane: what it accrued since its last hint-redeem.
  2. Lanes that are each below the floor but together clear it: the sweep would have redeemed them in one chunk (ADR 003 § redemption chunking: "a small (dust) lane rides alongside the larger lanes that cleared the floor"), but expiry comes first.

Case 2 can be large. A publisher that uses decdn pool assign to give many clients the same --expiry-at produces many small lanes that all expire at once. No one of them fires a hint.

This is not the dust-forfeit policy from #1761 (ADR 003 § Owner reclaims before a node redeems). That policy covers a lane that never earns enough to be worth its own gas, and its value goes back to the owner at reclaim. This value does clear the floor in aggregate, and it is lost only because redemption misses the deadline. It also happens while the node is running, not only across downtime.

Scope. Only delegated capabilities are exposed. Self-issued capabilities (node buyers, self-funded decdn fetch) use SELF_CAPABILITY_EXPIRY = u64::MAX (crates/client/src/buyer_pool.rs) and never expire.

Possible fixes

These are not decided. Each needs the spec-discipline pass before it goes into ADR 003.

  • Expiry-aware sweep. Plan a lane early when expiry - now <= redeem_interval_secs + margin. Also redeem its chunk at a lower floor, so value that clears the floor across lanes but would miss the deadline gets out. Open question: does a lane that is still sub-floor at expiry stay forfeit (consistent with refactor(node): drop PaymentPool close monitor; lean on the redeem sweep #1761), or is it forced?
  • Expiry-scheduled hint. When a lane with a finite expiry is registered, schedule one redeem pass at expiry - margin. This costs less than scanning every sweep, but it needs timer state.
  • Serve-side margin. Stop accepting a lane's vouchers some margin before expiry so its final value is fixed while it is still redeemable. On its own this still needs the redeem to run inside the margin.

Acceptance

A test in payment_settlement.rs covers several sub-floor lanes whose chunk clears the floor and whose shared capability expires before the next self-tick. It shows they are redeemed before the expiry.

Surfaced while reviewing the redeem-floor docs on #2191.

Activity

  1. added
    kind:bug
    prio:medium
    on Sep 29, 2026
  2. added
    rust
    status:mainnet-blocking
    area:node
    area:payments
    on Sep 29, 2026
  3. self-assigned this
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodearea:paymentskind:bugprio:mediumruststatus:mainnet-blocking

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions