Repository navigation
fix(cli,client,node)!: bound receipt waits so a dropped tx cannot hang - #2490
Merged
Merged
Conversation
alloy's get_receipt() has no timeout, so a transaction dropped from the mempool left the waiting command (or the node's open slot) blocked forever. - decdn-incentive: RECEIPT_TIMEOUT (3 min) and await_receipt, a tokio::time::timeout wrapper; send/send_for_receipt use it, and a lapse reports InFlight with the tx hash and a "may still mine" warning. - CLI: pool close/reclaim (and --all sweeps) bound their waits and count a lapse as unconfirmed; pool open/top-up pass the bound. - decdn-client: open_pool and top_up take a receipt_timeout; open_pool refuses a second open while UnconfirmedOpens holds one; the approve wait uses the shared bound. - Node: openPool is bounded and a lapse settles through settle_unconfirmed_open, which re-sends a dropped open; top_up stays unbounded because its task holds the top-up slot (#2489). - decdn-incentive test-util: ScriptedRpc, a transport that parks a receipt wait, for paused-clock tests across incentive, client, cli and node. Closes #2433 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
A timed-out refill can allow a concurrent bundle entry to submit another top-up before the fatal error stops the run.
1 open issue
What changed in this PR
Bounds receipt waits so dropped transactions cannot indefinitely stall CLI commands or node pool opening.
Changes:
- Adds a shared three-minute timeout while preserving transaction hashes and unconfirmed outcomes.
- Updates client APIs and callers; deliberately leaves node top-ups unbounded pending #2489.
- Adds paused-clock regression tests and updates documentation.
| File | Description |
|---|---|
| crates/node/src/runtime/mod.rs | Updates timeout comments. |
| crates/node/src/buyer_pool/tests.rs | Tests open and top-up wait behavior. |
| crates/node/src/buyer_pool.rs | Bounds opens while retaining settlement handling. |
| crates/incentive/src/tx/tests.rs | Tests bounded and unbounded waits. |
| crates/incentive/src/tx.rs | Adds shared receipt timeout helper. |
| crates/incentive/src/test_rpc.rs | Adds scripted test transport. |
| crates/incentive/src/lib.rs | Exposes test transport. |
| crates/incentive/Cargo.toml | Configures test transport dependencies. |
| crates/e2e/tests/pool_floor_ceiling_aggregate.rs | Updates open API call. |
| crates/e2e/tests/cli_fetch_topup.rs | Updates funding API calls. |
| crates/e2e/src/client.rs | Updates fixture API call. |
| crates/common/src/identity.rs | Documents timeout-related key preservation. |
| crates/client/tests/snapshots/public_api__public_api.snap | Records breaking API changes. |
| crates/client/src/funding/adoption_tests.rs | Tests funding receipt timeouts. |
| crates/client/src/funding.rs | Bounds client funding waits. |
| crates/client/src/buyer_pool/tests.rs | Tests timeouts and duplicate-open refusal. |
| crates/client/src/buyer_pool.rs | Adds configurable bounds and open guard. |
| crates/client/examples/common/mod.rs | Bounds example pool opening. |
| crates/client/Cargo.toml | Uses shared test transport. |
| crates/cli/src/commands/publish.rs | Documents unconfirmed timeout outcome. |
| crates/cli/src/commands/pool/tests.rs | Tests close and reclaim timeouts. |
| crates/cli/src/commands/pool.rs | Bounds pool command receipt waits. |
| CHANGELOG.md | Documents behavior and API changes. |
| Cargo.toml | Updates dependency comments. |
| Cargo.lock | Records dependency changes. |
| adr/appendix-operator-key-rotation.md | Documents receipt timeout scenario. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
A refill whose topUp lapsed at RECEIPT_TIMEOUT released open_lock before its fatal fault reached run_groups (acquire_entry awaits persist_watermarks first), so a sibling bundle entry queued on the lock could read the unchanged deposit and escrow a second topUp. A recovery step queued on the step lock could do the same. The refill and the recovery step now escrow through one helper, escrow_top_up. It holds the first unconfirmed topUp in RunFunding before the caller's lock is released, and every later call in the run refuses with that TopUpUnconfirmed, which the acquire loop treats as fatal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The refill holds open_lock and the recovery step holds RecoveryGate's step lock, and neither excludes the other. Both could send a topUp before either lapsed; with the receipt bound, one could then mine past its window and stay uncredited while the other was credited. RunFunding's held topUp becomes a tokio mutex that escrow_top_up holds from its check to its outcome, so a second caller waits for the first topUp to resolve and refuses if it went unconfirmed. top_up logs the tx hash at broadcast, as open_pool does; its nonce-retry send loop moves into send_top_up to keep it under the complexity lint. Tests: a recovery-step lapse refuses a later refill, and a concurrent refill and recovery step send one topUp between them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks done
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
alloy's
get_receipt()has no timeout. A transaction dropped from the mempool hung the CLI command that sent it. Underpool close --all/reclaim --allit also blocked every later pool, so the summary never printed. On the node, a droppedopenPoolheld the open slot forever.Every CLI receipt wait and the node's
openPoolwait now lapse afterRECEIPT_TIMEOUT(3 min). A lapse ends in the existing "unconfirmed" outcome, keeps the tx hash, and warns that the tx may still mine.RECEIPT_TIMEOUTandawait_receipt, atokio::time::timeoutwrapper (alloy'swith_timeoutchecks a stdInstant, so it never fires under a paused clock).send/send_for_receiptuse it, which covers register, deregister, bond, unbond, appeal, publish and the other plain-send commands.pool close/reclaim(and their--allsweeps) bound their waits and count a lapse asunconfirmed;pool open/top-uppass the bound.open_poolandtop_uptakereceipt_timeout: Option<Duration>.open_poolrefuses a second open while the run'sUnconfirmedOpensholds one, so a lapseddecdn getcannot escrow twice. Likewise, the run sends onetopUpat a time (escrow_top_upholds a run-wide lock inRunFundingfrom its check to its outcome, since a refill underopen_lockand a recovery step under the step lock do not exclude each other), and after one goes unconfirmed every later refill or recovery step in the run refuses with it. Theapprovewait uses the shared bound.openPoolis bounded; a lapse goes tosettle_unconfirmed_open, which holds the slot and re-sends a dropped open at the same nonce.top_upstays unbounded (None) because its task holds the top-up slot and nothing yet settles an unconfirmedtopUp. That gap is fix(node): settle an unconfirmed topUp instead of freeing the top-up slot #2489.decdn-incentive'stest-utilgainsScriptedRpc, a transport that parks a receipt wait, used by paused-clock tests in incentive, client, cli and node. Each bounded-wait test was mutation-checked by swapping its bound out.Closes #2433
Reviewer notes
crates/incentive/src/tx.rs(await_receipt), thencrates/client/src/buyer_pool.rs(open_poolguard and the receipt-bound doc section).top_up: Noneis deliberate;a_top_up_that_never_mines_keeps_the_top_up_slotpins it.recovertop-up andopen_replacementsites, and the CLIpool open/top-upcommand sites (each passesSome(RECEIPT_TIMEOUT)).topUpthat may still mine is refused within the run but not yet named on exit (give-up, Ctrl-C, a dropped sibling,drain_builds) the way a pending open is. That gap predates this PR and is fix(cli): name a topUp that may still mine on every decdn get exit #2491.open_pool(tests) andtop_up(sponsord-core/src/pool.rs); its next decdn bump needs the new argument, and its keeper should choose the bound the way the node does.Verification
cargo fmt -- --checkCARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-featurescargo nextest run -p decdn-incentive -p decdn-client -p decdn-cli -p decdn-node -p decdn-common: 4219 passedCARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items(plus incentive--features test-util)pre-commit runon every changed fileCHANGELOG.mdentry added🤖 Generated with Claude Code