Commit a12738b7 authored by Maurelian's avatar Maurelian Committed by GitHub

feat: deployImplementations and depImplementationsInterop (#12226)

* feat: Use DeploySuperchain script in Deploy.s.sol

Demonstrate that build breaks when using high level syntax

* fix: Cannot set null protocol versions error

* feat: Also save impls

* fix: semver lock

* fix: bump ProtocolVersions semver

* feat: Add superchainProxyAdmin

* feat: Undo removeing ProtocolVersion type from interface

* fix: semver-lock

* feat: remove setupOpChainAdmin

* fix: transfer ProxyAdmin ownership after all setup is complete

* feat: separate deployImplementations

* feat: split up deployImplementations and deployImplementationsInterop

* fix: lint
parent b1d119fc
...@@ -269,8 +269,12 @@ contract Deploy is Deployer { ...@@ -269,8 +269,12 @@ contract Deploy is Deployer {
setupSuperchain(); setupSuperchain();
console.log("set up superchain!"); console.log("set up superchain!");
} }
if (cfg.useInterop()) {
setupOpChainAdmin(); deployImplementationsInterop();
} else {
deployImplementations();
}
setupOpChain();
if (cfg.useAltDA()) { if (cfg.useAltDA()) {
bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType())); bytes32 typeHash = keccak256(bytes(cfg.daCommitmentType()));
bytes32 keccakHash = keccak256(bytes("KeccakCommitment")); bytes32 keccakHash = keccak256(bytes("KeccakCommitment"));
...@@ -278,8 +282,7 @@ contract Deploy is Deployer { ...@@ -278,8 +282,7 @@ contract Deploy is Deployer {
setupOpAltDA(); setupOpAltDA();
} }
} }
transferProxyAdminOwnership({ _isSuperchain: false });
setupOpChain();
console.log("set up op chain!"); console.log("set up op chain!");
} }
...@@ -287,12 +290,6 @@ contract Deploy is Deployer { ...@@ -287,12 +290,6 @@ contract Deploy is Deployer {
// High Level Deployment Functions // // High Level Deployment Functions //
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
/// @notice Deploy the address manager and proxy admin contracts.
function setupOpChainAdmin() public {
deployAddressManager();
deployProxyAdmin({ _isSuperchain: false });
}
/// @notice Deploy a full system with a new SuperchainConfig /// @notice Deploy a full system with a new SuperchainConfig
/// The Superchain system has 2 singleton contracts which lie outside of an OP Chain: /// The Superchain system has 2 singleton contracts which lie outside of an OP Chain:
/// 1. The SuperchainConfig contract /// 1. The SuperchainConfig contract
...@@ -324,14 +321,14 @@ contract Deploy is Deployer { ...@@ -324,14 +321,14 @@ contract Deploy is Deployer {
/// @notice Deploy a new OP Chain, with an existing SuperchainConfig provided /// @notice Deploy a new OP Chain, with an existing SuperchainConfig provided
function setupOpChain() public { function setupOpChain() public {
console.log("Deploying OP Chain"); console.log("Deploying OP Chain");
deployAddressManager();
deployProxyAdmin({ _isSuperchain: false });
// Ensure that the requisite contracts are deployed // Ensure that the requisite contracts are deployed
mustGetAddress("SuperchainConfigProxy"); mustGetAddress("SuperchainConfigProxy");
mustGetAddress("AddressManager"); mustGetAddress("AddressManager");
mustGetAddress("ProxyAdmin"); mustGetAddress("ProxyAdmin");
deployImplementations();
deployOpChain(); deployOpChain();
initializeOpChain(); initializeOpChain();
...@@ -342,7 +339,6 @@ contract Deploy is Deployer { ...@@ -342,7 +339,6 @@ contract Deploy is Deployer {
transferDisputeGameFactoryOwnership(); transferDisputeGameFactoryOwnership();
transferDelayedWETHOwnership(); transferDelayedWETHOwnership();
transferProxyAdminOwnership({ _isSuperchain: false });
} }
/// @notice Deploy all of the OP Chain specific contracts /// @notice Deploy all of the OP Chain specific contracts
...@@ -378,8 +374,9 @@ contract Deploy is Deployer { ...@@ -378,8 +374,9 @@ contract Deploy is Deployer {
deploySystemConfig(); deploySystemConfig();
deployL1StandardBridge(); deployL1StandardBridge();
deployL1ERC721Bridge(); deployL1ERC721Bridge();
deployOptimismPortal(); deployOptimismPortal(); // todo: pull this out into an override option after DeployImplementations runs
deployL2OutputOracle(); deployL2OutputOracle();
// Fault proofs // Fault proofs
deployOptimismPortal2(); deployOptimismPortal2();
deployDisputeGameFactory(); deployDisputeGameFactory();
...@@ -388,6 +385,24 @@ contract Deploy is Deployer { ...@@ -388,6 +385,24 @@ contract Deploy is Deployer {
deployMips(); deployMips();
} }
/// @notice Deploy all of the implementations
function deployImplementationsInterop() public {
console.log("Deploying implementations");
deployL1CrossDomainMessenger();
deployOptimismMintableERC20Factory();
deploySystemConfigInterop();
deployL1StandardBridge();
deployL1ERC721Bridge();
deployL2OutputOracle();
// Fault proofs
deployOptimismPortalInterop();
deployDisputeGameFactory();
deployDelayedWETH();
deployPreimageOracle();
deployMips();
}
/// @notice Initialize all of the proxies in an OP Chain by upgrading to the correct proxy and calling the /// @notice Initialize all of the proxies in an OP Chain by upgrading to the correct proxy and calling the
/// initialize function /// initialize function
function initializeOpChain() public { function initializeOpChain() public {
...@@ -633,32 +648,45 @@ contract Deploy is Deployer { ...@@ -633,32 +648,45 @@ contract Deploy is Deployer {
uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32" uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32"
); );
if (cfg.useInterop()) { addr_ = DeployUtils.create2AndSave({
addr_ = DeployUtils.create2AndSave({ _save: this,
_save: this, _salt: _implSalt(),
_salt: _implSalt(), _name: "OptimismPortal2",
_name: "OptimismPortalInterop", _args: DeployUtils.encodeConstructor(
_args: DeployUtils.encodeConstructor( abi.encodeCall(
abi.encodeCall( IOptimismPortal2.__constructor__,
IOptimismPortalInterop.__constructor__, (cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
)
) )
}); )
save("OptimismPortal2", addr_); });
} else {
addr_ = DeployUtils.create2AndSave({ // Override the `OptimismPortal2` contract to the deployed implementation. This is necessary
_save: this, // to check the `OptimismPortal2` implementation alongside dependent contracts, which
_salt: _implSalt(), // are always proxies.
_name: "OptimismPortal2", Types.ContractSet memory contracts = _proxiesUnstrict();
_args: DeployUtils.encodeConstructor( contracts.OptimismPortal2 = addr_;
abi.encodeCall( ChainAssertions.checkOptimismPortal2({ _contracts: contracts, _cfg: cfg, _isProxy: false });
IOptimismPortal2.__constructor__, }
(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
) /// @notice Deploy the OptimismPortalInterop contract
function deployOptimismPortalInterop() public broadcast returns (address addr_) {
// Could also verify this inside DeployConfig but doing it here is a bit more reliable.
require(
uint32(cfg.respectedGameType()) == cfg.respectedGameType(), "Deploy: respectedGameType must fit into uint32"
);
addr_ = DeployUtils.create2AndSave({
_save: this,
_salt: _implSalt(),
_name: "OptimismPortalInterop",
_args: DeployUtils.encodeConstructor(
abi.encodeCall(
IOptimismPortalInterop.__constructor__,
(cfg.proofMaturityDelaySeconds(), cfg.disputeGameFinalityDelaySeconds())
) )
}); )
} });
save("OptimismPortal2", addr_);
// Override the `OptimismPortal2` contract to the deployed implementation. This is necessary // Override the `OptimismPortal2` contract to the deployed implementation. This is necessary
// to check the `OptimismPortal2` implementation alongside dependent contracts, which // to check the `OptimismPortal2` implementation alongside dependent contracts, which
...@@ -814,22 +842,23 @@ contract Deploy is Deployer { ...@@ -814,22 +842,23 @@ contract Deploy is Deployer {
/// @notice Deploy the SystemConfig /// @notice Deploy the SystemConfig
function deploySystemConfig() public broadcast returns (address addr_) { function deploySystemConfig() public broadcast returns (address addr_) {
if (cfg.useInterop()) { addr_ = DeployUtils.create2AndSave({
addr_ = DeployUtils.create2AndSave({ _save: this,
_save: this, _salt: _implSalt(),
_salt: _implSalt(), _name: "SystemConfig",
_name: "SystemConfigInterop", _args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfig.__constructor__, ()))
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfigInterop.__constructor__, ())) });
}); }
save("SystemConfig", addr_);
} else { /// @notice Deploy the SystemConfigInterop contract
addr_ = DeployUtils.create2AndSave({ function deploySystemConfigInterop() public broadcast returns (address addr_) {
_save: this, addr_ = DeployUtils.create2AndSave({
_salt: _implSalt(), _save: this,
_name: "SystemConfig", _salt: _implSalt(),
_args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfig.__constructor__, ())) _name: "SystemConfigInterop",
}); _args: DeployUtils.encodeConstructor(abi.encodeCall(ISystemConfigInterop.__constructor__, ()))
} });
save("SystemConfig", addr_);
// Override the `SystemConfig` contract to the deployed implementation. This is necessary // Override the `SystemConfig` contract to the deployed implementation. This is necessary
// to check the `SystemConfig` implementation alongside dependent contracts, which // to check the `SystemConfig` implementation alongside dependent contracts, which
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment