safe-global / safe-deployments

A collection of Safe singleton deployments
MIT License
127 stars 257 forks source link

Incorrect deployment addresses listed for zkSync Sepolia (chainid 300) #686

Open spengrah opened 1 month ago

spengrah commented 1 month ago

I'm trying to deploy a contract to zkSync Era Sepolia (chainid 300) that interacts with several safe contracts, and I'm not finding those contracts to be deployed even though they have deployments listed on their respective v1.3.0 lists.

In fact, the addresses listed as deployed to chainid 300 in each of the below cases is the "canonical" address rather than the expected "zksync" address (which is listed for zkSync Era Mainnet, chainid 324).

https://github.com/safe-global/safe-deployments/blob/542b2efceb60f8937467bee58bab580959a50a39/src/assets/v1.3.0/gnosis_safe_l2.json#L64

https://github.com/safe-global/safe-deployments/blob/542b2efceb60f8937467bee58bab580959a50a39/src/assets/v1.3.0/compatibility_fallback_handler.json#L64

https://github.com/safe-global/safe-deployments/blob/542b2efceb60f8937467bee58bab580959a50a39/src/assets/v1.3.0/multi_send.json#L64

https://github.com/safe-global/safe-deployments/blob/542b2efceb60f8937467bee58bab580959a50a39/src/assets/v1.3.0/proxy_factory.json#L64

spengrah commented 1 month ago

cc @alexkeating

mmv08 commented 1 month ago

Chain id 300 originally belonged to Optimism on gnosis chain: https://github.com/safe-global/safe-deployments/pull/85

Looks like it was deprecated and the chain id got taken over by zksync: https://github.com/ethereum-lists/chains/commits/master/_data/chains/eip155-300.json

If you could deploy the contracts to zksync sepolia and create a PR, that would be great

alexkeating commented 1 month ago

@mmv08 To deploy to zksync sepolia we need to first deploy the safe singleton factory and the bot seems to error on the chains rpc url. https://github.com/safe-global/safe-singleton-factory/issues/575

remedcu commented 1 month ago

Looks like the gasLimit is resulting in null value: https://github.com/safe-global/safe-singleton-factory/actions/runs/9941306550/job/27460023828

So, the response here is generating a null value.

alexkeating commented 1 month ago

Ah thanks, iit looks like the github deploy does not support zksync based networks.

remedcu commented 1 month ago

This is the response in short for the script:

bash-3.2$ FACTORY_BYTECODE="${FACTORY_BYTECODE:-0x604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3}"
bash-3.2$ FACTORY_DEPLOYER_ADDRESS="${FACTORY_DEPLOYER_ADDRESS:-0xE1CB04A0fA36DdD16a06ea828007E35e1a3cBC37}"
bash-3.2$ json_request='[
>     {
>         "jsonrpc": "2.0",
>         "method": "eth_gasPrice",
>         "params": [],
>         "id": 1
>     },
>     {
>         "jsonrpc": "2.0",
>         "method": "eth_estimateGas",
>         "params": [
>             {
>                 "from": "'$FACTORY_DEPLOYER_ADDRESS'",
>                 "data": "'$FACTORY_BYTECODE'"
>             }
>         ],
>         "id": 2
>     }
> ]'
bash-3.2$ rpc_url=https://sepolia.era.zksync.dev
bash-3.2$ response=$(curl -s "$rpc_url" --location --header 'Content-Type: application/json' --data "$json_request")
bash-3.2$ echo $response
[{"jsonrpc":"2.0","result":"0x17d7840","id":1},{"jsonrpc":"2.0","error":{"code":3,"message":"Failed to serialize transaction: toAddressIsNull"},"id":2}]
alexkeating commented 1 month ago

@remedcu yes, and it would make sense for this to fail because the bytecode on a zkSync era network would be incompatible with the bytecode on an evm network. What would be the best way to move this forward?

mmv08 commented 1 month ago

