Skip to content

[Deployment] Wrong address derivation #952

Answered by ly0va
xrave110 asked this question in Deployments
Discussion options

You must be logged in to vote

Hi @xrave110!

Please note that bytecode hashes in ZKsync are calculated not the same way as in EVM. Here are reference implementations of hashBytecode from zksync-ethers SDK or ZKsync system contracts.

Also, type(Contract).creationCode does not return the contract bytecode, but only a header passed to the ContractDeployer contract, as per this doc.

Hence, to get the actual bytecodeHash, it might make more sense to compute it offchain using a script and place it in your contract as a constant.

To get the create2 derived address, you may also use ContractDeployer.getNewAddressCreate2 instead of computing it by hand.

Please feel free to unmark this discussion as answered if this does not res…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vasyl-ivanchuk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Questions for deployment
2 participants