Skip to content

fix(cli): name a topUp that may still mine on every decdn get exit #2491

Closed

Description

@thiras

Problem

decdn get names an openPool that may still mine on every exit, but no exit names a topUp that may still mine. A rerun can therefore escrow a second top-up beside the first.

UnconfirmedOpens holds an open from its submit until its receipt is read. The CLI reads opens.pending() on every exit:

  • name_unconfirmed_open (crates/cli/src/commands/interrupt.rs) turns an Ok into an error that names the tx.
  • stop_exit refuses EX_TEMPFAIL (75, "a rerun is safe") while an open is pending.
  • A second Ctrl-C prints each pending open before it exits.

A topUp gets none of this. RunFunding holds a TopUpUnconfirmed only after top_up returns it, which happens at the 3-minute receipt bound (#2433). Nothing in decdn-cli reads it. These exits drop an in-flight topUp future and say nothing about it:

  1. Give-up mid-wait. A recovery step's topUp is waiting for its receipt when the no-progress limit fires (--give-up-after-secs). Recovery runs exactly when no bytes are verifying. The command exits 75 with "rerun to resume", and the rerun can send a second topUp.
  2. Ctrl-C mid-wait. "interrupted; run the same command again to resume" names only pending opens.
  3. A bundle sibling dropped. run_groups (crates/client/src/bundle/engine.rs) drops every other entry on the first command-scope fault, including a refill or recovery topUp still in flight.
  4. After a successful fetch. drain_builds waits BUILD_DRAIN (30 s), which is shorter than RECEIPT_TIMEOUT. A late lane build whose refill topUp is still waiting is dropped with a WARN that names no tx. The command exits 0.

top_up logs the tx hash at broadcast (topUp broadcast; awaiting its receipt), but only with tracing turned on. On main, this gap already existed for the unbounded wait.

Fix direction

  • Mirror UnconfirmedOpens for topUp:
    • Hold TopUpUnconfirmed { tx: None, nonce } before the send.
    • Set tx once the hash is known.
    • Release the entry only when the receipt is read or the submit is rejected.
    • Expose the held entries alongside RunFunding::opens(), and on BundlePuller.
  • Feed the held entries to name_unconfirmed_open, the Interrupt watcher and stop_exit, so that:
    • a pending topUp turns an Ok exit into an error that names the tx;
    • it rules out exit 75;
    • a second Ctrl-C prints it.
  • Keep the in-run refusal from fix(cli,client,node)!: bound receipt waits so a dropped tx cannot hang #2490 (escrow_top_up). It can then read the same held set.

Checks

  • A give-up (paused clock) while a recovery step's topUp waits on a parked receipt exits with a non-75 code and names the tx.
  • A successful bundle pull with a late refill still in flight at drain_builds reports the topUp.
  • A second Ctrl-C prints a pending topUp.

Follow-up from the #2490 review.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. assigned and unassigned on Oct 17, 2026
  3. moved this from Backlog to In progress in deCDNon Oct 17, 2026
  4. moved this from In progress to Done in deCDNon Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions