From c740cf514f69c22d6fdf5af6dd69b510b42f3056 Mon Sep 17 00:00:00 2001 From: katzman Date: Fri, 8 Mar 2024 13:45:06 -0800 Subject: [PATCH] Update Sepolia Gas Config (#135) * Init * Added updateGasConfigSepolia script and associated env/makefile * Adjust scalar values to most recent, address PR comment * Update to pkey cli flag * Suppress stdout --- .../2024-03-07-ecotone-sysconfig-updates/.env | 30 +++++++++++++++++++ .../Makefile | 9 ++++++ .../foundry.toml | 20 +++++++++++++ .../script/UpdateGasConfig.sol | 24 +++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 sepolia/2024-03-07-ecotone-sysconfig-updates/.env create mode 100644 sepolia/2024-03-07-ecotone-sysconfig-updates/Makefile create mode 100644 sepolia/2024-03-07-ecotone-sysconfig-updates/foundry.toml create mode 100644 sepolia/2024-03-07-ecotone-sysconfig-updates/script/UpdateGasConfig.sol diff --git a/sepolia/2024-03-07-ecotone-sysconfig-updates/.env b/sepolia/2024-03-07-ecotone-sysconfig-updates/.env new file mode 100644 index 00000000..574344f1 --- /dev/null +++ b/sepolia/2024-03-07-ecotone-sysconfig-updates/.env @@ -0,0 +1,30 @@ +OP_COMMIT=c87a469d7d679e8a4efbace56c3646b925bcc009 +BASE_CONTRACTS_COMMIT=56d8f40b48795663fa88366d762161af5a1ba5d5 + +# https://sepolia.etherscan.io/address/0xf272670eb55e895584501d564AfEB048bEd26194 +L1_SYSTEM_CONFIG_ADDRESS=0xf272670eb55e895584501d564AfEB048bEd26194 +OWNER_ADDRESS=0x608081689Fe46936fB2fBDF7552CbB1D80ad4822 +PRIVATE_KEY= + +# 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: 659851 +# v1 hex encoding : 0x010000000000000000000000000000000000000000000000000a118b0000044d +# uint value for the 'scalar' parameter in SystemConfigProxy.setGasConfig(): +SCALAR=452312848583266388373324160190187140051835877600158453279134021569375896653 + +# 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 diff --git a/sepolia/2024-03-07-ecotone-sysconfig-updates/Makefile b/sepolia/2024-03-07-ecotone-sysconfig-updates/Makefile new file mode 100644 index 00000000..31b947c7 --- /dev/null +++ b/sepolia/2024-03-07-ecotone-sysconfig-updates/Makefile @@ -0,0 +1,9 @@ +include ../../Makefile +include ../.env +include .env + +# Unpause OptimismPortal Commands + +.PHONY: update-gas-config +update-gas-config: + @forge script --rpc-url $(L1_RPC_URL) UpdateGasConfigSepolia --private-key $(PRIVATE_KEY) --broadcast diff --git a/sepolia/2024-03-07-ecotone-sysconfig-updates/foundry.toml b/sepolia/2024-03-07-ecotone-sysconfig-updates/foundry.toml new file mode 100644 index 00000000..0be0575a --- /dev/null +++ b/sepolia/2024-03-07-ecotone-sysconfig-updates/foundry.toml @@ -0,0 +1,20 @@ +[profile.default] +src = 'src' +out = 'out' +libs = ['lib'] +broadcast = 'records' +fs_permissions = [ {access = "read-write", path = "./"} ] +optimizer = true +optimizer_runs = 999999 +solc_version = "0.8.15" +via-ir = true +remappings = [ + '@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/', + '@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts', + '@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts', + '@rari-capital/solmate/=lib/solmate/', + '@base-contracts/=lib/base-contracts', + 'solady/=lib/solady/src/' +] + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config \ No newline at end of file diff --git a/sepolia/2024-03-07-ecotone-sysconfig-updates/script/UpdateGasConfig.sol b/sepolia/2024-03-07-ecotone-sysconfig-updates/script/UpdateGasConfig.sol new file mode 100644 index 00000000..3e98d1ba --- /dev/null +++ b/sepolia/2024-03-07-ecotone-sysconfig-updates/script/UpdateGasConfig.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.15; + +import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol"; +import "forge-std/Script.sol"; + +contract UpdateGasConfigSepolia is Script { + + address internal L1_SYSTEM_CONFIG = vm.envAddress("L1_SYSTEM_CONFIG_ADDRESS"); + uint256 internal SCALAR = vm.envUint("SCALAR"); + address internal OWNER = vm.envAddress("OWNER_ADDRESS"); + + function _postCheck() internal view { + require(SystemConfig(L1_SYSTEM_CONFIG).scalar() == SCALAR); + require(SystemConfig(L1_SYSTEM_CONFIG).overhead() == 0); + } + + function run() public { + vm.startBroadcast(OWNER); + SystemConfig(L1_SYSTEM_CONFIG).setGasConfig(0, SCALAR); + _postCheck(); + vm.stopBroadcast(); + } +} \ No newline at end of file