From 477806e82deb12ed45900973d066af73dc418452 Mon Sep 17 00:00:00 2001 From: 0xRaccoon <112493530+0xRaccoon@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:27:53 -0300 Subject: [PATCH] chore: update prod deploy scripts (#5) Signed-off-by: 0xRaccoon --- packages/contracts-bedrock/.env.example | 10 +++- packages/contracts-bedrock/package.json | 3 +- .../winddown-upgrade/WinddownConstants.sol | 4 +- ...wn.s.sol => Winddown-implementation.s.sol} | 48 +++++++++---------- 4 files changed, 34 insertions(+), 31 deletions(-) rename packages/contracts-bedrock/scripts/winddown-upgrade/prod/{Winddown.s.sol => Winddown-implementation.s.sol} (59%) diff --git a/packages/contracts-bedrock/.env.example b/packages/contracts-bedrock/.env.example index 083ae7f7f46f..023f224e60dd 100644 --- a/packages/contracts-bedrock/.env.example +++ b/packages/contracts-bedrock/.env.example @@ -24,6 +24,12 @@ SAVE_DEPLOYMENTS=1 # Disable the live deployer so that transactions must be submitted manually DISABLE_LIVE_DEPLOYER=true -# Sets the deployer's key to match the first default hardhat account -PRIVATE_KEY_DEPLOYER=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 +# Contracts deployer private keys +PRIVATE_KEY_DEPLOYER= + +# Used for test deploy PRIVATE_KEY_PROXY_ADMIN= + +# Balance claimer proxy admin to be set +BALANCE_CLAIMER_PROXY_ADMIN_PUBLIC_ADDRESS= + diff --git a/packages/contracts-bedrock/package.json b/packages/contracts-bedrock/package.json index a81ac2fea050..97700859ff53 100644 --- a/packages/contracts-bedrock/package.json +++ b/packages/contracts-bedrock/package.json @@ -25,8 +25,9 @@ "autogen:artifacts": "ts-node scripts/generate-artifacts.ts", "autogen:invariant-docs": "ts-node scripts/invariant-doc-gen.ts", "deploy": "hardhat deploy", - "upgrade-prod:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/prod/Winddown.s.sol:WinddownUpgrade --rpc-url $ETHEREUM_MAINNET_RPC --broadcast'", "upgrade-local:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/local/Winddown.s.sol:WinddownUpgrade --rpc-url $LOCAL_RPC --unlocked --broadcast'", + "deploy-prod-simulation:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/prod/Winddown-implementation.s.sol:WinddownImplementationDeploy --rpc-url $ETHEREUM_MAINNET_RPC'", + "deploy-prod:winddown": "bash -c 'source .env && forge script scripts/winddown-upgrade/prod/Winddown-implementation.s.sol:WinddownImplementationDeploy --rpc-url $ETHEREUM_MAINNET_RPC --broadcast'", "test": "yarn build:differential && yarn build:fuzz && forge test", "coverage": "yarn build:differential && yarn build:fuzz && forge coverage", "coverage:lcov": "yarn build:differential && yarn build:fuzz && forge coverage --report lcov", diff --git a/packages/contracts-bedrock/scripts/winddown-upgrade/WinddownConstants.sol b/packages/contracts-bedrock/scripts/winddown-upgrade/WinddownConstants.sol index 9f434915ea01..7e3e25b0e8ce 100644 --- a/packages/contracts-bedrock/scripts/winddown-upgrade/WinddownConstants.sol +++ b/packages/contracts-bedrock/scripts/winddown-upgrade/WinddownConstants.sol @@ -13,6 +13,6 @@ library WinddownConstants { // L1StandardBridge constructor parameters address constant MESSENGER = 0x97BAf688E5d0465E149d1d5B497Ca99392a6760e; - // TODO: Set the correct merkle root - bytes32 constant MERKLE_ROOT; + // Prod generated merkle root + bytes32 constant MERKLE_ROOT = 0xdc8d72680e7aa76a53e17f537ee4455c1546c32badeac410313687a14bbe9625; } \ No newline at end of file diff --git a/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol b/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown-implementation.s.sol similarity index 59% rename from packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol rename to packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown-implementation.s.sol index 37734ee846f6..11d11b65fbde 100644 --- a/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown.s.sol +++ b/packages/contracts-bedrock/scripts/winddown-upgrade/prod/Winddown-implementation.s.sol @@ -5,7 +5,6 @@ import { console } from "forge-std/console.sol"; import { Script } from "forge-std/Script.sol"; import { Proxy } from "contracts/universal/Proxy.sol"; -import { L1ChugSplashProxy } from "contracts/legacy/L1ChugSplashProxy.sol"; import { WinddownConstants } from "../WinddownConstants.sol"; import { IBalanceClaimer, BalanceClaimer } from "contracts/L1/winddown/BalanceClaimer.sol"; @@ -15,15 +14,12 @@ import { OptimismPortal } from "contracts/L1/OptimismPortal.sol"; import { L2OutputOracle } from "../../../contracts/L1/L2OutputOracle.sol"; import { SystemConfig } from "../../../contracts/L1/SystemConfig.sol"; -contract WinddownUpgrade is Script { +contract WinddownImplementationDeploy is Script { function run() public { - uint256 _deployerPk = vm.envUint("PRIVATE_KEY_PROXY_ADMIN"); + uint256 _deployerPk = vm.envUint("PRIVATE_KEY_DEPLOYER"); address _deployer = vm.addr(_deployerPk); - - // Get the proxies for L1StandardBridge and OptimismPortal - L1ChugSplashProxy l1StandardBridgeProxy = L1ChugSplashProxy(payable(address(WinddownConstants.L1_STANDARD_BRIDGE_PROXY))); - Proxy optimismPortalProxy = Proxy(payable(address(WinddownConstants.OPTIMISM_PORTAL_PROXY))); - + address _balanceClaimerProxyAdmin = vm.envAddress("BALANCE_CLAIMER_PROXY_ADMIN_PUBLIC_ADDRESS"); + vm.startBroadcast(_deployer); // Deploy BalanceClaimer proxy @@ -31,17 +27,20 @@ contract WinddownUpgrade is Script { // Deploy BalanceClaimer implementation BalanceClaimer balanceClaimerImpl = new BalanceClaimer({ - _ethBalanceWithdrawer: address(optimismPortalProxy), - _erc20BalanceWithdrawer: address(l1StandardBridgeProxy), + _ethBalanceWithdrawer: WinddownConstants.OPTIMISM_PORTAL_PROXY, + _erc20BalanceWithdrawer: WinddownConstants.L1_STANDARD_BRIDGE_PROXY, _root: WinddownConstants.MERKLE_ROOT }); // Set BalanceClaimer implementation balanceClaimerProxy.upgradeTo(address(balanceClaimerImpl)); + // Change the admin of the BalanceClaimer proxy + balanceClaimerProxy.changeAdmin(_balanceClaimerProxyAdmin); + // BalanceClaimer assertions - assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == address(optimismPortalProxy)); - assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == address(l1StandardBridgeProxy)); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ETH_BALANCE_WITHDRAWER()) == WinddownConstants.OPTIMISM_PORTAL_PROXY); + assert(address(BalanceClaimer(address(balanceClaimerProxy)).ERC20_BALANCE_WITHDRAWER()) == WinddownConstants.L1_STANDARD_BRIDGE_PROXY); assert(BalanceClaimer(address(balanceClaimerProxy)).ROOT() == WinddownConstants.MERKLE_ROOT); // Deploy OptimismPortal implementation @@ -53,16 +52,11 @@ contract WinddownUpgrade is Script { _balanceClaimer: address(balanceClaimerProxy) }); - // Upgrade OptimismPortal - optimismPortalProxy.upgradeTo( - address(opPortalImpl) - ); - // OptimismPortal assertions - assert(address(OptimismPortal(payable(address(optimismPortalProxy))).L2_ORACLE()) == WinddownConstants.L2_ORACLE); - assert(address(OptimismPortal(payable(address(optimismPortalProxy))).GUARDIAN()) == WinddownConstants.GUARDIAN); - assert(address(OptimismPortal(payable(address(optimismPortalProxy))).SYSTEM_CONFIG()) == WinddownConstants.SYSTEM_CONFIG); - assert(address(OptimismPortal(payable(address(optimismPortalProxy))).BALANCE_CLAIMER()) == address(balanceClaimerProxy)); + assert(address(OptimismPortal(payable(address(opPortalImpl))).L2_ORACLE()) == WinddownConstants.L2_ORACLE); + assert(address(OptimismPortal(payable(address(opPortalImpl))).GUARDIAN()) == WinddownConstants.GUARDIAN); + assert(address(OptimismPortal(payable(address(opPortalImpl))).SYSTEM_CONFIG()) == WinddownConstants.SYSTEM_CONFIG); + assert(address(OptimismPortal(payable(address(opPortalImpl))).BALANCE_CLAIMER()) == address(balanceClaimerProxy)); // No assertion for pause since it's set in the initializer and setting true or false in the new implementation constructor parameter is idempotent // Deploy L1StandardBridge implementation @@ -71,12 +65,14 @@ contract WinddownUpgrade is Script { _balanceClaimer: address(balanceClaimerProxy) }); - // Upgrade L1StandardBridge - l1StandardBridgeProxy.setCode(address(l1StandardBridgeImpl).code); - // L1StandardBridge assertions - assert(address(L1StandardBridge(payable(address(l1StandardBridgeProxy))).BALANCE_CLAIMER()) == address(balanceClaimerProxy)); - assert(address(L1StandardBridge(payable(address(l1StandardBridgeProxy))).MESSENGER()) == WinddownConstants.MESSENGER); + assert(address(L1StandardBridge(payable(address(l1StandardBridgeImpl))).BALANCE_CLAIMER()) == address(balanceClaimerProxy)); + assert(address(L1StandardBridge(payable(address(l1StandardBridgeImpl))).MESSENGER()) == WinddownConstants.MESSENGER); + + console.log("BalanceClaimer proxy deployed at: ", address(balanceClaimerProxy)); + console.log("BalanceClaimer implementatoin deployed at: ", address(balanceClaimerImpl)); + console.log("OptimismPortal implementation deployed at: ", address(opPortalImpl)); + console.log("L1StandardBridge implementation deployed at: ", address(l1StandardBridgeImpl)); vm.stopBroadcast(); }