-
Notifications
You must be signed in to change notification settings - Fork 37
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
Deploying the P256Verifier contract on a new EVM chain #46
Comments
Note: CREATE2 does exist on the chain. For eg, even using anvil where the Create2 Factory is deployed does not deploy the contract to the same deterministic address @nalinbhardwaj |
Sorry, misunderstood your second comment: Are you using the same version of Foundry / solc (0.8.21) as the repository? It may also be simpler to replay our deployment transaction so you don't have to replicate the repo set up exactly. |
Yes using the same solc version, specified it in the foundry toml along with the optimizer runs as well. I see, so this txn is a call to the Create2 factory contract. I would like to deploy this contract on anvil for now, so technically if the foundry toml matches and the contract matches (including the same salt) then it should deploy to the deterministic address? Not sure why that's not working currently for me |
@nalinbhardwaj actually not using the same foundry version, I am on |
One thing I recently discovered is that if you just "forge build" you will not arrive at the same address because the bytecode differs. Apparently, the final portion of the bytecode encodes metadata (i.e., hashes) of the build configuration. Unless the build configuration matches exactly (compiler version is just one moving piece among many that can change the final hash; in my case, I suspect additional remappings which forge inserts automatically) with what was used originally (and it does not match out of the box, unfortunately) you will not arrive at the same address. I was actually going to create an issue and suggest the repo should at least mention somewhere that it is not sufficient to just run "forge build" to arrive at the same bytecode/deploy address. |
I agree, the repo should add this as a side-note. For now I have forked the repo and updated the address on the forked repo. |
might make sense for them to check in the compiled bytecode + init code and an alternative deploy script that uses that for deployment rather than the local foundry's compiled output (which may differ due to above) |
Running the same script and deploying the same contract with the same salt (ie, 0) deploys to a new contract address and not the deterministic address
0xc2b78104907F722DABAc4C69f826a522B2754De4
.I also used the same optimizer runs as well. Do you know what is being missed here?
The text was updated successfully, but these errors were encountered: