Skip to content

Support ERC-1271 (contract/Safe) pool owners — with registration gas guards #1707

Not planned

Description

@alpergundogdu

Summary

The node currently accepts EOA pool owners only. ClientHandler::intake_capability verifies the pool owner's capability signature off-chain with a plain 65-byte ecrecover and drops any non-65-byte (ERC-1271 / contract-wallet) owner signature (crates/node/src/handlers/client/mod.rs:791, docstring at :764 — "this design does not accept contract wallets as pool owners"). The PaymentPool contract itself already supports contract owners via SignatureChecker.isValidSignatureNow in _registerCapability, so this is a node-side functional gap, not a contract one.

Consequence: Safe / smart-account-owned pools do not work with this node — their capabilities are rejected at intake and never served or redeemed. Supporting them (a stated design goal for Safe-owned pools) requires node-side ERC-1271 verification.

What adding ERC-1271 support involves

  • Node-side owner verification must move on-chain for contract owners. An ERC-1271 signature can't be recovered off-chain, so intake would call the owner's isValidSignature (via eth_call / SignatureChecker) instead of ecrecover when the owner is a contract. The wire already carries variable-length owner sigs (WireCapability.owner_signature: Vec<u8>, crates/protocol/src/client.rs:269); the 65-byte pin is only at intake.
  • Keep the EOA fast-path; branch to the on-chain check only for contract owners.

⚠️ Gas concerns — these are the hard part, not the plumbing

A contract owner's isValidSignature runs owner-controlled code during on-chain _registerCapability, which happens inside redeemMany on a signer's first redemption. This introduces gas the redeemer (the node) pays and cannot bound:

  1. Unbounded registration gas. A malicious ERC-1271 owner can make isValidSignature burn arbitrary gas before returning valid. Registration fires once per signer, on first redemption — which for the one-time-payer workload is every lane.
  2. Breaks the redemption chunk-sizing invariant. redeem_max_vouchers_per_tx (default 300) is sized on a bounded per-lane cost — currently ~63.4k gas for a first-time EOA-owner lane (test_redeemMany_gas_firstTime_*, contracts/test/PaymentPool.t.sol; see the DEFAULT_REDEEM_MAX_VOUCHERS_PER_TX doc comment). A gas-bomb lane has no such bound: it costs a fixed huge amount regardless of chunk size, so the reactive halve-retry in submit_chunk cannot rescue it — split down to a one-lane chunk and it still won't fit a block → that lane becomes permanently un-redeemable (node served it, can't collect) and is a general griefing vector (force outsized gas or abandon the claim).
  3. Oversized ownerSig calldata. ERC-1271 sigs are unbounded bytes; a large blob inflates calldata gas (16 gas/byte) even with an execution-gas cap.

Note: the redeem half stays safe regardless — voucher signers are forced EOAs (ecrecover, ~3k, per #1701). Only the registration half is exposed, and only for contract owners.

Required mitigations for any ERC-1271 support

  • Node-side registration-cost guard at intake: eth_estimateGas the on-chain registration before accepting a contract-owner lane and reject abusively expensive owners; cap accepted ownerSig length; optionally allow-list known-good wallet implementations (e.g. Safe singletons).
  • Contract-side bound (defense-in-depth): cap gas forwarded to the ERC-1271 call (isValidSignatureNow{gas: CAP}) — generous enough for legit Safe threshold checks — and a max ownerSig length.

Related

  • Surfaced during PR feat(payments): chunk voucher redemption into gas-bounded redeemMany transactions #1704 (voucher-redemption chunking), whose redeem_max_vouchers_per_tx sizing assumes a bounded per-lane cost.
  • Adjacent to the serve-time over-subscription / refundable-floor M griefing surface: a malicious owner cheaply forcing the node into uneconomic work is the same shape. Consider designing the registration-cost guard alongside that work.

Activity

  1. moved this from Backlog to Blocked in deCDNon Aug 20, 2026
  2. added
    status:mainnet-blocking
    area:contracts
    and removed on Oct 21, 2026
  3. alpergundogdu commented on Nov 25, 2026

    @alpergundogdu
    ContributorAuthor

    Superseded by #2993. Capability signatures become ECDSA only, so nodes keep plain ecrecover and no ERC-1271 owner check reaches intake or registration. A Safe owner delegates signing with setIssuer instead.

  4. moved this from Blocked to Done in deCDNon Nov 25, 2026
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

    area:contractsstatus:mainnet-blocking

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions