Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
leovct committed Jun 5, 2024
1 parent c6e83c3 commit e89021c
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 46 deletions.
36 changes: 5 additions & 31 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:
- name: Deploy CDK erigon RPC
run: |
yq -Y --in-place '.deploy_cdk_erigon_rpc = true' params.yml
./scripts/cdk-erigon/set-local-config.sh
kurtosis run --enclave cdk-v1 --args-file params.yml .
yq -Y --in-place '.deploy_cdk_erigon_rpc = false' params.yml # reset
Expand Down Expand Up @@ -283,38 +284,11 @@ jobs:

- name: Configure cdk-ergion rpc node parameters
run: |
## L1 Configuration (Sepolia)
# The L1 chain id.
yq -Y --in-place '.args.l1_chain_id = "2442"' params.yml
# The L1 RPC endpoint.
yq -Y --in-place '.args.l1_rpc_url = "${{ secrets.ALCHEMY_SEPOLIA_RPC_URL }}"' params.yml
# Set most of the parameters (L1/L2 config, contracts and node config).
./scripts/cdk-erigon/set-cardona-config.sh
## L1 Contracts
# The address of the Sequencer EOA.
yq -Y --in-place '.args.zkevm_l2_sequencer_address = "0x761d53b47334bEe6612c0Bd1467FB881435375B2"' params.yml
# The address of the Admin EOA (contract deployer).
yq -Y --in-place '.args.zkevm_l2_admin_address = "0xff6250d0E86A2465B0C1bF8e36409503d6a26963"' params.yml
# The address of the Rollup contract.
yq -Y --in-place '.args.zkevm_rollup_address = "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa"' params.yml
# The address of the Polygon Rollup Manager contract.
yq -Y --in-place '.args.zkevm_rollup_manager_address = "0x2F50ef6b8e8Ee4E579B17619A92dE3E2ffbD8AD2"' params.yml
# The address of the Global Exit Root Manager contract.
yq -Y --in-place '.args.zkevm_global_exit_root_address = "0xAd1490c248c5d3CbAE399Fd529b79B42984277DF"' params.yml
# The address of the Matic contract.
yq -Y --in-place '.args.pol_token_address = "0x1850Dd35dE878238fb1dBa7aF7f929303AB6e8E4"' params.yml
# The first block to start syncing from on the L1
yq -Y --in-place '.args.genesis_block_number = "4789190"' params.yml
## L2 Configuration (Cardona)
# The RPC endpoint of the sequencer on L2.
yq -Y --in-place '.args.zkevm_rpc_url = "https://rpc.cardona.zkevm-rpc.com"' params.yml
# The endpoint of the datastreamer on L2.
yq -Y --in-place '.args.datastreamer_rpc_uri = "datastream.cardona.zkevm-rpc.com:6900"' params.yml
# The configuration files to run cdk-erigon as an RPC.
yq -Y --in-place '.args.cdk_erigon_rpc_chain_config_file = "data/cdk-erigon-rpc-cardona/dynamic-cardona-conf.json"' params.yml
yq -Y --in-place '.args.cdk_erigon_rpc_chain_allocs_file = "data/cdk-erigon-rpc-cardona/dynamic-cardona-allocs.json"' params.yml
# Set the L1 RPC endpoint.
yq -Y --in-place '.args.l1_rpc_url = "${{ secrets.ALCHEMY_SEPOLIA_RPC_URL }}"' params.yml
- name: Deploy the cdk-erigon rpc node
run: |
Expand Down
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cdk-erigon-rpc-local-l1
16 changes: 11 additions & 5 deletions doc-drafts/cdk-erigon-rpc/cdk-erigon-rpc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Erigon-CDK RPC

### Sync against a local L1

TODO

Extract the different configuration files and contract addreses using this handy script:

```bash
./scripts/cdk-erigon/set-local-config.sh
```

## Sync against Cardona

Here's a straightforward guide to setting up a standalone CDK-Erigon RPC node against Cardona.
Expand All @@ -9,7 +19,7 @@ Here's a straightforward guide to setting up a standalone CDK-Erigon RPC node ag
Begin by specifying a set of parameters related to L1, L2, and CDK-Erigon configuration. Utilize the provided script for convenience.

