Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include information on CREATE nounces differences between zkEVM and EVM #741

Open
idea404 opened this issue Oct 5, 2023 · 0 comments
Open
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@idea404
Copy link
Contributor

idea404 commented Oct 5, 2023

To get the same address on testnet as mainnet:

  • If it used CREATE2, the same salt was used
  • If it used CREATE, the same nonce was used at the time of the deployment

Note, btw, that there is a difference between us and Ethereum regarding (2). On Ethereum for CREATE the nonce od the transaction is used. We have a separate "deployment" nonce, which is used for CREATE and is incremented only for deployments

You need to ask for the rawNonce for an account (the param is uint256, you just need to pad the address with zeroes to the left) https://github.com/matter-labs/era-system-contracts/blob/3e954a629ad8e01616174bde2218241b360fda0a/contracts/NonceHolder.sol#L35
After you get the value it will be of form 2^128 * deploymentNonce + normalNonce. You just need to do the floored division (BigNumber.div(..) would suffice)

@idea404 idea404 added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 5, 2023
@idea404 idea404 self-assigned this Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant