umbra-protocol icon indicating copy to clipboard operation
umbra-protocol copied to clipboard

Umbra.sol smart account compatibility

Open mozrt2 opened this issue 2 years ago • 3 comments

Hi there,

While working on the Stealth Safes POC over the weekend, we initially intended to use the deployed Umbra.sol contracts to send stealth payments and emit corresponding events.

We however ended up having to deploy a modified version of the original contract with one specific change to make it compatible with smart contract based accounts.

The current implementation of sendEth() in Umbra.sol uses _receiver.transfer(amount) to transfer a payment to a stealth address. Since EIP-2929, gas is limited to 2300 when calling .transfer(). This causes an out of gas error when trying to send a payment to a Safe account via Umbra.sol.

EIP-2930 solves this with access lists, as shown here by the Safe team. While using access lists would solve the issue we are facing, they are unfortunately not widely supported by wallets (e.g. see here for Metamask).

To build a working POC, we therefore decided to modify the contract and replace _receiver.transfer(amount) with _receiver.call{value: amount}("") which does not face gas constraints.

It seems unlikely that we find a way to use access lists compatible with all major wallets based on our research.

We therefore wanted to open this issue to discuss potential ways forward. We see two, with the first being the preferred path:

  • Upgrading the current Umbra.sol contract with a new function, sendEthToSmartContract(), where we insert the .call() method and use a reentrancy guard protection
  • Using a separate, modified version of Umbra.sol with these changes for smart accounts

mozrt2 avatar Jul 27 '23 13:07 mozrt2