Skip to content

Commit c0ec403

Browse files
authored
Merge pull request 0xPolygon#227 from 0xPolygon/km/validium-deploy-review
CDK Validium deploy updates from review
2 parents 6f43be9 + 88d461b commit c0ec403

File tree

5 files changed

+108
-144
lines changed

5 files changed

+108
-144
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ Use a public faucet to get Sepolia test ETH.
3737

3838
## Configuration files
3939

40-
!!! warning
41-
We will be working with two separate `.env` files.
40+
We will be working with two separate `.env` files.
4241

43-
- One `.env` file resides in the contracts project directory. We will set this up in the [contract set up](set-up.md#create-the-env-configuration) section.
44-
- Another `.env` resides in a shared system directory so that it is accessible to the node and all running processes. We will populate this file as we go along.
42+
- One `.env` file resides in the contracts project directory. We will set this up in the [contract set up](set-up.md#create-the-contracts-env-configuration) section.
43+
- Another `.env` resides in a shared system directory so that it is accessible to the node and all running processes.
4544

4645
Create a folder `/tmp/cdk/` to store the shared `.env` file which will be used by all running processes.
4746

@@ -57,11 +56,11 @@ mkdir /tmp/cdk/
5756

5857
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.
5958

60-
This file will be populated throughout the [deploy node](../node/prerequisites.md) instructions.
59+
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).
6160

6261
```bash
6362
nano /tmp/cdk/.env
6463
```
6564

6665
!!! danger
67-
Don't forget, the system removes this file on shutdown.
66+
Don't forget: The system removes this file on shutdown.

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

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,9 @@
2929
npm install
3030
```
3131

32-
## Create the .env configuration
32+
## Create the contracts `.env` configuration
3333

34-
1. Copy the contract environment configuration example file into a new `.env` file.
35-
36-
```bash
37-
cp .env.example .env
38-
```
39-
40-
2. Generate a new mnemonic using `cast`.
34+
1. Generate a mnemonic, address, and private key using `cast`.
4135

4236
```bash
4337
cast wallet new-mnemonic --words 12
@@ -57,27 +51,65 @@ npm install
5751
Private key: 0x3b01870a8449ada951f59c0275670bea1fc145954ee7cb1d46f7d21533600726
5852
```
5953

60-
3. Add the environment variables to the `.env` file.
54+
2. Copy the contract environment configuration example file into a new `.env` file.
55+
56+
!!! important
57+
You should still be in the `cdk-validium-contracts-0.0.2/` directory from the previous step.
6158

6259
```bash
63-
nano .env
64-
MNEMONIC="<generated mnemonic>" # copy/paste the generated Phrase
65-
INFURA_PROJECT_ID="<INFURA_PROJECT_ID>" # Generate a project id on [Infura](https://www.infura.io/)
60+
cp .env.example .env
61+
```
62+
63+
3. Open the `.env` file.
64+
65+
!!! important
66+
You should still be in the `cdk-validium-contracts-0.0.2/` directory from the previous step.
67+
68+
```sh
69+
nano `.env`
70+
```
71+
72+
4. This is what the `.env` file will more or less look like, although you may see actual data in there from a previous run.
73+
74+
```txt
75+
MNEMONIC="<GENERATED_MNEMONIC>" # copy/paste the generated Phrase from cast
76+
INFURA_PROJECT_ID="<YOUR_INFURA_API_KEY>" # Generate a project id on [Infura](https://www.infura.io/)
6677
ETHERSCAN_API_KEY="<ETHERSCAN_API_KEY>" # Generate an API key on [Etherscan](https://etherscan.io)
6778
```
6879

80+
Replace the variables as follows:
81+
82+
- `GENERATED_MNEMONIC` is the generated mnemonic phrase from the cast step above.
83+
- `YOUR_INFURA_API_KEY` is a project id you have already created on Infura Sepolia.
84+
- `ETHERSCAN_API_KEY` is an API key you have already generated on Etherscan. This variable is optional.
85+
6986
!!! info
7087
Check the documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider).
7188

72-
4. Send 2 Sepolia ETH to the generated address.
89+
## Create the shared system `.env` configuration
7390

74-
5. Add the following variables to the *other* `.env` file residing in `/tmp/cdk/.env`.
91+
1. Now open the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps.
7592

76-
```bash
93+
```sh
7794
nano /tmp/cdk/.env
95+
```
96+
97+
2. Below is what the `.env` file will more or less look like, although you may see actual data in there from a previous run.
98+
99+
```sh
78100
TEST_ADDRESS="<the address generated by cast above>"
79101
TEST_PRIVATE_KEY="<the private key generated by cast above>"
80-
L1_URL="https://sepolia.infura.io/v3/<YOUR INFURA PROJECT ID>"
81-
L1_WS_URL="wss://sepolia.infura.io/ws/v3/<YOUR INFURA PROJECT ID>"
102+
L1_URL="https://sepolia.infura.io/v3/<YOUR_INFURA_API_KEY>" # same as in the other env file
103+
L1_WS_URL="wss://sepolia.infura.io/ws/v3/<YOUR_INFURA_API_KEY>" # same as in the other env file
82104
```
83105

106+
Replace the following variables:
107+
108+
- `TEST_ADDRESS` is the address generated by cast above.
109+
- `TEST_PRIVATE_KEY` is the private key generated by cast above.
110+
- `L1_URL` is your Infura Sepolia RPC URL, for example: https://sepolia.infura.io/v3/<YOUR_INFURA_API_KEY>
111+
- `L1_WS_URL` is your Infura Sepolia wss URL, for example: wss://sepolia.infura.io/ws/v3/<YOUR_INFURA_API_KEY>
112+
113+
## Send Sepolia
114+
115+
Send 2 Sepolia ETH to the cast generated address called `TEST_ADDRESS` in the shared `.env` file above.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,6 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:
249249
.genesisBlockNumber = $data.deploymentBlockNumber' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json > /tmp/cdk/genesis.json
250250
```
251251

252-
You should see something like this:
253-
254-
![DAC configuration output](../../../../img/cdk/dac-output.png)
255-
256252
## Configure the DAC
257253

258254
At this point we should have setup and provisioned the psql database and configured the zk prover and node.
@@ -334,8 +330,12 @@ Now let’s configure the Data Availability Committee.
334330
$TEST_ADDRESS
335331
```
336332

337-
!!! note
338-
This can take a few minutes.
333+
!!! note
334+
This can take a few minutes.
335+
336+
You should see something like this:
337+
338+
![DAC configuration output](../../../../img/cdk/dac-output.png)
339339

340340
## Configure bridge service
341341

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

Lines changed: 48 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,74 @@
1-
!!! warning
2-
- Use a separate terminal window to run the node and each service separately.
3-
- Whenever you need to restart the process, make sure you stop and delete all running Docker containers and images.
4-
51
## Run the prover
62

7-
Since the prover is large and compute-expensive to build, we will use a docker container.
3+
1. Open a new terminal window.
84

9-
```bash
10-
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
11-
```
5+
2. Since the prover is large and compute-expensive to build, we will use a docker container.
6+
7+
```bash
8+
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
9+
```
1210

13-
!!! important
14-
The database logs may output an error while they wait for a node. For example:
11+
!!! important
12+
The database logs may output an error while they wait for a node. For example:
1513

16-
```txt
17-
2024-01-31 12:18:30.329 UTC [675] ERROR: relation "state.nodes" does not exist at character 15
18-
2024-01-31 12:18:30.329 UTC [675] STATEMENT: SELECT * FROM state.nodes WHERE hash = E'\\xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
19-
```
14+
```txt
15+
2024-01-31 12:18:30.329 UTC [675] ERROR: relation "state.nodes" does not exist at character 15
16+
2024-01-31 12:18:30.329 UTC [675] STATEMENT: SELECT * FROM state.nodes WHERE hash = E'\\xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
17+
```
2018

21-
The node log may also output an error while they wait for services to come online. For example:
19+
The node log may also output an error while they wait for services to come online. For example:
2220

23-
```txt
24-
aggregatorClientMockThread() channel broken; will retry in 5 seconds
25-
aggregatorClientMockThread() failed calling readerWriter->Read(&aggregatorMessage)
26-
```
21+
```txt
22+
aggregatorClientMockThread() channel broken; will retry in 5 seconds
23+
aggregatorClientMockThread() failed calling readerWriter->Read(&aggregatorMessage)
24+
```
2725

2826
## Run the node
2927

30-
```bash
31-
cd ~/cdk-validium/cdk-validium-node
32-
./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \
33-
--components sequencer \
34-
--components sequence-sender \
35-
--components aggregator \
36-
--components rpc --http.api eth,net,debug,zkevm,txpool,web3 \
37-
--components synchronizer \
38-
--components eth-tx-manager \
39-
--components l2gaspricer
40-
```
28+
1. Open a new terminal window.
29+
30+
2. Run the following commands.
31+
32+
```bash
33+
cd ~/cdk-validium/cdk-validium-node
34+
./dist/zkevm-node run --network custom --custom-network-file /tmp/cdk/genesis.json --cfg /tmp/cdk/node-config.toml \
35+
--components sequencer \
36+
--components sequence-sender \
37+
--components aggregator \
38+
--components rpc --http.api eth,net,debug,zkevm,txpool,web3 \
39+
--components synchronizer \
40+
--components eth-tx-manager \
41+
--components l2gaspricer
42+
```
4143

4244
### Run the additional approval scripts for the node
4345

44-
```bash
45-
./dist/zkevm-node approve --network custom \
46-
--custom-network-file /tmp/cdk/genesis.json \
47-
--cfg /tmp/cdk/node-config.toml \
48-
--amount 1000000000000000000000000000 \
49-
--password "testonly" --yes --key-store-path /tmp/cdk/account.key
50-
```
46+
1. Open a new terminal window at the same directory as the previous step.
47+
48+
2. Run the following commands.
49+
50+
```bash
51+
cd ~/cdk-validium/cdk-validium-node
52+
./dist/zkevm-node approve --network custom \
53+
--custom-network-file /tmp/cdk/genesis.json \
54+
--cfg /tmp/cdk/node-config.toml \
55+
--amount 1000000000000000000000000000 \
56+
--password "testonly" --yes --key-store-path /tmp/cdk/account.key
57+
```
5158

5259
## Run the DAC
5360

61+
Open a new terminal window and run the following command.
62+
5463
```bash
5564
cd ~/cdk-validium/cdk-data-availability-0.0.3
5665
./dist/cdk-data-availability run --cfg /tmp/cdk/dac-config.toml
5766
```
5867

5968
## Run the bridge service
6069

70+
Open a new terminal window and run the following command.
71+
6172
```bash
6273
cd ~/cdk-validium/zkevm-bridge-service
6374
./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml

docs/pos/get-started/governance.md

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)