Skip to content

Commit

Permalink
feat(protocol): upgrade scripts for new proxies (#15452)
Browse files Browse the repository at this point in the history
Co-authored-by: David <[email protected]>
  • Loading branch information
cyberhorsey and davidtaikocha authored Jan 4, 2024
1 parent 391eff3 commit 37e6b62
Show file tree
Hide file tree
Showing 13 changed files with 388 additions and 2 deletions.
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeAddressManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/common/AddressManager.sol";
import "./UpgradeScript.s.sol";

contract UpgradeAddressManager is UpgradeScript {
function run() external setUp {
console2.log("upgrading AddressManager");
AddressManager newAddressManager = new AddressManager();
upgrade(address(newAddressManager));

console2.log("upgraded AddressManager to", address(newAddressManager));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeAssignmentHook.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/L1/hooks/AssignmentHook.sol";
import "./UpgradeScript.s.sol";

contract UpgradeAssignmentHook is UpgradeScript {
function run() external setUp {
console2.log("upgrading AssignmentHook");
AssignmentHook newAssignmentHook = new AssignmentHook();
upgrade(address(newAssignmentHook));

console2.log("upgraded AssignmentHook to", address(newAssignmentHook));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeBridge.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/bridge/Bridge.sol";
import "./UpgradeScript.s.sol";

contract UpgradeBridge is UpgradeScript {
function run() external setUp {
console2.log("upgrading bridge");
Bridge newBridge = new Bridge();
upgrade(address(newBridge));

console2.log("upgraded bridge to", address(newBridge));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeERC1155Vault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/tokenvault/ERC1155Vault.sol";
import "./UpgradeScript.s.sol";

contract UpgradeERC1155Vault is UpgradeScript {
function run() external setUp {
console2.log("upgrading ERC1155Vault");
ERC1155Vault newERC1155Vault = new ERC1155Vault();
upgrade(address(newERC1155Vault));

console2.log("upgraded ERC1155Vault to", address(newERC1155Vault));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeERC20Vault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/tokenvault/ERC20Vault.sol";
import "./UpgradeScript.s.sol";

contract UpgradeERC20Vault is UpgradeScript {
function run() external setUp {
console2.log("upgrading ERC20Vault");
ERC20Vault newERC20Vault = new ERC20Vault();
upgrade(address(newERC20Vault));

console2.log("upgraded ERC20Vault to", address(newERC20Vault));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeERC721Vault.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/tokenvault/ERC721Vault.sol";
import "./UpgradeScript.s.sol";

contract UpgradeERC721Vault is UpgradeScript {
function run() external setUp {
console2.log("upgrading ERC721Vault");
ERC721Vault newERC721Vault = new ERC721Vault();
upgrade(address(newERC721Vault));

console2.log("upgraded ERC721Vault to", address(newERC721Vault));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeGuardianProver.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/L1/provers/GuardianProver.sol";
import "./UpgradeScript.s.sol";

contract UpgradeGuardianProver is UpgradeScript {
function run() external setUp {
console2.log("upgrading GuardianProver");
GuardianProver newGuardianProver = new GuardianProver();
upgrade(address(newGuardianProver));

console2.log("upgraded GuardianProver to", address(newGuardianProver));
}
}
56 changes: 56 additions & 0 deletions packages/protocol/script/upgrade/UpgradeScript.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity 0.8.20;

import "../../contracts/L1/gov/TaikoTimelockController.sol";
import "lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol";

import "forge-std/console2.sol";
import "forge-std/Script.sol";

contract UpgradeScript is Script {
uint256 public privateKey = vm.envUint("PRIVATE_KEY");
address public timelockAddress = vm.envAddress("TIMELOCK_ADDRESS");
address public proxyAddress = vm.envAddress("PROXY_ADDRESS");

UUPSUpgradeable proxy;
TaikoTimelockController timelock;

modifier setUp() {
require(privateKey != 0, "PRIVATE_KEY not set");
require(proxyAddress != address(0), "PROXY_ADDRESS not set");
require(timelockAddress != address(0), "TIMELOCK_ADDRESS not set");

proxy = UUPSUpgradeable(payable(proxyAddress));
timelock = TaikoTimelockController(payable(timelockAddress));

vm.startBroadcast(privateKey);

_;

vm.stopBroadcast();
}

function upgrade(address newImpl) public {
bytes32 salt = bytes32(block.timestamp);

bytes memory payload =
abi.encodeWithSelector(bytes4(keccak256("upgradeTo(address)")), newImpl);

timelock.schedule(address(proxy), 0, payload, bytes32(0), salt, 0);

timelock.execute(address(proxy), 0, payload, bytes32(0), salt);
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeSignalService.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/signal/SignalService.sol";
import "./UpgradeScript.s.sol";

contract UpgradeSignalService is UpgradeScript {
function run() external setUp {
console2.log("upgrading SignalService");
SignalService newSignalService = new SignalService();
upgrade(address(newSignalService));

console2.log("upgraded SignalService to", address(newSignalService));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeTaikoGovernor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/L1/gov/TaikoGovernor.sol";
import "./UpgradeScript.s.sol";

contract UpgradeTaikoGovernor is UpgradeScript {
function run() external setUp {
console2.log("upgrading TaikoGovernor");
TaikoGovernor newTaikoGovernor = new TaikoGovernor();
upgrade(address(newTaikoGovernor));

console2.log("upgraded TaikoGovernor to", address(newTaikoGovernor));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeTaikoL1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/L1/TaikoL1.sol";
import "./UpgradeScript.s.sol";

contract UpgradeTaikoL1 is UpgradeScript {
function run() external setUp {
console2.log("upgrading TaikoL1");
TaikoL1 newTaikoL1 = new TaikoL1();
upgrade(address(newTaikoL1));

console2.log("upgraded TaikoL1 to", address(newTaikoL1));
}
}
30 changes: 30 additions & 0 deletions packages/protocol/script/upgrade/UpgradeTimelockController.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT
// _____ _ _ _ _
// |_ _|_ _(_) |_____ | | __ _| |__ ___
// | |/ _` | | / / _ \ | |__/ _` | '_ (_-<
// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/
//
// Email: [email protected]
// Website: https://taiko.xyz
// GitHub: https://github.com/taikoxyz
// Discord: https://discord.gg/taikoxyz
// Twitter: https://twitter.com/taikoxyz
// Blog: https://mirror.xyz/labs.taiko.eth
// Youtube: https://www.youtube.com/@taikoxyz

pragma solidity ^0.8.20;

import "forge-std/Script.sol";
import "forge-std/console2.sol";
import "../../contracts/L1/gov/TaikoTimelockController.sol";
import "./UpgradeScript.s.sol";

contract UpgradeTaikoTimelockController is UpgradeScript {
function run() external setUp {
console2.log("upgrading TaikoTimelockController");
TaikoTimelockController newTaikoTimelockController = new TaikoTimelockController();
upgrade(address(newTaikoTimelockController));

console2.log("upgraded TaikoTimelockController to", address(newTaikoTimelockController));
}
}
Loading

2 comments on commit 37e6b62

@vercel
Copy link

@vercel vercel bot commented on 37e6b62 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

bridge-ui-v2-a6 – ./packages/bridge-ui-v2

bridge-ui-v2-a6.vercel.app
bridge-ui-v2-a6-git-alpha-6-taikoxyz.vercel.app
bridge-ui-v2-a6-taikoxyz.vercel.app
bridge.katla.taiko.xyz

@vercel
Copy link

@vercel vercel bot commented on 37e6b62 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

bridge-ui-v2-internal – ./packages/bridge-ui-v2

bridge-ui-v2-internal-taikoxyz.vercel.app
bridge-ui-v2-internal.vercel.app
bridge-ui-v2-internal-git-alpha-6-taikoxyz.vercel.app

Please sign in to comment.