Skip to content

fix: keep the tx hash when a pool tx receipt fetch fails - #2414

Merged
thiras merged 3 commits into
mainfrom
fix/2413-pool-tx-hash
Oct 10, 2026
Merged

thiras merged 3 commits into
mainfrom
fix/2413-pool-tx-hash

Conversation

@thiras

@thiras thiras commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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, as ensure_allowance / top_up / tx::send_for_receipt already do:

  • cli close_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 through tx::send_for_receipt.
  • client open_pool: the receipt error names the tx and is still classified PoolOpenFailureReason::RpcError.
  • node reclaim sweep: tx field on the receipt-failure and reverted warn!s.
  • incentive::tx module doc: describes the CLI pair as reading the hash before the wait.

Test plan

  • New mocked-provider tests (send returns a hash, receipt read fails) for close_and_forget, reclaim_and_forget, and open_pool assert 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 doc with warnings denied
  • rg -n '\.get_receipt\(\)' crates --glob '!crates/e2e/**' --glob '!**/tests*' returns only sites that read tx_hash() first, plus tx.rs and onchain_tx.rs

Closes #2413

🤖 Generated with Claude Code

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]>
@thiras thiras self-assigned this Oct 10, 2026
@github-code-quality

github-code-quality Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit c2c993f in the fix/2413-pool-tx-has... branch remains at 75%, unchanged from commit f41ab4c in the main branch.

Show a line coverage summary of the most impacted files.
File main f41ab4c fix/2413-pool-tx-has... c2c993f +/-
crates/protocol/src/framing.rs 93% 93% 0%
crates/node/src/buyer_pool.rs 63% 65% +2%
crates/node/src/dht/publish.rs 78% 80% +2%
crates/client/s...c/buyer_pool.rs 67% 69% +2%
crates/cli/src/...ommands/pool.rs 53% 57% +4%

Updated October 10, 2026 14:59 UTC

thiras and others added 2 commits October 10, 2026 17:41
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]>
@thiras
thiras merged commit 62d640b into main Oct 10, 2026
30 checks passed
@thiras
thiras deleted the fix/2413-pool-tx-hash branch October 10, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: four pool tx sites lose the tx hash when the receipt fetch fails

1 participant