Skip to content

fix(node): bound the proof wait on time and classify its faults - #2287

Merged
thiras merged 2 commits into
mainfrom
fix/2230-proof-wait-review-followups
Oct 2, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/2230-proof-wait-review-followups

Conversation

@thiras

@thiras thiras commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

What

This follows up #2272, which merged before its review fixes landed. It applies the multi-agent review findings on the node's proof wait. It is node-local, with no wire, config, ADR or metric change.

Refs #2230

Review findings addressed

  1. Hard ceiling. PastCeiling was checked only on progress ticks, and each new proof wait restarted its own 1 s poll. So sub-second zero-credit proofs around the deadline let a chunk run about 34–38 s.
    • wait_for_proof now has a sleep_until(started + PROOF_WAIT_CEILING) arm after the biased read arm. A proof already buffered still wins, and the ceiling fires on time.
    • A wait that starts past the deadline faults at once.
    • Verdict::PastCeiling, proof_wait_verdict and ProgressClock::chunk_started are gone.
  2. One per-chunk value. ChunkProofs { attempts, started } (start, next_attempt, attempts, exhausted) replaces ChunkDeadline and the separate attempts counters in both recoup loops (delivery.rs, serve_leg.rs).
    • It is not Copy, and it is passed by reference.
    • Mutation check: if it is created inside the attempt loop, sliver_vouchers_exhaust_the_per_chunk_proof_budget and window_pull_through_sliver_vouchers_exhaust_the_proof_budget both fail.
  3. Seam test on the real counter. stream_frames_count_stream_data_and_not_keep_alives uses a real iroh loopback connection with a 200 ms keep-alive, and takes about 3 s.
    • Writing 8 KiB on a bi stream raises frame_tx.stream.
    • Over 3 s idle, frame_tx.ping rises and frame_tx.stream stays flat.
    • It also checks that describe_path reports direct IPv4.
    • The optional sibling-stream end-to-end test is not included.
  4. Typed fault marker. ProofWaitFault { kind: Stalled | PastCeiling, detail } rides as context beside PeerFault, and its Display is the detail.
    • The miss serve leg (serve_leg.rs) does not count a ceiling fault on decdn_node_pull_through_client_abandoned_total. That counter is not one of the inbound reason counters.
    • ErrEnd::of (outcome.rs) is unchanged on purpose. Both proof-wait faults stay on the declined/abandoned split. The other counters fit worse: the node-fault counter is for node bugs, logs at error! and is alertable. So every inbound failure still counts on exactly one INBOUND_FAILURE_REASONS counter.
    • No metric is added or renamed. metrics.rs has only a doc line on the existing pull-through abandon counter.
  5. Measured fault text.
    • It reports the time since the last STREAM frame, the chunk's total wait, and the STREAM frames this wait saw. For example: no proof and no transport progress for 10.0s; the chunk has waited 10.0s for its proofs, and this proof wait sent 0 STREAM frames (…) or the chunk's proofs ran past their wait ceiling after 30.0s; ….
    • describe_path labels the loss counters as path lifetime totals.
  6. Docs and comment sweep.
    • The bound docs are corrected: VOUCHER_READ_TIMEOUT, MAX_PROOFS_PER_CHUNK and the proof_wait module doc now say "one owed chunk" and describe how sibling traffic extends the wait.
    • The CHANGELOG entry now says that sibling traffic on the connection can hold the wait to 30 s, and that a ceiling fault does not count on the pull-through abandon counter.
    • The stall_delivery_at_closing_voucher doc is updated.
    • Stale "voucher-read"/"proof-read timeout"/"gather timeout" wording is fixed in client_loopback.rs (including the bail string), bundle_pull.rs, serve_leg.rs, mod.rs and wire.rs.
    • pool_floor_ceiling_aggregate.rs is re-wrapped.
    • The tests use MAX_PROOFS_PER_CHUNK and exhausted() in place of a literal 8.
  7. Loopback assertions. a_payer_that_stops_reading_faults_at_the_no_progress_timeout now asserts decdn_serve_stream_node_fault_total == 0 and support::assert_inbound_failures_attributed(&fx.metrics, 1).

Reviewer notes

  • New paused-time test sub_second_proofs_after_the_deadline_cannot_extend_a_chunk:
    • the first proof lands 0.5 s before the deadline, and every later one 0.7 s into its wait;
    • it asserts a ceiling fault at exactly 30 s after one proof;
    • it also checks that a wait starting past the deadline faults at once, and that a buffered proof still wins.
    • Mutation check: with the ceiling checked only on ticks, it fails with "the chunk took 8 proofs without a wait fault".
  • Out of scope, as agreed: renaming VOUCHER_READ_TIMEOUT, the ~31 s paced sliver tests, and a new pull-through stall test.

