Skip to content

fix(node): serve_leg hoists its credit window once and never re-ramps #1769

Closed

Description

@yigitdot

Split out of #1752 (out of scope there).

crates/node/src/handlers/client/serve_leg.rs resolves its window ONCE before the delivery loop:

let chunk_bytes = CHUNK_BYTES;
let window = window.max(chunk_bytes);

and never recomputes it. Its twin on the cache-hit path, delivery.rs, recomputes per iteration:

let window = self.credit_window(chunk_bytes, paid);

So on the cache-miss serve leg the downstream window stays pinned at the ramp floor for the whole stream, however much the client pays — only the upstream pull leg ramps, via RampPacer reading served_paid_frontier. On the cache-hit path the same client ramps toward credit_max as ADR 003 §Credit Window describes.

The consequence is throughput, not safety: a paying client served through a miss stays at strict stop-and-wait, one chunk per round trip, so a high-RTT link is capped where the hit path would saturate it.

Pre-existing since #1669; unrelated to PayWord. Noticed while re-flooring both loops onto CHUNK_BYTES in #1752.

🤖 Generated with Claude Code

Activity

  1. moved this from Backlog to Ready in deCDNon Aug 20, 2026
  2. self-assigned this
    on Aug 24, 2026
  3. moved this from Ready to In progress in deCDNon Aug 24, 2026
  4. moved this from In progress to Done in deCDNon Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

Urgent

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions