Skip to content

node: a reloaded lane re-credits its proved chain frontier as free stream headroom #2171

Closed

Description

@thiras

Summary

When a node loads a lane, it sets the stream credit counter from the signed watermark and not from the full claim. After a restart, the proved chain frontier counts again as unclaimed credit headroom. A stream can then take up to verified_index chunks of delivery (at most 255 MiB per lane per node restart) with no new payment.

Cause

ClientHandler::new (crates/node/src/handlers/client/mod.rs:1429) and the lane-insert path (mod.rs:1815) build LaneDeliveryState with:

bytes_delivered_cumulative: bytes,
paid_credited: bytes,

Here bytes = state.last_bytes_delivered(), which is the signed half only. The lane's full paid frontier is LaneState::owed_bytes(), the signed bytes plus verified_index × CHUNK_BYTES from released preimages.

In the previous process, streams already took credit for the proved chunks. After reload, paid_credited is lower than owed_bytes() by those chunks. credit_advance (crates/node/src/handlers/client/voucher.rs) credits any headroom up to the watermark. So a reveal that folds nothing (!applied.advanced() in commit_one_preimage) still credits a stream from that headroom.

Evidence

This was found while writing #2170's loopback test (crates/node/tests/client_loopback.rs, resume_under_a_live_chain). A lane seeded with verified_index = 5 delivered a full 3 MiB blob to a stream whose reveals folded nothing on the lane, and the fetch completed. With verified_index = 1 (1 MiB of headroom), the same stream stalled, as expected. Before the #2170 fix, the 5-reveal seed hid the #2167 stall completely.

Open question

Should reload start paid_credited at owed_bytes(), which treats every proved byte as already credited? Check this against the recoup and credit-window invariants in voucher.rs (OwedChunk, voucher_credit_delta). Also decide whether bytes_delivered_cumulative needs the same change.

Found during review of #2170 (#2167).

Activity

  1. added
    kind:bug
    rust
    status:mainnet-blocking
    area:node
    area:payments
    on Sep 26, 2026
  2. self-assigned this
    on Sep 26, 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:bugruststatus: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