Looks like the gasLimit is resulting in null value: https://github.com/safe-global/safe-singleton-factory/actions/runs/9941306550/job/27460023828

So, the response here is generating a null value.

Alexander is right here, the CI script doesn't support ZKSync networks. It's fine to proceed still, the actual deployment script will work.

alexkeating commented 1 month ago

Thanks @mmv08! I was able to deploy the safe-singleton-factory, but I did need to modify the submit script. I have a different sender address than other deployments which is creating a different address for the safe-singleton contract compared to the other zksync network deployments. How can I get the safe-singleton deployed with the correct address? My understanding is we need the safe-singleton deployed before we can deploy the rest of the safe contracts.

remedcu commented 1 month ago

You can use this repo to create an issue so the Safe team can create a safe-singleton contract for you.

alexkeating commented 1 month ago

@remedcu Thanks! I did here. There also seems to be a similar request from back in March here.

alexkeating commented 1 month ago

@remedcu @mmv08 I am having trouble deploying to zksync sepolia. I am using this branch locally and get the following error Error: deterministic zk deployments are not supported at this time. Any ideas how I can get past this? I only changed the rpc and network in the hardhat config.

mmv08 commented 1 month ago

@remedcu @mmv08 I am having trouble deploying to zksync sepolia. I am using this branch locally and get the following error Error: deterministic zk deployments are not supported at this time. Any ideas how I can get past this? I only changed the rpc and network in the hardhat config.

I can reproduce it, but honestly, I have no idea why it doesn't work, but it seems to be in line with the zksync pattern i observe - things are just not working. I relayed this to the Protofire team, which worked on the integration back then.

nick8319 commented 1 month ago

Hi guys, I just was able to deploy and verify safe contracts to zkSync Sepolia using the mentioned branch : deploying "SimulateTxAccessor" (tx: 0xa6e274ca8d719c6d906a68bfdff971041f7d76db8b9200a3f1ef24cd48d3b540)...: deployed at 0x4191E2e12E8BC5002424CE0c51f9947b02675a44 with 356418 gas deploying "GnosisSafeProxyFactory" (tx: 0x51f5b1cc6fc5b735d842d8ceb534448409aeb6d61d0287862719d94ff15f11ed)...: deployed at 0xDAec33641865E4651fB43181C6DB6f7232Ee91c2 with 13365501 gas deploying "DefaultCallbackHandler" (tx: 0x68d980be3a68105c33ce09b138ac9bc89de67613ad8ecb6000de344ae048f401)...: deployed at 0x08798512808f838a06BCe7c26905f05e94dF6f50 with 3169906 gas deploying "CompatibilityFallbackHandler" (tx: 0xc9e39a476a4c1a4151463629ebac6f8d8ea3f6fb8bb353e6ed11292ea084aeaf)...: deployed at 0x2f870a80647BbC554F3a0EBD093f11B4d2a7492A with 15112508 gas deploying "CreateCall" (tx: 0xc4265f379ff435364529561cca1db7174fe4960ce6995111817af066d9c1c26a)...: deployed at 0xcB8e5E438c5c2b45FbE17B02Ca9aF91509a8ad56 with 3690842 gas deploying "MultiSend" (tx: 0x7df2e847a2b74cf14b97f9673248f4572d7b78880af0f45c8230024bfd24e22b)...: deployed at 0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912 with 3464038 gas deploying "MultiSendCallOnly" (tx: 0x615578b1c84bf10171f5390fde95b8579252b57b720f71869e3d0931e534d196)...: deployed at 0xf220D3b4DFb23C4ade8C88E526C1353AbAcbC38F with 2309635 gas deploying "SignMessageLib" (tx: 0xe0b0139fe8ddce9fb86957136e0bbb45f8549dabadb32cbbdc2fd96bc4795b4e)...: deployed at 0x357147caf9C0cCa67DfA0CF5369318d8193c8407 with 5461844 gas deploying "GnosisSafeL2" (tx: 0x52e87056bca03617e9ee72c23044690976a99eefc4bb961e9c348de6d2b16650)...: deployed at 0x1727c2c531cf966f902E5927b98490fDFb3b2b70 with 44128994 gas deploying "GnosisSafe" (tx: 0x01450ba0d79b19506b39f578d8437b589a37a021485bd492c8ae8b98fede9789)...: deployed at 0xB00ce5CCcdEf57e539ddcEd01DF43a13855d9910 with 41945796 gas ✨ Done in 46.41s.