```bash
./set-cardona-config.sh
./scripts/cdk-erigon/set-cardona-config.sh
```

Also make sure to modify the value of the RPC URL `l1_rpc_url` in `params.yml`.
Expand Down Expand Up @@ -120,7 +130,3 @@ Before full synchronization, querying the block number will return 0.
```bash
cast block-number --rpc-url $(kurtosis port print cdk-v1 cdk-erigon-rpc-001 rpc)
```

### Sync against a local L1

TODO
1 change: 0 additions & 1 deletion lib/service.star
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def get_contract_setup_addresses(plan, args):
"zkevm_global_exit_root_l2_address": "fromjson | .polygonZkEVMGlobalExitRootL2Address",
"zkevm_admin_address": "fromjson | .admin",
"pol_token_address": "fromjson | .polTokenAddress",
"genesis_block_number": "fromjson | .deploymentRollupManagerBlockNumber",
}
if data_availability_package.is_cdk_validium(args):
extract[
Expand Down
10 changes: 9 additions & 1 deletion params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ args:
zkevm_node_image: hermeznetwork/zkevm-node:v0.6.5
cdk_node_image: 0xpolygon/cdk-validium-node:0.6.5-cdk
# cdk_node_image: 0xpolygon/cdk-validium-node:0.5.13-cdk.3
cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.0.10

cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.1.2
#cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.0.10

zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.7
# zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.6
Expand Down Expand Up @@ -160,6 +162,12 @@ args:
zkevm_aggregator_host: zkevm-node-aggregator-001
genesis_file: templates/permissionless-node/genesis.json

## CDK-Erigon RPC node configuration.
zkevm_rpc_url: http://zkevm-node-rpc-001:8123
datastreamer_rpc_uri: zkevm-node-sequencer-001:6900
cdk_erigon_rpc_chain_config_file: data/cdk-erigon-rpc-local-l1/dynamic-kurtosis-conf.json
cdk_erigon_rpc_chain_allocs_file: data/cdk-erigon-rpc-local-l1/dynamic-kurtosis-allocs.json

## Tools versions
polycli_version: v0.1.42

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ set -e

## L1 Configuration
# The L1 chain id.
yq -Y --in-place '.args.l1_chain_id = "2442"' params.yml
# The L1 RPC endpoint
yq -Y --in-place '.args.l1_rpc_url = "<l1-rpc-url>"' params.yml
yq -Y --in-place '.args.l1_chain_id = "11155111"' params.yml

## L2 Configuration
# The RPC endpoint of the sequencer on L2.
yq -Y --in-place '.args.zkevm_rpc_url = "https://rpc.cardona.zkevm-rpc.com"' params.yml
# The endpoint of the datastreamer on L2.
yq -Y --in-place '.args.zkevm_datastreamer_url = "datastream.cardona.zkevm-rpc.com:6900"' params.yml
# The L2 chain id.
yq -Y --in-place '.args.zkevm_rollup_chain_id = "10101"' params.yml
yq -Y --in-place '.args.zkevm_rollup_chain_id = "2442"' params.yml

## Contracts
# The address of the Sequencer EOA.
yq -Y --in-place '.args.zkevm_l2_sequencer_address = "0x761d53b47334bEe6612c0Bd1467FB881435375B2"' params.yml
# The address of the Admin EOA (contract deployer).
yq -Y --in-place '.args.zkevm_l2_admin_address = "0xff6250d0E86A2465B0C1bF8e36409503d6a26963"' params.yml

# The address of the Rollup contract.
yq -Y --in-place '.args.zkevm_rollup_address = "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa"' params.yml
# The address of the Polygon Rollup Manager contract.
Expand All @@ -29,7 +28,7 @@ yq -Y --in-place '.args.zkevm_global_exit_root_address = "0xAd1490c248c5d3CbAE39
# The address of the Matic contract.
yq -Y --in-place '.args.pol_token_address = "0x1850Dd35dE878238fb1dBa7aF7f929303AB6e8E4"' params.yml
# The first block to start syncing from on the L1
yq -Y --in-place '.args.genesis_block_number = "4789190"' params.yml
yq -Y --in-place '.args.zkevm_rollup_manager_block_number = "4789190"' params.yml

## Node Configuration
# The configuration files to run cdk-erigon as an RPC.
Expand Down
29 changes: 29 additions & 0 deletions scripts/cdk-erigon/set-local-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

# Download the cdk-erigon node configuration files.
rm -r /tmp/zkevm
mkdir -p data/cdk-erigon-rpc-local-l1
kurtosis files download cdk-v1 cdk-erigon-node-chain-config /tmp/zkevm
kurtosis files download cdk-v1 cdk-erigon-node-chain-allocs /tmp/zkevm
cp /tmp/zkevm/dynamic-kurtosis-conf.json data/cdk-erigon-rpc-local-l1
cp /tmp/zkevm/dynamic-kurtosis-allocs.json data/cdk-erigon-rpc-local-l1

# Extract the zkevm contract addresses.
contract_addresses="$(kurtosis service exec cdk-v1 contracts-001 "cat /opt/zkevm/combined.json" | tail -n +2 | jq)"

# Set the zkevm contract addresses in params.yml
zkevm_rollup_address="$(echo "$contract_addresses" | jq --raw-output .rollupAddress)"
yq -Y --in-place --arg a "$zkevm_rollup_address" '.args.zkevm_rollup_address = $a' params.yml

zkevm_rollup_manager_address="$(echo "$contract_addresses" | jq --raw-output .polygonRollupManagerAddress)"
yq -Y --in-place --arg a "$zkevm_rollup_manager_address" '.args.zkevm_rollup_manager_address = $a' params.yml

zkevm_global_exit_root_address="$(echo "$contract_addresses" | jq --raw-output .polygonZkEVMGlobalExitRootAddress)"
yq -Y --in-place --arg a "$zkevm_global_exit_root_address" '.args.zkevm_global_exit_root_address = $a' params.yml

pol_token_address="$(echo "$contract_addresses" | jq --raw-output .polTokenAddress)"
yq -Y --in-place --arg a "$pol_token_address" '.args.pol_token_address = $a' params.yml

zkevm_rollup_manager_block_number="$(echo "$contract_addresses" | jq --raw-output .deploymentRollupManagerBlockNumber)"
yq -Y --in-place --arg a "$zkevm_rollup_manager_block_number" '.args.zkevm_rollup_manager_block_number = $a' params.yml
6 changes: 3 additions & 3 deletions templates/cdk-erigon/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ zkevm.l1-chain-id: {{.l1_chain_id}}
# The L1 RPC endpoint
zkevm.l1-rpc-url: {{.l1_rpc_url}}
# The first block to start syncing from on the L1
zkevm.l1-first-block: {{.genesis_block_number}}
zkevm.l1-first-block: {{.zkevm_rollup_manager_block_number}}
# The Ethereum L1 rollup id.
zkevm.l1-rollup-id: 1

Expand All @@ -16,7 +16,7 @@ zkevm.address-sequencer: "{{.zkevm_l2_sequencer_address}}"
# The address of the Rollup contract.
zkevm.address-zkevm: "{{.zkevm_rollup_address}}"
# The address of the Admin EOA (contract deployer).
zkevm.address-admin: "{{.zkevm_admin_address}}"
zkevm.address-admin: "{{.zkevm_l2_admin_address}}"
# The address of the Polygon Rollup Manager contract.
zkevm.address-rollup: "{{.zkevm_rollup_manager_address}}"
# The address of the Global Exit Root Manager contract.
Expand All @@ -28,7 +28,7 @@ zkevm.l1-matic-contract-address: "{{.pol_token_address}}"
# The L2 chain id.
zkevm.l2-chain-id: {{.zkevm_rollup_chain_id}}
# The RPC endpoint of the sequencer on L2.
zkevm.l2-sequencer-rpc-url: {{.zkevm_sequencer_url}}
zkevm.l2-sequencer-rpc-url: {{.zkevm_rpc_url}}
# The endpoint of the datastreamer on L2.
zkevm.l2-datastreamer-url: {{.zkevm_datastreamer_url}}

Expand Down

0 comments on commit e89021c

Please sign in to comment.