Skip to content

Commit

Permalink
Add scripts and configuration to upgrade L1 system config (#225)
Browse files Browse the repository at this point in the history
* Add scripts and configuration to upgrade L1 system config

* use public repo

* Use L1 RPC for broadcast

* fix compile errors

* wip multicall

* fix addresses + working script

* remove wrong new impl

* Added new Rollback template to demonstrate the safe way to handle tx pairs (do/undo)

* Update with new address

* Update makefile

* Add readme

* Update to latest contract implementation

* Remove irrelevant RollbackPause script

* Commit contract change

* Add different signing tasks for op and cb

---------

Co-authored-by: Baptiste Oueriagli <[email protected]>
Co-authored-by: katzman <[email protected]>
Co-authored-by: Francis Li <[email protected]>
  • Loading branch information
4 people authored Dec 4, 2024
1 parent 2c53805 commit 1f09acf
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mainnet/2024-11-18-increase-max-gas-limit/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
OPTIMISM_REPO=https://github.com/ethereum-optimism/optimism.git
OPTIMISM_VERSION=op-contracts/v1.5.0
OPTIMISM_CONTRACT_PATCH=patch/max-gas-limit.patch

OP_MULTISIG=0x2501c477D0A35545a387Aa4A3EEe4292A9a8B3F0
CB_MULTISIG=0x6e1DFd5C1E22A4677663A81D24C6BA03561ef0f6

SAFE_ADDRESS=0x7bb41c3008b3f03fe483b28b8db90e19cf07595c
PROXY_ADMIN_ADDRESS=0x0475cBCAebd9CE8AfA5025828d5b98DFb67E059E
SYSTEM_CONFIG_ADDRESS=0x73a79Fab69143498Ed3712e519A88a918e1f4072

NEW_IMPLEMENTATION=0x3c768A33C473F664678b58C2253DB096b41F7cFC
42 changes: 42 additions & 0 deletions mainnet/2024-11-18-increase-max-gas-limit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
include ../../Makefile
include ../.env
include .env

ifndef LEDGER_ACCOUNT
override LEDGER_ACCOUNT = 0
endif

# Overwriting this from top level makefile to change the branch
.PHONY: checkout-op-commit
checkout-op-commit:
rm -rf lib/optimism
mkdir -p lib/optimism
cd lib/optimism; \
git init; \
git remote add origin $(OPTIMISM_REPO); \
git fetch --depth=1 origin tag $(OPTIMISM_VERSION) --no-tags; \
git checkout $(OPTIMISM_VERSION); \
git apply ../../$(OPTIMISM_CONTRACT_PATCH)


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

.PHONY: sign-cb
sign-cb:
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) UpgradeSystemConfig \
--sig "sign(address)" $(CB_MULTISIG)

.PHONY: sign-op
sign-op:
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
forge script --rpc-url $(L1_RPC_URL) UpgradeSystemConfig \
--sig "sign(address)" $(OP_MULTISIG)

.PHONY: run-upgrade
run-upgrade:
forge script --rpc-url $(L1_RPC_URL) UpgradeSystemConfig \
--sig "run(bytes)" $(SIGNATURES) -i 1 --broadcast
29 changes: 29 additions & 0 deletions mainnet/2024-11-18-increase-max-gas-limit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## [READY TO SIGN] Upgrade to new system config with 400m max gas limit

Base is continuing to scale and we need higher block gas limit to support the increased demand.

### Steps

1. pull main branch of https://github.com/base-org/contract-deployments:
`git clone [email protected]:base-org/contract-deployments.git`

2. ledger needs to be connected and unlocked
3. deploying contracts (base team):
```
cd mainnet/2024-11-18-increase-max-gas-limit
make deps
make deploy
```

4. sign (both base & op team):
```
cd mainnet/2024-11-18-increase-max-gas-limit
make deps # skip if already installed
make sign
```

