By using the create opcode to deploy new tokens we are subject to address creation based on account nonce. This means that if we were to deploy a token on both chains, that for the addresses to be equal, the account nonces should also be equal. This could lead to confusion for users expecting a certain token to share the same address on both chains.
The deployToken function uses the create
opcode to create a new token. The create
opcode generates the address based on the address and nonce of the sender. Provided that the TokenFactory will be deployed on both Ethereum Mainnet and ZkSync we can assume that there will be occurrences where the owner would like to deploy a token on both chains. In order to have this token share the same address on both chains the owner would have to manage the account nonces to be equal on both chains, as well as have the owner of the TokenFactory be the same address (=> not transferring owners for either of the implementations). This introduces complexity in generating a shared address for a token on both chains.
Confusion over token addresses
Manual review
Favour the use of create2
opcode over the create
opcode in order to allow the owner of the TokenFactory to create a shared address for a token on both chains. The create2
opcode allows the token deployer to specify a salt, giving the owner control over whether to create a shared-address token or not.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.