Skip to content

fix(node): drop the redeemer's per-voucher getAuthorizations read - #1961

Merged
alpergundogdu merged 1 commit into
mainfrom
claude/redeemer-drop-auth-read
Sep 9, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
claude/redeemer-drop-auth-read

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Problem (fix #2 from the log investigation)

The node-side getAuthorizations spam seen in production: the hint-driven redeemer issued one getAuthorizations eth_call per accepted voucher (~1 per MiB) for any lane whose signer wasn't yet marked registered. On a metered RPC that's thousands of billed calls per stuck lane during a single pull.

Root cause: the read is a redundant registration-discovery read. It only answered "is this signer registered, so should I attach a CapabilityReg?" — but the node can answer that locally:

So the read was dead weight, issued per voucher because the skip-guard (registered_until) only latches on a positive result.

Fix

Resolve registration from local durable state only — no chain read:

  • plan_lanes/plan_lane: a lane is Registered iff this node has landed its registration (registered_until still live), else Unregistered → attach a CapabilityReg from the held owner_sig. The first landed redemption persists registered_until, so every later pass attaches nothing (one idempotent reg at most, even for a signer registered elsewhere).
  • The redeemer's only on-chain-derived gate is now pool solvency (the event-fed PoolProjection) — the same solvency model the serve path uses.
  • The no-owner_sig branch stops saying "wait for the client to re-send" — that's a node durability fault (value without its owner_sig, which can't happen since they're written/lost together), now logged at error! and skipped.
  • Deletes batched_authorizations and the RegistrationStatus::Fetched read path (net −82 lines).

Independent of #1958's admit-time getAuthorization (signer cap): that's a serve-path read; this is the redeemer's registration read.

Not in scope (separate follow-up)

The mid-stream signer cap-headroom recheck (catching a shared cap drained by another node mid-stream, mirroring the pool-solvency recheck via the projection's per-signer spent) is a distinct serve-path change and will be its own PR.

Testing

All gates pass locally (independently re-run): build · clippy --all-targets --all-features -D warnings · fmt · doc — clean; cargo nextest run -p decdn-node — 1096 passed, 0 skipped. plan_lane tests updated for the collapsed RegistrationStatus (registered omits reg; unregistered-with-owner_sig attaches; unregistered-without is skipped).

🤖 Generated with Claude Code

The hint-driven redeemer re-issued a `getAuthorizations` eth_call for a
lane on every accepted voucher (~1 per MiB) whenever the signer was not
yet marked registered. The read only answered "is this signer registered,
so should I attach a CapabilityReg?" — a question the node can answer
locally: it already holds a validated `owner_sig` (captured and verified
against the pool owner at admit, #1956/#1958), stored in the same fsynced
row as the frontier (#1906), so a lane with redeemable value always has
the material to register its signer. And `_registerCapability` is
idempotent, so re-attaching a CapabilityReg for a signer another provider
already registered is a harmless no-op. The read was dead weight issued
per voucher — thousands of billed eth_calls per stuck lane.

Resolve registration locally instead: a lane is Registered iff this node
has landed its registration (persisted `registered_until` still live),
else Unregistered → attach a CapabilityReg from the held `owner_sig`. The
first landed redemption persists `registered_until`, so every later pass
attaches nothing. The redeemer's only on-chain-derived gate is now pool
solvency (the event-fed projection), exactly like the serve path.

The no-`owner_sig` case stops telling the client to "re-send its
capability" — the client sent it once; a redeemable lane without
`owner_sig` is a node durability fault, logged at error! and skipped.
Deletes `batched_authorizations` and the `RegistrationStatus::Fetched`
read path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 11:17

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 diff cleanly removes redundant chain reads while keeping registration behavior safe via idempotent on-chain registration and updating the planning/tests consistently.

Pull request overview

This PR removes the redeemer’s per-voucher getAuthorizations chain read during lane planning, relying instead on locally persisted lane state to decide whether to attach a CapabilityReg when redeeming. This fits into the node’s settlement pipeline by reducing RPC load/cost while preserving the ability to register signers on first redemption.

Changes:

  • Collapse registration planning to a local-only RegistrationStatus (Registered/Unregistered) derived from registered_until (no chain reads).
  • Delete the batched getAuthorizations helper and the RegistrationStatus::Fetched path; make plan_lanes synchronous.
  • Update planning behavior + tests: unregistered lanes attach a CapabilityReg from owner_sig; missing owner_sig is treated as a node-side durability fault and skipped.
File summaries
File Description
crates/node/src/payment_settlement.rs Removes redeemer-side getAuthorizations usage and plans registration purely from durable lane state (registered_until + owner_sig).
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Coverage report

Total: 82.69% (was 82.64%, ▲ +0.05%) — 74455/90042 lines

File Coverage Lines Δ
crates/node/src/payment_settlement.rs 62.27% 873/1402 ▲ +2.42%
History
Commit Total Δ vs base
532c9b5 (HEAD) 82.69% ▲ +0.05%

@alpergundogdu
alpergundogdu merged commit 4d99903 into main Sep 9, 2026
26 checks passed
@alpergundogdu
alpergundogdu deleted the claude/redeemer-drop-auth-read branch September 9, 2026 11:39
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.

2 participants