Repository navigation
Description
Found during review of #1568. Sibling of #1550 — same root cause: tx.rs cannot express the difference between its failure shapes, so the CLI receipt makes a claim it cannot support.
Problem
decdn_incentive::tx::send_for_receipt records the hash after call.send() returns (crates/incentive/src/tx.rs:81-93):
let pending = call.send().await.with_context(|| { ... })?;
let hash = *pending.tx_hash();
*landed = Some(hash);So an Err from send() always leaves landed == None. Callers read that as "nothing was broadcast" — crates/cli/src/commands/publish.rs renders it through single_tx_status as status=failed / submitted=false, and namespace_failure_context deliberately attaches no warning to that state, because a rejected send really did mint nothing.
But send() covers two outcomes that are indistinguishable from the client:
- The node rejected the request — pre-flight gas estimate (
NamespaceCapReached), bad nonce, malformed tx. Nothing was broadcast. Correctlyfailed. - The node accepted the request and the response was lost — HTTP timeout, connection reset, a 502 from an RPC load balancer. The transaction is in the mempool and may mine.
eth_sendRawTransaction is not idempotent from the client's point of view, and send_for_receipt's own error text already concedes that transport errors surface at this point. In case 2 the CLI prints an unambiguous "nothing happened" with no hash and no warning; the operator re-runs, and for publish namespace create that mints a second namespace against maxNamespacesPerPublisher, permanently — namespaces cannot be deleted, and the first is still owned with its id unrecovered.
Why it is not #1550
#1550 is about a confirmed revert losing its hash (the tx mined, landed is cleared at tx.rs:104). This is the send side: no hash was ever recorded, and unlike a revert, the truth is genuinely unknown rather than merely unreported. A fix for #1550 that only adds revert provenance leaves this case untouched. Worth solving together since both are "landed: Option<B256> cannot carry the outcome".
Possible directions
- Classify the send error. Distinguish a provider-side rejection (JSON-RPC error response) from a transport failure (timeout/reset/5xx), and give the latter its own state — the tx hash is computable from the signed transaction before broadcast, so it can be reported even when the response was lost.
- Warn whenever a nonce may have been consumed. Cheaper: on a transport-class send failure, attach a "the transaction may still have been broadcast — check for a pending or mined tx from this signer before re-running" note. Less precise, but it stops the confident "nothing happened".
Also worth covering
send_for_receipt has no unit test. crates/incentive/src/tx.rs's mod tests covers run_then_cleanup only. The invariant the whole failed-vs-unknown split rests on — that a confirmed revert clears the hash while an unreadable receipt keeps it — is verified by nothing in the repo, and the e2e assertion that looks like it covers the revert path is annotated as a pre-flight gas-estimate rejection, so receipt.status() == false never executes in any test.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(cli): make the namespace-create recovery path one that actually w…
fix(cli): print the namespace-create receipt before a post-receipt fa…
Merge main into #1550/#1577 fix, reconciling with #1578
fix(cli): carry revert + lost-response outcomes into publish receipts (…
fix: warn when a failed USDC approve send may have broadcast
fix: warn when a failed pool send may have broadcast (#2424)