Repository navigation
docs(node): describe the buffered lane store in the receipt and voucher comments - #1800
Merged
Merged
Conversation
…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]>
Coverage reportTotal: 81.67% (was 81.66%, ▲ +0.02%) — 65330/79990 lines
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five-plus comment sites in
crates/nodestill promised that the lane store fsyncs every accepted voucher before a receipt is written. It does not:PersistentPoolStateStore::recordis a buffered working-set insert, durability comes from the periodic flush task (payment.voucher_commit_interval_ms, 5 s by default) plus the unconditionalflush_store_durablebefore 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.rsmodule# Durabilitynote — 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.rsrecord_receipt— same correction on theapply_voucherordering claim.handlers/client/mod.rs— thereceipt_sinkfield doc, thelane_metrics_refresh"may be fsync-bound" note, andregister_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_losspath genuinely commits withDurability::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), andcargo nextest run -p decdn-node --no-fail-fastpasses 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