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

feat: support create3 #3

Merged
merged 3 commits into from
Oct 17, 2024
Merged

feat: support create3 #3

merged 3 commits into from
Oct 17, 2024

Conversation

chefburger
Copy link
Contributor

No description provided.

src/CustomizedProxyChild.sol Outdated Show resolved Hide resolved
src/interfaces/ICreate3Factory.sol Outdated Show resolved Hide resolved
test/Create3FactoryFork.t.sol Outdated Show resolved Hide resolved
src/libraries/Create3.sol Outdated Show resolved Hide resolved
src/libraries/Create3.sol Outdated Show resolved Hide resolved
Copy link

@chef-omelette chef-omelette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Collaborator

@ChefMist ChefMist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow great work 👏 👏 👏

bytes memory creationCode,
uint256 creationFund,
bytes calldata afterDeploymentExecutionPayload,
uint256 afterDeploymentExecutionFund

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion , can we add one parameter about creationCode hash , so we can check whether the creationCode is correct.
For example, we already deployed in one chain , when we tried to deploy same contract in other chains , if we passed wrong creationCode , we will lose chance to deploy with same address.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Copy link
Collaborator

@ChefMist ChefMist Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, we already deployed in one chain , when we tried to deploy same contract in other chains , if we passed wrong creationCode , we will lose chance to deploy with same address.

would adding creationCodeHash works to prevent this?

eg.

  1. burger call `create3Factory.deploy("PCS_V4_VAULT", vault.creationCode, keccak256(vault.hash), ...);

  2. mist can make the error calling `create3Factory.deploy("PCS_V4_VAULT", clPoolManager.creationCode, keccak256(clPoolManager.hash), ...);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or can we have a concrete scenario example? thanks

Copy link
Collaborator

@ChefMist ChefMist Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scenario: when someone is calling create3Factory.deploy directly (not via our v4 deployment script).

Context: new-hire asked to deploy Vault in new chain (arb)

1/ step 1: new-hire see the transaction hash on how vault was deploy on eth
2/ step 2: new-hire copy the params and paste in etherscan calling create3Factory.deploy()

At step 2, somehow the new hire copy-pasted the wrong creation code, and this check will help to protect it

) external payable onlyWhitelisted nonReentrant returns (address deployed) {
deployed = Create3.create3(
salt, creationCode, creationFund, afterDeploymentExecutionPayload, afterDeploymentExecutionFund
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: can add deploy event here.

/// @dev ensure this contract is deployed on multiple chain with the same address
contract Create3Factory is ICreate3Factory, Ownable2Step, ReentrancyGuard {
event SetWhitelist(address indexed user, bool isWhitelist);
event Deployed(address indexed deployed, bytes32 salt);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add creationCodeHash here ?
so can verify codehash when tried to deploy in new chains.

@chefburger chefburger merged commit fe0da95 into main Oct 17, 2024
2 checks passed
@ChefMist ChefMist deleted the feat/add-create3-factory branch October 23, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants