Skip to content

Commit 0f95421

Browse files
Merge pull request 0xPolygon#255 from 0xPolygon/cdk/validium-test-run
CDK/validium test run, more fixes and clarifications
2 parents cc9496d + 24a7e6f commit 0f95421

File tree

9 files changed

+104
-55
lines changed

9 files changed

+104
-55
lines changed

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

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

3-
1. Run the following `jq` script to streamline the process of replacing the fields with the `/tmp/cdk/.env` data:
3+
1. Navigate to the contracts deployment directory.
4+
5+
```sh
6+
cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment
7+
```
8+
9+
2. Run the following `jq` script to streamline the process of replacing the fields with the `/tmp/cdk/.env` data:
410

511
```bash
612
source /tmp/cdk/.env
713
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
814
```
915

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`:
16+
3. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`:
1117

1218
```bash
1319
nano ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json
@@ -48,7 +54,7 @@ This is a factory contract that deploys the deterministic contracts required by
4854
4955
The address of the contracts it creates depends on the salt and the `initialCDKValidiumDeployerOwner` inside `deploy_parameters.json`.
5056
51-
1. From the same `deployment` directory, run the deploy script.
57+
1. From the same `deployment` directory you were already in, run the deploy script.
5258
5359
```bash
5460
npm run deploy:deployer:CDKValidium:sepolia
@@ -137,10 +143,10 @@ If you would rather use a different node provider than Infura, modify the conten
137143
For example, using Alchemy:
138144
139145
```bash
140-
MNEMONIC="island debris exhaust typical clap debate exhaust little verify mean sausage entire"
141-
INFURA_PROJECT_ID="" # or blank if not using Infura
142-
ETHERSCAN_API_KEY="1234567890abcdefghijklmnopqr" # or blank if not verify contracts
143-
ALCHEMY_PROJECT_ID="dGPpsDzM9KpFTEnqMO44rvIXcc0fmgxr" # add this line
146+
MNEMONIC="test test test test test test test test test test test junk"
147+
INFURA_PROJECT_ID="" # leave blank when not using Infura
148+
ETHERSCAN_API_KEY="" # or blank if not verifying contracts
149+
ALCHEMY_PROJECT_ID="" # add the Alchemy data here
144150
```
145151
146152
```bash

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

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Make sure you have the following minimum software requirements.
1919

2020
## Access to a Sepolia node
2121

22-
Use a node provider like Infura or Alchemy. We use Infura throughout but you can use any node provider you wish.
22+
Use a node provider like Infura or Alchemy. We use Infura throughout but you can [use a different node provider](deploy-contracts.md#use-a-different-node-provider) if you want.
2323

2424
!!! important
2525
We recommend running your own Sepolia node for a production set up.
@@ -37,28 +37,13 @@ Use a public faucet to get Sepolia test ETH.
3737
- [Chainstack faucet](https://chainstack.com/sepolia-faucet/).
3838
- [Quicknode faucet](https://faucet.quicknode.com/ethereum/sepoli).
3939

40-
## Configuration files
40+
## Configuration with environment variables
4141

42-
We will be working with two separate `.env` files.
42+
We will be working with two separate `.env` files to manage the contracts and node configurations.
4343

44-
- 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.
45-
- Another `.env` resides in a shared system directory so that it is accessible to the node and all running processes.
46-
47-
Create a folder `/tmp/cdk/` to store the shared `.env` file which will be used by all running processes.
48-
49-
```bash
50-
mkdir /tmp/cdk/
51-
```
44+
- One `.env` file resides in the contracts project directory. We will set this up in the [contracts environment variables set up](set-up.md#create-the-contracts-env-configuration) section.
45+
- Another `.env` resides in a shared system directory, `/tmp/cdk/`, which is accessible to the node and all running processes. We set this up in the [system-wide environment variables set up](set-up.md#create-the-shared-system-env-configuration) section. This shared `.env` file allows us to use `jq` and `tomlq` to easily setup the configuration for the node and running processes.
5246

5347
!!! danger
5448
- Any files in the `tmp/` directory are deleted on shutdown.
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.
56-
57-
### Shared environment variables
58-
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.
60-
61-
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).
62-
63-
!!! danger
64-
Don't forget: The system removes this file on shutdown.
49+
- 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 add it back when you need to.

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

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,16 @@ npm install
6262

6363
3. Open the `.env` file.
6464

65-
!!! important
66-
You should still be in the `cdk-validium-contracts-0.0.2/` directory from the previous step.
67-
6865
```sh
6966
nano .env
7067
```
7168

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.
69+
4. This is what the `.env` file looks like.
7370

7471
```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/)
77-
ETHERSCAN_API_KEY="<ETHERSCAN_API_KEY>" # Generate an API key on [Etherscan](https://etherscan.io)
72+
MNEMONIC="test test test test test test test test test test test junk"
73+
INFURA_PROJECT_ID=""
74+
ETHERSCAN_API_KEY=""
7875
```
7976

8077
Replace the variables as follows:
@@ -88,27 +85,29 @@ npm install
8885

8986
## Create the shared system `.env` configuration
9087

91-
1. Now create the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps.
88+
1. Now create a new directory to store the *other* `.env` file, `cd` into it, and create the `.env` file.
9289

9390
```sh
94-
nano /tmp/cdk/.env
91+
mkdir /tmp/cdk/
92+
cd ~/tmp/cdk/
93+
nano .env
9594
```
9695

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.
96+
2. Copy and paste the data below into the file.
9897

99-
```sh
100-
TEST_ADDRESS="<the address generated by cast above>"
101-
TEST_PRIVATE_KEY="<the private key generated by cast above>"
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
98+
```txt
99+
TEST_ADDRESS=""
100+
TEST_PRIVATE_KEY=""
101+
L1_URL="https://sepolia.infura.io/v3/<YOUR_INFURA_API_KEY>"
102+
L1_WS_URL="wss://sepolia.infura.io/ws/v3/<YOUR_INFURA_API_KEY>"
104103
```
105104

106-
Replace the following variables:
105+
Replace the variables with the following:
107106

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>
107+
- `TEST_ADDRESS` is the address generated by cast
108+
- `TEST_PRIVATE_KEY` is the private key generated by cast
109+
- `L1_URL` is your Infura Sepolia RPC URL
110+
- `L1_WS_URL` is your Infura Sepolia wss URL
112111

113112
## Send Sepolia
114113

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The process requires two separate flows with different software requirements. Fo
1616

1717
## Git repos and running order
1818

19-
These are code bases we used to set everything up for this deployment guide, and in this order.
19+
These are the code bases we used to set everything up for this deployment guide, and in this order.
2020

2121
!!! warning
2222
The versions below may not be the most recent.

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:
3131

3232
3. Create a file `node-config.toml` inside `/tmp/cdk/` and paste in the following content.
3333

34+
```bash
35+
nano /tmp/cdk/node-config.toml
36+
```
37+
3438
??? "`node-config.toml`"
3539
#/tmp/cdk/node-config.toml
3640
IsTrustedSequencer = true
@@ -238,6 +242,10 @@ Now let’s configure the Data Availability Committee.
238242

239243
1. Navigate to `~/cdk-validium/cdk-data-availability`.
240244

245+
```sh
246+
cd ~/cdk-validium/cdk-data-availability
247+
```
248+
241249
2. Build the DAC
242250

243251
```bash
@@ -246,6 +254,10 @@ Now let’s configure the Data Availability Committee.
246254

247255
3. Create a `dac-config.toml` file inside `/tmp/cdk/`.
248256

257+
```bash
258+
nano /tmp/cdk/dac-config.toml
259+
```
260+
249261
4. Copy and paste the following example config below into `dac-config.toml`.
250262

251263
```bash
@@ -327,7 +339,11 @@ Now let’s configure the Data Availability Committee.
327339
make build
328340
```
329341

330-
2. Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk` using the following config file:
342+
2. Create a starter bridge config `bridge-config.toml` inside `/tmp/cdk` and copy/paste the file below.
343+
344+
```bash
345+
nano /tmp/cdk/bridge-config.toml
346+
```
331347

