Skip to content

Commit cc9496d

Browse files
Merge pull request 0xPolygon#252 from 0xPolygon/cdk/validium-deploy
Updating the validium deployment guide with input from SME review
2 parents 22caa92 + 05a5867 commit cc9496d

File tree

7 files changed

+30
-44
lines changed

7 files changed

+30
-44
lines changed

docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
## Configure deployment parameters
22

3-
1. `cd` to the `deployment/` directory and create a new `deploy_parameters.json` by copying the example
4-
5-
```bash
6-
cd deployment/
7-
cp deploy_parameters.json.example deploy_parameters.json
8-
```
9-
10-
2. Run the following `jq` script to streamline the process of replacing these fields:
3+
1. Run the following `jq` script to streamline the process of replacing the fields with the `/tmp/cdk/.env` data:
114

125
```bash
136
source /tmp/cdk/.env
147
jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json
158
```
169

17-
3. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`:
10+
2. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`:
1811

1912
```bash
2013
nano ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json

docs/cdk/get-started/deploy-validium/contracts/prerequisites.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ Make sure you have the following minimum software requirements.
1717
| [Foundry](https://book.getfoundry.sh/getting-started/installation) | ^0.2 | `forge --version` |
1818
| [jq](https://jqlang.github.io/jq/download/) | ^1.6 | `jq -V` |
1919

20-
## Sepolia access
20+
## Access to a Sepolia node
2121

22-
!!! info
23-
You can run your own Sepolia node if you wish and we recommend this for a production set up. However, for simplicity and brevity, we demonstrate by using a node provider.
22+
Use a node provider like Infura or Alchemy. We use Infura throughout but you can use any node provider you wish.
23+
24+
!!! important
25+
We recommend running your own Sepolia node for a production set up.
2426

2527
You will need the following:
2628

@@ -50,17 +52,13 @@ mkdir /tmp/cdk/
5052

5153
!!! danger
5254
- Any files in the `tmp/` directory are deleted on shutdown.
53-
- For this reason, we recommend that you save this folder in your home directory once the shared configuration set up is complete.
55+
- For this reason, we recommend that you copy this folder and paste it into your home directory once the shared configuration set up is complete. That way, you can just paste it back after the `tmp` directory empties.
5456

5557
### Shared environment variables
5658

57-
Create a `.env` file to store the environment variables that all running processes will share. This shared `.env` file allows us to use `jq` and `tomlq` to easily setup the configuration for the node and running processes.
59+
We will add a `.env` file to the `/tmp/cdk/` directory to store the environment variables that all running processes will share. This shared `.env` file allows us to use `jq` and `tomlq` to easily setup the configuration for the node and running processes.
5860

5961
After adding a few variables to this file in the next [set up section](set-up.md#create-the-shared-system-env-configuration), this file is populated with more environment variables during the [node set up step](../node/set-up.md) and is then accessed by the system throughout the [deploy node configuration step](../node/configure-deployment.md) and [node and services run step](../node/run-node-services.md).
6062

61-
```bash
62-
nano /tmp/cdk/.env
63-
```
64-
6563
!!! danger
6664
Don't forget: The system removes this file on shutdown.

docs/cdk/get-started/deploy-validium/contracts/set-up.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ npm install
8888

8989
## Create the shared system `.env` configuration
9090

91-
1. Now open the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps.
91+
1. Now create the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps.
9292

9393
```sh
9494
nano /tmp/cdk/.env

docs/cdk/get-started/deploy-validium/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This guide takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia.
1+
This guide takes you through the process of deploying a fully EVM-compatible, CDK validium on the Sepolia network.
22

33
We have hidden most of the configuration complexity in scripts to make the process straightforward and easy to follow.
44

docs/cdk/get-started/deploy-validium/node/configure-deployment.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copy and modify the contents of `test.prover.config.json` in `~/cdk-validium/cdk
44

55
```bash
66
cd ~/cdk-validium/cdk-validium-node
7-
jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/postgres"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json
7+
jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/prover_db"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json
88
```
99

1010
## Configure the node
@@ -218,26 +218,7 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:
218218
tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.Aggregator.SenderAddress = $TEST_ADDRESS' /tmp/cdk/node-config.toml
219219
```
220220

221-
5. Now we will modify the `genesis.json` from the earlier contract deployment to include information about the newly configured chain.
222-
223-
!!! info
224-
`genesis.json` is in the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` directory
225-
226-
The values to append to `genesis.json` are something like:
227-
228-
```bash
229-
#~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json
230-
"L1Config": {
231-
"chainId": 11155111,
232-
"maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c",
233-
"polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1",
234-
"cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a",
235-
"polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2"
236-
},
237-
"genesisBlockNumber": 5098088
238-
```
239-
240-
6. Run the following script that automates the process of appending those values:
221+
5. Now we will modify the `genesis.json` from the earlier contract deployment to include information about the newly configured chain. Run the following script that automates the process of appending those values:
241222

242223
```bash
243224
jq --argjson data "$(jq '{maticTokenAddress, cdkValidiumAddress, cdkDataCommitteeContract, polygonZkEVMGlobalExitRootAddress, deploymentBlockNumber}' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json)" \
@@ -255,7 +236,7 @@ At this point we should have setup and provisioned the psql database and configu
255236

256237
Now let’s configure the Data Availability Committee.
257238

258-
1. Navigate to `~/cdk-validium/cdk-data-availability-0.0.3`.
239+
1. Navigate to `~/cdk-validium/cdk-data-availability`.
259240

260241
2. Build the DAC
261242

docs/cdk/get-started/deploy-validium/node/run-node-services.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json
99
```
1010

11+
!!! note "Run containers in background"
12+
Add the `-d` flag to the command to run the container in the background.
13+
14+
```bash
15+
docker run -d -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json
16+
```
17+
1118
!!! important
1219
The database logs may output an error while they wait for a node. For example:
1320

@@ -70,7 +77,7 @@ cd ~/cdk-validium/cdk-data-availability
7077
Open a new terminal window and run the following command.
7178

7279
```bash
73-
cd ~/cdk-validium/zkevm-bridge-service
80+
cd ~/cdk-validium/zkevm-bridge-service-0.3.1/
7481
./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml
7582
```
7683

docs/cdk/get-started/deploy-validium/node/set-up.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1. Navigate to `cdk-validium-contracts-0.0.2/deployment` and run the following script that inputs the required parameters from `deploy_output.json` into `/tmp/cdk/.env`.
44

55
```bash
6-
cd ~/cdk-validium-contracts-0.0.2/deployment
6+
cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment
77
echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env
88
echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env
99
echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env
@@ -60,6 +60,13 @@
6060
docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15
6161
```
6262

63+
!!! note "Run containers in background"
64+
Add the `-d` flag to the command to run the container in the background.
65+
66+
```bash
67+
docker run -d -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15
68+
```
69+
6370
!!! note "Port is in use"
6471
If you are unable to start the process because a port is in use, check the processes occupying the port then kill those processes.
6572

0 commit comments

Comments
 (0)