From 603d51b9ccd372347ae051d3c89088ef25c9ea04 Mon Sep 17 00:00:00 2001 From: katzman Date: Wed, 6 Mar 2024 16:50:31 -0800 Subject: [PATCH] Add rollback script --- .../Makefile | 19 +++++++++ .../script/RollbackGasConfig.sol | 39 +++++++++++++++++++ .../script/UpdateGasConfig.sol | 2 +- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 mainnet/2024-03-07-ecotome-sysconfig-updates/script/RollbackGasConfig.sol diff --git a/mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile b/mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile index 6541d849..885410b9 100644 --- a/mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile +++ b/mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile @@ -23,3 +23,22 @@ approve-update-gas-config: execute: forge script --rpc-url $(L1_RPC_URL) UpdateGasConfig \ --sig "run()" --ledger -hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" + + +.PHONY: sign-rollback-gas-config +sign-update-gas-config: + $(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \ + forge script --rpc-url $(L1_RPC_URL) RollbackGasConfig \ + --sig "sign()" + +.PHONY: approve-rollback-gas-config +approve-update-gas-config: + forge script --rpc-url $(L1_RPC_URL) RollbackGasConfig \ + --sig "approve(address,bytes)" $(SYSTEM_CONFIG_OWNER) $(SIGNATURES) \ + --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \ + --broadcast + +.PHONY: execute-rollback +execute: + forge script --rpc-url $(L1_RPC_URL) RollbackGasConfig \ + --sig "run()" --ledger -hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" diff --git a/mainnet/2024-03-07-ecotome-sysconfig-updates/script/RollbackGasConfig.sol b/mainnet/2024-03-07-ecotome-sysconfig-updates/script/RollbackGasConfig.sol new file mode 100644 index 00000000..ce6f8a82 --- /dev/null +++ b/mainnet/2024-03-07-ecotome-sysconfig-updates/script/RollbackGasConfig.sol @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; +import {MultisigBuilder, IMulticall3} from "@base-contracts/script/universal/MultisigBuilder.sol"; + +contract RollbackGasConfig is MultisigBuilder { + + address internal SYSTEM_CONFIG_OWNER = vm.envAddress("SYSTEM_CONFIG_OWNER"); + address internal L1_SYSTEM_CONFIG = vm.envAddress("L1_SYSTEM_CONFIG_ADDRESS"); + uint256 internal FALLBACK_SCALAR = vm.envUint("FALLBACK_SCALAR"); + + function _postCheck() internal override view { + require(SystemConfig(L1_SYSTEM_CONFIG).scalar() == FALLBACK_SCALAR); + require(SystemConfig(L1_SYSTEM_CONFIG).overhead() == 0); + } + + function _buildCalls() internal override view returns (IMulticall3.Call3[] memory) { + IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](1); + + calls[0] = IMulticall3.Call3({ + target: L1_SYSTEM_CONFIG, + allowFailure: false, + callData: abi.encodeCall( + SystemConfig.setGasConfig, + ( + 0, // overhead is not used post Ecotome + FALLBACK_SCALAR + ) + ) + }); + + return calls; + } + + function _ownerSafe() internal override view returns (address) { + return SYSTEM_CONFIG_OWNER; + } +} \ No newline at end of file diff --git a/mainnet/2024-03-07-ecotome-sysconfig-updates/script/UpdateGasConfig.sol b/mainnet/2024-03-07-ecotome-sysconfig-updates/script/UpdateGasConfig.sol index 77b898b8..91f70b74 100644 --- a/mainnet/2024-03-07-ecotome-sysconfig-updates/script/UpdateGasConfig.sol +++ b/mainnet/2024-03-07-ecotome-sysconfig-updates/script/UpdateGasConfig.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.15; import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; -import "@base-contracts/script/universal/MultisigBuilder.sol"; +import {MultisigBuilder, IMulticall3} from "@base-contracts/script/universal/MultisigBuilder.sol"; contract UpdateGasConfig is MultisigBuilder {