Skip to content

Commit

Permalink
feat(protocol): add Hekla Ontake hardfork upgrade scripts (#18103)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Sep 17, 2024
1 parent 38fa03a commit a3436e8
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
52 changes: 52 additions & 0 deletions packages/protocol/script/layer1/UpgradeHeklaOntakeL1.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import "../../test/shared/DeployCapability.sol";
import "../../contracts/layer1/hekla/HeklaTaikoL1.sol";
import "../../contracts/shared/bridge/Bridge.sol";
import "../../contracts/shared/common/AddressManager.sol";
import "../../contracts/layer1/provers/ProverSet.sol";
import "../../contracts/layer1/provers/GuardianProver.sol";

contract UpgradeHeklaOntakeL1 is DeployCapability {
uint256 public privateKey = vm.envUint("PRIVATE_KEY");

modifier broadcast() {
require(privateKey != 0, "invalid private key");
vm.startBroadcast(privateKey);
_;
vm.stopBroadcast();
}

function run() external broadcast {
// TaikoL1
UUPSUpgradeable(0x79C9109b764609df928d16fC4a91e9081F7e87DB).upgradeTo(
address(new HeklaTaikoL1())
);
// Bridge
UUPSUpgradeable(0xA098b76a3Dd499D3F6D58D8AcCaFC8efBFd06807).upgradeTo(address(new Bridge()));
// Rollup address manager
UUPSUpgradeable(0x1F027871F286Cf4B7F898B21298E7B3e090a8403).upgradeTo(
address(new AddressManager())
);
// Shared address manager
UUPSUpgradeable(0x7D3338FD5e654CAC5B10028088624CA1D64e74f7).upgradeTo(
address(new AddressManager())
);
// Prover set
UUPSUpgradeable(0xD3f681bD6B49887A48cC9C9953720903967E9DC0).upgradeTo(
address(new ProverSet())
);
UUPSUpgradeable(0x335103c4fa2F55451975082136F1478eCFeB84B9).upgradeTo(
address(new ProverSet())
);
// Guardian Prover
UUPSUpgradeable(0x92F195a8702da2104aE8E3E10779176E7C35d6BC).upgradeTo(
address(new GuardianProver())
);
UUPSUpgradeable(0x31d4d27da5c299d4b6CE19c869B8891C0002795d).upgradeTo(
address(new GuardianProver())
);
}
}
70 changes: 70 additions & 0 deletions packages/protocol/script/layer1/UpgradeHeklaOntakeL2.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
import "../../test/shared/DeployCapability.sol";
import "../../contracts/layer2/hekla/HeklaTaikoL2.sol";
import "../../contracts/shared/bridge/Bridge.sol";
import "../../contracts/shared/common/AddressManager.sol";
import "../../test/shared/thirdparty/Multicall3.sol";
import "../../contracts/layer2/DelegateOwner.sol";

contract UpgradeHeklaOntakeL2 is DeployCapability {
address public delegateOwner = 0x95F6077C7786a58FA070D98043b16DF2B1593D2b;
address public multicall3 = 0xcA11bde05977b3631167028862bE2a173976CA11;

uint256 public privateKey = vm.envUint("PRIVATE_KEY");
address public newHeklaTaikoL2 = vm.envAddress("NEW_HEKLA_TAIKO_L2");
address public newBridge = vm.envAddress("NEW_BRIDGE");
address public newAddressManager = vm.envAddress("NEW_ADDRESS_MANAGER");

modifier broadcast() {
require(privateKey != 0, "invalid private key");
vm.startBroadcast(privateKey);
_;
vm.stopBroadcast();
}

function run() external broadcast {
Multicall3.Call3[] memory calls = new Multicall3.Call3[](4);
// TaikoL2
calls[0].target = 0x1670090000000000000000000000000000010001;
calls[0].allowFailure = false;
calls[0].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (newHeklaTaikoL2));
// Bridge
calls[1].target = 0x1670090000000000000000000000000000000001;
calls[1].allowFailure = false;
calls[1].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (newBridge));
// Rollup address manager
calls[2].target = 0x1670090000000000000000000000000000010002;
calls[2].allowFailure = false;
calls[2].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (newAddressManager));
// Shared address manager
calls[3].target = 0x1670090000000000000000000000000000000006;
calls[3].allowFailure = false;
calls[3].callData = abi.encodeCall(UUPSUpgradeable.upgradeTo, (newAddressManager));

DelegateOwner.Call memory dcall = DelegateOwner.Call({
txId: 0,
target: multicall3,
isDelegateCall: true,
txdata: abi.encodeCall(Multicall3.aggregate3, (calls))
});

IBridge.Message memory message = IBridge.Message({
id: 0,
fee: 0,
gasLimit: 3_000_000,
from: msg.sender,
srcChainId: 17_000,
srcOwner: msg.sender,
destChainId: 167_009,
destOwner: delegateOwner,
to: delegateOwner,
value: 0,
data: abi.encodeCall(DelegateOwner.onMessageInvocation, abi.encode(dcall))
});

IBridge(0xA098b76a3Dd499D3F6D58D8AcCaFC8efBFd06807).sendMessage(message);
}
}

0 comments on commit a3436e8

Please sign in to comment.