|
| 1 | +# Upgrade OptimismMintableERC20Factory implementation |
| 2 | + |
| 3 | +Status: READY TO SIGN |
| 4 | + |
| 5 | +## Objective |
| 6 | + |
| 7 | +This task upgrades the `OptimismMintableERC20Factory` implementation, at address [0x4200000000000000000000000000000000000012](https://basescan.org/address/0x4200000000000000000000000000000000000012#code), to point to the newly deployed factory at address [0x6922ac4DbDfEdEa3a1E5535f12c3171f2b964C91](https://basescan.org/address/0x6922ac4dbdfedea3a1e5535f12c3171f2b964c91#code), effectively replacing the old implementation at address [0xc0D3c0d3C0d3c0d3c0D3c0d3c0D3c0D3c0D30012](https://basescan.org/address/0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d30012#code). |
| 8 | + |
| 9 | +## Approving the transaction |
| 10 | + |
| 11 | +### 1. Update repo and move to the appropriate folder: |
| 12 | + |
| 13 | +``` |
| 14 | +cd contract-deployments |
| 15 | +git pull |
| 16 | +cd mainnet/2024-04-17-upgrade-erc20-factory |
| 17 | +make deps |
| 18 | +``` |
| 19 | + |
| 20 | +### 2. Setup Ledger |
| 21 | + |
| 22 | +Your Ledger needs to be connected and unlocked. The Ethereum |
| 23 | +application needs to be opened on Ledger with the message "Application |
| 24 | +is ready". |
| 25 | + |
| 26 | +### 3. Simulate and validate the transaction |
| 27 | + |
| 28 | +Make sure your ledger is still unlocked and run the following. |
| 29 | + |
| 30 | +``` shell |
| 31 | +make sign-op # or make sign-cb for Coinbase signers |
| 32 | +``` |
| 33 | + |
| 34 | +Once you run the make sign command successfully, you will see a "Simulation link" from the output. |
| 35 | + |
| 36 | +Paste this URL in your browser. A prompt may ask you to choose a |
| 37 | +project, any project will do. You can create one if necessary. |
| 38 | + |
| 39 | +Click "Simulate Transaction". |
| 40 | + |
| 41 | +We will be performing 3 validations and then we'll extract the domain hash and |
| 42 | +message hash to approve on your Ledger then verify completion: |
| 43 | + |
| 44 | +1. Validate integrity of the simulation. |
| 45 | +2. Validate correctness of the state diff. |
| 46 | +3. Validate and extract domain hash and message hash to approve. |
| 47 | +4. Validate that the transaction completed successfully |
| 48 | + |
| 49 | + |
| 50 | +#### 3.1. Validate integrity of the simulation. |
| 51 | + |
| 52 | +Make sure you are on the "Overview" tab of the tenderly simulation, to |
| 53 | +validate integrity of the simulation, we need to check the following: |
| 54 | + |
| 55 | +1. "Network": Check the network is Base Mainnet. |
| 56 | +2. "Timestamp": Check the simulation is performed on a block with a |
| 57 | + recent timestamp (i.e. close to when you run the script). |
| 58 | +3. "Sender": Check the address shown is your signer account. If not, |
| 59 | + you will need to determine which “number” it is in the list of |
| 60 | + addresses on your ledger. |
| 61 | +4. "Success" with a green check mark |
| 62 | + |
| 63 | + |
| 64 | +#### 3.2. Validate correctness of the state diff. |
| 65 | + |
| 66 | +Now click on the "State" tab. Verify that: |
| 67 | + |
| 68 | +1. Verify that the nonce is incremented for the Nested Multisig under the "GnosisSafeProxy" at address `0x2304cb33d95999dc29f4cef1e35065e670a70050`: |
| 69 | + |
| 70 | +``` |
| 71 | +Key: 0x0000000000000000000000000000000000000000000000000000000000000005 |
| 72 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000003 |
| 73 | +After: 0x0000000000000000000000000000000000000000000000000000000000000004 |
| 74 | +``` |
| 75 | + |
| 76 | +2. And for the same contract, verify that this specific execution is approved: |
| 77 | + |
| 78 | +``` |
| 79 | +Key (if you are an OP signer): 0x9052fb3c2fd9cb5dd17446c311f63a63659a6f571458940b7f0aced851e51d55 |
| 80 | +Key (if you are a CB signer): 0x967af9182a28f979962ecb388b54737ad2cbe53fbe8f354b8b1a0005bc9abcff |
| 81 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000000 |
| 82 | +After: 0x0000000000000000000000000000000000000000000000000000000000000001 |
| 83 | +``` |
| 84 | + |
| 85 | +3. Verify that the nonce is incremented for your multisig: |
| 86 | + |
| 87 | +If you are an OP signer - the OP Foundation Multisig should be under the "GnosisSafeProxy" at address `0x28edb11394eb271212ed66c08f2b7893c04c5d65`: |
| 88 | + |
| 89 | +``` |
| 90 | +Key: 0x0000000000000000000000000000000000000000000000000000000000000005 |
| 91 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000003 |
| 92 | +After: 0x0000000000000000000000000000000000000000000000000000000000000004 |
| 93 | +``` |
| 94 | + |
| 95 | +If you are a CB signer - the Coinbase Multisig should be under the address `0xd94e416cf2c7167608b2515b7e4102b41efff94f`: |
| 96 | + |
| 97 | +``` |
| 98 | +Key: 0x0000000000000000000000000000000000000000000000000000000000000005 |
| 99 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000006 |
| 100 | +After: 0x0000000000000000000000000000000000000000000000000000000000000007 |
| 101 | +``` |
| 102 | + |
| 103 | +4. Verify that the new ERC20 factory implementation has been registered in the ERC20 factory "Proxy" at address `0x4200000000000000000000000000000000000012`: |
| 104 | + |
| 105 | +``` |
| 106 | +Key: 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc |
| 107 | +Before: 0x000000000000000000000000c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d30012 |
| 108 | +After: 0x0000000000000000000000006922ac4dbdfedea3a1e5535f12c3171f2b964c91 |
| 109 | +``` |
| 110 | + |
| 111 | +5. For the same contract, verify its `initialized` slot has been set to 1: |
| 112 | + |
| 113 | +``` |
| 114 | +Key: 0x0000000000000000000000000000000000000000000000000000000000000000 |
| 115 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000000 |
| 116 | +After: 0x0000000000000000000000000000000000000000000000000000000000000001 |
| 117 | +``` |
| 118 | + |
| 119 | +6. For the same contract, verify the `bridge` address has been correctly registered: |
| 120 | + |
| 121 | +``` |
| 122 | +Key: 0x0000000000000000000000000000000000000000000000000000000000000001 |
| 123 | +Before: 0x0000000000000000000000000000000000000000000000000000000000000000 |
| 124 | +After: 0x0000000000000000000000004200000000000000000000000000000000000010 |
| 125 | +``` |
| 126 | + |
| 127 | +7. Verify that the L1FeeVault at `0x420000000000000000000000000000000000001a` receives the gas associated with the call: |
| 128 | + |
| 129 | +``` |
| 130 | +Balance 1132449259793366198 -> 1132449525791013671 |
| 131 | +``` |
| 132 | + |
| 133 | +8. Verify that the nonce for the sending address is appropriately incremented: |
| 134 | + |
| 135 | +``` |
| 136 | +Nonce 0 -> 1 |
| 137 | +``` |
| 138 | + |
| 139 | +#### 3.3. Extract the domain hash and the message hash to approve. |
| 140 | + |
| 141 | +Now that we have verified the transaction performs the right |
| 142 | +operation, we need to extract the domain hash and the message hash to |
| 143 | +approve. |
| 144 | + |
| 145 | +Go back to the "Overview" tab, and find the |
| 146 | +`GnosisSafeL2.checkSignatures` call. This call's `data` parameter |
| 147 | +contains both the domain hash and the message hash that will show up |
| 148 | +in your Ledger. |
| 149 | + |
| 150 | +Here is an example screenshot. Note that the hash value may be |
| 151 | +different: |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | +It will be a concatenation of `0x1901`, the domain hash, and the |
| 156 | +message hash: `0x1901[domain hash][message hash]`. |
| 157 | + |
| 158 | +Note down this value. You will need to compare it with the ones |
| 159 | +displayed on the Ledger screen at signing. |
| 160 | + |
| 161 | +### 4. Approve the signature on your ledger |
| 162 | + |
| 163 | +Once the validations are done, it's time to actually sign the |
| 164 | +transaction. Make sure your ledger is still unlocked and run the |
| 165 | +following: |
| 166 | + |
| 167 | +``` shell |
| 168 | +make sign-op # or make sign-cb for Coinbase signers |
| 169 | +``` |
| 170 | + |
| 171 | +> [!IMPORTANT] This is the most security critical part of the |
| 172 | +> playbook: make sure the domain hash and message hash in the |
| 173 | +> following two places match: |
| 174 | +
|
| 175 | +1. on your Ledger screen. |
| 176 | +2. in the Tenderly simulation. You should use the same Tenderly |
| 177 | + simulation as the one you used to verify the state diffs, instead |
| 178 | + of opening the new one printed in the console. |
| 179 | + |
| 180 | + |
| 181 | +There is no need to verify anything printed in the console. There is |
| 182 | +no need to open the new Tenderly simulation link either. |
| 183 | + |
| 184 | +After verification, sign the transaction. You will see the `Data`, |
| 185 | +`Signer` and `Signature` printed in the console. Format should be |
| 186 | +something like this: |
| 187 | + |
| 188 | +``` |
| 189 | +Data: <DATA> |
| 190 | +Signer: <ADDRESS> |
| 191 | +Signature: <SIGNATURE> |
| 192 | +``` |
| 193 | + |
| 194 | +Double check the signer address is the right one. |
| 195 | + |
| 196 | +### 5. Send the output to Facilitator(s) |
| 197 | + |
| 198 | +Nothing has occurred onchain - these are offchain signatures which |
| 199 | +will be collected by Facilitators for execution. Execution can occur |
| 200 | +by anyone once a threshold of signatures are collected, so a |
| 201 | +Facilitator will do the final execution for convenience. |
| 202 | + |
| 203 | +Share the `Data`, `Signer` and `Signature` with the Facilitator, and |
| 204 | +congrats, you are done! |
| 205 | + |
| 206 | +## [For Facilitator ONLY] How to execute the rehearsal |
| 207 | + |
| 208 | +### [After the rehearsal] Execute the output |
| 209 | + |
| 210 | +1. Collect outputs from all participating signers. |
| 211 | +2. Concatenate all signatures and export it as the `SIGNATURES` |
| 212 | + environment variable, i.e. `export |
| 213 | + SIGNATURES="0x[SIGNATURE1][SIGNATURE2]..."`. |
| 214 | +3. Run `make approve-cb` with Coinbase signer signatures. |
| 215 | +4. Run `make approve-op` with Optimism signer signatures. |
| 216 | +4. Run `make run` to execute the transaction onchain. |
| 217 | + |
0 commit comments