mmv08 commented 1 month ago

Hi guys, I just was able to deploy and verify safe contracts to zkSync Sepolia using the mentioned branch : deploying "SimulateTxAccessor" (tx: 0xa6e274ca8d719c6d906a68bfdff971041f7d76db8b9200a3f1ef24cd48d3b540)...: deployed at 0x4191E2e12E8BC5002424CE0c51f9947b02675a44 with 356418 gas deploying "GnosisSafeProxyFactory" (tx: 0x51f5b1cc6fc5b735d842d8ceb534448409aeb6d61d0287862719d94ff15f11ed)...: deployed at 0xDAec33641865E4651fB43181C6DB6f7232Ee91c2 with 13365501 gas deploying "DefaultCallbackHandler" (tx: 0x68d980be3a68105c33ce09b138ac9bc89de67613ad8ecb6000de344ae048f401)...: deployed at 0x08798512808f838a06BCe7c26905f05e94dF6f50 with 3169906 gas deploying "CompatibilityFallbackHandler" (tx: 0xc9e39a476a4c1a4151463629ebac6f8d8ea3f6fb8bb353e6ed11292ea084aeaf)...: deployed at 0x2f870a80647BbC554F3a0EBD093f11B4d2a7492A with 15112508 gas deploying "CreateCall" (tx: 0xc4265f379ff435364529561cca1db7174fe4960ce6995111817af066d9c1c26a)...: deployed at 0xcB8e5E438c5c2b45FbE17B02Ca9aF91509a8ad56 with 3690842 gas deploying "MultiSend" (tx: 0x7df2e847a2b74cf14b97f9673248f4572d7b78880af0f45c8230024bfd24e22b)...: deployed at 0x0dFcccB95225ffB03c6FBB2559B530C2B7C8A912 with 3464038 gas deploying "MultiSendCallOnly" (tx: 0x615578b1c84bf10171f5390fde95b8579252b57b720f71869e3d0931e534d196)...: deployed at 0xf220D3b4DFb23C4ade8C88E526C1353AbAcbC38F with 2309635 gas deploying "SignMessageLib" (tx: 0xe0b0139fe8ddce9fb86957136e0bbb45f8549dabadb32cbbdc2fd96bc4795b4e)...: deployed at 0x357147caf9C0cCa67DfA0CF5369318d8193c8407 with 5461844 gas deploying "GnosisSafeL2" (tx: 0x52e87056bca03617e9ee72c23044690976a99eefc4bb961e9c348de6d2b16650)...: deployed at 0x1727c2c531cf966f902E5927b98490fDFb3b2b70 with 44128994 gas deploying "GnosisSafe" (tx: 0x01450ba0d79b19506b39f578d8437b589a37a021485bd492c8ae8b98fede9789)...: deployed at 0xB00ce5CCcdEf57e539ddcEd01DF43a13855d9910 with 41945796 gas ✨ Done in 46.41s.

did you have this branch locally, or was it freshly checked out? Perhaps your local dependencies are different? What os did you use?

nick8319 commented 1 month ago

I have it locally, but it is in sync with the remote branch (apart from zkSyncSepolia network in hardhat, and I put a safe-singleton-factory json into artifacts in node_modules). I am using MacOS, node version is 20.10.0 image

alexkeating commented 1 month ago

Thank you @nick8319! FWIW I am using Fedora as my OS, and I also copied the safe singleton into my node modules.