Skip to content

fix(node): batch fix for #2328, #2340, #2330, #2320 - #2343

Merged
thiras merged 6 commits into
mainfrom
fix/node-batch-2340-2330-2328-2320
Oct 6, 2026
Merged

thiras merged 6 commits into
mainfrom
fix/node-batch-2340-2330-2328-2320

Conversation

@thiras

@thiras thiras commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Batch fix for four node bugs from the 2026-10-05/06 testnet runs. One commit per issue.

#2328: a mid-gap hole ended a paid serve-miss stream

Root cause: fill_gap computed delivered_frontier = gap_end - missing_byte_count. That is a byte count, not the contiguous present frontier. If the gap had a hole in the middle and its tail was present, the frontier landed past the hole. In the fra1 incident, 1131757568 − 49152 = 1131708416, which is exactly the logged leg offset. The next leg re-paid the already-present tail (paid_wire 50176 is exactly that leg). missing stayed the same, so LegNoProgress ended the gap. The serve encoder was parked at the real hole and then failed the whole paid client stream. The store did not drop anything.

  • Driver: the delivered frontier is now the start of the gap's first missing range. The next leg opens at the hole.
  • Serve encoder: after a failed pull, the data reader re-checks the store before it fails a read. The session outboard reader takes a dead-range node's pair from the store outboard: it exports one chunk group's proof path per node. A pull that faults now streams what the node holds before the stream ends.
  • A client stream that ends with an error after payment now logs paid_wire_bytes.

#2340: a failed redeemMany was retried on every voucher hint

submit_chunk, the reconcile read and redeem_planned_lanes now report chain faults. redeemer_loop parks a lane after a hint-path chain fault and drops its later hints until the next sweep. The new counter is decdn_redeem_hints_parked_total, with a live row in adr/appendix-observability.md. During an RPC outage this costs one attempt per lane per interval instead of one per voucher.

#2330: "pull still paused" WARN after the client left

Tempo shows every serve stream for that client ended 31–34 s after the SIGINT with connection lost. That is the 30 s QUIC idle timeout. The lease then dropped and the pull was cancelled, so teardown already works. The WARN fired because its 30 s threshold was no longer than the time a serve leg needs to notice that its payer is gone. PULL_WAIT_WARN_AFTER is now 45 s. A const assert keeps it at least 10 s above both QUIC_MAX_IDLE_TIMEOUT and PROOF_WAIT_CEILING.

#2320: the probe read-timeout test hit the accept_bi timeout instead

The test now writes one unfinished varint byte, so the server blocks in read_frame. It pauses the clock only after the handshake. It asserts the b"probe-error" close reason, Ok(()) from the handler, and decdn_probe_read_faults_total == 1. Mutation-checked: it fails with the read-timeout arm disabled, and it fails with the old no-write shape.

Verification

Closes #2328
Closes #2340
Closes #2330
Closes #2320

🤖 Generated with Claude Code

thiras and others added 4 commits October 6, 2026 20:52
The test opened a bi stream and never wrote to it. noq announces a
stream to the peer only on its first write, so the server stayed in
accept_bi and ACCEPT_BI_TIMEOUT fired instead; the client saw the
implicit code-0, empty-reason close of a dropped connection, which the
code-only assertion accepted.

The client now writes one unfinished varint length byte, which parks
read_frame, and keeps the stream open. The handshake and write run on
the real clock; the test pauses only to fast-forward past
PROBE_READ_TIMEOUT and resumes at once. It asserts the (0, "probe-error")
application close, the accept task's Ok(()), and
decdn_probe_read_faults_total == 1. The close wait is bounded on the
real clock so a handler that never times out fails fast.

Closes #2320

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ve ended its serve leg

A payer that disappears without a CONNECTION_CLOSE ends its serve leg
only at the QUIC idle timeout (30 s) or the proof-wait ceiling (30 s).
The last serve leg's end then cancels the pull, so teardown works, but
the 30 s PULL_WAIT_WARN_AFTER fired before that could happen and logged
a false "stalled payer or pacing regression" on every SIGINT'd client.

PULL_WAIT_WARN_AFTER is now 45 s. A compile-time assertion keeps it at
least PULL_WAIT_WARN_MARGIN (10 s) above both QUIC_MAX_IDLE_TIMEOUT and
PROOF_WAIT_CEILING, which become pub(crate) for it. A pause that reaches
the warning now means a live serve leg holds the pull.

Closes #2330

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ext sweep

submit_chunk, reconcile_onchain_watermarks and redeem_planned_lanes now
report a chain fault (a failed watermark read or any non-landed redeemMany),
and redeem_one passes it to redeemer_loop. The loop parks the lane and drops
its later hints (decdn_redeem_hints_parked_total) until the next tick or
serve-cutoff sweep, so an RPC outage costs one attempt per lane per interval.

Closes #2340

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e before a pull fault

The gap-fill loop computed its delivered frontier as the gap end minus the
missing byte COUNT. With a hole mid-gap and present bytes after it, that
frontier landed past the hole: the next leg re-paid the present tail, moved
neither frontier, and ended the gap with LegNoProgress. The delivered
frontier is now the start of the gap's first missing range, so the next leg
opens at the hole and fills it.

