Repository navigation
fix(node): bound the proof wait on time and classify its faults - #2287
Conversation
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
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fault diagnostics can resample transport progress after selecting a stall, producing contradictory measurements.
Review effort: Balanced
Findings: 1
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.
Code Coverage OverviewLanguages: Rust, Solidity Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit c621369 in the Solidity / code-coverage/forgeThe overall line coverage in commit c621369 in the Updated |
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
Gas snapshotNo gas changes vs base. |

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
PastCeilingwas 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_proofnow has asleep_until(started + PROOF_WAIT_CEILING)arm after thebiasedread arm. A proof already buffered still wins, and the ceiling fires on time.Verdict::PastCeiling,proof_wait_verdictandProgressClock::chunk_startedare gone.ChunkProofs { attempts, started }(start,next_attempt,attempts,exhausted) replacesChunkDeadlineand the separateattemptscounters in both recoup loops (delivery.rs,serve_leg.rs).Copy, and it is passed by reference.sliver_vouchers_exhaust_the_per_chunk_proof_budgetandwindow_pull_through_sliver_vouchers_exhaust_the_proof_budgetboth fail.stream_frames_count_stream_data_and_not_keep_alivesuses a real iroh loopback connection with a 200 ms keep-alive, and takes about 3 s.frame_tx.stream.frame_tx.pingrises andframe_tx.streamstays flat.describe_pathreportsdirect IPv4.ProofWaitFault { kind: Stalled | PastCeiling, detail }rides as context besidePeerFault, and itsDisplayis the detail.serve_leg.rs) does not count a ceiling fault ondecdn_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 aterror!and is alertable. So every inbound failure still counts on exactly oneINBOUND_FAILURE_REASONScounter.metrics.rshas only a doc line on the existing pull-through abandon counter.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 (…)orthe chunk's proofs ran past their wait ceiling after 30.0s; ….describe_pathlabels the loss counters as path lifetime totals.VOUCHER_READ_TIMEOUT,MAX_PROOFS_PER_CHUNKand theproof_waitmodule doc now say "one owed chunk" and describe how sibling traffic extends the wait.stall_delivery_at_closing_voucherdoc is updated.client_loopback.rs(including the bail string),bundle_pull.rs,serve_leg.rs,mod.rsandwire.rs.pool_floor_ceiling_aggregate.rsis re-wrapped.MAX_PROOFS_PER_CHUNKandexhausted()in place of a literal 8.a_payer_that_stops_reading_faults_at_the_no_progress_timeoutnow assertsdecdn_serve_stream_node_fault_total == 0andsupport::assert_inbound_failures_attributed(&fx.metrics, 1).Reviewer notes
sub_second_proofs_after_the_deadline_cannot_extend_a_chunk:VOUCHER_READ_TIMEOUT, the ~31 s paced sliver tests, and a new pull-through stall test.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-node: 1550 passed. Twonode_origin_pulltests flaked once under full-suite load and passed on retry:window_pull_through_connected_nonpaying_leaf_past_ramp_bounds_upstream_spendandwindow_pull_through_sliver_voucher_leaves_the_rest_owed. Both passed 5 of 5 isolated reruns.cargo build --bin decdn-node, thencargo nextest run -p decdn-e2e --features anvil-e2e -E 'binary(pool_floor_ceiling_aggregate)': passedCHANGELOG.mdentry updated🤖 Generated with Claude Code
https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz