Repository navigation
test(node): prove the reclaim sweep returns when a reclaim receipt never arrives - #2525
Merged
Merged
Conversation
…ver arrives (#2495) `a_sweep_reclaim_that_never_mines_lapses_and_keeps_the_row` runs `sweep_reclaimable_once` on a `ScriptedRpc` whose `reclaim` receipt read never answers, under a paused clock. The sweep returns at `RECEIPT_TIMEOUT`, warns with the tx hash, meters `decdn_buyer_reclaim_failures_total`, and keeps the row. With the bound removed the test fails through its outer timeout. `ScriptedRpc::at_head` answers `eth_getBlockByNumber` with a head block at a chosen timestamp, which the sweep reads before it sends; without it the head read parks the sweep before the receipt wait. Closes #2495 Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The focused regression test covers the timeout’s required outcomes, and the test harness preserves existing defaults.
No open issues 🎉
What changed in this PR
Adds regression coverage for the reclaim receipt timeout introduced in #2492, addressing #2495 without changing production behavior.
Changes:
- Adds a paused-clock test verifying timeout completion, warning output, failure counting, and row retention.
- Extends
ScriptedRpcwith an optional chain-head timestamp response.
| File | Description |
|---|---|
| crates/node/src/buyer_pool/tests.rs | Tests a never-arriving reclaim receipt and clarifies existing error-path coverage. |
| crates/incentive/src/test_rpc.rs | Adds scripted head-block responses for the sweep’s pre-check. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 5 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
`a_scripted_head_decodes_at_its_timestamp` reads the head through the provider on a `ScriptedRpc::at_head` transport. The sweep is optimistic on a head-read failure, so a block shape that stops decoding would leave the node test on that fallback path and its head gate uncovered without a failure. `a_block_read_with_no_head_set_parks` pins the default. The sweep lapse test also asserts the lapse reason, and the `ScriptedRpc` doc names which block the head arm answers and what parks without one. Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.
What
reclaim_oncebounds itsreclaimreceipt wait withRECEIPT_TIMEOUT(#2492). The only test of that arm,an_unreadable_sweep_reclaim_receipt_logs_the_tx, runs on alloy'sAsserter, whose empty queue fails the receipt read at once, so it passes with or without the bound.a_sweep_reclaim_that_never_mines_lapses_and_keeps_the_row(crates/node/src/buyer_pool/tests.rs) runssweep_reclaimable_onceonScriptedRpc::parked_receipt()under a paused clock. Thereclaimsends and its receipt never arrives. The sweep returns atRECEIPT_TIMEOUT, warnsreclaim receipt not readwith the tx hash, metersdecdn_buyer_reclaim_failures_totalto 1, and keeps the row.ScriptedRpc::at_head(timestamp)(crates/incentive/src/test_rpc.rs,test-util) answerseth_getBlockByNumberwith a head block at that timestamp. The sweep reads the chain head for its grace-window pre-check before it sends, andScriptedRpcleft that read pending, which parked the sweep before the receipt wait.crates/incentive/src/test_rpc/tests.rspins that builder: a scripted head decodes through the provider at its timestamp, and a block read with no head set parks. The sweep is optimistic on a head-read failure, so without this a block shape that stops decoding would leave the node test on the fallback path with its head gate uncovered and no failure.Closes #2495
Reviewer notes
at_headarm intest_rpc.rs. The head block isBlock::<Transaction>::default()with the timestamp set, the same shape the CLIpooltests already feed anAsserter.Assertertest stays: it covers the receipt read that errors, the new one covers the read that never answers. Its doc comment now says so.test-utilonly.decdn-incentiveis not in the public-api snapshot.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-node -E 'test(reclaim)'(5 passed),cargo nextest run -p decdn-incentive(320 passed) and theno_inline_test_modulesguardCARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemscontracts/changed: n/aMutation checks, by hand:
await_receipt(pending, None)inreclaim_oncethe sweep must return when the receipt wait lapses: Elapsed(()).at_head(0)(head before the deadline)🤖 Generated with Claude Code