-
Notifications
You must be signed in to change notification settings - Fork 319
feat(CHAIN-2508): set up update gas params task #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fdc7dc9
161bcee
a4e62c6
b90200c
a5d0636
384aa87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| OP_COMMIT=594bc933a38425f745b46399a3619bcdeb74965d | ||
| BASE_CONTRACTS_COMMIT=dcd8c98aa881e0ae4ebf872e0d91692a7bf94000 | ||
|
|
||
| SYSTEM_CONFIG=0x73a79Fab69143498Ed3712e519A88a918e1f4072 | ||
| OWNER_SAFE=0x14536667Cd30e52C0b458BaACcB9faDA7046E056 | ||
|
|
||
| FROM_GAS_LIMIT=250000000 | ||
| TO_GAS_LIMIT=300000000 | ||
|
|
||
| FROM_ELASTICITY=4 | ||
| TO_ELASTICITY=5 | ||
|
|
||
| SENDER=0x1841CB3C2ce6870D0417844C817849da64E6e937 | ||
|
|
||
| RECORD_STATE_DIFF=true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Facilitator Guide | ||
|
|
||
| Guide for facilitators after collecting signatures from signers. | ||
|
|
||
| ### 1. Update repo: | ||
|
|
||
| ```bash | ||
| cd contract-deployments | ||
| git pull | ||
| cd mainnet/2025-11-10-increase-gas-and-elasticity-limit | ||
| make deps | ||
| ``` | ||
|
|
||
| ### 2. Execute upgrade | ||
|
|
||
| ```bash | ||
| SIGNATURES=AAABBBCCC make execute | ||
| ``` | ||
|
|
||
| ### 3. (**ONLY** if needed) Execute upgrade rollback | ||
|
|
||
| > [!IMPORTANT] THIS SHOULD ONLY BE PERFORMED IN THE EVENT THAT WE NEED TO ROLLBACK | ||
|
|
||
| ```bash | ||
| SIGNATURES=AAABBBCCC make execute-rollback | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| include ../../Makefile | ||
| include ../../Multisig.mk | ||
| include ../.env | ||
| include .env | ||
|
|
||
| ifndef LEDGER_ACCOUNT | ||
| override LEDGER_ACCOUNT = 0 | ||
| endif | ||
|
|
||
| ifndef ROLLBACK_NONCE_OFFSET | ||
| override ROLLBACK_NONCE_OFFSET = 1 | ||
| endif | ||
|
|
||
| SCRIPT_NAME = UpdateGasParams | ||
|
|
||
| RPC_URL = $(L1_RPC_URL) | ||
|
|
||
| .PHONY: gen-validation | ||
| gen-validation: checkout-signer-tool run-script | ||
|
|
||
| .PHONY: gen-validation-rollback | ||
| gen-validation-rollback: checkout-signer-tool run-script-rollback | ||
|
|
||
| .PHONY: run-script | ||
| run-script: | ||
| cd $(SIGNER_TOOL_PATH); \ | ||
| npm ci; \ | ||
| bun run scripts/genValidationFile.ts --rpc-url $(RPC_URL) \ | ||
| --workdir .. --forge-cmd 'forge script --rpc-url $(RPC_URL) \ | ||
| $(SCRIPT_NAME) --sig "sign(address[])" [] --sender $(SENDER)' --out ../validations/base-signer.json; | ||
|
|
||
| .PHONY: run-script-rollback | ||
| run-script-rollback: | ||
| cd $(SIGNER_TOOL_PATH); \ | ||
| npm ci; \ | ||
| bun run scripts/genValidationFile.ts --rpc-url $(RPC_URL) \ | ||
| --workdir .. --forge-cmd 'FROM_GAS_LIMIT=$(TO_GAS_LIMIT) \ | ||
| TO_GAS_LIMIT=$(FROM_GAS_LIMIT) FROM_ELASTICITY=$(TO_ELASTICITY) TO_ELASTICITY=$(FROM_ELASTICITY) \ | ||
| SAFE_NONCE=$(shell expr $$(cast call $(OWNER_SAFE) "nonce()" --rpc-url $(RPC_URL) | cast to-dec) + $(ROLLBACK_NONCE_OFFSET)) \ | ||
| forge script --rpc-url $(RPC_URL) \ | ||
| $(SCRIPT_NAME) --sig "sign(address[])" [] --sender $(SENDER)' --out ../validations/base-signer-rollback.json; | ||
|
|
||
| .PHONY: execute | ||
| execute: | ||
| FROM_GAS_LIMIT=$(FROM_GAS_LIMIT) \ | ||
| TO_GAS_LIMIT=$(TO_GAS_LIMIT) \ | ||
| FROM_ELASTICITY=$(FROM_ELASTICITY) \ | ||
| TO_ELASTICITY=$(TO_ELASTICITY) \ | ||
| $(call MULTISIG_EXECUTE,$(SIGNATURES)) | ||
|
|
||
| .PHONY: execute-rollback | ||
| execute-rollback: | ||
| FROM_GAS_LIMIT=$(TO_GAS_LIMIT) \ | ||
| TO_GAS_LIMIT=$(FROM_GAS_LIMIT) \ | ||
| FROM_ELASTICITY=$(TO_ELASTICITY) \ | ||
| TO_ELASTICITY=$(FROM_ELASTICITY) \ | ||
| SAFE_NONCE=$(shell expr $$(cast call $(OWNER_SAFE) "nonce()" --rpc-url $(RPC_URL) | cast to-dec) + $(ROLLBACK_NONCE_OFFSET)) \ | ||
| forge script --rpc-url $(RPC_URL) $(SCRIPT_NAME) \ | ||
| --sig "run(bytes)" $(SIGNATURES) --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Update Mainnet Gas Params | ||
|
|
||
| Status: READY TO SIGN | ||
|
|
||
| ## Description | ||
|
|
||
| We are updating the gas limit to **300 MGas / block** and elasticity to **5** improve TPS and reduce gas fees. | ||
|
|
||
| This runbook invokes the following script which allows our signers to sign the same call with two different sets of parameters for our Incident Multisig: | ||
|
|
||
| `UpdateGasParams` -- This script will update the gas limit to our new limit of 300M gas and 5 elasticity if invoked as part of the "upgrade" process, or revert to the old limit of 250M gas and 4 elasticity if invoked as part of the "rollback" process. | ||
|
|
||
| ## Setup | ||
|
|
||
| ### 1. Update foundry | ||
|
|
||
| ``` | ||
| foundryup | ||
| ``` | ||
|
|
||
| ### 2. Install Node.js if needed | ||
|
|
||
| Check if you have node installed | ||
|
|
||
| ```bash | ||
| node --version | ||
| ``` | ||
|
|
||
| If you do not see a version above or if it is older than v18.18, install | ||
|
|
||
| ```bash | ||
| brew install node | ||
| ``` | ||
|
|
||
| ## Sign Task | ||
|
|
||
| ### 1. Update repo: | ||
|
|
||
| ```bash | ||
| cd contract-deployments | ||
| git pull | ||
| ``` | ||
|
|
||
| ### 2. Run the signing tool (NOTE: do not enter the task directory. Run this command from the project's root). | ||
|
|
||
| ```bash | ||
| make sign-task | ||
| ``` | ||
|
|
||
| ### 3. Open the UI at [http://localhost:3000](http://localhost:3000) | ||
|
|
||
| > [!IMPORTANT] Please run through the signing process twice. Once for "Base Signer" and once for "Base Signer Rollback" | ||
|
|
||
| ### 4. After signing, you can end the signer tool process with Ctrl + C |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 = 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/' | ||
| ] | ||
|
|
||
| # See more config options https://github.com/foundry-rs/foundry/tree/master/config |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||||||||||||||
| // SPDX-License-Identifier: MIT | ||||||||||||||||||
| pragma solidity 0.8.15; | ||||||||||||||||||
|
|
||||||||||||||||||
| import {Vm} from "forge-std/Vm.sol"; | ||||||||||||||||||
| import {Simulation} from "@base-contracts/script/universal/Simulation.sol"; | ||||||||||||||||||
| import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol"; | ||||||||||||||||||
|
|
||||||||||||||||||
| import {MultisigScript} from "@base-contracts/script/universal/MultisigScript.sol"; | ||||||||||||||||||
|
|
||||||||||||||||||
| interface ISystemConfig { | ||||||||||||||||||
| function eip1559Elasticity() external view returns (uint32); | ||||||||||||||||||
| function eip1559Denominator() external view returns (uint32); | ||||||||||||||||||
| function setEIP1559Params(uint32 _denominator, uint32 _elasticity) external; | ||||||||||||||||||
| function gasLimit() external view returns (uint64); | ||||||||||||||||||
| function setGasLimit(uint64 _gasLimit) external; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| contract UpdateGasParams is MultisigScript { | ||||||||||||||||||
| address internal immutable OWNER_SAFE; | ||||||||||||||||||
| address internal immutable SYSTEM_CONFIG; | ||||||||||||||||||
|
|
||||||||||||||||||
| uint32 internal immutable ELASTICITY; | ||||||||||||||||||
| uint32 internal immutable NEW_ELASTICITY; | ||||||||||||||||||
| uint64 internal immutable GAS_LIMIT; | ||||||||||||||||||
| uint64 internal immutable NEW_GAS_LIMIT; | ||||||||||||||||||
| uint32 internal immutable DENOMINATOR; | ||||||||||||||||||
|
|
||||||||||||||||||
| constructor() { | ||||||||||||||||||
| OWNER_SAFE = vm.envAddress("OWNER_SAFE"); | ||||||||||||||||||
| SYSTEM_CONFIG = vm.envAddress("SYSTEM_CONFIG"); | ||||||||||||||||||
|
|
||||||||||||||||||
| GAS_LIMIT = uint64(vm.envUint("FROM_GAS_LIMIT")); | ||||||||||||||||||
jackchuma marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| NEW_GAS_LIMIT = uint64(vm.envUint("TO_GAS_LIMIT")); | ||||||||||||||||||
|
|
||||||||||||||||||
| ELASTICITY = uint32(vm.envUint("FROM_ELASTICITY")); | ||||||||||||||||||
| NEW_ELASTICITY = uint32(vm.envUint("TO_ELASTICITY")); | ||||||||||||||||||
|
|
||||||||||||||||||
| DENOMINATOR = ISystemConfig(SYSTEM_CONFIG).eip1559Denominator(); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once the state overrides are set (as in my suggestion below), then these pre-checks can be included (from here):
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually think the precheck doesn't work even with the overrides set. I noticed our usual gas limit script doesn't include the precheck either. I'm fine excluding this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What issue did you encounter with the precheck? It works for me locally with the overrides set. I don't mind either way, whichever you prefer! |
||||||||||||||||||
| function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override { | ||||||||||||||||||
| vm.assertEq(ISystemConfig(SYSTEM_CONFIG).eip1559Denominator(), DENOMINATOR, "Denominator mismatch"); | ||||||||||||||||||
| vm.assertEq(ISystemConfig(SYSTEM_CONFIG).eip1559Elasticity(), NEW_ELASTICITY, "Elasticity mismatch"); | ||||||||||||||||||
| vm.assertEq(ISystemConfig(SYSTEM_CONFIG).gasLimit(), NEW_GAS_LIMIT, "Gas Limit mismatch"); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
jackchuma marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| function _buildCalls() internal view override returns (IMulticall3.Call3Value[] memory) { | ||||||||||||||||||
| IMulticall3.Call3Value[] memory calls = new IMulticall3.Call3Value[](2); | ||||||||||||||||||
|
|
||||||||||||||||||
| calls[0] = IMulticall3.Call3Value({ | ||||||||||||||||||
| target: SYSTEM_CONFIG, | ||||||||||||||||||
| allowFailure: false, | ||||||||||||||||||
| callData: abi.encodeCall(ISystemConfig.setEIP1559Params, (DENOMINATOR, NEW_ELASTICITY)), | ||||||||||||||||||
jackchuma marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| value: 0 | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| calls[1] = IMulticall3.Call3Value({ | ||||||||||||||||||
| target: SYSTEM_CONFIG, | ||||||||||||||||||
| allowFailure: false, | ||||||||||||||||||
| callData: abi.encodeCall(ISystemConfig.setGasLimit, (NEW_GAS_LIMIT)), | ||||||||||||||||||
| value: 0 | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| return calls; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| function _ownerSafe() internal view override returns (address) { | ||||||||||||||||||
| return OWNER_SAFE; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| function _simulationOverrides() internal view override returns (Simulation.StateOverride[] memory stateOverrides) { | ||||||||||||||||||
| if ( | ||||||||||||||||||
| GAS_LIMIT != ISystemConfig(SYSTEM_CONFIG).gasLimit() | ||||||||||||||||||
| || ELASTICITY != ISystemConfig(SYSTEM_CONFIG).eip1559Elasticity() | ||||||||||||||||||
| ) { | ||||||||||||||||||
| // Override SystemConfig state to the expected "from" values so simulation succeeds even | ||||||||||||||||||
| // if the chain already reflects the post-change values (e.g. during rollback simulation). | ||||||||||||||||||
| stateOverrides = new Simulation.StateOverride[](1); | ||||||||||||||||||
| Simulation.StorageOverride[] memory storageOverrides = new Simulation.StorageOverride[](2); | ||||||||||||||||||
| // Load current packed gas config (slot 0x68) and replace only the lower 64 bits with GAS_LIMIT | ||||||||||||||||||
| bytes32 gasConfigSlotKey = bytes32(uint256(0x68)); | ||||||||||||||||||
| uint256 gasConfigWord = uint256(vm.load(SYSTEM_CONFIG, gasConfigSlotKey)); | ||||||||||||||||||
| uint256 updatedGasConfigWord = (gasConfigWord & ~uint256(0xffffffffffffffff)) | uint256(GAS_LIMIT); | ||||||||||||||||||
| storageOverrides[0] = | ||||||||||||||||||
| Simulation.StorageOverride({key: gasConfigSlotKey, value: bytes32(updatedGasConfigWord)}); | ||||||||||||||||||
| // Deterministically set EIP-1559 params (slot 0x6a) to [ ... | elasticity (uint32) | denominator (uint32) ] | ||||||||||||||||||
| // Compose the full 256-bit word with only these two fields set to avoid unused high bits which can | ||||||||||||||||||
| // cause mismatches during validation. | ||||||||||||||||||
| bytes32 eip1559SlotKey = bytes32(uint256(0x6a)); | ||||||||||||||||||
| uint256 composedEip1559Word = (uint256(ELASTICITY) << 32) | uint256(DENOMINATOR); | ||||||||||||||||||
| storageOverrides[1] = Simulation.StorageOverride({key: eip1559SlotKey, value: bytes32(composedEip1559Word)}); | ||||||||||||||||||
| stateOverrides[0] = Simulation.StateOverride({contractAddress: SYSTEM_CONFIG, overrides: storageOverrides}); | ||||||||||||||||||
| return stateOverrides; | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| { | ||
| "cmd": "FROM_GAS_LIMIT=300000000 TO_GAS_LIMIT=250000000 FROM_ELASTICITY=5 TO_ELASTICITY=4 SAFE_NONCE=95 forge script --rpc-url https://eth-mainnet.public.blastapi.io UpdateGasParams --sig sign(address[]) [] --sender 0x1841CB3C2ce6870D0417844C817849da64E6e937", | ||
| "ledgerId": 0, | ||
| "rpcUrl": "https://eth-mainnet.public.blastapi.io", | ||
| "expectedDomainAndMessageHashes": { | ||
| "address": "0x14536667Cd30e52C0b458BaACcB9faDA7046E056", | ||
| "domainHash": "0xf3474c66ee08325b410c3f442c878d01ec97dd55a415a307e9d7d2ea24336289", | ||
| "messageHash": "0x06173131ba6094cb8b439a9b3ae7a39725d1f8255a4031a54b38180bd72fbb74" | ||
| }, | ||
| "stateOverrides": [ | ||
| { | ||
| "name": "Incident Safe - Mainnet", | ||
| "address": "0x14536667cd30e52c0b458baaccb9fada7046e056", | ||
| "overrides": [ | ||
| { | ||
| "key": "0x0000000000000000000000000000000000000000000000000000000000000004", | ||
| "value": "0x0000000000000000000000000000000000000000000000000000000000000001", | ||
| "description": "Override the threshold to 1 so the transaction simulation can occur." | ||
| }, | ||
| { | ||
| "key": "0x0000000000000000000000000000000000000000000000000000000000000005", | ||
| "value": "0x000000000000000000000000000000000000000000000000000000000000005f", | ||
| "description": "Override the nonce to be our expected value after initial execution." | ||
| }, | ||
| { | ||
| "key": "0x9f69b29f17688c4aa856cfc9038ef2e22ecb7c26eca1ab65ffc86fb6322a5089", | ||
| "value": "0x0000000000000000000000000000000000000000000000000000000000000001", | ||
| "description": "Simulates an approval from msg.sender in order for the task simulation to succeed." | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "System Config - Mainnet", | ||
| "address": "0x73a79fab69143498ed3712e519a88a918e1f4072", | ||
| "overrides": [ | ||
| { | ||
| "key": "0x0000000000000000000000000000000000000000000000000000000000000068", | ||
| "value": "0x0000000000000000000000000000000000101c12000008dd0000000011e1a300", | ||
| "description": "Overrides gas limit 300M for the chain" | ||
| }, | ||
| { | ||
| "key": "0x000000000000000000000000000000000000000000000000000000000000006a", | ||
| "value": "0x0000000000000000000000000000000000000000000000000000000500000032", | ||
| "description": "Overrides elasticity to 5 for the chain" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "stateChanges": [ | ||
| { | ||
| "name": "Incident Safe - Mainnet", | ||
| "address": "0x14536667cd30e52c0b458baaccb9fada7046e056", | ||
| "changes": [ | ||
| { | ||
| "key": "0x0000000000000000000000000000000000000000000000000000000000000005", | ||
| "before": "0x000000000000000000000000000000000000000000000000000000000000005f", | ||
| "after": "0x0000000000000000000000000000000000000000000000000000000000000060", | ||
| "description": "Increments the nonce", | ||
| "allowDifference": false | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "System Config - Mainnet", | ||
| "address": "0x73a79fab69143498ed3712e519a88a918e1f4072", | ||
| "changes": [ | ||
| { | ||
| "key": "0x0000000000000000000000000000000000000000000000000000000000000068", | ||
| "before": "0x0000000000000000000000000000000000101c12000008dd0000000011e1a300", | ||
| "after": "0x0000000000000000000000000000000000101c12000008dd000000000ee6b280", | ||
| "description": "Updates gas limit from 300M to 250M for the chain", | ||
| "allowDifference": false | ||
| }, | ||
| { | ||
| "key": "0x000000000000000000000000000000000000000000000000000000000000006a", | ||
| "before": "0x0000000000000000000000000000000000000000000000000000000500000032", | ||
| "after": "0x0000000000000000000000000000000000000000000000000000000400000032", | ||
| "description": "Updates elasticity from 5 to 4 for the chain", | ||
| "allowDifference": false | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "balanceChanges": [] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.