# Mainnet fork9 upgrade guideline

## Upgrade time window

Upgrade time window: 2025-01-24 02:00-14:00 UTC time.

## Release notes

* cdk-validium-node
  * version: v2.1.1 upgrade to v3.1.0
  * github: <https://github.com/MerlinLayer2/merlin-cdk-validium-node/releases/v3.1.0>
* zkevm-prover
  * version: v5.0.9 upgrade to v6.0.2
  * github: <https://github.com/0xPolygonHermez/zkevm-prover/releases/tag/v6.0.2>

## Latest block confirmation

fork8 last block halt number is "0x1d8e1d", you will need to ensure that your local node has synchronized to this height first.

```bash
curl http://127.0.0.1:8123/  \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"zkevm_batchNumber","params":[],"id":1,"jsonrpc":"2.0"}'
```

## Version upgrade

* After you confirm that your local node has synchronized to the halt number, stop and remove cdk-validium-sync / cdk-validium-json-rpc / cdk-validium-prover.

```
docker compose down cdk-validium-sync cdk-validium-json-rpc cdk-validium-prover
```

* Add addtional index for db migration

```sql
CREATE INDEX IF NOT EXISTS idx_virtual_batch_block_num ON state.virtual_batch(block_num); 
CREATE INDEX IF NOT EXISTS idx_verified_batch_block_num ON state.verified_batch(block_num); 
CREATE INDEX IF NOT EXISTS idx_forced_batch_block_num ON state.forced_batch(block_num); 
CREATE INDEX IF NOT EXISTS idx_exit_root_block_num ON state.exit_root(block_num); 
CREATE INDEX IF NOT EXISTS idx_monitored_txs_block_num ON state.monitored_txs(block_num); 
CREATE INDEX IF NOT EXISTS idx_fork_id_block_num ON state.fork_id(block_num);
```

* Change "SyncOnlyTrusted" to "true" in node.config.toml

```toml
SyncOnlyTrusted = true
```

* Upgrade the image version in your docker-compose.yml:
  * cdk-validium-sync: `image: merlinadmin/zkevm-node:v2.1.1` change to `image: merlinadmin/zkevm-node:v3.1.0`
  * cdk-validium-json-rpc: `image: merlinadmin/zkevm-node:v2.1.1` change to `image: merlinadmin/zkevm-node:v3.1.0`
  * cdk-validium-prover: `image: merlinadmin/zkprover:v5.0.9` change to `image: hermeznetwork/zkevm-prover:v6.0.2`
* Launch the new version of services by below steps

  * Launch prover first:

  ```sh
  docker compose up -d cdk-validium-prover
  ```

  * Launch synchronizer and then wait migrations completed:

  ```sh
  docker compose up -d cdk-validium-sync
  ```

  * Launch json-rpc:

  ```sh
  docker compose up -d cdk-validium-json-rpc
  ```
* Update forkId and then restart cdk-validium-sync / json-rpc

{% code overflow="wrap" %}

```sql
UPDATE state.fork_id SET from_batch_num = 1642245,to_batch_num = 1936925,version = '', block_num = 2017235 WHERE fork_id = 8;
INSERT INTO state.fork_id (fork_id, from_batch_num, to_batch_num, version, block_num) VALUES (9, 1936926, 18446744073709551615, '', 6249456);
```

{% endcode %}

## Upgrade result verification

Make sure the new synchronizer can get the new fork9 block data.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.merlinchain.io/merlin-docs/developers/run-a-merlin-node/deployment-and-configuration/mainnet-fork9-upgrade-guideline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
