Skip to content

PaymentPool: owner-set capability issuers, ECDSA-only capability signatures, open topUp #2993

Backlog

Description

@alpergundogdu

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 closePool and reclaim.
  • 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_call per new capability, while capability intake today is ecrecover only.

Capabilities are signed per user download, so they need a hot key. A Safe signature is the wrong tool for them.

Proposal

  1. Issuers. The owner names keys that may sign capabilities for a pool.
    • setIssuer(bytes32 poolId, address issuer): owner-only. Marks issuer active.
    • revokeIssuer(bytes32 poolId, address issuer): owner-only. Sets the issuer's validUntil = block.timestamp + disputeWindow.
    • Storage: mapping(bytes32 => mapping(address => uint64)) issuerValidUntil, with type(uint64).max for active and 0 for never set.
    • View: isIssuer(poolId, issuer) for nodes and clients.
    • An issuer signs capabilities and nothing else. closePool and reclaim stay owner-only, and refunds go to the owner.
  2. 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 window closePool gives nodes, and for the same reason. Key rotation is setIssuer(new) then revokeIssuer(old): both keys are valid until the old one's validUntil, which is why issuers are a mapping and not one slot.
  3. Capability signatures are ECDSA only. _registerCapability accepts ECDSA.tryRecover(digest, ownerSig) equal to pool.owner or an issuer with block.timestamp <= issuerValidUntil[poolId][recovered]. The ERC-1271 fallback is removed. A smart-account owner (a Safe) calls setIssuer once as an ordinary transaction and delegates signing to an EOA or KMS key.
  4. Anyone can topUp an open pool. A top-up only adds money, and reclaim refunds 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_call on the serve path and let the issuer repudiate.

Scope

  • contracts/: PaymentPoolBase (storage, two owner functions, a view, events IssuerSet / IssuerRevoked, the _registerCapability check, the topUp owner check removed), tests, gas snapshot, deploy script if it touches the ABI surface.
  • crates/incentive: bindings and an is_issuer read.
  • 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.rs matches a capability to a pool by owner or issuer. decdn pool gains set-issuer / revoke-issuer.
  • crates/sponsord-core: Sponsor::connect accepts 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 (topUp is open to anyone); ADR 024's signature partition (capabilities join vouchers as ECDSA-only); ADR 016 contract inventory and the topUp row.

Closes

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions