From 300d9f335726b0608b50d478aa65cb30a4fd8bd2 Mon Sep 17 00:00:00 2001 From: Maurelian Date: Thu, 26 Sep 2024 10:35:33 -0400 Subject: [PATCH] feat(deploy): deploy implementations before proxies (#12114) * 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. * test(deploy): Move ASR impl deployment to deployProxies It must be deployed per chain because it is not MCP ready. * test(deploy): Rename deploy functions to correspond to OPCM --- .../scripts/deploy/Deploy.s.sol | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol b/packages/contracts-bedrock/scripts/deploy/Deploy.s.sol index 5456b88492d5..0787c965e199 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(); + + deployOpChain(); + initializeOpChain(); setAlphabetFaultGameImplementation({ _allowUpgrade: false }); setFastFaultGameImplementation({ _allowUpgrade: false }); @@ -411,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"); @@ -431,6 +432,8 @@ contract Deploy is Deployer { deployERC1967Proxy("PermissionedDelayedWETHProxy"); deployERC1967Proxy("AnchorStateRegistryProxy"); + deployAnchorStateRegistry(); + transferAddressManagerOwnership(); // to the ProxyAdmin } @@ -450,12 +453,12 @@ contract Deploy is Deployer { deployDelayedWETH(); deployPreimageOracle(); deployMips(); - deployAnchorStateRegistry(); } - /// @notice Initialize all of the implementations - function initializeImplementations() public { - console.log("Initializing implementations"); + /// @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()) {