Skip to content

fix(node): wake the redeemer at a closing pool's deadline - #3004

Closed
alpergundogdu wants to merge 1 commit into
mainfrom
claude/2813-close-deadline-wake-47ea3f
Closed

alpergundogdu wants to merge 1 commit into
mainfrom
claude/2813-close-deadline-wake-47ea3f

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Closes #2813

What

A lane's serve cutoff is now the earlier of its capability expiry and, when the pool projection holds the pool Closing, the pool's dispute deadline. The redeemer's existing cutoff sweep (serve_cutoff_wake / next_serve_cutoff) therefore also fires at deadline - margin + 1: one second after the mid-stream re-check (#2812) stops a stream on the closing pool, and one redeem interval before pool_is_redeemable's landing-slack filter drops the pool.

  • lane_cutoff_wake takes the lane's pool status; serve_cutoff_wake also requires pool_is_redeemable(pool, now), so a drained pool or one inside the slack gets no wake.
  • next_serve_cutoff reads each lane's pool from the PoolProjection; the hint path (redeem_one) does the same, so a live stream's hint pulls the close cutoff forward.
  • The projection is refreshed every 30 s for live lanes, and every sweep and hint recomputes the wake, so a close is scheduled long before its cutoff (48 h grace vs. at most 6 h interval).
  • ADR 003's mid-stream close re-check paragraph names the sweep.

Floor

The cutoff sweep does not force sub-floor lanes through, and neither does the close sweep: it packs every owed lane like the capability cutoff sweep does (ADR 003: a node does not force sub-threshold dust through the sweep). Forcing dust would be a separate policy change.

Tests

Unit tests on the wake computation: close deadline first vs. expiry first, no re-schedule after the sweep, due-now after an unscanned cutoff, none inside the slack or on a drained pool, the wake sits one second after inside_capability_expiry_margin starts and the pool is still redeemable there, and next_serve_cutoff picks the deadline up from the projection.

cargo nextest run -p decdn-node (1628 passed), cargo clippy --workspace --all-targets --all-features clean. No pub signature changed.

🤖 Generated with Claude Code

A lane's serve cutoff is its capability expiry, or its pool's dispute
deadline when the projection holds the pool `Closing` and the deadline
comes first. The redeemer's cutoff sweep then runs one second after the
mid-stream re-check stops a stream on the closing pool, so the final
claim is swept before `pool_is_redeemable`'s landing-slack filter drops
the pool. A lane on a pool that cannot pay gets no wake.

Closes #2813

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main e720fbb claude/2813-close-de... a300bcb +/-
78% 78% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@alpergundogdu

Copy link
Copy Markdown
Contributor Author

Superseded by #3006: a live stream now stops as soon as its pool turns Closing, so the node keeps the whole dispute window to redeem and needs no close-deadline wake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

redeemer: no close-deadline wake, so the pool-close margin's last sweep can miss

1 participant