Skip to content

Commit

Permalink
chore: update prod deploy scripts (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: 0xRaccoon <[email protected]>
  • Loading branch information
0xRaccoon authored Dec 9, 2024
1 parent e0d5c85 commit 477806e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
10 changes: 8 additions & 2 deletions packages/contracts-bedrock/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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=

3 changes: 2 additions & 1 deletion packages/contracts-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -15,33 +14,33 @@ 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
Proxy balanceClaimerProxy = new Proxy(_deployer);

// 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
Expand All @@ -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
Expand All @@ -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();
}
Expand Down

0 comments on commit 477806e

Please sign in to comment.