332348
```bash
333349
#/tmp/cdk/bridge-config.toml

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
## Run the DAC
6767

68-
Open a new terminal window and run the following command.
68+
Navigate to the `cdk-data-availability` directory and run the following command.
6969

7070
```bash
7171
cd ~/cdk-validium/cdk-data-availability
@@ -83,4 +83,6 @@ cd ~/cdk-validium/zkevm-bridge-service-0.3.1/
8383

8484
## Congratulations
8585

86-
You have now set up and deployed a full CDK validium network.
86+
You have now set up and deployed a full CDK validium network.
87+
88+
Check the next section to find out how to send a test transaction.

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Set up the environment variables
22

3-
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`.
3+
1. Navigate to `~/cdk-validium/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
66
cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment
@@ -54,6 +54,15 @@
5454
cd cdk-validium-node/
5555
```
5656

57+
!!! warning
58+
59+
Make sure to remove all previously running Docker containers and images.
60+
61+
```sh
62+
docker rm $(docker ps -aq)
63+
docker rmi $(docker images -q)
64+
```
65+
5766
2. Run the docker command below to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service.
5867

5968
```bash
@@ -75,7 +84,7 @@
7584
kill -9 <PID>
7685
```
7786

78-
3. Use the following command to validate the setup (`\q` to exit).
87+
3. In a new terminal window, use the following command to validate the setup (`\q` to exit).
7988

8089
```bash
8190
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432
@@ -93,7 +102,7 @@ The `cdk-validium-node` directory contains a script called `single_db_server.sql
93102
1. In a new terminal window, run the script to provision all the necessary databases and schemas used for the prover and node:
94103

95104
```bash
96-
cd cdk-validium/cdk-validium-node
105+
cd ~/cdk-validium/cdk-validium-node
97106
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql
98107
```
99108

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Test transactions
2+
3+
Once everything is up and running you can do a quick test of the running stack by sending a zero-value transaction.
4+
5+
Run the following command where the mnemonic is for testing and the address can be any account address.
6+
7+
```sh
8+
cast send --legacy --mnemonic 'code code code code code code code code code code code quality' --value 0 --gas-price 0 --rpc-url http://127.0.0.1:8123 0x0bb7AA0b4FdC2D2862c088424260e99ed6299148
9+
```
10+
11+
You should see something like this as output:
12+
13+
```sh
14+
blockHash 0x5d6d45f46e54c5d0890dd8a4ede989dc8042d7d3aeada375ea11d2e77c91a298
15+
blockNumber 1
16+
contractAddress
17+
cumulativeGasUsed 21000
18+
effectiveGasPrice 0
19+
from 0x85dA99c8a7C2C95964c8EfD687E95E632Fc533D6
20+
gasUsed 21000
21+
logs []
22+
logsBloom 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
23+
root 0x97b15537641583db08f1e3db15cb1e89212ed8d147670a11f93f368d5960e72f
24+
status 1
25+
transactionHash 0xd5443cff8dcc1147ead09d978d3abe9179615aa3eecbe4819c6768390bc467a3
26+
transactionIndex 0
27+
type 0
28+
to 0x66ec…89fd
29+
```
30+
31+
Status `1` signifies a successful transaction.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ nav:
7070
- Set up: cdk/get-started/deploy-validium/node/set-up.md
7171
- Configure the deployment: cdk/get-started/deploy-validium/node/configure-deployment.md
7272
- Run node and services: cdk/get-started/deploy-validium/node/run-node-services.md
73+
- Test transaction: cdk/get-started/deploy-validium/node/test-transaction.md
7374
- Rollup:
7475
- Introduction: cdk/get-started/deploy-rollup/intro.md
7576
- Environment overview: cdk/get-started/deploy-rollup/environment-overview.md

0 commit comments

Comments
 (0)