Repository navigation
fix: count a maybe-broadcast pool tx as unconfirmed in --all sweeps - #2430
Merged
Merged
Conversation
`pool close --all` and `pool reclaim --all` counted every per-pool error as failed, so the summary, the final error and the exit code reported a definite failure for a tx that may still mine. A `closePool`/`reclaim` send that fails in transport, or a broadcast tx whose receipt cannot be read, now carries a typed `TxUnconfirmed` context (its Display keeps the existing messages). `BatchTally` counts those apart from failures, the summary prints an `unconfirmed` count, and `batch_result` names it with a check-before-re-running note. The exit code stays nonzero. A JSON-RPC rejection still counts as failed. Closes #2427 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The typed classification, reporting paths, and focused tests consistently implement the stated behavior.
0 open findings
What changed in this PR
Separates uncertain pool transactions from definite failures during batch close/reclaim operations.
Changes:
- Adds typed
TxUnconfirmederror classification and batch tallying. - Updates operator messages and tests for uncertain broadcasts.
- Documents the behavior change.
| File | Description |
|---|---|
crates/cli/src/commands/pool.rs |
Classifies and reports unconfirmed transactions. |
crates/cli/src/commands/pool/tests.rs |
Tests error markers and batch summaries. |
CHANGELOG.md |
Records the user-visible behavior change. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The close --all test had one rejected and one transport-failed pool, so a swapped classifier still produced 1 failed / 1 unconfirmed. Queue two rejections and one transport failure instead, add the same test for reclaim --all (with a mocked head block), and test `record_error` directly. Tighten the `send_failed` doc now that its note lives in `TxUnconfirmed`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 12, 2026
7 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
decdn pool close --allandpool reclaim --allcounted every per-pool error asfailed. That included a send that may have broadcast (#2416) and a broadcast tx whose receipt could not be read. The summary line, the final error and the exit code all reported a definite failure, so an operator or wrapper reading only the last line could re-run and double-submit.TxUnconfirmed { label, tx: Option<TxHash> }, modelled onOpenUnconfirmed/TopUpUnconfirmed.send_failedattaches it whensend_broadcast_unknownholds.close_and_forget/reclaim_and_forgetattach it when the receipt read fails.BatchTallygainsunconfirmed(disjoint fromfailed) andrecord_error, which classifies bydowncast_refinstead of matching text. For these cases the per-pool line reads "close of pool X unconfirmed: …".…, failed F, unconfirmed U.batch_resultnames both counts, e.g. "2 pool(s) failed to close, and 1 pool(s) may have broadcast a close transaction — check this signer's pending and mined transactions before re-running; see the summary above".Closes #2427
Reviewer notes
TxUnconfirmedandBatchTally::record_errorincrates/cli/src/commands/pool.rs.TxUnconfirmed'sDisplayrenders the same text as before, so single-pool (--pool) output does not change. The exit code stays nonzero for unconfirmed pools. A JSON-RPC rejection, an estimation revert, a mined revert, agetPoolread failure and a post-landing row-clear fault still count asfailed.send_broadcast_unknownalso marks a transport failure in the provider's fill stage (eth_estimateGas, nonce read) as maybe-broadcast. That is conservative and matchesopen_pool/top_up. A landed close whose local row-clear faults still counts as failed (overlaps fix: pool close/reclaim leave the local row on a pool that is no longer Open #2425).openPool) touch the same file but are separate fixes.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-cli pool::: 54 passed. New tests:close_all_…andreclaim_all_counts_a_transport_failed_send_as_unconfirmed(mocked provider, two rejected sends and one transport-failed send → 2 failed, 1 unconfirmed),record_error_splits_unconfirmed_from_failed, andbatch_result_names_unconfirmed_pools_apart_from_failed_ones. Mutation-checked: an inverted classifier fails all three tally tests. The existing transport / rejected / unreadable-receipt tests forclosePoolandreclaimnow assert the marker too.CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemscontracts/changed: n/aCHANGELOG.mdentry added🤖 Generated with Claude Code