Skip to content

fix(incentive): treat an "already known" send rejection as possibly broadcast - #2560

Merged
thiras merged 3 commits into
mainfrom
fix/2432-already-known-maybe-broadcast
Oct 20, 2026
Merged

thiras merged 3 commits into
mainfrom
fix/2432-already-known-maybe-broadcast

Conversation

@yigitdot

@yigitdot yigitdot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • tx::send_broadcast_unknown treated every JSON-RPC error response as a clean rejection. already known / known transaction means the node already holds this signed tx (for example after a gateway retried eth_sendRawTransaction on a second backend), so the tx may still mine.
  • Those two messages (case-insensitive; unknown transaction … excluded) now classify as maybe-broadcast. Every caller picks this up: pool close/reclaim warn and --all counts the pool unconfirmed, send_for_receipt sets MaybeBroadcast (publish statuses, key rotation, bond/register/appeal), open_pool/top_up keep OpenUnconfirmed/TopUpUnconfirmed, and approve says the tx may be pending.
  • is_nonce_collision is unchanged and does not match them, so topUp never re-sends such a tx on a fresh nonce.
  • Docs, comments, operator log lines, docs/runbook.md, docs/sponsord/operator.md and adr/appendix-observability.md that said a no-hash submit means a transport failure now name the already-known case. A no-hash send now says the tx "may be in a mempool"; the approve note says a re-approve to the same value is harmless.
  • The related nonce too low race is out of scope here (buyer_pool: a gateway-retried openPool/topUp answered nonce too low is treated as a foreign collision and double-escrows #2562 / fix(incentive): report a nonce too low send as possibly broadcast (#2562) #2563).

Test plan

  • tx::tests: classifier (incl. a prefixed known transaction), send_for_receipt → MaybeBroadcast with warning / Rejected without
  • buyer_pool::tests: already-known openPool keeps OpenUnconfirmed; topUp keeps TopUpUnconfirmed and reads no fresh nonce; approve says it may be pending
  • pool::tests: already-known closePool carries TxUnconfirmed and tallies as unconfirmed
  • Mutation check: reverting the ErrorResp arm to false fails all 6 new tests
  • cargo nextest run -p decdn-incentive -p decdn-client -p decdn-cli -p sponsord-core (2339 passed), -p decdn-node buyer_pool (117 passed)
  • cargo fmt -- --check, cargo clippy --workspace --all-targets -- -D warnings, cargo doc gate

Closes #2432

🤖 Generated with Claude Code

…roadcast

send_broadcast_unknown treated every JSON-RPC error response as a clean
rejection. `already known` (geth, reth, Nitro) and `known transaction`
(older geth) mean the node already holds this signed tx, so it may still
mine. Those messages now classify as maybe-broadcast; `unknown
transaction ...` and every other rejection stay definite. is_nonce_collision
does not match them, so topUp never re-sends them on a fresh nonce.

Closes #2432

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-code-quality

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

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main c7dd19e fix/2432-already-kno... 7098584 +/-
77% 77% 0%
View coverage of the 3 most impacted files.
File main c7dd19e fix/2432-already-kno... 7098584 +/-
crates/client/src/lib.rs 89% 89% 0%
crates/node/src...gin/pull_leg.rs 84% 84% 0%
crates/incentive/src/tx.rs 55% 75% +20%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 20, 2026 13:53 UTC

…end docs

The SendOutcome, send and send_for_receipt comments said only a
transport-class failure leaves the broadcast unknown. An `already known`
answer does too (#2432).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ller

Adds caller-level tests for #2432: openPool keeps OpenUnconfirmed, topUp
keeps TopUpUnconfirmed and reads no fresh nonce, approve says the tx may be
pending, closePool carries TxUnconfirmed and counts as unconfirmed, and
send_for_receipt sets MaybeBroadcast with its warning (and Rejected, with
none, for any other rejection). The matcher test gains a prefixed
`known transaction` case.

The docs, comments, operator log lines, runbook and ADR text that said a
no-hash submit means a transport failure now name the already-known case
too. A no-hash send reports that the tx may be in a mempool, and the
approve note says a re-approve to the same value is harmless. The
CHANGELOG entry lists every chain write the verdict reaches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yigitdot
yigitdot requested a review from thiras October 20, 2026 13:58
@thiras
thiras requested a balanced review from Copilot October 20, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The narrow classifier change reuses existing uncertainty handling, has targeted regression coverage, and has no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@thiras
thiras merged commit 8dabb4f into main Oct 20, 2026
35 checks passed
@thiras
thiras deleted the fix/2432-already-known-maybe-broadcast branch October 20, 2026 14:02
yigitdot added a commit that referenced this pull request Oct 20, 2026
…2562)

Fold `nonce too low` into send_broadcast_unknown, as #2560 did for
`already known`: every chain write (send_for_receipt, pool close/reclaim,
approve, publish) now reports it as MaybeBroadcast, and open_pool /
send_top_up need no separate check. is_nonce_spent goes away.

Narrow is_nonce_collision's safety claim to the answering backend and
point at #2565 for the remaining gateway-retry risk of the underpriced
re-send. Add a test for `nonce too low` after a collision re-send, and fix
review comments on the docs and CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
thiras pushed a commit that referenced this pull request Oct 20, 2026
…2562) (#2563)

* fix(client): keep an openPool/topUp answered `nonce too low` unconfirmed (#2562)

A gateway that retries the same signed bytes on a second backend gets
`nonce too low` once the first copy is sequenced. is_nonce_collision read
that as a foreign collision that broadcast nothing, so topUp re-sent on a
fresh nonce and openPool released its entry: either could escrow twice.

is_nonce_collision now matches only `replacement transaction underpriced`;
the new is_nonce_spent matches `nonce too low`, which open_pool and
send_top_up treat as possibly broadcast at the pinned nonce.

Closes #2562

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(incentive): report a `nonce too low` send as possibly broadcast (#2562)

Fold `nonce too low` into send_broadcast_unknown, as #2560 did for
`already known`: every chain write (send_for_receipt, pool close/reclaim,
approve, publish) now reports it as MaybeBroadcast, and open_pool /
send_top_up need no separate check. is_nonce_spent goes away.

Narrow is_nonce_collision's safety claim to the answering backend and
point at #2565 for the remaining gateway-retry risk of the underpriced
re-send. Add a test for `nonce too low` after a collision re-send, and fix
review comments on the docs and CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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: an "already known" send error is treated as a clean rejection

3 participants