Repository navigation
fix(cli): name an in-flight openPool when a command ends before its receipt - #2452
Merged
Merged
Conversation
…eceipt A Ctrl-C during the openPool receipt wait dropped the future with no error. `decdn fetch` and `decdn bundle pull` printed only the resume hint, and `decdn pool open` died with no output. The tx could still mine, and a re-run before it confirmed opened a second pool. `open_pool` now holds its broadcast in an `UnconfirmedOpens` handle until the receipt wait returns. The handle is threaded through `RunFunding`, which both client open sites already hold. Each CLI command reads the handle when it ends. An open that is still unconfirmed is attached to the result, so the command names the tx and nonce. An interrupt still exits 130. A run that would otherwise succeed exits nonzero instead. `decdn pool open` now watches Ctrl-C around the open. The OpenUnconfirmed message now points to `decdn pool list --all`. Only the on-chain list shows a pool the local store never recorded. Closes #2418 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups for #2418. The first change named an open only when its receipt wait was dropped and the command returned through `name_unconfirmed_open`. Several ends still lost the tx: - A give-up printed only "rerun to resume" and exited 75. It now names the open and exits 1, because 75 tells a wrapper a re-run is safe. - `bundle pull --hash` opened in its manifest fetch with no Ctrl-C watch and returned before the naming. The watch now starts before the manifest, and the naming covers both phases. - A second Ctrl-C exited before main printed. The watcher now names the pending opens before the immediate exit. - A receipt read that failed during the scheduler's drain was removed from the handle, and its error was dropped at debug. Only a read receipt now releases an entry. - A Ctrl-C during the submit itself recorded nothing. The entry is now held by nonce from before the submit. - A bundle pass reset dropped the handle. The builder now takes the caller's handle, and each pass keeps it. - Only the first pending open was named. All of them are now. New tests pin the open sites in funding.rs to the run's handle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The new public tuple field lacks required documentation and can fail the warnings-denied documentation gate.
1 open finding
What changed in this PR
Ensures CLI commands report unresolved openPool transactions before exiting, preventing unsafe retries and duplicate deposits.
Changes:
- Adds shared tracking for unconfirmed pool opens.
- Integrates tracking with fetch, bundle pull, and pool open interruption handling.
- Adds regression tests and updates public API documentation.
| File | Description |
|---|---|
crates/node/src/buyer_pool.rs |
Adapts the node open call. |
crates/e2e/tests/pool_floor_ceiling_aggregate.rs |
Adapts E2E pool setup. |
crates/e2e/tests/cli_fetch_topup.rs |
Adapts fetch/top-up fixtures. |
crates/e2e/src/client.rs |
Adapts the client fixture. |
crates/client/tests/snapshots/public_api__public_api.snap |
Records the new public API. |
crates/client/src/funding/adoption_tests.rs |
Tests funding-path tracking. |
crates/client/src/funding.rs |
Propagates the tracking handle. |
crates/client/src/buyer_pool/tests.rs |
Tests dropped and failed opens. |
crates/client/src/buyer_pool.rs |
Implements unconfirmed-open tracking. |
crates/client/src/bundle/engine.rs |
Preserves tracking across passes. |
crates/client/src/bundle.rs |
Adds bundle tracking configuration. |
crates/client/examples/common/mod.rs |
Adapts the client example. |
crates/client/Cargo.toml |
Adds the test transport dependency. |
crates/cli/src/main.rs |
Centralizes stop messages and exit codes. |
crates/cli/src/commands/pool.rs |
Handles interruption during pool opening. |
crates/cli/src/commands/interrupt/tests.rs |
Tests reporting and exit behavior. |
crates/cli/src/commands/interrupt.rs |
Reports pending opens on termination. |
crates/cli/src/commands/fetch.rs |
Tracks opens throughout fetches. |
crates/cli/src/commands/bundle_pull.rs |
Tracks opens during manifests and pulls. |
CHANGELOG.md |
Documents behavior and API changes. |
Cargo.lock |
Records the dependency update. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Only the interrupt module and its tests build or read it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 96c34cf in the Show a line coverage summary of the most impacted files.
|
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.

Summary
open_poolwaits for theopenPoolreceipt with no time limit, by design. If the CLI future was dropped first (a Ctrl-C, a give-up, or a fault elsewhere in the run), no error named the tx. The user was told to "run the same command again". A re-run before the tx confirmed opened a second pool and escrowed a second deposit.The rule now: a command never exits without naming an
openPoolwhose receipt it did not read.open_pooltakesOption<&UnconfirmedOpens>.RunFunding::reporting_opens_toandBundlePullerBuilder::unconfirmed_opens. A bundle pass reset keeps it.fetch,bundle pullandpool openname every pending open when they end (name_unconfirmed_open).EX_TEMPFAILtells a wrapper that a re-run is safe).escrowed_but_untracked.pool open: now handles Ctrl-C around the open.bundle pull --hash: the Ctrl-C watch now starts before the paid manifest fetch.OpenUnconfirmednow points todecdn pool list --all, because the plainpool listreads only the local store, which never recorded a dropped open.None. The open runs in a detached task, so its own handling covers it (fix: daemon can escrow a second deposit after an openPool receipt failure #2415).Out of scope
top_uphas the same Ctrl-C exposure, but the deposit goes into a pool the user already owns. fix: CLI tx paths wait for a receipt with no timeout #2433 tracks its unbounded wait.Test plan
buyer_pooltests, on a scripted transport:adoption_testspin both open sites infunding.rsto the run's handle. Each test fails if its site passesNone.interrupttests: stop message and exit code for an interrupt or give-up, with and without a pending open; every pending open is named; an open the error already carries is not named twice.cargo clippy --workspace --all-targets --all-features -D warnings,cargo docwith warnings denied, fmt, pre-commitcargo nextest run -p decdn-client -p decdn-cli -p decdn-node -p decdn-e2e: 3325 passeddecdn-clientregeneratedNoneargument.decdn pool openon Arbitrum Sepolia just after the broadcastCloses #2418
🤖 Generated with Claude Code