On the serve side, a pull fault no longer cuts the downstream stream short
of bytes the node holds. The encoder's data reader re-checks the store
before it fails a read after a failed pull, and the session outboard reader
reads a node no live fill will capture from the store's outboard (one chunk
group's proof path per node) before it fails.

A client stream that ends with an error after payment now logs the wire
bytes its vouchers credited (paid_wire_bytes).

Closes #2328

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Stale presence data can still discard durable bytes, and failed sweeps allow an extra per-lane RPC retry each interval.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Fixes four testnet-discovered issues across node serving, settlement, timeout diagnostics, and probe testing.

Changes:

  • Corrects gap-frontier calculation and improves partial serving after failed pulls.
  • Parks redemption hints after chain faults and adds observability.
  • Adjusts pull warnings and accurately tests probe read timeouts.
File Description
crates/​client/​src/​driver.rs Resumes delivery from the first hole.
crates/​cache/​src/​fill_session.rs Adds store-backed outboard fallback.
crates/​cache/​src/​engine.rs Tests fallback proof loading.
crates/​node/​src/​handlers/​client/​serve_encoder.rs Serves stored data after pull faults.
crates/​node/​src/​handlers/​client/​wire.rs Records credited bytes in payment markers.
crates/​node/​src/​handlers/​client/​dispatch.rs Logs credited bytes on stream errors.
crates/​node/​src/​payment_settlement.rs Parks redemption hints after chain faults.
crates/​node/​src/​metrics.rs Adds the parked-hint counter.
adr/​appendix-observability.md Documents the new metric.
crates/​node/​src/​node_origin/​pull_leg.rs Raises and guards the pause-warning threshold.
crates/​node/​src/​runtime/​mod.rs Exposes the QUIC timeout internally.
crates/​node/​src/​handlers/​client/​proof_wait.rs Exposes the proof timeout internally.
crates/​node/​src/​handlers/​client/​mod.rs Re-exports the proof timeout.
crates/​node/​tests/​probe_loopback.rs Exercises the actual probe read-timeout path.
crates/​node/​src/​admin.rs Corrects the settlement eligibility reference.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/node/src/payment_settlement.rs Resolved
@github-code-quality

github-code-quality Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 254d562 in the fix/node-batch-2340-... branch remains at 88%, unchanged from commit e416a1e in the main branch.

Show a line coverage summary of the most impacted files.
File main e416a1e fix/node-batch-2340-... 254d562 +/-
crates/client/src/driver.rs 97% 97% 0%
crates/cache/sr...fill_session.rs 96% 96% 0%
crates/client/src/lib.rs 92% 92% 0%
crates/client/src/scheduler.rs 95% 95% 0%
crates/cache/src/engine.rs 94% 94% 0%
crates/node/src...erve_encoder.rs 93% 93% 0%
crates/protocol/src/framing.rs 97% 97% 0%
crates/node/src...t_settlement.rs 90% 91% +1%
crates/client/s...c/connection.rs 97% 98% +1%
crates/node/src...ndlers/probe.rs 86% 88% +2%

Updated October 06, 2026 19:06 UTC

thiras and others added 2 commits October 6, 2026 21:32
- Correct docs: the pull-pause warning fires past 45 s
  (PULL_WAIT_WARN_AFTER), the paid-frontier clamp also bites on a hole
  before present bytes, lane parking costs at most one hint-path attempt
  per sweep plus the sweep's retry (reverts park too), the held prefix
  streams less the encoded chunks still buffered at a fault, and a read
  with no live fill settles from the store rather than always failing.
- Store-fallback visibility: StoreFallback::capture reports whether it
  exported pairs; an export that misses the node fails with its own
  error, and a fallback hit logs at debug (warn after a clean pull).
- The driver warns once per distinct hole that leaves present bytes
  after it, since the next leg pays for them again.
- A failed store presence check after a failed pull keeps the pull's
  error in the combined message.
- PaidProgress.wire_bytes is a NonZeroU64.
- Pull the redeemMany outcome-to-chain-fault mapping into
  is_chain_fault, and log a lane park at debug.
- Tests: a chain fault parks only its own lane, every non-landed
  outcome is a chain fault, a failed strict flush adds no chain fault
  (and a failed read survives one), a hole the store never keeps ends
  the gap after two opens; the sweep-release test runs on a paused
  clock; rename the probe read-timeout test to match what it checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s parked past a failed sweep

After a failed pull, the serve encoder's data reader checks the takedown
gate and then reads the range straight from the store. The store read
checks its own current bitfield and fails on absent bytes, so the reader
no longer gates on the observed present bitfield, which can lag a
durable admit.

The redeemer clears its parked lanes only after a sweep that runs and
reports no chain fault. A failed lane load or a faulted sweep keeps the
set, so an RPC outage costs each lane one failed attempt per interval.
redeem_sweep now returns the chain-fault flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras merged commit cb69f6f into main Oct 6, 2026
30 checks passed
@thiras
thiras deleted the fix/node-batch-2340-2330-2328-2320 branch October 6, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants