From 15fd271d52f75c63275225ccf41fa1b73eb62e8c Mon Sep 17 00:00:00 2001 From: Henri Devieux Date: Thu, 21 Nov 2024 11:31:47 -0500 Subject: [PATCH] Add scripts to deploy and upgrade holocene systemconfig (#223) * Add scripts to deploy and upgrade holocene systemconfig * fixes * fixes pt 2 * set denominator * fix denominator --- Makefile | 2 +- .../2024-11-19-holocene-contracts/.env | 13 ++++++++++ .../2024-11-19-holocene-contracts/.gitignore | 1 + .../2024-11-19-holocene-contracts/Makefile | 15 +++++++++++ .../foundry.toml | 19 ++++++++++++++ .../script/DeploySystemConfig.s.sol | 14 ++++++++++ .../script/SetEIP1559Params.s.sol | 26 +++++++++++++++++++ .../script/UpgradeSystemConfig.s.sol | 22 ++++++++++++++++ 8 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/.env create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/.gitignore create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/Makefile create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/foundry.toml create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/script/DeploySystemConfig.s.sol create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/script/SetEIP1559Params.s.sol create mode 100644 sepolia-alpha/2024-11-19-holocene-contracts/script/UpgradeSystemConfig.s.sol diff --git a/Makefile b/Makefile index d8240331..a5794445 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ forge-deps: github.com/OpenZeppelin/openzeppelin-contracts-upgradeable@v4.7.3 \ github.com/rari-capital/solmate@8f9b23f8838670afda0fd8983f2c41e8037ae6bc \ github.com/Saw-mon-and-Natalie/clones-with-immutable-args@105efee1b9127ed7f6fedf139e1fc796ce8791f2 \ - github.com/Vectorized/solady@862a0afd3e66917f50e987e91886b9b90c4018a1 + github.com/Vectorized/solady@1dd8967b93b379ca6cf384640e0715e55ef08e3d .PHONY: checkout-op-commit checkout-op-commit: diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/.env b/sepolia-alpha/2024-11-19-holocene-contracts/.env new file mode 100644 index 00000000..61e75ea4 --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/.env @@ -0,0 +1,13 @@ +# op-contracts v1.8.0-rc.2 +OP_COMMIT=df25977a160f85160779bbca71a8e56cf35b0f69 +SYSTEM_CONFIG_PROXY=0x7F67DC4959cb3E532B10A99F41bDD906C46FdFdE + +# Newly deployed implementation contract for Holocene +SYSTEM_CONFIG_IMPLEMENTATION=0x57563A1Ad5b07CEB7e77B395d767E6144699C887 + +# Same values as previous SystemConfig: +SYTEM_CONFIG_OWNER=0xAf6E0E871f38c7B653700F7CbAEDafaa2784D430 + +GAS_LIMIT=60000000 +ELASTICITY_MULTIPLIER=2 +DENOMINATOR=250 diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/.gitignore b/sepolia-alpha/2024-11-19-holocene-contracts/.gitignore new file mode 100644 index 00000000..4f00cd9a --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/.gitignore @@ -0,0 +1 @@ +/src/ diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/Makefile b/sepolia-alpha/2024-11-19-holocene-contracts/Makefile new file mode 100644 index 00000000..9ae88cf3 --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/Makefile @@ -0,0 +1,15 @@ +include ../../Makefile +include ../.env +include .env + +.PHONY: deploy +deploy: + forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) DeploySystemConfig --broadcast + +.PHONY: upgrade +upgrade: + forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) UpgradeSystemConfig --broadcast + +.PHONY: set-1559-params +set-1559-params: + forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) SetEIP1559Params --broadcast diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/foundry.toml b/sepolia-alpha/2024-11-19-holocene-contracts/foundry.toml new file mode 100644 index 00000000..ce15d349 --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/foundry.toml @@ -0,0 +1,19 @@ +[profile.default] +src = 'src' +out = 'out' +libs = ['lib'] +broadcast = 'records' +fs_permissions = [ {access = "read-write", path = "./"} ] +optimizer = true +optimizer_runs = 999999 +via-ir = true +remappings = [ + '@eth-optimism-bedrock/contracts/=lib/optimism/packages/contracts-bedrock/src/', + '@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts', + '@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts', + '@rari-capital/solmate/=lib/solmate/', + '@solady/=lib/solady/src', + '@cwia/=lib/clones-with-immutable-args/src' +] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/script/DeploySystemConfig.s.sol b/sepolia-alpha/2024-11-19-holocene-contracts/script/DeploySystemConfig.s.sol new file mode 100644 index 00000000..06720c7c --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/script/DeploySystemConfig.s.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import "lib/optimism/packages/contracts-bedrock/src/L1/SystemConfig.sol"; +import "forge-std/Script.sol"; + +contract DeploySystemConfig is Script { + function run() public { + vm.startBroadcast(); + SystemConfig systemConfigImpl = new SystemConfig(); + console.log("SystemConfig implementation deployed at: ", address(systemConfigImpl)); + vm.stopBroadcast(); + } +} diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/script/SetEIP1559Params.s.sol b/sepolia-alpha/2024-11-19-holocene-contracts/script/SetEIP1559Params.s.sol new file mode 100644 index 00000000..639483f6 --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/script/SetEIP1559Params.s.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import "forge-std/Script.sol"; +import "@eth-optimism-bedrock/contracts/universal/ProxyAdmin.sol"; +import "@eth-optimism-bedrock/contracts/L1/SystemConfig.sol"; + +contract SetEIP1559Params is Script { + address systemConfigProxyAddress = vm.envAddress("SYSTEM_CONFIG_PROXY"); + address proxyAdminOwner = vm.envAddress("PROXY_ADMIN_OWNER"); + + uint64 gasLimit = uint64(vm.envUint("GAS_LIMIT")); + + uint32 denominator = uint32(vm.envUint("DENOMINATOR")); + uint32 elasticityMultiplier = uint32(vm.envUint("ELASTICITY_MULTIPLIER")); + + + function run() public { + vm.startBroadcast(proxyAdminOwner); + + SystemConfig(systemConfigProxyAddress).setEIP1559Params(denominator, elasticityMultiplier); + SystemConfig(systemConfigProxyAddress).setGasLimit(gasLimit); + + vm.stopBroadcast(); + } +} diff --git a/sepolia-alpha/2024-11-19-holocene-contracts/script/UpgradeSystemConfig.s.sol b/sepolia-alpha/2024-11-19-holocene-contracts/script/UpgradeSystemConfig.s.sol new file mode 100644 index 00000000..d175cdfc --- /dev/null +++ b/sepolia-alpha/2024-11-19-holocene-contracts/script/UpgradeSystemConfig.s.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import "forge-std/Script.sol"; +import "@eth-optimism-bedrock/contracts/universal/ProxyAdmin.sol"; +import "@eth-optimism-bedrock/contracts/L1/SystemConfig.sol"; + +contract UpgradeSystemConfig is Script { + address systemConfigProxy = vm.envAddress("SYSTEM_CONFIG_PROXY"); + address systemConfigImplementation = vm.envAddress("SYSTEM_CONFIG_IMPLEMENTATION"); + address proxyAdminOwner = vm.envAddress("PROXY_ADMIN_OWNER"); + + function run() public { + vm.broadcast(proxyAdminOwner); + ProxyAdmin proxyAdmin = ProxyAdmin(payable(vm.envAddress("PROXY_ADMIN"))); + + proxyAdmin.upgrade( + payable(systemConfigProxy), + systemConfigImplementation + ); + } +}