safe-global / safe-transaction-service

Keeps track of transactions sent via Safe contacts and confirmed transactions. It also keeps track of Ether and ERC20 token transfers to Safe contracts.
MIT License
191 stars 262 forks source link

Delegates signing structure should allow signing all chains #2081

Closed Uxio0 closed 3 months ago

Uxio0 commented 3 months ago

What is needed?

Currently, for adding delegates a EIP712 structure with the chainId must be signed. But if the chainId: 0, that signature should be valid for every network (currently 0 is taken as a valid chainId).

Background

Instead of the need to sign X signatures for X transaction services, only 1 signature would be valid for every tx service.

This was requested by @DmitryBespalov , and I think it makes a lot of sense so we can deprecate the old delegate endpoints

JagoFigueroa commented 3 months ago

Tested and verified with the help of señor @falvaradorodriguez many thanks!

fmrsabino commented 3 months ago

To add some clarification to this ticket: the implementation does not validate against chain id 0 since this is not according to the EIP-712 specification. More specifically on the Domain Separator ^1:

where the type of eip712Domain is a struct named EIP712Domain with one or more of the below fields. Protocol designers only need to include the fields that make sense for their signing domain. Unused fields are left out of the struct type.

where

uint256 chainId the EIP-155 chain id. The user-agent should refuse signing if it does not match the currently active chain.


Given the above, we have decided to support an optional chain id for cross-chain EIP712 payloads instead of chain id 0 for cross-chain compatibility.