Verification

  • cargo fmt -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • cargo nextest run -p decdn-node: 1550 passed. Two node_origin_pull tests flaked once under full-suite load and passed on retry: window_pull_through_connected_nonpaying_leaf_past_ramp_bounds_upstream_spend and window_pull_through_sliver_voucher_leaves_the_rest_owed. Both passed 5 of 5 isolated reruns.
  • cargo build --bin decdn-node, then cargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(pool_floor_ceiling_aggregate)': passed
  • pre-commit hooks passed on commit
  • CHANGELOG.md entry updated
  • Design change: none

🤖 Generated with Claude Code

https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz

Follow-up to #2272, from its review.

- Hard ceiling. The per-chunk ceiling was checked only on progress ticks,
  and each new proof wait restarted its own 1 s poll, so sub-second
  zero-credit proofs around the deadline let a chunk run past 30 s. A
  sleep_until arm now fires the ceiling on time, after the biased read
  arm, so a proof already buffered still wins and a wait that starts past
  the deadline faults at once.
- One per-chunk value. ChunkProofs holds a chunk's proof count and its
  wait start; both recoup loops make it once per owed chunk and pass it by
  reference, replacing ChunkDeadline and the separate attempts counters.
- Typed fault marker. ProofWaitFault (stalled or past the ceiling) rides
  beside PeerFault. The miss serve leg leaves the ceiling out of
  decdn_node_pull_through_client_abandoned_total; the inbound reason
  split (declined or abandoned) is unchanged, so every inbound failure
  still counts on exactly one reason counter.
- Measured fault text: the time since the last STREAM frame, the chunk's
  total wait, and the STREAM frames this wait saw; the path's loss
  counters are labelled lifetime totals.
- Seam test on a real loopback connection: writing stream data raises
  the STREAM frame count, and keep-alive PINGs over 3 s of idle do not.
- Paused-time tests for sub-second proofs around the deadline and for a
  wait that starts past it; the loopback stall test now checks inbound
  failure attribution and that no node fault counts.
- Docs and comments: the per-chunk bound, the effect of sibling traffic,
  and stale "voucher-read"/"proof-read timeout" wording.

Refs #2230

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz
Copilot AI balanced review requested due to automatic review settings October 2, 2026 02:38
@thiras thiras self-assigned this Oct 2, 2026

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

Fault diagnostics can resample transport progress after selecting a stall, producing contradictory measurements.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Bounds per-chunk proof waits and improves fault classification and diagnostics.

Changes:

  • Adds a hard 30-second per-chunk ceiling and unified proof-attempt tracking.
  • Adds typed proof-wait faults and adjusts pull-through metrics.
  • Expands timing, transport-counter, and attribution tests.
File Description
CHANGELOG.md Documents proof-wait behavior.
crates/​cli/​src/​commands/​bundle_pull.rs Updates timeout terminology.
crates/​e2e/​tests/​pool_floor_ceiling_aggregate.rs Rewraps test documentation.
crates/​node/​src/​handlers/​client/​delivery.rs Uses unified per-chunk proof tracking.
crates/​node/​src/​handlers/​client/​mod.rs Clarifies proof limits and cancellation.
crates/​node/​src/​handlers/​client/​outcome.rs Documents fault classification.
crates/​node/​src/​handlers/​client/​proof_wait.rs Implements the ceiling, typed faults, diagnostics, and tests.
crates/​node/​src/​handlers/​client/​serve_leg.rs Refines pull-through fault accounting.
crates/​node/​src/​handlers/​client/​voucher.rs Passes shared chunk proof state into waits.
crates/​node/​src/​handlers/​client/​wire.rs Updates peer-fault documentation.
crates/​node/​src/​metrics.rs Clarifies abandon-counter semantics.
crates/​node/​tests/​client_loopback.rs Adds failure-attribution assertions and updates terminology.

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

@github-code-quality

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

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit c621369 in the fix/2230-proof-wait-... branch remains at 87%, unchanged from commit 9f46eaf in the main branch.

Solidity / code-coverage/forge

The overall line coverage in commit c621369 in the fix/2230-proof-wait-... branch remains at 92%, unchanged from commit 9f46eaf in the main branch.


Updated October 02, 2026 03:20 UTC

The proof wait re-sampled the STREAM frame count after the select had
already chosen a fault. A frame sent in between reset the no-progress
clock, so a stall could report "no transport progress for 0.0s" and a
frame the decision never saw. Each arm now takes its sample and the
fault text formats that same sample.

Refs #2230

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@thiras
thiras merged commit 9f243c9 into main Oct 2, 2026
30 checks passed
@thiras
thiras deleted the fix/2230-proof-wait-review-followups branch October 2, 2026 03:23
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.

2 participants