safe-global / safe-wallet-web

Safe{Wallet} – smart contract wallet for Ethereum (ex-Gnosis Safe multisig)
https://app.safe.global
GNU General Public License v3.0
336 stars 400 forks source link

[Epic] Synchronous off-chain EIP-1271 signature flow #1886

Closed schmanu closed 1 year ago

schmanu commented 1 year ago

What is the feature about

The Problem

Currently Safe{Wallet} supports two ways to sign a message (e.g. EIP-712).

  1. on-chain by sending a transaction to the SignMessageLib smart contract.
  2. using a separate off-chain flow which requires dapps to integrate with out transaction service.

Option 1) requires users to pay gas and does not work with all dapps as dapps expect the returned signature from e.g. eth_signTypedData to be valid (immediately).

Option 2) is gasless but requires dapps to built custom integrations with Safe{Wallet} which most dapps are not willing to do.

The solution

We want to bring EIP-1271 in a way that it will work in most if not all dapps out of the box.

The idea is that the first signer of any message will have to keep the Safe App & modal open until all signers signed it. Then the preparedSignature will be send as answer to the signature request.

We already evaluated the solution by building a PoC in this PR: #1630 And tried it with multiple dapps.

The list of requirements

Designs/sketches

Figma

Links

McCloudS commented 1 year ago

Maybe i'm still a bit premature, but building Safe Wallet and WC (and also trying the dev links), it fails trying to sign a message on OpenSea with seemingly random owner addresses (that are not mine). This is on a 2/3 Multisig, the error occurs after the first sign. The two errors are from two different signings. image

schmanu commented 1 year ago

@McCloudS What connected wallet are you using? Also which version is your deployed Safe (You can check that in Settings -> Setup)

McCloudS commented 1 year ago

@McCloudS What connected wallet are you using? Also which version is your deployed Safe (You can check that in Settings -> Setup)

Using Ledger via Metamask, since Ledgers don't support the v3/v4 signing and failed (Error is "The method eth_signTypedData_v4 does not exist/is not available"). 1.3.0 is deployed.

schmanu commented 1 year ago

@McCloudS we found the issue and it will be fixed with this PR: https://github.com/safe-global/safe-wallet-web/pull/1958