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

create2 execution strategy #661

Closed
6 tasks done
Tracked by #91
kanej opened this issue Dec 21, 2023 · 2 comments
Closed
6 tasks done
Tracked by #91

create2 execution strategy #661

kanej opened this issue Dec 21, 2023 · 2 comments
Assignees
Labels
status:ready This issue is ready to be worked on
Milestone

Comments

@kanej
Copy link
Member

kanej commented Dec 21, 2023

We have a POC of using createX to implement a create2 execution strategy. We want to work this up to a full implementation that we can release. You can find the PR here: #626

TODO

  • Rebase with development
  • Update CreateX to v0.1.0
    • In strategy update the list of existing deployed addresses to match: https://createx.rocks/deployments. If the network is not in the list, call eth_getCode at the create2 factory address 0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed to see if someone else has deployed it.
    • In strategy init leverage the signed transactions outlined here: https://github.com/pcaversaccio/createx#new-deployments, to support creation of a factory in local nodes. If the factory is not present and it is not a 31337 chainId (i.e. a HH node) throw - we can deal with deploying a factory against a real network as a separate issue.
  • Update the api on the deploy function to be an enumeration that can have two values: basic | create2. If no strategy is given default to basic.
  • Update the UI to show the strategy, the suggestion is everywhere we currently show Deploying [xxx] we should show the strategy (and that it is a strategy). If other changes are needed make a call. The UI tweaks doc is likely useful for considering the different cases: https://www.notion.so/nomicfoundation/UI-tweaks-4197056e017e43239550c582f9b962cb?pvs=4

Test Suite

Maybe an approach to testing here is to add a new section under the hardat-plugin package integration tests.

Those tests should iterate between the two strategies: basic and create2 for a core set of tests:

  1. Deploy a contract
  2. Deploy multiple contracts
  3. Make a call against a contract
  4. Read an event from a constructor
  5. Read an event from a call

The goal here is to show up a problem with a strategy where we switch from one strategy to another (e.g. calls still work even though we are mainly about contract deploys in create2), and allow us to support an increasing number of strategies.

There should also be a section of integration tests just for create2 testing:

  1. Deploy with an existing create2 contract based on the known list (chainId hackery for the win)
  2. Deploy with an existing create2 not on the list
  3. Deploy without a create2 to 31337
  4. Deploy without a create2 to non-31337 throws
@kanej kanej mentioned this issue Dec 21, 2023
5 tasks
@kanej kanej moved this to Todo in Hardhat Ignition Dec 21, 2023
@kanej kanej added status:ready This issue is ready to be worked on and removed status:triaging labels Dec 21, 2023
@kanej kanej added this to the v1.0.0 milestone Dec 21, 2023
@zoeyTM zoeyTM moved this from Todo to In Progress in Hardhat Ignition Jan 3, 2024
@zoeyTM zoeyTM moved this from In Progress to In Review in Hardhat Ignition Jan 8, 2024
@lastperson
Copy link

Hello. While the CREATE2 could be usable for independent contracts, it does not allow deployments to the same address if you use different constructor parameters (for immutable variables for instance).
CreateX conveniently provides a CREATE3 functionality, that lets you deploy to a deterministic address independent from the actual bytecode. This would probably be more useful for Hardhat users.
Do you think it would be better to add create3 strategy, or modify the create2 one to actually work as create3?

@kanej
Copy link
Member Author

kanej commented Apr 2, 2024

Hello. While the CREATE2 could be usable for independent contracts, it does not allow deployments to the same address if you use different constructor parameters (for immutable variables for instance). CreateX conveniently provides a CREATE3 functionality, that lets you deploy to a deterministic address independent from the actual bytecode. This would probably be more useful for Hardhat users. Do you think it would be better to add create3 strategy, or modify the create2 one to actually work as create3?

Hey @lastperson, create3 support is a great suggestion. I have opened an issue for it here: #726, so others can weigh in/up vote.

@kanej kanej closed this as completed Apr 2, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Hardhat Ignition Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on
Projects
Archived in project
Development

No branches or pull requests

3 participants