Skip to content

Commit 9f79db6

Browse files
Merge branch 'main' of https://github.com/0xPolygon/polygon-docs into cdk-fep-fin3-update
2 parents a800366 + 5428aef commit 9f79db6

File tree

1 file changed

+69
-50
lines changed

1 file changed

+69
-50
lines changed

docs/cdk/getting-started/local-deployment.md

Lines changed: 69 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,12 @@ The [Polygon CDK Kurtosis package](https://github.com/0xPolygon/kurtosis-cdk/) a
2727
And, optionally, for submitting transactions and interacting with the environment once set up, we are using:
2828

2929
- [Foundry](https://book.getfoundry.sh/getting-started/installation)
30-
- [yq](https://github.com/mikefarah/yq)
30+
- [yq](https://github.com/mikefarah/yq) (v3)
3131
- [jq](https://stedolan.github.io/jq/)
3232
- [polyon-cli](https://github.com/0xPolygon/polygon-cli)
3333

3434
## Set up the Kurtosis environment
3535

36-
### Clone the repository
37-
38-
```bash
39-
git clone https://github.com/0xPolygon/kurtosis-cdk.git
40-
cd kurtosis-cdk
41-
```
42-
4336
### Understanding the deployment steps
4437

4538
There are two configuration files which help you understand what happens during a deployment.
@@ -54,11 +47,13 @@ It defines the following steps for the deployment process:
5447
|-------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
5548
| 1 | Deploy a local layer 1 Ethereum chain | [ethereum.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/ethereum.star) | True |
5649
| 2 | Deploy the CDK smart contracts on the L1 | [deploy_zkevm_contracts.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/deploy_zkevm_contracts.star) | True |
57-
| 3 | Deploy the central environment, prover, and CDK erigon or zkEVM node databases | [databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star) | True |
58-
| 4 | Deploy the CDK central environment | [cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star) | True |
59-
| 5 | Deploy the CDK erigon package | [cdk_erigon.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_erigon.star) - included in step 4 deployment | True |
60-
| 6 | Deploy the bridge infrastructure | [cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star) | True |
61-
| 7 | Deploy the AggLayer | [agglayer.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/agglayer.star) | True |
50+
| 3 | Deploy the central environment, prover, and CDK erigon or zkEVM node databases | [databases.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/databases.star)
51+
| 4 | Get the genesis file | n/a | False |
52+
| 5 | Deploy the CDK central environment | [cdk_central_environment.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_central_environment.star) | True |
53+
| 6 | Deploy the CDK erigon package | [cdk_erigon.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_erigon.star) - included in step 4 deployment | True |
54+
| 7 | Deploy the bridge infrastructure | [cdk_bridge_infrastructure.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/cdk_bridge_infra.star) | True |
55+
| 8 | Deploy the AggLayer | [agglayer.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/agglayer.star) | True |
56+
| 9 | Additional services | Explorers, reporting, permissionless zkEVM node | False |
6257
| - | Input parser tool to help deployment stages | [input_parser.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/input_parser.star) - deployed immediately | n/a |
6358
| - | zkEVM pool manager tool | [zkevm_pool_manager.star](https://github.com/0xPolygon/kurtosis-cdk/blob/main/zkevm_pool_manager.star) - deployed with CDK erigon node | n/a |
6459

@@ -79,31 +74,22 @@ You can modify each of these parameters to customize the chain to your specific
7974

8075
## Run the chain locally
8176

82-
1. Run the [kurtosis clean](https://docs.kurtosis.com/clean) to remove any existing Kurtosis environments:
77+
1. In the `kurtosis-cdk` directory, use the [kurtosis run](https://docs.kurtosis.com/run) command to deploy the chain on your local machine by executing the `main.star` script provided with the `params.yml` configuration file:
8378

8479
```bash
85-
kurtosis clean --all
80+
kurtosis run --enclave cdk github.com/0xPolygon/kurtosis-cdk
8681
```
8782

88-
2. In the `kurtosis-cdk` directory, use the [kurtosis run](https://docs.kurtosis.com/run) command to deploy the chain on your local machine by executing the `main.star` script provided with the `params.yml` configuration file:
89-
90-
```bash
91-
kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .
92-
```
93-
94-
- `enclave cdk-v1` specifies the name of the enclave, or isolated environment, to use for the deployment process.
95-
- `args-file params.yml` specifies the configuration file to use for the deployment process.
96-
- `image-download` specifies to always download the latest Docker images for the deployment process.
97-
98-
3. This command typically takes a while to complete and outputs the logs of each step in the deployment process for you to monitor the progress of the chain setup. Once the command is complete, you should see the following output:
83+
2. This command typically takes a while to complete and outputs the logs of each step in the deployment process for you to monitor the progress of the chain setup. Once the command is complete, you should see the following output:
9984

10085
```bash
10186
Starlark code successfully run. No output was returned.
10287
103-
===============================================
104-
|| Created enclave: cdk-v1 ||
105-
===============================================
106-
Name: cdk-v1
88+
INFO[2024-10-17T10:56:06+02:00] ============================================
89+
INFO[2024-10-17T10:56:06+02:00] || Created enclave: cdk ||
90+
INFO[2024-10-17T10:56:06+02:00] ============================================
91+
Name: cdk
92+
UUID: 0fb1ba8e87ad
10793
Status: RUNNING
10894
10995
========================================= Files Artifacts =========================================
@@ -116,13 +102,29 @@ You can modify each of these parameters to customize the chain to your specific
116102
117103
```
118104

119-
3. Inspect the chain
105+
The default deployment includes `cdk-erigon` as the sequencer, and `cdk-node` functioning as the sequence sender and aggregator.
120106

121-
Run the following command to see the status of the enclave and the services running within it at any time.
107+
You can verify the default versions of these components and the default fork ID by reviewing `input_parser.star`. You can check the default versions of the deployed components and the default fork ID by looking at `input_parser.star`.
122108

123-
```sh
124-
kurtosis enclave inspect cdk-v1
125-
```
109+
3. Customize the chain
110+
111+
To make customizations to the CDK environment, clone this repo, make any desired configuration changes, and then run:
112+
113+
```sh
114+
# Delete all stop and clean all currently running enclaves
115+
kurtosis clean --all
116+
117+
# Run this command from the root of the repository to start the network
118+
kurtosis run --enclave cdk .
119+
```
120+
121+
4. Inspect the chain
122+
123+
Get a feel for the entire network layout by running the following command:
124+
125+
```sh
126+
kurtosis enclave inspect cdk
127+
```
126128

127129
## Interacting with the chain
128130

@@ -134,40 +136,57 @@ Below are a few examples of how you can interact with the chain.
134136

135137
Let's do some read and write operations and test transactions on the L2 with Foundry.
136138
137-
1. Use `cast` to view information about the chain, such as the latest block number:
139+
1. To facilitate the operations, export the RPC URL of your L2 to an environment variable called `ETH_RPC_URL` with the following command:
140+
141+
```bash
142+
export ETH_RPC_URL="$(kurtosis port print cdk cdk-erigon-node-001 rpc)"
143+
```
144+
145+
2. Use `cast` to view information about the chain, such as the latest block number:
138146
139147
```bash
140148
cast block-number
141149
```
142150
143-
2. View the balance of an address, such as the pre-funded admin account:
151+
3. View the balance of an address, such as the pre-funded admin account:
144152
145153
```bash
146154
cast balance --ether 0xE34aaF64b29273B7D567FCFc40544c014EEe9970
147155
```
148156
149-
3. Send simple transactions to the chain, such as a transfer of some ETH:
157+
4. Send simple transactions to the chain, such as a transfer of some ETH:
150158
151159
```bash
152-
cast send --legacy --value 0.01ether 0x0000000000000000000000000000000000000000 --private-key "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
160+
--private-key "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
161+
cast send --legacy --value 0.01ether 0x0000000000000000000000000000000000000000
153162
```
154163
155-
!!! info
156-
The `0xE34...9970` and `0x12d...c625` public-private key pair used in the above commands is the default admin account configured in `params.yml`.
157-
158164
### Load testing the chain
159165
160-
1. Export the RPC URL of your L2 to an environment variable called `ETH_RPC_URL` with the following command:
166+
1. Use the [`polycli loadtest`](https://github.com/maticnetwork/polygon-cli/blob/main/doc/polycli_loadtest.md) command to send multiple transactions at once to the chain to test its performance:
161167
162168
```bash
163-
export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-node-001 http-rpc)"
169+
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 50000 --rate-limit 50 --concurrency 5 --mode t
170+
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode 2
171+
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 3 --mode uniswapv3
164172
```
165173
166-
2. Use the [`polycli loadtest`](https://github.com/maticnetwork/polygon-cli/blob/main/doc/polycli_loadtest.md) command to send multiple transactions at once to the chain to test its performance:
174+
### Grab some logs
167175
168-
```bash
169-
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --verbosity 700 --requests 500 --rate-limit 5 --mode t --private-key "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625"
170-
```
176+
Add the service name to the following command to grab the logs you're interested in.
177+
178+
```bash
179+
kurtosis service logs cdk agglayer --follow
180+
```
181+
182+
### Open a shell on a service
183+
184+
To open a shell to examine a service, add the service name to the following command.
185+
186+
```bash
187+
kurtosis service shell cdk contracts-001
188+
jq . /opt/zkevm/combined.json
189+
```
171190

172191
### Viewing transaction finality
173192

@@ -183,10 +202,10 @@ cast rpc zkevm_verifiedBatchNumber # Latest batch verified or "proven" on the L
183202

184203
### Opening the bridge UI
185204

186-
To open the bridge interface and bridge tokens across the L1 and L2, run the following command:
205+
To open the `zkevm-bridge` interface and bridge tokens across the L1 and L2, run the following command:
187206

188207
```bash
189-
open $(kurtosis port print cdk-v1 zkevm-bridge-proxy-001 web-ui)
208+
open $(kurtosis port print cdk zkevm-bridge-proxy-001 web-ui)
190209
```
191210

192211
## Additional services

0 commit comments

Comments
 (0)