From 23ca830b7a945c8f4943a677c102946e5bc4dcbd Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 25 Sep 2024 12:53:13 -0400 Subject: [PATCH 1/3] feat(deploy): deploy implementations before proxies This change prepares for the OPCM integration by deploying the implementations before the proxies. `intializeImplementations()` was renamed to `initializeProxies()` which is more accurate. Also the ASR's implementation was unnecessarily initialized with a proxy address for a constructor argument. --- .../contracts-bedrock/scripts/deploy/Deploy.s.sol | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 5456b88492d5c..77af097800a84 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -398,9 +398,10 @@ contract Deploy is Deployer { mustGetAddress("AddressManager"); mustGetAddress("ProxyAdmin"); - deployProxies(); deployImplementations(); - initializeImplementations(); + + deployProxies(); + initializeProxies(); setAlphabetFaultGameImplementation({ _allowUpgrade: false }); setFastFaultGameImplementation({ _allowUpgrade: false }); @@ -453,9 +454,9 @@ contract Deploy is Deployer { deployAnchorStateRegistry(); } - /// @notice Initialize all of the implementations - function initializeImplementations() public { - console.log("Initializing implementations"); + /// @notice Initialize all of the proxies by upgrading to the correct proxy and calling the initialize function + function initializeProxies() public { + console.log("Initializing proxies"); // Selectively initialize either the original OptimismPortal or the new OptimismPortal2. Since this will upgrade // the proxy, we cannot initialize both. if (cfg.useFaultProofs()) { From bf048056582bc34040b6fe1c9c3c0389cdc7c46b Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 25 Sep 2024 15:35:28 -0400 Subject: [PATCH 2/3] test(deploy): Move ASR impl deployment to deployProxies It must be deployed per chain because it is not MCP ready. --- packages/contracts-bedrock/scripts/deploy/Deploy.s.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 77af097800a84..8f7cef4b12926 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -432,6 +432,8 @@ contract Deploy is Deployer { deployERC1967Proxy("PermissionedDelayedWETHProxy"); deployERC1967Proxy("AnchorStateRegistryProxy"); + deployAnchorStateRegistry(); + transferAddressManagerOwnership(); // to the ProxyAdmin } @@ -451,7 +453,6 @@ contract Deploy is Deployer { deployDelayedWETH(); deployPreimageOracle(); deployMips(); - deployAnchorStateRegistry(); } /// @notice Initialize all of the proxies by upgrading to the correct proxy and calling the initialize function From f70779fba261f33c40c4aeb8dd6b6424246aaf1c Mon Sep 17 00:00:00 2001 From: Maurelian Date: Wed, 25 Sep 2024 15:49:18 -0400 Subject: [PATCH 3/3] test(deploy): Rename deploy functions to correspond to OPCM --- .../scripts/deploy/Deploy.s.sol | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 8f7cef4b12926..0787c965e199d 100644 --- a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol +++ b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol @@ -400,8 +400,8 @@ contract Deploy is Deployer { deployImplementations(); - deployProxies(); - initializeProxies(); + deployOpChain(); + initializeOpChain(); setAlphabetFaultGameImplementation({ _allowUpgrade: false }); setFastFaultGameImplementation({ _allowUpgrade: false }); @@ -412,9 +412,9 @@ contract Deploy is Deployer { transferDelayedWETHOwnership(); } - /// @notice Deploy all of the proxies - function deployProxies() public { - console.log("Deploying proxies"); + /// @notice Deploy all of the OP Chain specific contracts + function deployOpChain() public { + console.log("Deploying OP Chain contracts"); deployERC1967Proxy("OptimismPortalProxy"); deployERC1967Proxy("SystemConfigProxy"); @@ -455,9 +455,10 @@ contract Deploy is Deployer { deployMips(); } - /// @notice Initialize all of the proxies by upgrading to the correct proxy and calling the initialize function - function initializeProxies() public { - console.log("Initializing proxies"); + /// @notice Initialize all of the proxies in an OP Chain by upgrading to the correct proxy and calling the + /// initialize function + function initializeOpChain() public { + console.log("Initializing Op Chain proxies"); // Selectively initialize either the original OptimismPortal or the new OptimismPortal2. Since this will upgrade // the proxy, we cannot initialize both. if (cfg.useFaultProofs()) {