Skip to content

Commit cff08ef

Browse files
[mainnet] Add scripts and runbook for updating gas limit (#144)
* Add scripts and runbook for updating gas config, add generic state override * Update base contracts commit hash to include new override
1 parent 9d5a610 commit cff08ef

File tree

6 files changed

+479
-0
lines changed

6 files changed

+479
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
OP_COMMIT=c87a469d7d679e8a4efbace56c3646b925bcc009
2+
BASE_CONTRACTS_COMMIT=32022cd06d414b75924b1565a4cfe8e0c837bf9b
3+
4+
L1_SYSTEM_CONFIG_ADDRESS=0x73a79Fab69143498Ed3712e519A88a918e1f4072
5+
SYSTEM_CONFIG_OWNER=0x14536667Cd30e52C0b458BaACcB9faDA7046E056
6+
7+
GAS_LIMIT=45000000
8+
ROLLBACK_GAS_LIMIT=30000000
9+
10+
# Expecting pause (N=11) and unpause (N=12) to execute before this, explicitly set the nonces accordingly
11+
# See: mainnet/2024-03-05-pause-unpause-test
12+
UPDATE_NONCE=13
13+
ROLLBACK_NONCE=14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
include ../../Makefile
2+
include ../.env
3+
include .env
4+
5+
ifndef LEDGER_ACCOUNT
6+
override LEDGER_ACCOUNT = 0
7+
endif
8+
9+
.PHONY: sign-update-gas-limit
10+
sign-update-gas-limit:
11+
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
12+
forge script --rpc-url $(L1_RPC_URL) UpdateGaslimit \
13+
--sig "sign()"
14+
15+
.PHONY: execute
16+
execute:
17+
forge script --rpc-url $(L1_RPC_URL) UpdateGaslimit \
18+
--sig "run(bytes)" $(SIGNATURES) --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast
19+
20+
21+
.PHONY: sign-rollback-gas-limit
22+
sign-rollback-gas-limit:
23+
$(GOPATH)/bin/eip712sign --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" -- \
24+
forge script --rpc-url $(L1_RPC_URL) RollbackGasLimit \
25+
--sig "sign()"
26+
27+
28+
.PHONY: execute-rollback
29+
execute-rollback:
30+
forge script --rpc-url $(L1_RPC_URL) RollbackGasLimit \
31+
--sig "run(bytes)" $(SIGNATURES) --ledger --hd-paths "m/44'/60'/$(LEDGER_ACCOUNT)'/0/0" --broadcast
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
# Update Gas Limit in L1 `SystemConfig`
2+
3+
Status: IN TEST
4+
5+
## Objective
6+
7+
We are updating the gas limit to improve TPS and reduce gas fees.
8+
9+
This runbook implements scripts which allow our signers to sign two different calls for our Incident Multisig:
10+
1. `UpdateGasLimit` -- This script will update the gas limit to our new limit of 45M gas
11+
2. `RollbackGasLimit` -- This script establishes a rollback call in the case we need to revert to 30M gas
12+
13+
The values we are sending are statically defined in the `.env`.
14+
15+
> [!IMPORTANT] We have two transactions to sign. Please follow
16+
> the flow for both "Approving the Update transaction" and
17+
> "Approving the Rollback transaction". Hopefully we only need
18+
> the former, but will have the latter available if needed.
19+
20+
## Approving the Update transaction
21+
22+
### 1. Update repo and move to the appropriate folder:
23+
```
24+
cd contract-deployments
25+
git pull
26+
cd mainnet/2024-03-26-increase-gas-limit
27+
make deps
28+
```
29+
30+
### 2. Setup Ledger
31+
32+
Your Ledger needs to be connected and unlocked. The Ethereum
33+
application needs to be opened on Ledger with the message "Application
34+
is ready".
35+
36+
### 3. Simulate and validate the transaction
37+
38+
Make sure your ledger is still unlocked and run the following.
39+
40+
``` shell
41+
make sign-update-gas-limit
42+
```
43+
44+
Once you run the `make sign...` command successfully, you will see a "Simulation link" from the output.
45+
46+
Paste this URL in your browser. A prompt may ask you to choose a
47+
project, any project will do. You can create one if necessary.
48+
49+
Click "Simulate Transaction".
50+
51+
We will be performing 3 validations and then we'll extract the domain hash and
52+
message hash to approve on your Ledger then verify completion:
53+
54+
1. Validate integrity of the simulation.
55+
2. Validate correctness of the state diff.
56+
3. Validate and extract domain hash and message hash to approve.
57+
58+
59+
#### 3.1. Validate integrity of the simulation.
60+
61+
Make sure you are on the "Overview" tab of the tenderly simulation, to
62+
validate integrity of the simulation, we need to check the following:
63+
64+
1. "Network": Check the network is Ethereum Mainnet.
65+
2. "Timestamp": Check the simulation is performed on a block with a
66+
recent timestamp (i.e. close to when you run the script).
67+
3. "Sender": Check the address shown is your signer account. If not,
68+
you will need to determine which “number” it is in the list of
69+
addresses on your ledger.
70+
4. "Success" with a green check mark
71+
72+
73+
#### 3.2. Validate correctness of the state diff.
74+
75+
Now click on the "State" tab. Verify that:
76+
77+
1. Verify that the nonce is incremented for the Incident Multisig under the "GnosisSafeProxy" at address `0x14536667Cd30e52C0b458BaACcB9faDA7046E056`. We should see the nonce increment from 13 to 14:
78+
79+
```
80+
Key: 0x0000000000000000000000000000000000000000000000000000000000000005
81+
Before: 0x000000000000000000000000000000000000000000000000000000000000000d
82+
After: 0x000000000000000000000000000000000000000000000000000000000000000e
83+
```
84+
85+
2. Verify that gas limit value is appropriately updated under "Proxy" at address `0x73a79fab69143498ed3712e519a88a918e1f4072`. We should see that the gas limit has been changed from 30M to 45M:
86+
87+
```
88+
Key: 0x0000000000000000000000000000000000000000000000000000000000000068
89+
Before: 0x0000000000000000000000000000000000000000000000000000000001c9c380
90+
After: 0x0000000000000000000000000000000000000000000000000000000002aea540
91+
```
92+
93+
#### 3.3. Extract the domain hash and the message hash to approve.
94+
95+
Now that we have verified the transaction performs the right
96+
operation, we need to extract the domain hash and the message hash to
97+
approve.
98+
99+
Go back to the "Overview" tab, and find the
100+
`GnosisSafe.checkSignatures` call. This call's `data` parameter
101+
contains both the domain hash and the message hash that will show up
102+
in your Ledger.
103+
104+
Here is an example screenshot. Note that the value will be
105+
different for each signer:
106+
107+
![Screenshot 2024-03-07 at 5 49 02 PM](https://github.com/base-org/contract-deployments/assets/84420280/1b7905f1-1350-4634-a804-7b4458d0ddc9)
108+
109+
110+
It will be a concatenation of `0x1901`, the domain hash, and the
111+
message hash: `0x1901[domain hash][message hash]`.
112+
113+
Note down this value. You will need to compare it with the ones
114+
displayed on the Ledger screen at signing.
115+
116+
### 4. Approve the signature on your ledger
117+
118+
Once the validations are done, it's time to actually sign the
119+
transaction. Make sure your ledger is still unlocked and run the
120+
following:
121+
122+
``` shell
123+
make sign-update-gas-limit
124+
```
125+
126+
> [!IMPORTANT] This is the most security critical part of the
127+
> playbook: make sure the domain hash and message hash in the
128+
> following two places match:
129+
130+
1. on your Ledger screen.
131+
2. in the Tenderly simulation. You should use the same Tenderly
132+
simulation as the one you used to verify the state diffs, instead
133+
of opening the new one printed in the console.
134+
135+
There is no need to verify anything printed in the console. There is
136+
no need to open the new Tenderly simulation link either.
137+
138+
After verification, sign the transaction. You will see the `Data`,
139+
`Signer` and `Signature` printed in the console. Format should be
140+
something like this:
141+
142+
```
143+
Data: <DATA>
144+
Signer: <ADDRESS>
145+
Signature: <SIGNATURE>
146+
```
147+
148+
Double check the signer address is the right one.
149+
150+
### 5. Send the output to Facilitator(s)
151+
152+
Nothing has occurred onchain - these are offchain signatures which
153+
will be collected by Facilitators for execution. Execution can occur
154+
by anyone once a threshold of signatures are collected, so a
155+
Facilitator will do the final execution for convenience.
156+
157+
Share the `Data`, `Signer` and `Signature` with the Facilitator, and
158+
congrats, you are done!
159+
160+
161+
## Approving the Rollback transaction
162+
163+
Complete the above steps for `Approving the Update transaction` before continuing below.
164+
165+
### 1. Simulate and validate the transaction
166+
167+
Make sure your ledger is still unlocked and run the following.
168+
``` shell
169+
make sign-rollback-gas-limit
170+
```
171+
Once you run the make sign command successfully, you will see a "Simulation link" from the output. Once again paste this URL in your browser and click "Simulate Transaction".
172+
173+
We will be performing 3 validations and then we'll extract the domain hash and
174+
message hash to approve on your Ledger then verify completion:
175+
176+
1. Validate integrity of the simulation.
177+
2. Validate correctness of the state diff.
178+
3. Validate and extract domain hash and message hash to approve.
179+
4. Validate that the transaction completed successfully
180+
181+
182+
#### 3.1. Validate integrity of the simulation.
183+
184+
Make sure you are on the "Overview" tab of the tenderly simulation, to
185+
validate integrity of the simulation, we need to check the following:
186+
187+
1. "Network": Check the network is Ethereum Mainnet.
188+
2. "Timestamp": Check the simulation is performed on a block with a
189+
recent timestamp (i.e. close to when you run the script).
190+
3. "Sender": Check the address shown is your signer account. If not,
191+
you will need to determine which “number” it is in the list of
192+
addresses on your ledger.
193+
4. "Success" with a green check mark
194+
195+
196+
#### 3.2. Validate correctness of the state diff.
197+
198+
Now click on the "State" tab. Verify that:
199+
200+
1. Verify that the nonce is incremented for the Incident Multisig under the "GnosisSafeProxy" at address `0x14536667Cd30e52C0b458BaACcB9faDA7046E056`:
201+
202+
```
203+
Key: 0x0000000000000000000000000000000000000000000000000000000000000005
204+
Before: 0x000000000000000000000000000000000000000000000000000000000000000e
205+
After: 0x000000000000000000000000000000000000000000000000000000000000000f
206+
```
207+
208+
2. Verify that gas limit value is appropriately updated under "Proxy" at address `0x73a79fab69143498ed3712e519a88a918e1f4072`:
209+
210+
```
211+
Key: 0x0000000000000000000000000000000000000000000000000000000000000068
212+
Before: 0x0000000000000000000000000000000000000000000000000000000002aea540
213+
After: 0x0000000000000000000000000000000000000000000000000000000001c9c380
214+
```
215+
216+
#### 3.3. Extract the domain hash and the message hash to approve.
217+
218+
Now that we have verified the transaction performs the right
219+
operation, we need to extract the domain hash and the message hash to
220+
approve.
221+
222+
Go back to the "Overview" tab, and find the
223+
`GnosisSafe.checkSignatures` call. This call's `data` parameter
224+
contains both the domain hash and the message hash that will show up
225+
in your Ledger.
226+
227+
Here is an example screenshot. Note that the value will be
228+
different for each signer:
229+
230+
![Screenshot 2024-03-07 at 5 49 32 PM](https://github.com/base-org/contract-deployments/assets/84420280/b6b5817f-0d05-4862-b16a-4f7f5f18f036)
231+
232+
It will be a concatenation of `0x1901`, the domain hash, and the
233+
message hash: `0x1901[domain hash][message hash]`.
234+
235+
Note down this value. You will need to compare it with the ones
236+
displayed on the Ledger screen at signing.
237+
238+
### 4. Approve the signature on your ledger
239+
240+
Once the validations are done, it's time to actually sign the
241+
transaction. Make sure your ledger is still unlocked and run the
242+
following:
243+
244+
``` shell
245+
make sign-rollback-gas-limit
246+
```
247+
248+
> [!IMPORTANT] This is the most security critical part of the
249+
> playbook: make sure the domain hash and message hash in the
250+
> following two places match:
251+
252+
1. on your Ledger screen.
253+
2. in the Tenderly simulation. You should use the same Tenderly
254+
simulation as the one you used to verify the state diffs, instead
255+
of opening the new one printed in the console.
256+
257+
There is no need to verify anything printed in the console. There is
258+
no need to open the new Tenderly simulation link either.
259+
260+
After verification, sign the transaction. You will see the `Data`,
261+
`Signer` and `Signature` printed in the console. Format should be
262+
something like this:
263+
264+
```
265+
Data: <DATA>
266+
Signer: <ADDRESS>
267+
Signature: <SIGNATURE>
268+
```
269+
270+
Double check the signer address is the right one.
271+
272+
### 5. Send the output to Facilitator(s)
273+
274+
Nothing has occurred onchain - these are offchain signatures which
275+
will be collected by Facilitators for execution. Execution can occur
276+
by anyone once a threshold of signatures are collected, so a
277+
Facilitator will do the final execution for convenience.
278+
279+
Share the `Data`, `Signer` and `Signature` with the Facilitator, and
280+
congrats, you are done!
281+
282+
## Execute the output
283+
284+
1. Collect outputs from all participating signers.
285+
2. Concatenate all signatures and export it as the `SIGNATURES`
286+
environment variable, i.e. `export
287+
SIGNATURES="0x[SIGNATURE1][SIGNATURE2]..."`.
288+
3. Run `make execute`
289+
290+
> [!IMPORTANT] IN THE EVENT WE NEED TO PERFORM ROLLBACK
291+
> Repeat the above, but replace the signatures with the signed
292+
> rollback signatures collected, the call `make execute-rollback`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[profile.default]
2+
src = 'src'
3+
out = 'out'
4+
libs = ['lib']
5+
broadcast = 'records'
6+
fs_permissions = [ {access = "read-write", path = "./"} ]
7+
optimizer = true
8+
optimizer_runs = 999999
9+
solc_version = "0.8.15"
10+
via-ir = true
11+
remappings = [
12+
'@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/',
13+
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
14+
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
15+
'@rari-capital/solmate/=lib/solmate/',
16+
'@base-contracts/=lib/base-contracts',
17+
'solady/=lib/solady/src/'
18+
]
19+
20+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

0 commit comments

Comments
 (0)