Skip to content

docs(node): describe the buffered lane store in the receipt and voucher comments - #1800

Merged
alpergundogdu merged 1 commit into
mainfrom
docs/1787-buffered-lane-store-comments
Aug 25, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
docs/1787-buffered-lane-store-comments

Conversation

@yigitdot

Copy link
Copy Markdown
Contributor

Five-plus comment sites in crates/node still promised that the lane store fsyncs every accepted voucher before a receipt is written. It does not: PersistentPoolStateStore::record is a buffered working-set insert, durability comes from the periodic flush task (payment.voucher_commit_interval_ms, 5 s by default) plus the unconditional flush_store_durable before any on-chain redemption — exactly the split ADR 003 §Off-chain voucher state persistence specifies. The code matches the ADR; only the comments had drifted.

Rewritten to the current model:

  • receipt_log.rs module # Durability note — the lane watermark advances in memory at accept and is mirrored by the periodic flush. The old "a receipt can never be ahead of the lane store" promise is inverted and stated plainly: after a hard crash the audit log can be ahead of the lane store, which costs at most one flush interval of un-redeemed frontier (safe per ADR 003) and reopens no replay window, because replay protection rests on the redeemed watermark that the pre-redemption flush floors.
  • ReceiptLog::append, NoopReceiptLog, ReceiptSink, RECEIPT_LOG_CAPACITY, spawn_receipt_writer, append_one — "the payment already committed to the fsynced lane store" → "the payment already advanced the lane watermark"; "durably accepted" → "accepted".
  • handlers/client/wire.rs record_receipt — same correction on the apply_voucher ordering claim.
  • handlers/client/mod.rs — the receipt_sink field doc, the lane_metrics_refresh "may be fsync-bound" note, and register_lane (its "synchronous fsync (store trait §Durability)" comment and the "persisted durably" wording).
  • lane_state_snapshot — the "never reports a voucher the node has not persisted" claim is dropped, not weakened. The doc now states what the snapshot really is: the strongest proof this process verified and still holds the signature for, at least as strong as the on-disk row and possibly leading it by one flush interval, with the crash case and the pre-redeem flush floor spelled out. The code is unchanged — reading through the store would be a behavior change.

The claims that are still true are preserved: the receipt log genuinely does not fsync per record, and the floor-loss record_loss path genuinely commits with Durability::Immediate.

Comment-only, so there is no before/after test. The diff contains no non-comment lines (every added and removed line is a // line), and cargo nextest run -p decdn-node --no-fail-fast passes unchanged: 992 tests, 992 passed.

Gates: cargo fmt -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo doc (clean, no intra-doc-link warnings), cargo nextest run -p decdn-node --no-fail-fast.

Closes #1787

…er comments

The lane store buffers `record` in memory and reaches disk on the periodic
flush plus the unconditional pre-redemption flush, so the comments that
promised a per-voucher fsync before every receipt described an ordering the
code does not have. Restate the receipt-log durability note, the receipt
sink/trait docs, the register_lane store write, and the lane snapshot doc
against the buffered model: in-memory advance at accept, interval-bounded
frontier loss on crash, redeemed watermark floored by the pre-redeem flush.

Comment-only; no behavior change.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

Coverage report

Total: 81.67% (was 81.66%, ▲ +0.02%) — 65330/79990 lines

File Coverage Lines Δ
crates/node/src/handlers/client/mod.rs 92.15% 1420/1541 ● 0.00%
crates/node/src/handlers/client/wire.rs 97.73% 129/132 ● 0.00%
crates/node/src/receipt_log.rs 91.06% 489/537 ● 0.00%
History
Commit Total Δ vs base
ff40435 (HEAD) 81.67% ▲ +0.02%

@alpergundogdu
alpergundogdu merged commit 1004a09 into main Aug 25, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the docs/1787-buffered-lane-store-comments branch August 25, 2026 14:44
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.

docs(node): stale "fsyncs every accepted voucher" comments contradict the buffered lane store (#1672)

2 participants