Skip to content

Commit e3a0035

Browse files
authored
Merge pull request 0xPolygon#2496 from 0xPolygon/Sharonbc01-patch-1
Update forkid-9-12.md
2 parents 43526c6 + 646e9bc commit e3a0035

File tree

1 file changed

+110
-15
lines changed

1 file changed

+110
-15
lines changed

docs/cdk/how-to/migrate/forkid-9-12.md

Lines changed: 110 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> 💡 For CDK fork ID9 chains **NOT attached to the AggLayer** (Isolated), can ignore section 4.
1+
> 💡 For CDK fork ID9 chains **NOT attached to the AggLayer** (Isolated), they can ignore section 4.
22
33
> 💡 For CDK fork ID9 chains **attached to the AggLayer**, follow steps in sections 1 to 5. This is a coordinated effort between Polygon and the Implementation Provider.
44
@@ -50,7 +50,7 @@ The table below lists the CDK Fork ID 9 components and the new CDK FEP Fork ID 1
5050
| Prover | [v6.0.0](https://github.com/0xPolygonHermez/zkevm-prover/releases/tag/v6.0.0) | Prover | [zkevm-prover v8.0.0-RC14](https://hub.docker.com/r/hermeznetwork/zkevm-prover/tags) |
5151
| CDK data availability | [v0.0.7](https://hub.docker.com/layers/0xpolygon/cdk-data-availability/0.0.7/images/sha256-17590789a831259d7a07d8a042ea87e381c5708dec3a7daef6f3f782f50b2c00?context=explore) | CDK data availability | [cdk-data-availability](https://github.com/0xPolygon/cdk-data-availability) use latest tag |
5252
| zkEVM rollup node | [v6.0.0](https://github.com/0xPolygonHermez/zkevm-prover/releases/tag/v6.0.0) | zkEVM rollup node | N/A |
53-
| Contracts | [v6.0.0](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v6.0.0-rc.1-fork.9) | Contracts | [zkevm-contracts](https://github.com/0xPolygonHermez/zkevm-contracts) |
53+
| Contracts | [v6.0.0](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v6.0.0-rc.1-fork.9) | Contracts | [zkevm-contracts](https://github.com/0xPolygonHermez/zkevm-contracts/releases/tag/v8.0.0-fork.12) |
5454
| Bridge service | [v0.4.2-cdk.1](https://hub.docker.com/layers/hermeznetwork/zkevm-bridge-service/v0.4.2-cdk.1/images/sha256-f22ad8c9ad058c7a97a3d38f53cac5b1053858916523b96211d33ae40a9b45f8?context=explore) | Bridge service | [zkevm-bridge-service](https://github.com/0xPolygonHermez/zkevm-bridge-service) |
5555
| Bridge UI | [Polygon Portal](https://portal.polygon.technology/) | Bridge UI | [Polygon Portal](https://portal.polygon.technology/) |
5656

@@ -62,8 +62,12 @@ The Implementation Provider must prepare in advance for the upgrade to ensure a
6262
2. Map to the latest prover files which can be found here: [https://storage.googleapis.com/zkevm/zkproverc/v8.0.0-rc.9-fork.12.tgz](https://storage.googleapis.com/zkevm/zkproverc/v8.0.0-rc.9-fork.12.tgz)
6363
3. Scale up the number of provers in advance. It is recommended that you at least double the number of provers up and running for the scheduled upgrade maintenance window.
6464
- Ensure all (majority) of the network batches are verified before starting the upgrade process, otherwise there will be additional downtime as we wait for the network to be ready.
65-
4. Run the CDK-Node aggregator component in sync-only mode in advance to populate its database.
66-
5. Required Erigon pre-syncing:
65+
4. Setting up your CDK Erigon node.
66+
- Please see the [cdk-erigon readme](https://github.com/0xPolygonHermez/cdk-erigon/blob/v1.0.3/README.md) for information on Prereqs, configuration files and running cdk-erigon.
67+
5. Required CDK-Node pre syncing.
68+
- Run CDK-Node aggregator component in sync only mode in advance to populate its database.
69+
- Run CDK-Node l1infotreesync component in advance to populate the sequence sender database.
70+
7. Required Erigon pre-syncing:
6771
- Generate data stream files from the current `cdk-validium-node` database.
6872
- Tool and instructions can be found here:
6973
- [https://github.com/0xPolygonHermez/zkevm-node/tree/develop/tools/datastreamer](https://github.com/0xPolygonHermez/zkevm-node/tree/develop/tools/datastreamer)
@@ -155,7 +159,8 @@ go run ./zk/debug_tools/datastream-host \
155159

156160
3. Stop all services (node, prover/executor, bridge).
157161

158-
> 💡 For an **isolated chain not attached to the Agglayer**, the chain admin can perform operational step 4 on their chain’s rollup manager contract. Polygon is not involved.
162+
> 💡 Please note: For an isolated chain not attached to the Agglayer the chain admin can perform operational step 4 on their chain’s rollupmanagercontract.
163+
Polygon are not involved. Please check the [upgrade procedure for isolated networks](#contract-upgrade-procedure-for-isolated-networks).
159164

160165
**Please Note:** Wait for Polygon to send the L1 transaction (tx) and confirm it.
161166

@@ -164,23 +169,31 @@ go run ./zk/debug_tools/datastream-host \
164169
- Wait for the Tx to be finalized.
165170

166171
### Steps to Deploy CDK FEP Fork 12 Components
167-
168-
1. [With the network stopped, repeat Erigon sync to get it fully synced to the current state.](#5-operational-steps)
172+
1. It is recommended to back up your DAC node by taking a snapshot of the DAC database.
173+
- **Locate Your PostgreSQL Instance**:
174+
- Identify the PostgreSQL host, port, database name (`dac_db`), and the username (`master_user`) configured for your DAC node. These values can typically be found in your environment's configuration or `.env` files.
175+
- **Run the `pg_dump` Command**:
176+
- Use the `pg_dump` command to create a backup of your DAC database. Replace the placeholders with your specific values:
177+
- pg_dump -U master_user -d dac_db -h 127.0.0.1 -p 5432 > dac.db.sql
178+
- **Verify the Backup**:
179+
- After running the command, ensure that the `dac.db.sql` file has been created and contains the database snapshot.
180+
181+
2. [With the network stopped, repeat Erigon sync to get it fully synced to the current state.](#5-operational-steps)
169182
- This instance is ready to act as Sequencer and/or RPC. Clone the whole Erigon config/datadir as many times as instances are needed. Pick one to be the new Sequencer (by setting the environment variable **`CDK_ERIGON_SEQUENCER=1`**), and configure all other instances (permissionless RPCs) to point to the Sequencer:
170183
171184
```yaml
172185
zkevm.l2-sequencer-rpc-url: "http://sequencer-fqdn-or-ip:8123"
173186
zkevm.l2-datastreamer-url: "sequencer-fqdn-or-ip:6900"
174187
```
175188
176-
2. Start the stateless Executor.
177-
3. Start the CDK-Erigon Sequencer.
178-
4. Verify in the sequencer’s logs that new blocks are being generated with fork ID 12.
179-
5. Start the Pool Manager (if used/needed).
180-
6. Start CDK-Erigon RPCs (if used/needed).
181-
7. Start the Bridge.
182-
8. Start the CDK aggregator and Sequence Sender components.
183-
9. Start the stateless Prover.
189+
3. Start the stateless Executor.
190+
4. Start the CDK-Erigon Sequencer.
191+
5. Verify in the sequencer’s logs that new blocks are being generated with fork ID 12.
192+
6. Start the Pool Manager (if used/needed).
193+
7. Start CDK-Erigon RPCs (if used/needed).
194+
8. Start the Bridge.
195+
9. Start the CDK aggregator and Sequence Sender components.
196+
10. Start the stateless Prover.
184197
185198
### Polygon Steps for CDK Chains Attached to the Agglayer
186199
@@ -191,6 +204,8 @@ Polygon's DevOps team will be accountable for upgrading the Agglayer permissionl
191204
1. Test batch lifecycle.
192205
2. Test the bridge.
193206

207+
208+
194209
# Example Maintenance Communication to Network Partners
195210

196211
There is a planned maintenance window upgrade of the xxxx network on the following dates. This is to upgrade the xxx network from Fork ID9 to Fork ID12.
@@ -222,3 +237,83 @@ Update FROM node version [0.6.7+cdk.1](https://hub.docker.com/layers/0xpolygon/c
222237
1. Prover/Executor
223238
2. Synchronizer
224239
3. RPC
240+
241+
242+
243+
244+
# Contract Upgrade procedure for isolated networks
245+
## Resources
246+
247+
- [rollup-manager-cli](https://github.com/0xPolygonHermez/rollup-manager-cli)
248+
- get L1 information easily
249+
- [tool deploy verifiers](https://github.com/0xPolygonHermez/zkevm-contracts/tree/main/tools/deployVerifier)
250+
- [tool add new rollup type](https://github.com/0xPolygonHermez/zkevm-contracts/tree/main/tools/addRollupType)
251+
252+
> For fork.12 upgrades, it is need to upgrade PolygonZkEVMGlobalExitRootV2 and the PolygonRollupManager. Please refer to [the Upgrade Banana SC section](https://www.notion.so/CDK-chain-upgrade-procedure-from-Fork-ID9-to-Fork-ID12-11980500116a802ab22cec6f7eea6080?pvs=21) in order to do the SCs upgrade
253+
>
254+
255+
## Verifier
256+
257+
- Go to the correct branch(or tag) in [zkevm-contracts](https://github.com/0xPolygonHermez/zkevm-contracts)
258+
- [main](https://github.com/0xPolygonHermez/zkevm-contracts) for fork.10 & fork.11
259+
- [develop](https://github.com/0xPolygonHermez/zkevm-contracts/tree/develop) for fork.12 (AKA Banana)
260+
- Check out previous verifiers deployed in [contracts-info repository](https://github.com/0xPolygonHermez/contracts-info/tree/master/verifiers)
261+
- If verifiers are not deployed:
262+
- use the [following tool](https://github.com/0xPolygonHermez/zkevm-contracts/tree/main/tools/deployVerifier) to deploy them
263+
264+
## Add rollup type
265+
266+
- check-out which address has the ability to add new rollup types
267+
- role is `_ADD_ROLLUP_TYPE_ROLE`
268+
- [this tool](https://github.com/0xPolygonHermez/rollup-manager-cli) could be used to check which addresses has this role
269+
- Two types of addresses could do the SC call: EOA or timelock (multisig)
270+
- Next tooling takes that into account
271+
- Timelock usually have an associated delay. In order to check it, you can check it directly on etherscan as it is a SC variable.
272+
- Example:
273+
- Timelock delay Cardona: https://sepolia.etherscan.io/address/0xfd8ace213595fac05d45714e8e2a63df267e3545#readContract#F6
274+
- Timelock delay Mainnet: https://etherscan.io/address/0xef1462451c30ea7ad8555386226059fe837ca4ef#readContract#F6
275+
- Use [tool to add new rollup type](https://github.com/0xPolygonHermez/zkevm-contracts/tree/main/tools/addRollupType) to do the transaction properly
276+
- if the receiver is the timelock:
277+
- transaction needs to be schedules first and then executed
278+
- tool output needs to be forwarded to the admin address of the timelock to schedule/execute the transaction
279+
280+
## Upgrade rollup
281+
282+
- check-out which address has the ability to add new rollup types
283+
- role is `_UPDATE_ROLLUP_ROLE`
284+
- rollup admin
285+
- [this tool](https://github.com/0xPolygonHermez/rollup-manager-cli) could be used to check which addresses has this role and the rollup admin
286+
- this step is straughforward and it can be done is several ways:
287+
- directly call etherscan function if the role is managed by an EOA
288+
- example Bali
289+
- https://sepolia.etherscan.io/address/0xE2EF6215aDc132Df6913C8DD16487aBF118d1764#writeProxyContract#F20
290+
- https://sepolia.etherscan.io/address/0xE2EF6215aDc132Df6913C8DD16487aBF118d1764#writeProxyContract#F21
291+
- use [this tool](https://github.com/0xPolygonHermez/zkevm-contracts/tree/main/tools/updateRollup) to call the SC function
292+
293+
# Upgrade Smart Contracts to Banana
294+
295+
- [script to upgrade from old version (fork.11) to Banana SC](https://github.com/0xPolygonHermez/zkevm-contracts/tree/v8.0.0-fork.12/upgrade/upgradeBanana)
296+
- it upgrades the [PolygonZkEVMGlobalExitRootV2](https://github.com/0xPolygonHermez/zkevm-contracts/blob/v8.0.0-fork.12/upgrade/upgradeBanana/upgradeBanana.ts#L104)
297+
- and [PolygonRollupManager](https://github.com/0xPolygonHermez/zkevm-contracts/blob/v8.0.0-fork.12/upgrade/upgradeBanana/upgradeBanana.ts#L140)
298+
299+
## Params
300+
301+
- [example parameters](https://github.com/0xPolygonHermez/zkevm-contracts/blob/v8.0.0-fork.12/upgrade/upgradeBanana/upgrade_parameters.json.example)
302+
- the script deploys the new implementation and any EOA can do that
303+
- On top of those parameters, it is needed a file from previous deployment
304+
- this file is generated automatically by hardhat when you deploy a network
305+
- placed in `$root-sc_repo/.oppenzeppelin/${network-name}.json`
306+
- remember to copy this file into thew folder mentioned above and then run the [upgradeBanana](https://github.com/0xPolygonHermez/zkevm-contracts/blob/v8.0.0-fork.12/upgrade/upgradeBanana/upgradeBanana.ts) script
307+
308+
## Output script
309+
310+
- [Similar to this one](https://github.com/0xPolygonHermez/contracts-info/blob/master/mainnet/upgrade-banana/upgrade_output.json)
311+
- Take the `scheduleData`, send a tx to `timelockAddress` with the proper EOA that has `proxyAdmin` rights
312+
- wait `timelockDelay`
313+
- Take the `executeData`, send a tx to `timelockAddress` with the proper EOA that has `proxyAdmin` rights
314+
315+
## Apply upgrade
316+
317+
- `cast send $TIMELOCK_ADDR $SCHEDULE_DATA --private-key $ADMIN_KEY --rpc-url $L1_URL`
318+
- Wait timelock delay
319+
- `cast send $TIMELOCK_ADDR $EXECUTE_DATA --private-key $ADMIN_KEY --rpc-url $L1_URL`

0 commit comments

Comments
 (0)