Skip to content

Commit ce7988d

Browse files
update after reviews
1 parent 1c34319 commit ce7988d

File tree

4 files changed

+68
-53
lines changed

4 files changed

+68
-53
lines changed

docs/cdk/erigon/chain-config.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
The following instructions show you how to set up configurations to use a chain other than the default chains.
1+
To use chains other than the [defaults](releases.md#current-status), supply a set of custom configuration files.
22

3-
1. Create a directory `~/dynamic-configs` in the user home directory.
3+
1. Ensure the chain name starts with the word `dynamic` e.g. `dynamic-mynetwork`.
44

5-
2. Use a chain name that starts with the word `dynamic` e.g. `dynamic-my-network`, and create three files in the `dynamic-configs` directory:
5+
2. Create the following files for dynamic configs. The examples for Cardona are in `zk/examples/dynamic-configs` and can be edited as required:
66

7-
- `dynamic-{network}-allocs.json`: the allocs file.
8-
- `dynamic-{network}-chainspec.json`: the chainspec file.
9-
- `dynamic-{network}-conf.json`: an additional configuration file.
10-
- `dynamic-{network}.yaml`: the run config file for erigon.
7+
- `dynamic-{network}-allocs.json` - the allocs file.
8+
- `dynamic-{network}-chainspec.json` - the chainspec file.
9+
- `dynamic-{network}-conf.json` - an additional configuration file.
10+
- `dynamic-{network}.yaml` - the run config file for erigon.
1111

12-
Use any of the example yaml files at the root of the repo as a base and edit as required, but ensure the chain field is in the format `dynamic-{network}` and matches the names of the config files above.
12+
You can use any of the example yaml files at the root of the repo as a base and edit as required, but ensure the `chain` field is in the format `dynamic-{network` and matches the names of the config files above.
1313

14-
3. Check the examples for Cardona in [`zk/examples/dynamic-configs`](https://github.com/0xPolygonHermez/cdk-erigon/tree/zkevm/zk/examples/dynamic-configs), copy these into your dynamic-configs folder, and edit as required.
14+
3. Put the erigon config file, along with the other files, in the directory of your choice. For example `dynamic-mynetwork`.
1515

16-
!!! tip "Allocs file format conversation"
17-
If you have allocs in the Polygon format from the original network launch, save this file to the root of the `cdk-erigon` code base and run the following:
18-
19-
```sh
20-
go run cmd/hack/allocs/main.go [your-file-name]
21-
```
22-
23-
This converts the file to the format required by erigon and forms the `dynamic-{network}-allocs.json` file.
16+
!!! tip
17+
- If you have allocs in the Polygon format from the original network launch, save this file to the root of the `cdk-erigon` code base and run `go run cmd/hack/allocs/main.go [your-file-name]` to convert it to the format needed by erigon.
18+
- This creates the `dynamic-{network}-allocs.json` file.
2419

25-
!!! tip "Contract addresses"
26-
Find the contract addresses for the `dynamic-{network}.yaml` in the files output when launching the network:
20+
!!! tip
21+
Find the following contract addresses for the `dynamic-{network}.yaml` in the output files created at network launch:
2722

28-
- zkevm.address-sequencer => create_rollup_output.json => sequencer
29-
- zkevm.address-zkevm => create_rollup_output.json => rollupAddress
30-
- zkevm.address-admin => deploy_output.json => admin
31-
- zkevm.address-rollup => deploy_output.json => polygonRollupManagerAddress
32-
- zkevm.address-ger-manager => deploy_output.json => polygonZkEVMGlobalExitRootAddress
23+
- `zkevm.address-sequencer` => `create_rollup_output.json` => `sequencer`
24+
- `zkevm.address-zkevm` => `create_rollup_output.json` => `rollupAddress`
25+
- `zkevm.address-admin` => `deploy_output.json` => `admin`
26+
- `zkevm.address-rollup` => `deploy_output.json` => `polygonRollupManagerAddress`
27+
- `zkevm.address-ger-manager` => `deploy_output.json` => `polygonZkEVMGlobalExitRootAddress`
3328

34-
4. The mount point for the folder on docker container is `~/dynamic-configs`, i.e. the home directory of the erigon user.
29+
4. Mount the directory containing the config files on a Docker container. For example `/dynamic-mynetwork`.
3530

36-
5. To use the new config when starting erigon, update the `--config` flag with the path to the config file e.g. `--config="/path/to/home-dir/dynamic-networks/dynamic-mynetwork.yaml"`.
31+
5. To use the new config when starting erigon, use the `--cfg` flag with the path to the config file e.g. `--cfg="/dynamic-mynetwork/dynamic-mynetwork.yaml"`.

docs/cdk/erigon/deploy-cdk-erigon.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,41 @@
11
## Prerequisites
22

3-
1. The installation requires [Go 1.19](https://go.dev/doc/manage-install).
3+
### Hardware
44

5-
2. Clone the repo and `cd` to the root:
5+
On x86, the following packages are required to use the optimal, vectorized-Poseidon-hashing for the sparse Merkle tree:
6+
7+
Linux: `libgtest-dev libomp-dev libgmp-dev`
8+
MacOS: `brew install libomp` `brew install gmp`
9+
10+
!!! tip
11+
- For Apple silicon, the `iden3` library is used instead.
12+
13+
### Software
14+
15+
The installation requires [Go 1.19](https://go.dev/doc/manage-install).
16+
17+
### Set up
18+
19+
1. Clone the repo and `cd` to the root:
620

721
```sh
822
git clone https://github.com/0xPolygonHermez/cdk-erigon
923
cd cdk-erigon/
1024
```
1125

12-
3. Install the relevant libraries for your architecture by running:
26+
2. Install the relevant libraries for your architecture by running:
1327

1428
```sh
1529
make build-libs
1630
```
1731

18-
!!! tip "Hardware specifics"
19-
- On x86, the following packages are used by the optimal, vectorized-Poseidon-hashing for the sparse Merkle tree:
32+
## L1 interaction
2033

21-
- Linux: `libgtest-dev libomp-dev libgmp-dev`
22-
- MacOS: `libomp brew install gmp`
34+
In order to retrieve data from L1, the L1 syncer needs to know how to request the highest block.
2335

24-
- For Apple silicon, the `iden3` library is used instead.
36+
This can be configured by the flag: `zkevm.l1-highest-block-type`.
37+
38+
The flag defaults to retrieving the `finalized` block. However, there are cases where you may wish to pass `safe` or `latest`.
2539

2640
## Set up sequencer (WIP)
2741

@@ -48,7 +62,7 @@ When the node starts up it pulls the L1 data into the `cdk-erigon` database and
4862

4963
You can use this in tandem with unwinding the chain, or using the `zkevm.sync-limit` flag to limit the chain to a certain block height before starting the L1 recovery. This is useful if you have an RPC node available to speed up the process.
5064

51-
!!! tip
65+
!!! warning
5266
If using the `zkevm.sync-limit` flag, you need to go to the boundary of a `batch+1` block; so if batch `41` ends at block `99` then set the flag to `100`.
5367

5468
## Enable zkEVM APIs
@@ -66,8 +80,10 @@ In order to enable the `zkevm_ namespace`, add `zkevm` to the [`http.api`](#conf
6680
- `zkevm_virtualBatchNumber`
6781
- `zkevm_getFullBlockByHash`
6882
- `zkevm_getFullBlockByNumber`
83+
- `zkevm_virtualCounters`
84+
- `zkevm_traceTransactionCounters`
6985

70-
### Supported (remote)
86+
### Supported functions (remote)
7187

7288
- `zkevm_getBatchByNumber`
7389

@@ -184,10 +200,3 @@ The following examples are comprehensive. There are key fields which must be set
184200
### Useful config entries
185201
186202
- `zkevm.sync-limit`: This ensures the network only syncs to a given block height.
187-
188-
## Networks
189-
190-
| Network name | Chain ID | ForkID | Genesis file | RPC URL | Rootchain | Rollup Address |
191-
|---------------|----------|--------|--------------|--------------------------------------------------|------------------|----------------------------------------------|
192-
| zkEVM Mainnet | 1101 | 9 | [Link](https://hackmd.io/bpmxb5QaSFafV0nB4i-KZA) | [Mainnet RPC](https://zkevm-rpc.com/) | Ethereum Mainnet | `0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2` |
193-
| zkEVM Cardona | 2442 | 9 | [Link](https://hackmd.io/Ug9pB613SvevJgnXRC4YJA) | [Cardona RPC](https://rpc.cardona.zkevm-rpc.com/) | Sepolia | `0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff` |

docs/cdk/erigon/releases.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[`cdk-erigon`](https://github.com/0xPolygonHermez/cdk-erigon) is a fork of [erigon](https://github.com/ledgerwatch/erigon) and is currently in alpha.
22

3-
The PoErigon is a performant implementation of the Ethereum execution plus optional consensus layers. The Polygon fork optimizes syncing with the Polygon zkEVM.
3+
It is optimized for syncing with the Polygon zkEVM network.
44

5-
## Release roadmap
6-
7-
- `v0.9.x`: Support for the Polygon Cardona testnet.
8-
- `v1.x.x`: Support for Polygon mainnet.
9-
- `v3.x.x`: Erigon 3 based (snapshot support).
10-
11-
### Current status
5+
## Current status
126

137
At the time of writing, `cdk-erigon` supports the following chains and fork ids:
148

159
- zkEVM Cardona testnet: beta support.
16-
- zkEVM mainnet: alpha support.
17-
- CDK chains: experimental support (forkid.8 and above).
10+
- zkEVM mainnet: beta support.
11+
- CDK chains: beta support (forkid.9 and above).
12+
13+
## Roadmap
14+
15+
- `v0.9.x`: Support for the Polygon Cardona testnet.
16+
- `v1.x.x`: Support for Polygon mainnet.
17+
- `v3.x.x`: Erigon 3 based (snapshot support).

docs/cdk/erigon/resources.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Networks
2+
3+
| Network Name | Chain ID | ForkID | Genesis File | RPC URL | Rootchain | Rollup Address |
4+
|---------------|----------|--------|--------------|--------------------------------------------------|------------------|----------------------------------------------|
5+
| zkEVM Mainnet | 1101 | 9 | [Link](https://hackmd.io/bpmxb5QaSFafV0nB4i-KZA) | [Mainnet RPC](https://zkevm-rpc.com/) | Ethereum Mainnet | `0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2` |
6+
| zkEVM Cardona | 2442 | 9 | [Link](https://hackmd.io/Ug9pB613SvevJgnXRC4YJA) | [Cardona RPC](https://rpc.cardona.zkevm-rpc.com/) | Sepolia | `0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff` |
7+
8+
## Block explorers
9+
10+
- Mainnet: [PolygonScan mainnet](https://zkevm.polygonscan.com/)
11+
- Cardona: [PolygonScan Cardona](https://cardona-zkevm.polygonscan.com/)

0 commit comments

Comments
 (0)