allo-protocol / allo-v2

Core Allo V2 Contracts
GNU Affero General Public License v3.0
86 stars 64 forks source link

feat: improve msg.sender and msg.value usage #611

Closed ilpepepig closed 2 months ago

ilpepepig commented 3 months ago

Closes #593.

Supporting meta-transactions as suggested in #594 would probably become as easy as overriding _msgSender(). Depending on how meta-transactions are expected to work in Allo, OZ::ERC2771Context.sol could be used.

The usage of onlyOwner remains unchanged for the following reasons:

  1. Using a trusted forwarder contract to support meta-transactions adds a risk layer to Allo. For users this seems reasonable, but for such a critical role as the owner of the protocol it seems like an unnecessary risk.
  2. The owner address will probably be a contract which can't sign transactions anyway.
  3. Owner transactions will probably take place with much less frequency than users transactions.
0xOneTony commented 3 months ago

We would need a function which does https://github.com/bcnmy/metatx-standard/blob/master/src/contracts/EIP712MetaTransaction.sol#L37 So that any relayer can sign the msg -> invoke this function and

  • get the real msg.sender
  • override _msgSender
  • know which function to call with what data

Is this right ? (I'm assuming we'd do this in a follow up ticket)

@thelostone-mc Correct! This will be part of https://github.com/allo-protocol/allo-v2/issues/594