Skip to content

Commit

Permalink
Added script and Makefile cmds for updating gas config
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Mar 7, 2024
1 parent 424217a commit 9301d7a
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 268 deletions.
30 changes: 30 additions & 0 deletions mainnet/2024-03-07-ecotome-sysconfig-updates/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
OP_COMMIT=c87a469d7d679e8a4efbace56c3646b925bcc009
BASE_CONTRACTS_COMMIT=fe492be3478134b2305c207a12b153eca04148c0

L1_SYSTEM_CONFIG_ADDRESS=0x73a79Fab69143498Ed3712e519A88a918e1f4072
SYSTEM_CONFIG_OWNER=0x14536667Cd30e52C0b458BaACcB9faDA7046E056

# scalars defined by running: https://github.com/ethereum-optimism/optimism/tree/4b7627cbb94a75e478a34f33f91121ef6ae794b3/op-chain-ops/cmd/ecotone-scalar
# 1 BLOB PER TX
# base fee scalar : 6607
# blob base fee scalar: 654675
# v1 hex encoding : 0x0100000000000000000000000000000000000000000000000009fd53000019cf
# uint value for the 'scalar' parameter in SystemConfigProxy.setGasConfig():
SCALAR=452312848583266388373324160190187140051835877600158453279133999338625178063


# 6 BLOBS PER TX
# base fee scalar : 1101
# blob base fee scalar: 652972
# v1 hex encoding : 0x0100000000000000000000000000000000000000000000000009f6ac0000044d
# uint value for the 'scalar' parameter in SystemConfigProxy.setGasConfig():
# SCALAR=452312848583266388373324160190187140051835877600158453279133992024295867469

# THINGS WENT WRONG --> FALLBACK TO CALLDATA
# base fee scalar : 668098
# blob base fee scalar: 0
# v1 hex encoding : 0x01000000000000000000000000000000000000000000000000000000000a31c2
# uint value for the 'scalar' parameter in SystemConfigProxy.setGasConfig():
FALLBACK_SCALAR=452312848583266388373324160190187140051835877600158453279131187530911330754

SIGNATURES=
54 changes: 12 additions & 42 deletions mainnet/2024-03-07-ecotome-sysconfig-updates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,20 @@ ifndef LEDGER_ACCOUNT
override LEDGER_ACCOUNT = 0
endif

##
# Incident response commands
# Note that --ledger --hd-paths <PATH> can be replaced with --private-key $(PRIVATE_KEY)
# in any command when using a local key.
##

# Delete L2 Outputs Commands

.PHONY: delete-outputs-sign
delete-outputs-sign: deps
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) DeleteL2Outputs --sig "sign()"

.PHONY: delete-outputs-run
delete-outputs-run: deps
forge script --rpc-url $(L1_RPC_URL) \
DeleteL2Outputs --sig "run(bytes)" $(SIGNATURES) \
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \
--broadcast

# Pause OptimismPortal Commands

.PHONY: pause-portal-sign
pause-portal-sign: deps
.PHONY: sign-update-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) PausePortal --sig "sign()"
forge script --rpc-url $(L1_RPC_URL) UpdateGasConfig \
--sig "sign()"

.PHONY: pause-portal-run
pause-portal-run: deps
forge script --rpc-url $(L1_RPC_URL) \
PausePortal --sig "run(bytes)" $(SIGNATURES) \
.PHONY: approve-update-gas-config
approve-update-gas-config:
forge script --rpc-url $(L1_RPC_URL) UpdateGasConfig \
--sig "approve(address,bytes)" $(SYSTEM_CONFIG_OWNER) $(SIGNATURES) \
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \
--broadcast

# Unpause OptimismPortal Commands

.PHONY: unpause-portal-sign
unpause-portal-sign: deps
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) UnpausePortal --sig "sign()"

.PHONY: unpause-portal-run
unpause-portal-run: deps
forge script --rpc-url $(L1_RPC_URL) \
UnpausePortal --sig "run(bytes)" $(SIGNATURES) \
--ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" \
--broadcast
.PHONY: execute
execute:
forge script --rpc-url $(L1_RPC_URL) UpdateGasConfig \
--sig "run()" --ledger -hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0"

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

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 "@base-contracts/script/universal/MultisigBuilder.sol";

contract UpdateGasConfig 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 SCALAR = vm.envUint("SCALAR");

function _postCheck() internal override view {
require(SystemConfig(L1_SYSTEM_CONFIG).scalar() == 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
SCALAR
)
)
});

return calls;
}

function _ownerSafe() internal override view returns (address) {
return SYSTEM_CONFIG_OWNER;
}
}

This file was deleted.

0 comments on commit 9301d7a

Please sign in to comment.