safe-global / safe-smart-account

Safe allows secure management of blockchain assets.
https://safe.global
GNU Lesser General Public License v3.0
1.84k stars 907 forks source link

Newly created safes do not have a EIP1271 isSignatureValid() method #633

Closed slavik0329 closed 1 year ago

slavik0329 commented 1 year ago

Description

After creating a new safe, they do not have an isSignatureValid method to be able to verify contract signatures with EIP1271 standard.

Steps to reproduce

Create a safe and try to call isValidSignature method with any correct or invalid values.

mmv08 commented 1 year ago

The EIP-1271 logic is not a part of the core contract. The Safe has a feature where it can forward calls to an external contract, and this is where the EIP-1271 logic is handled in the Safe{Wallet} setup. We use the compatibility fallback handler as the fallback contract where the logic is present: https://github.com/safe-global/safe-contracts/blob/main/contracts/handler/CompatibilityFallbackHandler.sol#L57-L68

To use the contract in your Safe, ensure the address is correctly passed to the setup method or set up the handler via the setFallbackHandler method.