Repository navigation
fix(node): drop the redeemer's per-voucher getAuthorizations read - #1961
Merged
Merged
Conversation
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]>
There was a problem hiding this comment.
🟢 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 fromregistered_until(no chain reads). - Delete the batched
getAuthorizationshelper and theRegistrationStatus::Fetchedpath; makeplan_lanessynchronous. - Update planning behavior + tests: unregistered lanes attach a
CapabilityRegfromowner_sig; missingowner_sigis 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.
Coverage reportTotal: 82.69% (was 82.64%, ▲ +0.05%) — 74455/90042 lines
History
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (fix #2 from the log investigation)
The node-side
getAuthorizationsspam seen in production: the hint-driven redeemer issued onegetAuthorizationseth_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:owner_sig(captured + verified against the pool owner at admit, fix(node): confirm a pool on-chain before admitting a serve #1956/fix(node): confirm signer cap headroom on-chain before admitting a serve #1958), stored in the same fsynced row as the frontier (Surface operator eth address indecdn node status#1906) — so a lane with redeemable value always has the material to register its signer. The client sends the capability once; it is never asked to re-send._registerCapabilityis idempotent — re-attaching aCapabilityRegfor a signer another provider already registered is a harmless no-op, and it reverts only on a bad owner signature, which a validatedowner_signever is.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 isRegisterediff this node has landed its registration (registered_untilstill live), elseUnregistered→ attach aCapabilityRegfrom the heldowner_sig. The first landed redemption persistsregistered_until, so every later pass attaches nothing (one idempotent reg at most, even for a signer registered elsewhere).PoolProjection) — the same solvency model the serve path uses.owner_sigbranch stops saying "wait for the client to re-send" — that's a node durability fault (value without itsowner_sig, which can't happen since they're written/lost together), now logged aterror!and skipped.batched_authorizationsand theRegistrationStatus::Fetchedread 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
capdrained by another node mid-stream, mirroring the pool-solvency recheck via the projection's per-signerspent) 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_lanetests updated for the collapsedRegistrationStatus(registered omits reg; unregistered-with-owner_sigattaches; unregistered-without is skipped).🤖 Generated with Claude Code