storage-incentives icon indicating copy to clipboard operation
storage-incentives copied to clipboard

feat: add signer / 'delegate' field to support account abstraction

Open mfw78 opened this issue 2 years ago • 1 comments

Problem

Refer to the postage batch struct: https://github.com/ethersphere/storage-incentives/blob/e97ec1033843dbd373857597332e43dfc209806c/src/PostageStamp.sol#L61-L74

This provides pretty average UX / DX in that the owner MUST always be the same as the signer for stamps applied to chunks. This is a large handbrake on some particularly important features that would greatly smooth UX / DX.

Solution

Considering that stamps that have been processed by Swarm clients are in effect immutable, I propose:

  1. The owner field is changed to a signer field. This represents the public address of the signer that must sign the chunks, as inspected by Swarm clients when exchanging data over Swarm. The signer would still effectively have root control over the batch.
  2. An owner field is created, which can be instantiated on createBatch to a custom address. This owner has the additional benefits of being able to call dilute the batch and set a delegate as described below.
  3. A delegate field (or better terminology TBD), which is configurable on createBatch, and configurable by owner. This field can also call the topUp and dilute functions for the respective batch.

Use cases

This allows for atomic dilution of a batch to increase it's capacity. Mandating that dilute can only be called by the owner requires the owner to posses gas, which prohibits smart contracts / smart contract wallets from possessing batches, which is prohibitively exclusive given the moves towards account abstraction.

mfw78 avatar Jul 15 '23 06:07 mfw78

Actually, a much tighter solution to this would be to enable an EIP-712 signatures on dilute so that owner could sign a dilute. This would represent significant UX/DX experience, allowing for many dilutes to be batched effectively, and atomically.

mfw78 avatar Jul 15 '23 09:07 mfw78