[Dev Tools] hardhat deploy-zksync:contract does not seem to be deterministic across wallets #768
-
Team or ProjectAbstract EnvironmentTestnet Select the Dev Tool you are usingHardhat Plugins Provide the version of the tool (if applicable)1.10 Provide a brief description of the functionality you're trying to implement and the issue you are running into.By running the following command I would expect the deployment of the same contract address no matter what the deploying private key/transaction origin is:
Instead, create2 seems to deploy to two separate addresses depending on tx origin Deployment tx 1https://explorer.testnet.abs.xyz/tx/0xd2b91c3a1b296ba1d31e7ec4fafa822c10e628d7d4764a02c8bfaac90b0aa476 Deployment tx 2https://explorer.testnet.abs.xyz/tx/0xc1fa188452ca18edced681f6e4dc5ee65e78d675bbddea997c5f8423a481ca6d Please note that the calldata for these is identical:
Repo Link (Optional)https://gist.github.com/coffeexcoin/ffdea6221ede2ea4e9191c8cf0126990 Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The behavior you're experiencing with the To ensure deterministic contract addresses across different wallets or transaction origins, you need to use ZKsync's specific hashing mechanism that includes a Here are some steps and considerations:
For more detailed guidance on deploying contracts on ZKsync and ensuring deterministic behavior, you can refer to the ZKsync Deployment Guide. If you continue to face issues, I recommend visiting the ZKsync developers discussions on Github for more in-depth support and community insights. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
@coffeexcoin ZKsync create2 implementation is different then EVM. Specifically, CREATE2 implementation includes the deployer's address ( |
Beta Was this translation helpful? Give feedback.
@coffeexcoin ZKsync create2 implementation is different then EVM. Specifically, CREATE2 implementation includes the deployer's address (
msg.sender
) in the address derivation. This means that deploying the same contract with different origins will result in distinct addresses, even if the calldata, salt, and bytecode hash are identical. You can view the implementation here