Skip to content

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

Closed

Description

@thiras

Problem

crates/incentive/src/tx.rs exists (#1355) because each hand-written send-and-receipt sequence made the same mistake. When get_receipt() fails, the error names no transaction. That is the case where the operator needs the hash most. The transaction may still be in flight, and sending it again can cause a duplicate spend.

Four production sites still have this bug. Each one sends, then calls pending.get_receipt() and does not first read *pending.tx_hash(). The receipt error therefore carries no hash:

Site Call Error on receipt failure
crates/cli/src/commands/pool.rs close_and_forget (~L577) closePool "closePool receipt failed"
crates/cli/src/commands/pool.rs reclaim_and_forget (~L635) reclaim "reclaim receipt failed"
crates/client/src/buyer_pool.rs open_pool (~L499) openPool "await openPool receipt" + PoolOpenFailureReason::RpcError
crates/node/src/buyer_pool.rs reclaim sweep (~L2418) reclaim warn! "reclaim sweep: reclaim receipt failed" (no tx field)

openPool has the highest stakes: it escrows a USDC deposit. If an operator re-runs it after a receipt timeout, they can open a second pool.

Sites that already handle this correctly can serve as models:

  • client/src/buyer_pool.rs USDC approve (~L396) and topUp (~L819) capture *pending.tx_hash() before the wait.
  • node/src/onchain_tx.rs await_receipt does the same and recovers the receipt by hash.

Why the CLI pair is hand-written

close_and_forget / reclaim_and_forget turn both an estimation-time revert and a mined revert into one pool-specific message. They do this because a pool that someone else already closed is a normal race. tx::send_for_receipt would report that as a generic error. The tx.rs module doc names these two sites and says that they lose the hash (#2412).

Fix

At each of the four sites, either:

  • route the call through decdn_incentive::tx::send_for_receipt with a SendOutcome. The CLI pair can then map its revert arm to the pool-specific message. Or:
  • capture let tx = *pending.tx_hash(); before get_receipt() and put it in the error (or as a tx field on the node warn!).

Then remove the "loses the hash too" sentence from the tx.rs module doc. If no hand-written exception is left, remove the paragraph.

Checks

  • A unit test per CLI site where the receipt fetch fails, asserting that the error string contains the tx hash. A provider whose eth_getTransactionReceipt errors is enough.
  • rg -n '\.get_receipt\(\)' crates --glob '!crates/e2e/**' --glob '!**/tests*' shows only sites that read tx_hash() first, or that go through tx.rs / onchain_tx.rs.

Activity

  1. added
    kind:bug
    on Oct 10, 2026
  2. self-assigned this
    on Oct 10, 2026
  3. added
    prio:medium
    area:cli
    area:node
    area:payments
    on Oct 10, 2026
  4. added a commit that references this issue on Oct 10, 2026
    62d640b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:nodearea:paymentskind:bugprio:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions