Skip to content

fix(node): report a redeemMany or reclaim send with no answer as possibly broadcast (#2568) - #2574

Merged
thiras merged 2 commits into
mainfrom
fix/node-send-leg-marker-2568
Oct 21, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/node-send-leg-marker-2568

Conversation

@thiras

@thiras thiras commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

The node's wallet providers carry SendLegLayer (#2567), but nothing in crates/node read the marker. The seller's redeemMany and the buyer's reclaim sweep reported every failed .send() as "nothing issued". A send request that timed out, reset or got a 5xx was logged as refused and counted into decdn_redemption_failures_total, even though the transaction may be in a mempool.

  • onchain_tx::TxOutcome splits SendErr on decdn_incentive::tx::send_broadcast_unknown into SendErr (refused, or a chain read before the send failed) and MaybeBroadcast.
  • submit_chunk: MaybeBroadcast warns that the send failed with no tx hash, but the transaction may be in a mempool. This covers a send request with no answer, and an already known, nonce too low or replacement transaction underpriced answer. It counts into the new decdn_onchain_tx_maybe_broadcast_total, not into send_failed or redemption_failures. It is still a chain fault, so a hinted lane parks until a sweep finishes clean. The claims stay: if the redeemMany mined, the next sweep skips the lanes it paid, and a re-send of a still-pending one is an on-chain no-op.
  • reclaim_once: the same split in the log wording. Both cases still count into decdn_buyer_reclaim_failures_total, which already covered the uncertain receipt-wait case.
  • adr/appendix-observability.md gets a row for the new counter, and the send_failed / redemption_failures rows are updated. CHANGELOG entry added.

Closes #2568

Reviewer notes

  • Start with onchain_tx.rs (the split), then payment_settlement.rs (submit_chunk, is_chain_fault, is_redemption_failure).
  • The oversize-split guard still matches SendErr only. An oversize answer is a JSON-RPC error response or an HTTP 4xx, and both read as definite.
  • Unchanged on purpose: the existing mocked_* fixtures use ProviderBuilder::new(), so their sends fail in the fill leg and stay SendErr.
  • Alert coverage: Alert and panel for decdn_onchain_tx_maybe_broadcast_total (redeemMany send failed with no tx hash) devops#170. These sends used to count into decdn_redemption_failures_total, which DecdnRedemptionFailing watches. Until that issue lands, nothing alerts on a send leg that keeps failing. The issue asks for a separate rule shaped like DecdnRedemptionFailing, not an addition to DecdnOnchainTxUnconfirmed: that rule fires on the first event (for: 0m), so harmless seller/buyer nonce collisions would page, and its runbook needs a tx hash these sends don't have.
  • Second commit: review follow-up (wording, docs, answer-path tests).

Verification

  • cargo fmt -- --check
  • cargo clippy -p decdn-node --all-targets --all-features -- -D warnings (only crates/node changed)
  • cargo nextest run -p decdn-node -p decdn-incentive: 2082 passed
  • CARGO_BUILD_WARNINGS=deny cargo doc -p decdn-node --no-deps --document-private-items, make -C adr check-refs, pre-commit
  • New tests: a filler-free marked send classifies as MaybeBroadcast; a table of RPC answers (nonce too low, already known and replacement transaction underpriced are possibly broadcast, insufficient funds is refused), plus nonce too low and insufficient funds reclaim cases; marked redeemMany and reclaim with no answer versus a failing gas estimate (refused) via redeem_planned_lanes / reclaim_once; the classifier tables include the new arm. I mutated the four new branches one at a time, and each mutation fails at least one test. Narrowing either check to transport failures only also fails a test.
  • contracts/ changed: n/a
  • User-visible change: CHANGELOG.md entry added
  • Design change: adr/appendix-observability.md rows updated
  • PR title uses an allowed type with a lowercase subject

🤖 Generated with Claude Code

…ibly broadcast (#2568)

The node's wallet providers carry SendLegLayer, but the redeemer and the
reclaim sweep read every failed send as "nothing issued". Split
TxOutcome::SendErr on decdn_incentive::tx::send_broadcast_unknown into
SendErr and MaybeBroadcast. A MaybeBroadcast redeemMany warns that the
transaction may be in a mempool, counts into the new
decdn_onchain_tx_maybe_broadcast_total instead of send_failed and
redemption_failures, and still parks a hinted lane. The reclaim sweep
warns the same way and keeps metering buyer_reclaim_failures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 12:21
@thiras thiras self-assigned this Oct 21, 2026

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 focused reporting changes preserve retry behavior, include targeted regression coverage, and have no unresolved findings.

No open issues 🎉

What changed in this PR

Corrects node transaction reporting for #2568 by distinguishing possibly broadcast sends from definite failures, using the existing send-leg marker.

Changes:

  • Adds MaybeBroadcast classification and a dedicated settlement counter.
  • Updates settlement and reclaim warnings without changing retry behavior.
  • Adds regression tests and updates observability documentation.
File Description
crates/​node/​src/​runtime/​tests.rs Updates wallet-provider test documentation.
crates/​node/​src/​runtime/​mod.rs Updates the send-leg marker comment.
crates/​node/​src/​payment_settlement/​tests.rs Tests classification, counters, and chain-fault handling.
crates/​node/​src/​payment_settlement.rs Handles possibly broadcast settlements separately.
crates/​node/​src/​onchain_tx/​tests.rs Tests marked send-failure classification.
crates/​node/​src/​onchain_tx.rs Adds and counts MaybeBroadcast outcomes.
crates/​node/​src/​metrics/​tests.rs Checks the new counter exports at zero.
crates/​node/​src/​metrics.rs Defines the counter and documents accounting.
crates/​node/​src/​buyer_pool/​tests.rs Tests reclaim warnings and retained state.
crates/​node/​src/​buyer_pool.rs Distinguishes uncertain reclaim sends in warnings.
CHANGELOG.md Documents the reporting correction.
adr/​appendix-observability.md Updates transaction metric definitions.

Review effort: Balanced

@github-code-quality

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

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main f2c9082 fix/node-send-leg-ma... 39a920e +/-
77% 77% 0%
View coverage of the 6 most impacted files.
File main f2c9082 fix/node-send-leg-ma... 39a920e +/-
crates/client/src/lib.rs 89% 89% 0%
crates/node/src/buyer_pool.rs 82% 82% 0%
crates/node/src...gin/pull_leg.rs 84% 84% 0%
crates/node/src/onchain_tx.rs 89% 89% 0%
crates/protocol/src/framing.rs 92% 93% +1%
crates/node/src/dht/publish.rs 78% 80% +2%

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


Updated October 21, 2026 13:19 UTC

…he answer path (#2568)

Review follow-up. `send_broadcast_unknown` also reads three JSON-RPC
answers (`already known`, `nonce too low`, `replacement transaction
underpriced`) as uncertain, so the redeemMany and reclaim warnings say
"failed with no tx hash" rather than "got no answer". Tests now drive
those answers through the classifier and the reclaim sweep, plus an
`insufficient funds` answer that stays refused.

Docs: MaybeBroadcast, the maybe_broadcast counter and its ADR row say the
transaction may have mined, that a seller/buyer nonce collision gives the
same answers with nothing broadcast, and what a steady rate means; the
CHANGELOG no longer claims the watermark read settles a mined redeemMany;
SendErr covers a send that never connected; the reclaim sweep is named as
an uncounted buyer-side transaction; incentive's tx docs list the node as
a reader of the marker; over-width doc lines rewrapped.

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.

node: a redeemMany or reclaim send whose request failed in transport is counted as refused, not possibly broadcast

2 participants