-
Notifications
You must be signed in to change notification settings - Fork 153
use create2 for factory deployment #358
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
Conversation
…m/OffchainLabs/nitro-contracts into deterministic-factory-deployments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I think we can simplify more
Fixing CI |
* disable CBOR * chore: remove entries for removed files * refactor: commonSetting * feat: foundry override * fix: test * chore: default profile * format: yarn format * ci: comapre bytecodes * fix: slither db --------- Co-authored-by: gzeon <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors contract deployment to use CREATE2 for deterministic addresses, updates deployment utilities and scripts accordingly, and streamlines factory contracts by removing mutable template setters.
- Introduces a
create2
helper and adds auseCreate2
flag todeployContract/deployAllContracts
, switching core deployments to CREATE2. - Updates local, upgrade, and end-to-end deployment scripts for CREATE2 factory deployment and passes
factoryOwner
todeployAllContracts
. - Removes
Ownable
inheritance and update/template setter functions fromBridgeCreator
, and consolidates template initialization inValidatorWalletCreator
andRollupCreator
constructors.
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
scripts/deploymentUtils.ts | Added create2 helper, useCreate2 param, and wired CREATE2 flag |
scripts/local-deployment/deployCreatorAndCreateRollup.ts | Bootstraps CREATE2 factory, updates deployAllContracts call signature |
src/rollup/ValidatorWalletCreator.sol | Removed Ownable , made template immutable, removed setter |
src/rollup/RollupCreator.sol | Extended constructor, set up templates & ownership on deploy |
src/rollup/BridgeCreator.sol | Dropped Ownable , removed dynamic setters for templates |
test/signatures/BridgeCreator | Removed outdated signature entries for removed template setters |
test/foundry/RollupCreator.t.sol | Updated tests to use creatorOwner instead of deployer |
test/foundry/BridgeCreator.t.sol | Cleaned up tests for removed update functions |
test/e2e/orbitChain.ts | Changed _uint256ToAddress to accept BigNumber and updated logic |
package.json | Enabled FOUNDRY_PROFILE=test for coverage and bytecode testing scripts |
hardhat.config.ts | Consolidated compiler settings into commonSetting |
foundry.toml | Aligned profiles and optimizer settings with hardhat config |
.github/workflows/contract-tests.yml | Added bytecode comparison step and updated Geth test node ref |
.env-sample | Documented FACTORY_OWNER and CREATE2_FACTORY vars |
Comments suppressed due to low confidence (4)
test/e2e/orbitChain.ts:1116
- [nitpick] The local variable
address
shadows a common identifier and may be confusing. Consider renaming it toaddr
oraddrStr
for clarity.
const address =
src/rollup/BridgeCreator.sol:21
- By removing
Ownable
and theupdateTemplates
functions, you lose the ability to update bridge templates after deployment. If runtime template changes are required, consider reintroducing controlled setters or document that templates are immutable.
contract BridgeCreator {
src/rollup/RollupCreator.sol:94
- [nitpick]
setTemplates
was external before; marking itpublic
may increase gas costs and expose unnecessary internal use. Consider reverting it toexternal
to follow standard access patterns.
) public onlyOwner {
test/e2e/orbitChain.ts:1114
- You changed
_uint256ToAddress
to acceptBigNumber
but existing calls may still pass strings. Verify and update all callers to passBigNumber
instances to avoid runtime type errors.
function _uint256ToAddress(uint256: BigNumber) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, latest review items are resolved
Implement CREATE2 deployment, also making BridgeCreator and ValidatorWalletCreator immutable.