Repository navigation
fix(cli,client)!: name a topUp that may still mine on every decdn get exit - #2499
Merged
Merged
Conversation
… exit A refill or recovery topUp whose receipt wait was dropped (a give-up, a Ctrl-C, a sibling bundle fault, the late-build drain) left no record, so decdn get exited 75 or 0 and a rerun could escrow a second top-up. UnconfirmedOpens becomes UnconfirmedEscrows, which holds both openPool and topUp entries (EscrowUnconfirmed). top_up takes the handle and holds the topUp from before its submit until its receipt is read, as open_pool does. RunFunding refuses a second topUp from the same handle, and the CLI's name_unconfirmed_escrows, stop_exit and second-Ctrl-C print read it, so a pending topUp is named, rules out exit 75 and fails an Ok exit. Closes #2491 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0123DU1V2G3UnrwF2o9g4XHa
There was a problem hiding this comment.
🟡 Changes recommended
Tracking gaps and removal of equal entries can still hide potentially broadcast top-ups.
2 open issues
What changed in this PR
Extends pending-transaction tracking to top-ups so decdn get reports escrow that may still occur after cancellation or completion.
Changes:
- Shares open and top-up tracking across fetches and passes.
- Updates exit reporting, SDK APIs, regression tests, and release notes.
| File | Description |
|---|---|
| crates/node/src/buyer_pool.rs | Adapts the top-up call signature. |
| crates/e2e/tests/cli_fetch_topup.rs | Updates the integration-test call. |
| crates/client/tests/snapshots/public_api__public_api.snap | Records SDK API changes. |
| crates/client/src/funding/adoption_tests.rs | Tests dropped recovery top-ups. |
| crates/client/src/funding.rs | Uses shared tracking for funding refusal. |
| crates/client/src/buyer_pool/tests.rs | Tests top-up tracking lifecycle. |
| crates/client/src/buyer_pool.rs | Tracks unconfirmed opens and top-ups. |
| crates/client/src/bundle/engine.rs | Preserves tracking between passes. |
| crates/client/src/bundle.rs | Exposes shared escrow tracking. |
| crates/cli/src/commands/pool.rs | Adapts pool commands to updated APIs. |
| crates/cli/src/commands/interrupt/tests.rs | Tests escrow reporting and exit status. |
| crates/cli/src/commands/interrupt.rs | Reports pending top-ups on interruption. |
| crates/cli/src/commands/fetch.rs | Shares tracking across fetches. |
| crates/cli/src/commands/bundle_pull.rs | Reports unresolved bundle funding. |
| CHANGELOG.md | Documents behavior and SDK changes. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 8 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
- A topUp submit with no hash reads "returned no tx hash", not "failed in transport": a submit dropped in flight holds no hash either. - UnconfirmedEscrows::remove releases one entry, so two calls that hold equal entries each release their own. - A submit that returns a hash is swapped for the broadcast entry under one lock (open_pool and top_up), so a second Ctrl-C never reads it as held neither way. - EscrowUnconfirmed is a list entry, not an error marker; opens/top_ups are crate-private; RunFunding's lock is top_up_serial. - decdn pool top-up watches Ctrl-C and names its topUp, as pool open does. - Docs that named only openPool now name topUp too. - Tests: a transport-failed submit stays held, a nonce collision releases its entry before the re-send, retries that run out hold nothing, equal entries release one at a time, a later pass is refused, and a mid-submit topUp line names its nonce. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0123DU1V2G3UnrwF2o9g4XHa
Contributor
Author
|
Pushed 7996df3 to address the multi-agent review:
Not fixed here:
🤖 Generated with Claude Code |
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
decdn getnamed anopenPoolthat may still mine on every exit, but never atopUp. A refill or recoverytopUpwhose receipt wait was dropped left no record. Four exits did this: a give-up, a Ctrl-C, a fault in a sibling bundle entry, and the 30 sdrain_buildscutoff after a fetch that succeeded. The command then exited 75 or 0, and a rerun could escrow a second top-up.UnconfirmedOpens→UnconfirmedEscrows, which holdsEscrowUnconfirmed::{Open, TopUp}.pending()returns both kinds;opens()andtop_ups()return one kind each.top_uptakesOption<&UnconfirmedEscrows>and holds thetopUpthe same wayopen_poolholds an open:{tx: None, nonce}across the submit (and after a transport failure), then{Some(tx), nonce}until the receipt is read.RunFunding's in-run refusal (fix(cli,client,node)!: bound receipt waits so a dropped tx cannot hang #2490) reads the same handle. Its tokio mutex now only serializestopUps. The handle is shared across passes and fetches, so the refusal now covers them too.name_unconfirmed_escrows,stop_message/stop_exitand the second-Ctrl-C print all reporttopUps. A carriedTopUpUnconfirmedis not named twice, and it also rules out exit 75.open_poolstill refuses only on a held open. The node anddecdn pool top-uppassNone, so their behavior is unchanged.BREAKING (SDK):
top_upgains an argument beforereceipt_timeout. Renames:UnconfirmedOpens→UnconfirmedEscrows,BundlePullerBuilder::unconfirmed_opens→unconfirmed_escrows,RunFunding::reporting_opens_to/opens→reporting_escrows_to/escrows. The CHANGELOG is updated, and the public-api snapshot is regenerated.Out of scope:
decdn pool top-upinstalls no Ctrl-C watch. That gap predates this PR, and the handle can close it in a one-line follow-up.Test plan
buyer_pooltests: atopUpdropped in its receipt wait or in its submit stays held; a read receipt and a rejected submit leave nothing held; a heldtopUpdoes not refuse an open.adoption_tests: a recovery step dropped mid-wait leaves thetopUpin the run's handle, and a later refill refuses with it. The two existing refusal tests now read the handle.interrupttests: a give-up with a pendingtopUpnames the tx and is not 75;Okplus a pendingtopUpis an error; an interrupt names opens andtopUps one per line; a carriedtopUpis not named twice.topUpdowncast fails 1.cargo nextest run -p decdn-client -p decdn-cli -p decdn-node(3461 passed), clippy--all-targets --all-features -D warnings,cargo docwith warnings denied, the public-api test.Closes #2491
🤖 Generated with Claude Code
https://claude.ai/code/session_0123DU1V2G3UnrwF2o9g4XHa