5. upgrade
```
cd mainnet/2024-11-18-increase-max-gas-limit
make run-upgrade
```
21 changes: 21 additions & 0 deletions mainnet/2024-11-18-increase-max-gas-limit/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[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 = false
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/',
'src/=lib/optimism/packages/contracts-bedrock/src/',
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
1 change: 1 addition & 0 deletions mainnet/2024-11-18-increase-max-gas-limit/output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Start verifying contract `0x57563A1Ad5b07CEB7e77B395d767E6144699C887` deployed on sepolia
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/packages/contracts-bedrock/src/L1/SystemConfig.sol b/packages/contracts-bedrock/src/L1/SystemConfig.sol
index 67a8353ae..ae72faf92 100644
--- a/packages/contracts-bedrock/src/L1/SystemConfig.sol
+++ b/packages/contracts-bedrock/src/L1/SystemConfig.sol
@@ -87,7 +87,7 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
/// @notice The maximum gas limit that can be set for L2 blocks. This limit is used to enforce that the blocks
/// on L2 are not too large to process and prove. Over time, this value can be increased as various
/// optimizations and improvements are made to the system at large.
- uint64 internal constant MAX_GAS_LIMIT = 200_000_000;
+ uint64 internal constant MAX_GAS_LIMIT = 400_000_000;

/// @notice Fixed L2 gas overhead. Used as part of the L2 fee calculation.
uint256 public overhead;
@@ -115,8 +115,8 @@ contract SystemConfig is OwnableUpgradeable, ISemver, IGasToken {
event ConfigUpdate(uint256 indexed version, UpdateType indexed updateType, bytes data);

/// @notice Semantic version.
- /// @custom:semver 2.2.0
- string public constant version = "2.2.0";
+ /// @custom:semver 2.2.0+max-gas-limit-400M
+ string public constant version = "2.2.0+max-gas-limit-400M";

/// @notice Constructs the SystemConfig contract. Cannot set
/// the owner to `address(0)` due to the Ownable contract's

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import {Script, console} from "forge-std/Script.sol";

import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";

contract DeploySystemConfig is Script {
function run() public {
vm.startBroadcast();
SystemConfig systemConfigImpl = new SystemConfig();
console.log("SystemConfig implementation deployed at: ", address(systemConfigImpl));
vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import {Vm} from "forge-std/Vm.sol";
import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol";

import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";
import {MultisigBuilder, Simulation} from "@base-contracts/script/universal/MultisigBuilder.sol";

interface IProxyAdmin {
function upgrade(address _proxy, address _implementation) external;
}

interface IProxy {
function implementation() external view returns (address);
}

contract UpgradeSystemConfig is MultisigBuilder {
address internal SAFE_ADDRESS = vm.envAddress("SAFE_ADDRESS");
address internal PROXY_ADMIN_ADDRESS = vm.envAddress("PROXY_ADMIN_ADDRESS");
address internal SYSTEM_CONFIG_ADDRESS = vm.envAddress("SYSTEM_CONFIG_ADDRESS");
address internal NEW_IMPLEMENTATION = vm.envAddress("NEW_IMPLEMENTATION");

function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal override {
// NOTE: Bypass `proxyCallIfNotAdmin` modifier.
vm.prank(PROXY_ADMIN_ADDRESS);
require(IProxy(SYSTEM_CONFIG_ADDRESS).implementation() == NEW_IMPLEMENTATION);
}

function _buildCalls() internal view override returns (IMulticall3.Call3[] memory) {
IMulticall3.Call3[] memory calls = new IMulticall3.Call3[](3);

calls[0] = IMulticall3.Call3({
target: PROXY_ADMIN_ADDRESS,
allowFailure: false,
// NOTE: No need to call initialize as no storage would change (only changing `MAX_GAS_LIMIT` and `version`).
callData: abi.encodeCall(IProxyAdmin.upgrade, (SYSTEM_CONFIG_ADDRESS, NEW_IMPLEMENTATION))
});

return calls;
}

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

0 comments on commit 1f09acf

Please sign in to comment.