Repository navigation
fix: keep the tx hash when a pool tx receipt fetch fails - #2414
Merged
Merged
Conversation
closePool / reclaim in the CLI, openPool in the client, and the node's reclaim sweep read the receipt without first reading the tx hash, so a receipt failure named no transaction — the one case where the tx may still mine and re-sending can double-spend. Each site now reads `*pending.tx_hash()` before the wait and carries it in the error (or as a `tx` field on the node warn). Closes #2413 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit c2c993f in the Show a line coverage summary of the most impacted files.
Updated |
Review follow-ups for #2413: the openPool / closePool / reclaim mined-revert errors and the node reclaim sweep's success and forget-failure logs carry the tx hash. The tx.rs module doc states the read-hash-first rule in present tense, and open_pool's doc says a receipt-read error ends the unbounded wait and leaves reconciliation to the caller. Adds a node test that the sweep's receipt-failure warning names the tx. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ures Second-pass review follow-ups for #2413: open_pool logs its tx at info before the unbounded receipt wait, so a caller that drops the future still leaves the hash in the log. The approve receipt-error and revert and the topUp revert name their tx. The tx.rs rule is scoped to production code, with the e2e fixtures exempt. Tests pin the reclaim_reverted tx note and that a failed sweep receipt keeps the pool row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Four hand-rolled send →
get_receipt()sites read the receipt without reading the tx hash first. A receipt failure therefore named no transaction, in exactly the case where the tx may still mine and re-sending can double-spend. Each site now reads*pending.tx_hash()before the wait, asensure_allowance/top_up/tx::send_for_receiptalready do:cliclose_and_forget/reclaim_and_forget:"{closePool,reclaim} sent (tx 0x…) but the receipt could not be fetched; it may still mine — check the tx before re-running". The pool-specific revert wording is unchanged, which is why these stay hand-rolled rather than going throughtx::send_for_receipt.clientopen_pool: the receipt error names the tx and is still classifiedPoolOpenFailureReason::RpcError.nodereclaim sweep:txfield on the receipt-failure and revertedwarn!s.incentive::txmodule doc: describes the CLI pair as reading the hash before the wait.Test plan
sendreturns a hash, receipt read fails) forclose_and_forget,reclaim_and_forget, andopen_poolassert the error contains the hash. Mutation-checked: dropping the hash from each message fails its test.cargo nextest run -p decdn-cli -p decdn-client -p decdn-node -p decdn-incentive(3499 passed)cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo fmt --check,cargo docwith warnings deniedrg -n '\.get_receipt\(\)' crates --glob '!crates/e2e/**' --glob '!**/tests*'returns only sites that readtx_hash()first, plustx.rsandonchain_tx.rsCloses #2413
🤖 Generated with Claude Code