[Deployment] Wrong address derivation #952
-
Team or ProjectNo response ZK chainLocal anvil-zksync, Era EnvironmentMainnet L2 block numberNo response zkSolc Version1.3.22 zksync-ethers VersionMinimal Reproducible Code or Repo LinkFOUNDRY .toml:
TEST:
Does this work on other EVMs? (If yes, please list at least 1 of them)No Description of What Your Contract DoesHello, Additional DetailsUsed foundryup-zksync |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @xrave110! Please note that bytecode hashes in ZKsync are calculated not the same way as in EVM. Here are reference implementations of Also, Hence, to get the actual To get the Please feel free to unmark this discussion as answered if this does not resolve your issue. |
Beta Was this translation helpful? Give feedback.
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 theContractDeployer
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 useContractDeployer.getNewAddressCreate2
instead of computing it by hand.Please feel free to unmark this discussion as answered if this does not res…