Skip to content

fix(node): canonicalize the capability owner signature and isolate a reverting redeemMany claim - #2854

Merged
thiras merged 3 commits into
mainfrom
claude/sharp-margulis-6fc5bc
Nov 10, 2026
Merged

thiras merged 3 commits into
mainfrom
claude/sharp-margulis-6fc5bc

Conversation

@yigitdot

@yigitdot yigitdot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

intake_capability parses the owner signature with Signature::from_raw, which accepts recovery bytes 0/1 (and the EIP-155 forms) and recovers the correct owner — but it stored the raw wire bytes. Settlement forwarded them verbatim, and on chain ECDSA.tryRecover returns address(0) for v ∉ {27, 28}, so redeemMany reverted with InvalidCapabilitySignature — the whole chunk, on every sweep, until the capability expired. One capability and one voucher were enough to block a settlement batch.

Four changes:

  • intake stores the canonical signature.as_bytes() (a v=0/1 capability is accepted and normalized to 27/28 — recovery already proved the owner, so refusal would only punish a sloppy but honest encoder);
  • settlement re-canonicalizes stored rows, healing lanes written before this fix (register_lane records only into a vacant lane slot, so intake alone never rewrites an existing row); a row from_raw cannot parse is a node durability fault: logged and skipped, like a missing owner_sig;
  • a redeemMany whose pre-flight gas estimate reverts bisects via the existing submit_halves — the wallet provider estimates before every send, so this refused-send leg, not a mined revert, is how a poisoned claim actually surfaces — and a mined revert of a multi-claim chunk (the estimate-to-inclusion state race) bisects the same way, so a poisoned claim ends alone and the healthy claims land;
  • the warn for a revert that cannot be halved further names the lone claim's lane (pool_id, lane_signer).

Test support: ScriptedRpc::mined_in_order (per-send receipts), reverted_receipt, and erroring_sends (JSON-RPC error answers, as a node answers a reverting estimate).

Closes #2835

🤖 Generated with Claude Code

…reverting redeemMany claim

Intake stores the owner signature as the canonical signature.as_bytes()
(v = 27 + parity) instead of the raw wire bytes, settlement re-canonicalizes
stored rows before building a CapabilityReg, and a reverted multi-claim
redeemMany chunk now halves via submit_halves so a poisoned claim ends alone
while the healthy claims land.

Closes #2835

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 14:30

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 insufficient remaining quota. Try requesting a review at a lower effort level.

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 Nov 6, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Rust, Solidity

Rust / code-coverage/cargo-llvm-cov

main a9fb9c7 claude/sharp-marguli... e830aa0 +/-
77% 77% 0%
View coverage of the 7 most impacted files.
File main a9fb9c7 claude/sharp-marguli... e830aa0 +/-
crates/node/src/dht/publish.rs 78% 77% -1%
crates/client/src/lib.rs 90% 89% -1%
crates/node/src...t_settlement.rs 79% 79% 0%
crates/client/s...undle/engine.rs 65% 65% 0%
crates/node/src...s/client/mod.rs 95% 95% 0%
crates/incentiv...src/test_rpc.rs 97% 98% +1%
crates/protocol/src/framing.rs 92% 93% +1%

Solidity / code-coverage/forge

main a9fb9c7 claude/sharp-marguli... e830aa0 +/-
92% 92% 0%

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


Updated November 07, 2026 01:42 UTC

…parseable owner_sig rows

Review follow-ups: the wallet provider estimates gas before every send, so a
claim the contract refuses surfaces as a refused send (SendErr), not a mined
revert — split that case too (is_revert_send). A stored owner_sig that
from_raw cannot parse is the same durability fault as a missing one: error!
and skip instead of sending a claim known to revert. An unhalved revert's
warn now names the lone claim's lane. Comment/doc corrections (register_lane
vacant-slot guard, submit_halves, MAX_SPLIT_DEPTH, metric docs, ADR
observability rows) and tests for the estimate-revert split, the depth bound,
a transient parent revert, and ScriptedRpc::erroring_sends.

Co-Authored-By: Claude Fable 5 <[email protected]>
@yigitdot
yigitdot requested a review from thiras November 6, 2026 18:02
@thiras
thiras requested a balanced review from Copilot November 6, 2026 20:42

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.

🟡 Changes recommended

The redemption depth limit and reapplied floor can indefinitely block healthy claims after a revert, allowing them to expire unpaid unless unresolved claims retain eligibility or are fully isolated.

1 open issue

Review effort: Balanced

Comment thread crates/node/src/payment_settlement.rs Outdated
// warn-and-retry. Re-sending the chunk's lanes in halves is safe for
// the same reason as the oversize split above.
TxOutcome::SendErr(err)
if lanes.len() >= 2 && depth < MAX_SPLIT_DEPTH && is_revert_send(&err) =>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e830aa0. Revert splits (gas-estimate and mined) no longer take the depth bound: they halve down to the lone claim within the eligible sweep, so no sub-floor sub-chunk is left behind. MAX_SPLIT_DEPTH now bounds only the oversize split. Worst case is 2n − 1 sends for a chunk whose every claim reverts; a deterministic veto fails at the gas estimate, so those sends spend no gas. Test: a_full_chunk_isolates_one_poisoned_claim_in_one_sweep_under_a_floor (300 claims × 4,000 µUSDC, 1,000,000 µUSDC floor, last claim poisoned: 9 splits, 299 claims land, one lone-claim retry).

… sweep

A depth-bounded revert split left a few-claim sub-chunk for the next
sweep, where the per-chunk redemption floor dropped it on its own value,
so its healthy claims waited unpaid until their capabilities expired.
Revert splits now run to single claims; the oversize split keeps
MAX_SPLIT_DEPTH.

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

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@yigitdot

yigitdot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up: this PR keeps the node-side bisection as a workaround, because the deployed PaymentPool still reverts the whole call on one failing claim. The proper fix is a contract change so redeemMany skips failing claims and reports them in an event, after which the bisection can be deleted. Tracked in #2857. Not blocking this PR.

@thiras
thiras merged commit b17a2b4 into main Nov 10, 2026
38 checks passed
@thiras
thiras deleted the claude/sharp-margulis-6fc5bc branch November 10, 2026 20:58
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: capability intake stores the owner signature's raw recovery byte, so a v=0/1 capability reverts every redeemMany batch it joins

3 participants