Skip to content

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

Closed

Description

@alpergundogdu

Since #1672 the lane store no longer fsyncs per accepted voucher: PersistentPoolStateStore::record is a buffered in-memory insert (crates/node/src/channel_store.rs module doc, lines 1–11: "record/forget mutate that working set only, and an explicit flush() call writes every dirty lane … the caller decides the flush cadence"), durability comes from the periodic flush task (crates/node/src/runtime/mod.rs:503-530, default voucher_commit_interval_ms = 5000) plus the mandatory pre-redemption flush_store_durable (crates/node/src/payment_settlement.rs:1276-1291). ADR 003 §Off-chain voucher state persistence describes exactly this split: background-timer mirror, frontier loss on crash is safe, flush-before-redeem floors the redeemed watermark.

Five comment sites still describe the old per-voucher-fsync ordering:

  1. crates/node/src/receipt_log.rs:28-31 — "the durable anti-replay watermark is [crate::channel_store::PersistentPoolStateStore], which fsyncs every accepted voucher before a receipt is ever written."
  2. crates/node/src/receipt_log.rs:226-227 — "the payment already committed to the fsynced lane store".
  3. crates/node/src/receipt_log.rs:720-722 — "the payment already committed to the fsynced channel store".
  4. crates/node/src/handlers/client/wire.rs:11-13 — "Called only after apply_voucher committed the payment to the fsynced channel store".
  5. crates/node/src/handlers/client/mod.rs:1757-1760 (lane_state_snapshot doc) — "the voucher-accept path advances only after the durable store write commits (incentive: no replay-protection window enforced on incoming voucher nonces, allowing a client to resubmit a previously accepted voucher after a node restart and receive a second byte-delivery for the same payment #527), so the snapshot never reports a voucher the node has not persisted."

Items 1–4 are ordering claims a reader will use to reason about crash behavior: today a receipt line can be durable on disk while the lane advance it records is still buffered, i.e. the audit log can be ahead of the lane store after a crash, the opposite of what the comments promise. Item 5 is the sharpest: the #1586 settlement self-defense doc claims the snapshot "never reports a voucher the node has not persisted", which no longer holds — the in-memory row advances at record() time, up to one flush interval ahead of disk.

Fix: reword all five to the current model — in-memory advance at accept, periodic fsynced flush (interval-bounded frontier loss, safe per ADR 003), unconditional durable flush before any on-chain redemption. For item 5, the self-defense reasoning should be restated against the buffered model (or the snapshot should read through the store) rather than keeping the stronger claim. Per CLAUDE.md, write the replacements as present-tense canon, no changelog voice.

No behavior change is being requested here — the buffered design matches ADR 003 and #1672; only the comments drifted.

Activity

  1. self-assigned this
    on Aug 24, 2026
  2. moved this from Backlog to In progress in deCDNon Aug 24, 2026
  3. moved this from In progress to Done in deCDNon Aug 25, 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

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions