Skip to content

Commit

Permalink
Add rollback script
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Mar 7, 2024
1 parent 9301d7a commit 603d51b
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
19 changes: 19 additions & 0 deletions mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down

0 comments on commit 603d51b

Please sign in to comment.