Repository navigation
Backlog
Description
Problem
Only the pool owner can sign a capability. A pool owner who wants a separate signer (a sponsord daemon, or a key on another host) to issue capabilities has two options today, and both are bad:
- Hand the signer the pool itself. The signer then holds the publisher's funds: it can
closePoolandreclaim. - Make the owner a Safe and have the signer sign through it. A Safe accepts the signer's signature alone only if the signer is a threshold-1 owner, which is full custody of the Safe. A custom fallback handler avoids custody, but the publisher can swap it at any time and void capabilities that nodes already served against. Nodes would also need an
eth_callper new capability, while capability intake today isecrecoveronly.
Capabilities are signed per user download, so they need a hot key. A Safe signature is the wrong tool for them.
Proposal
- Issuers. The owner names keys that may sign capabilities for a pool.
setIssuer(bytes32 poolId, address issuer): owner-only. Marksissueractive.revokeIssuer(bytes32 poolId, address issuer): owner-only. Sets the issuer'svalidUntil = block.timestamp + disputeWindow.- Storage:
mapping(bytes32 => mapping(address => uint64)) issuerValidUntil, withtype(uint64).maxfor active and 0 for never set. - View:
isIssuer(poolId, issuer)for nodes and clients. - An issuer signs capabilities and nothing else.
closePoolandreclaimstay owner-only, and refunds go to the owner.
- Revocation waits out the close grace window. A capability the issuer signed before revocation stays registrable until
validUntil. A node that served against it before revocation can still redeem it. This is the same windowclosePoolgives nodes, and for the same reason. Key rotation issetIssuer(new)thenrevokeIssuer(old): both keys are valid until the old one'svalidUntil, which is why issuers are a mapping and not one slot. - Capability signatures are ECDSA only.
_registerCapabilityacceptsECDSA.tryRecover(digest, ownerSig)equal topool.owneror an issuer withblock.timestamp <= issuerValidUntil[poolId][recovered]. The ERC-1271 fallback is removed. A smart-account owner (a Safe) callssetIssueronce as an ordinary transaction and delegates signing to an EOA or KMS key. - Anyone can
topUpan open pool. A top-up only adds money, andreclaimrefunds it to the owner, so the caller can only give. This separates funding from ownership: a hot wallet or a script refills the pool, while the owner key stays cold.
Owner actions (openPool, setIssuer, revokeIssuer, closePool, reclaim) check msg.sender, so a Safe or a hardware wallet can be the owner. Signing per download moves to an issuer key, and funding to whoever tops up.
Kept out
- A per-issuer spending allowance on-chain. The pool deposit already bounds what an issuer can spend. A publisher who wants a tighter bound keeps the pool small and tops it up often.
- Issuer signatures by ERC-1271. Issuers are EOAs, as voucher signers are. ERC-1271 would put an
eth_callon the serve path and let the issuer repudiate.
Scope
contracts/:PaymentPoolBase(storage, two owner functions, a view, eventsIssuerSet/IssuerRevoked, the_registerCapabilitycheck, thetopUpowner check removed), tests, gas snapshot, deploy script if it touches the ABI surface.crates/incentive: bindings and anis_issuerread.crates/node: capability intake accepts a recovered address that is the owner or a valid issuer. Cache the issuer read like the owner read.crates/cli:capability_pool.rsmatches a capability to a pool by owner or issuer.decdn poolgainsset-issuer/revoke-issuer.crates/sponsord-core:Sponsor::connectaccepts a signer that is the pool owner or an active issuer. The keeper tops up from its own funding wallet, which need not be the owner or the issuer.- ADRs: ADR 003 § Capability delegation, the capability verification text and the owner's role (
topUpis open to anyone); ADR 024's signature partition (capabilities join vouchers as ECDSA-only); ADR 016 contract inventory and thetopUprow.
Closes
- Support ERC-1271 (contract/Safe) pool owners — with registration gas guards #1707 (ERC-1271 pool owners at node intake): capability signatures are ECDSA only, so nodes keep plain
ecrecover. A Safe owner delegates throughsetIssuer, and the registration gas-bomb concern goes away with ERC-1271. - Separate the pool-owner (signing) key from the top-up funding wallet #2547 (separate the pool-owner key from the top-up wallet): issuers split signing from ownership, and an open
topUpsplits funding from both. - Support hardware-wallet (Ledger) signers in sponsord-core #2546 (Ledger signers in sponsord-core): the hardware wallet owns the pool and calls
setIssueronce.sponsordsigns with a hot issuer key and never needs the Ledger.
Related
- PaymentPool/node: any EOA can land a signer registration with no event, and a live lane is never clamped to it #2839 (any EOA can land a signer registration with no event): issuers add one more key that can sign a narrow second capability for a signer. The fix there (payee gate on every
CapabilityReg, aCapabilityRegisteredevent, mid-stream clamp) covers issuer-signed capabilities the same way. Land it before or with this change.
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Projects
- StatusShow more project fieldsBacklog
Activity