diff --git a/.github/actions/monitor-cdk-verified-batches/action.yml b/.github/actions/monitor-cdk-verified-batches/action.yml index 9d87a031..bf336b93 100644 --- a/.github/actions/monitor-cdk-verified-batches/action.yml +++ b/.github/actions/monitor-cdk-verified-batches/action.yml @@ -11,6 +11,10 @@ inputs: description: The script timeout in seconds required: false default: '600' # 10 minutes + rpc_service: + description: The RPC service to use + required: false + default: 'cdk-erigon-node-001' runs: using: "composite" @@ -18,4 +22,4 @@ runs: - name: Check that batches are being verified working-directory: .github/actions/monitor-cdk-verified-batches shell: bash - run: ./batch_verification_monitor.sh ${{ inputs.verified_batches_target }} ${{ inputs.timeout }} + run: ./batch_verification_monitor.sh ${{ inputs.verified_batches_target }} ${{ inputs.timeout }} ${{ inputs.rpc_service }} diff --git a/.github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh b/.github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh index f058e8a0..a0b3a230 100755 --- a/.github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh +++ b/.github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh @@ -35,7 +35,7 @@ while true; do --legacy \ --rpc-url "$rpc_url" \ --private-key "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" \ - --gas-limit 643528 \ + --gas-limit 100_000 \ --create 0x600160015B810190630000000456 \ >/dev/null 2>&1 diff --git a/.github/actions/setup-kurtosis-cdk/action.yml b/.github/actions/setup-kurtosis-cdk/action.yml index fa04daaf..01882db2 100644 --- a/.github/actions/setup-kurtosis-cdk/action.yml +++ b/.github/actions/setup-kurtosis-cdk/action.yml @@ -6,11 +6,18 @@ inputs: kurtosis-version: description: The version of kurtosis required: false - default: '0.90.1' # https://github.com/kurtosis-tech/kurtosis/releases + default: '1.0.0' # https://github.com/kurtosis-tech/kurtosis/releases runs: using: "composite" steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Install kurtosis shell: bash run: | diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8f39a717..a15a6777 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ concurrency: jobs: # Basic deployment workflow. # Note that more advanced use cases are tested in the nightly workflow. - deploy: + deploy-cdk: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -22,7 +22,25 @@ jobs: uses: ./.github/actions/setup-kurtosis-cdk - name: Deploy Kurtosis CDK package - run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . + run: | + kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . '{apply_workload: true}' - name: Monitor verified batches uses: ./.github/actions/monitor-cdk-verified-batches + + deploy-zkevm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Kurtosis CDK tools + uses: ./.github/actions/setup-kurtosis-cdk + + - name: Deploy Kurtosis CDK package + run: | + kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . '{deploy_zkevm_permissionless_node: true, args: {sequencer_type: "zkevm"}, deploy_cdk_erigon_node: false, apply_workload: true}' + + - name: Monitor verified batches + uses: ./.github/actions/monitor-cdk-verified-batches + with: + rpc_service: zkevm-node-rpc-001 diff --git a/README.md b/README.md index d27c5af2..fec3dbc2 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,7 @@ kurtosis clean --all kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . ``` -The command above deploys a CDK stack using [zkevm-node](https://github.com/0xPolygonHermez/zkevm-node) as the sequencer. Alternatively, to launch a CDK stack using [cdk-erigon](https://github.com/0xPolygonHermez/cdk-erigon) as a sequencer, you can run the following command. - -```bash -kurtosis run --enclave cdk-v1 --args-file cdk-erigon-sequencer-params.yml --image-download always . -``` +The command above deploys a CDK stack using [cdk-erigon](https://github.com/0xPolygonHermez/cdk-erigon) as a sequencer. Let's do a simple L2 RPC test call. @@ -40,11 +36,7 @@ kurtosis enclave inspect cdk-v1 That output, while quite useful, might also be a little overwhelming. If you want to simply see the port mapping within the `cdk-v1` enclave for the `zkevm-node-rpc` service and the `trusted-rpc` port, you can use the following command. For this test, let's store the RPC URL in an environment variable: ```bash -# if zkevm-node is the sequencer -export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)" - -# if cdk-erigon is the sequencer -export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-sequencer-001 rpc)" +export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-node-001 http-rpc)" ``` That is the same environment variable that `cast` uses, so you should now be able to run this command. Note that the steps below will assume you have the [Foundry toolchain](https://book.getfoundry.sh/getting-started/installation) installed. diff --git a/cdk-erigon-sequencer-params.yml b/cdk-erigon-sequencer-params.yml deleted file mode 100644 index 7c41fee6..00000000 --- a/cdk-erigon-sequencer-params.yml +++ /dev/null @@ -1,184 +0,0 @@ ---- -# Deployment parameters. -# The deployment process is divided into various stages. - -# Deploy local L1. -deploy_l1: true - -# Deploy zkevm contracts on L1 (and also fund accounts). -deploy_zkevm_contracts_on_l1: true - -# Deploy zkevm node and cdk peripheral databases. -deploy_databases: true - -# Deploy cdk central/trusted environment. -deploy_cdk_central_environment: true - -# Deploy cdk/bridge infrastructure. -deploy_cdk_bridge_infra: true - -# Deploy permissionless node. -deploy_zkevm_permissionless_node: false - -# Deploy cdk-erigon node. -deploy_cdk_erigon_node: true - -# Deploy observability stack. -deploy_observability: true - -# Deploy Blockscout stack. -deploy_l2_blockscout: false - -# Deploy eth load balancer. -deploy_blutgang: false - -# Apply workload to the different components of the CDK stack. -apply_workload: false - -args: - # Suffix appended to service names. - # Note: It should be a string. - deployment_suffix: "-001" - - # Sequence type. Choose from ["erigon", "zkevm-node"] - sequencer_type: "erigon" - # The type of data availability to use. - # Options: - # - 'rollup': Transaction data is stored on-chain on L1. - # - 'cdk-validium': Transaction data is stored off-chain using the CDK DA layer and a DAC. - # In the future, we would like to support external DA protocols such as Avail, Celestia and Near. - data_availability_mode: cdk-validium - - # Docker images and repositories used to spin up services. - zkevm_prover_image: hermeznetwork/zkevm-prover:v6.0.3-RC18 - # zkevm_prover_image: hermeznetwork/zkevm-prover:v4.0.19 - zkevm_node_image: hermeznetwork/zkevm-node:v0.6.7 - cdk_node_image: 0xpolygon/cdk-validium-node:0.6.7-cdk - - zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.7 - # zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.6 - zkevm_contracts_image: leovct/zkevm-contracts # the tag is automatically replaced by the value of /zkevm_rollup_fork_id/ - - # zkevm_agglayer_image: 0xpolygon/agglayer:0.1.3 - zkevm_agglayer_image: ghcr.io/agglayer/agglayer-rs:main - zkevm_bridge_service_image: hermeznetwork/zkevm-bridge-service:v0.4.2 - cdk_erigon_node_image: hermeznetwork/cdk-erigon:beta13-candidate3-5225235-amd64 - # cdk_erigon_node_image: erigon:loop-wait - panoptichain_image: minhdvu/panoptichain - zkevm_bridge_ui_image: leovct/zkevm-bridge-ui:multi-network - zkevm_bridge_proxy_image: haproxy:2.9.9-bookworm - workload_image: leovct/workload:0.0.1 - zkevm_sequence_sender_image: hermeznetwork/zkevm-sequence-sender:v0.2.0-RC5 - toolbox_image: leovct/toolbox:0.0.1 - - # Port configuration. - zkevm_hash_db_port: 50061 - zkevm_executor_port: 50071 - zkevm_aggregator_port: 50081 - zkevm_pprof_port: 6060 - zkevm_prometheus_port: 9091 - zkevm_data_streamer_port: 6900 - zkevm_rpc_http_port: 8123 - zkevm_rpc_ws_port: 8133 - zkevm_bridge_rpc_port: 8080 - zkevm_bridge_grpc_port: 9090 - zkevm_bridge_ui_port: 80 - zkevm_agglayer_port: 4444 - zkevm_dac_port: 8484 - blockscout_public_port: 50101 - - # Addresses and private keys of the different components. - # They have been generated using the following command: - # polycli wallet inspect --mnemonic 'lab code glass agree maid neutral vessel horror deny frequent favorite soft gate galaxy proof vintage once figure diary virtual scissors marble shrug drop' --addresses 9 | tee keys.txt | jq -r '.Addresses[] | [.ETHAddress, .HexPrivateKey] | @tsv' | awk 'BEGIN{split("sequencer,aggregator,claimtxmanager,timelock,admin,loadtest,agglayer,dac,proofsigner",roles,",")} {print "zkevm_l2_" roles[NR] "_address: \"" $1 "\""; print "zkevm_l2_" roles[NR] "_private_key: \"0x" $2 "\"\n"}' - zkevm_l2_sequencer_address: "0x5b06837A43bdC3dD9F114558DAf4B26ed49842Ed" - zkevm_l2_sequencer_private_key: "0x183c492d0ba156041a7f31a1b188958a7a22eebadca741a7fe64436092dc3181" - - zkevm_l2_aggregator_address: "0xCae5b68Ff783594bDe1b93cdE627c741722c4D4d" - zkevm_l2_aggregator_private_key: "0x2857ca0e7748448f3a50469f7ffe55cde7299d5696aedd72cfe18a06fb856970" - - zkevm_l2_claimtxmanager_address: "0x5f5dB0D4D58310F53713eF4Df80ba6717868A9f8" - zkevm_l2_claimtxmanager_private_key: "0x8d5c9ecd4ba2a195db3777c8412f8e3370ae9adffac222a54a84e116c7f8b934" - - zkevm_l2_timelock_address: "0x130aA39Aa80407BD251c3d274d161ca302c52B7A" - zkevm_l2_timelock_private_key: "0x80051baf5a0a749296b9dcdb4a38a264d2eea6d43edcf012d20b5560708cf45f" - - zkevm_l2_admin_address: "0xE34aaF64b29273B7D567FCFc40544c014EEe9970" - zkevm_l2_admin_private_key: "0x12d7de8621a77640c9241b2595ba78ce443d05e94090365ab3bb5e19df82c625" - - zkevm_l2_loadtest_address: "0x81457240ff5b49CaF176885ED07e3E7BFbE9Fb81" - zkevm_l2_loadtest_private_key: "0xd7df6d64c569ffdfe7c56e6b34e7a2bdc7b7583db74512a9ffe26fe07faaa5de" - - zkevm_l2_agglayer_address: "0x351e560852ee001d5D19b5912a269F849f59479a" - zkevm_l2_agglayer_private_key: "0x1d45f90c0a9814d8b8af968fa0677dab2a8ff0266f33b136e560fe420858a419" - - zkevm_l2_dac_address: "0x5951F5b2604c9B42E478d5e2B2437F44073eF9A6" - zkevm_l2_dac_private_key: "0x85d836ee6ea6f48bae27b31535e6fc2eefe056f2276b9353aafb294277d8159b" - - zkevm_l2_proofsigner_address: "0x7569cc70950726784c8D3bB256F48e43259Cb445" - zkevm_l2_proofsigner_private_key: "0x77254a70a02223acebf84b6ed8afddff9d3203e31ad219b2bf900f4780cf9b51" - - # Keystore password. - zkevm_l2_keystore_password: pSnv6Dh5s9ahuzGzH9RoCDrKAMddaX3m - - ## L1 configuration. - l1_chain_id: 271828 - l1_preallocated_mnemonic: code code code code code code code code code code code quality - l1_funding_amount: 100ether - l1_rpc_url: http://el-1-geth-lighthouse:8545 - l1_ws_url: ws://el-1-geth-lighthouse:8546 - # https://github.com/kurtosis-tech/ethereum-package/tree/main?tab=readme-ov-file#configuration - l1_additional_services: [ - # blockscout, # block explorer - # dora, # beaconchain explorer - # el_forkmon, # fork monitor tool - ] - l1_preset: minimal - l1_seconds_per_slot: 1 - - ## Rollup configuration. - - # The chain id of the new rollup. - zkevm_rollup_chain_id: 10101 - - # The fork id of the new rollup. It indicates the prover (zkROM/executor) version. - zkevm_rollup_fork_id: 9 - - # The address of the rollup manager contract on L1. - # If specified, the rollup data will be retrieved from this contract instead of using the contracts service. - # zkevm_rollup_manager_address: "" - # # The block number at which the rollup manager contract was deployed. - # zkevm_rollup_manager_block_number: 0 - # # The address of the global exit root contract on L2. - # zkevm_global_exit_root_l2_address: "" - # # The address of the Polygon data committee contract on L1. - # polygon_data_committee_address: "" - - polygon_zkevm_explorer: https://explorer.private/ - l1_explorer_url: https://sepolia.etherscan.io/ - - # If this is true, we will automatically deploy an ERC20 contract on - # L1 to be used at the gasTokenAddress - zkevm_use_gas_token_contract: false - - ## Permissionless node configuration. - trusted_sequencer_node_uri: zkevm-node-sequencer-001:6900 - zkevm_aggregator_host: zkevm-node-aggregator-001 - genesis_file: templates/permissionless-node/genesis.json - - ## Tools versions - polycli_version: v0.1.42 - - ## Workload configuration. - workload_commands: [ - "polycli_loadtest_on_l2.sh t", # eth transfers - "polycli_loadtest_on_l2.sh 2", # erc20 transfers - "polycli_loadtest_on_l2.sh 7", # erc721 mints - "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps - "polycli_rpcfuzz_on_l2.sh", # rpc calls - "bridge.sh", # bridge tokens l1 -> l2 and l2 -> l1 - ] - - ## ETH Load balancer configuration. - blutgang_image: makemake1337/blutgang:0.3.5 - blutgang_rpc_port: 55555 - blutgang_admin_port: 55556 diff --git a/cdk_central_environment.star b/cdk_central_environment.star index d22efe76..21a6cada 100644 --- a/cdk_central_environment.star +++ b/cdk_central_environment.star @@ -4,6 +4,7 @@ zkevm_dac_package = import_module("./lib/zkevm_dac.star") zkevm_node_package = import_module("./lib/zkevm_node.star") zkevm_prover_package = import_module("./lib/zkevm_prover.star") zkevm_sequence_sender_package = import_module("./lib/zkevm_sequence_sender.star") +cdk_node_package = import_module("./lib/cdk_node.star") databases = import_module("./databases.star") @@ -36,52 +37,80 @@ def run(plan, args): config={"genesis.json": struct(template=genesis_file, data={})}, ) - # Create the zkevm node config. - node_config_template = read_file(src="./templates/trusted-node/node-config.toml") - node_config_artifact = plan.render_templates( - config={ - "node-config.toml": struct( - template=node_config_template, - data=args - | { - "is_cdk_validium": data_availability_package.is_cdk_validium(args), - } - | db_configs, - ) - }, - name="trusted-node-config", - ) - - # Start the synchronizer. - zkevm_node_package.start_synchronizer( - plan, args, node_config_artifact, genesis_artifact - ) - - # Start the rest of the zkevm node components. keystore_artifacts = get_keystores_artifacts(plan, args) - zkevm_node_components_configs = ( - zkevm_node_package.create_zkevm_node_components_config( - args, node_config_artifact, genesis_artifact, keystore_artifacts + if args["sequencer_type"] == "zkevm": + # Create the zkevm node config. + node_config_template = read_file( + src="./templates/trusted-node/node-config.toml" + ) + node_config_artifact = plan.render_templates( + config={ + "node-config.toml": struct( + template=node_config_template, + data=args + | { + "is_cdk_validium": data_availability_package.is_cdk_validium( + args + ), + } + | db_configs, + ) + }, + name="trusted-node-config", ) - ) - plan.add_services( - configs=zkevm_node_components_configs, - description="Starting the rest of the zkevm node components", - ) + # Start the synchronizer. + zkevm_node_package.start_synchronizer( + plan, args, node_config_artifact, genesis_artifact + ) - if args["sequencer_type"] == "erigon": - sequence_sender_config = ( - zkevm_sequence_sender_package.create_zkevm_sequence_sender_config( - plan, args, genesis_artifact, keystore_artifacts.sequencer + # Start the rest of the zkevm node components. + zkevm_node_components_configs = ( + zkevm_node_package.create_zkevm_node_components_config( + args, node_config_artifact, genesis_artifact, keystore_artifacts ) ) plan.add_services( - configs=sequence_sender_config, + configs=zkevm_node_components_configs, description="Starting the rest of the zkevm node components", ) + if args["sequencer_type"] == "erigon": + # Create the cdk node config. + node_config_template = read_file( + src="./templates/trusted-node/cdk-node-config.toml" + ) + contract_setup_addresses = service_package.get_contract_setup_addresses( + plan, args + ) + node_config_artifact = plan.render_templates( + name="cdk-node-config-artifact", + config={ + "cdk-node-config.toml": struct( + template=node_config_template, + data=args + | { + "is_cdk_validium": data_availability_package.is_cdk_validium( + args + ), + } + | db_configs + | contract_setup_addresses, + ) + }, + ) + + # Start the cdk components. + cdk_node_configs = cdk_node_package.create_cdk_node_service_config( + args, node_config_artifact, genesis_artifact, keystore_artifacts + ) + + plan.add_services( + configs=cdk_node_configs, + description="Starting the cdk node components", + ) + # Start the DAC if in validium mode. if data_availability_package.is_cdk_validium(args): dac_config_artifact = create_dac_config_artifact(plan, args, db_configs) diff --git a/databases.star b/databases.star index 53a639dc..c5857e32 100644 --- a/databases.star +++ b/databases.star @@ -45,14 +45,19 @@ TRUSTED_DATABASES = { "user": "state_user", "password": "redacted", }, + "aggregator_db": { + "name": "aggregator_db", + "user": "aggregator_user", + "password": "redacted", + }, + "aggregator_syncer_db": { + "name": "syncer_db", + "user": "syncer_user", + "password": "redacted", + }, } PERMISSIONLESS_DATABASES = { - "agglayer_db": { - "name": "agglayer_db", - "user": "agglayer_user", - "password": "redacted", - }, "bridge_db": { "name": "bridge_db", "user": "bridge_user", diff --git a/docs/da-mode.md b/docs/da-mode.md index 8fbe1c8a..9002109e 100644 --- a/docs/da-mode.md +++ b/docs/da-mode.md @@ -6,10 +6,10 @@ The two options are: - `rollup`: Transaction data is stored on-chain on Layer 1 (L1). This approach leverages the security of the main L1 chain (e.g. Ethereum) to ensure data integrity and availability. -> In this mode, the components will run the `zkevm_node_image` and the consensus contract will be `PolygonZkEVMEtrog`. +> In this mode, the components will run CDK in `zkevm` mode and the consensus contract will be `PolygonZkEVMEtrog`. - `cdk-validium`: Transaction data is stored off-chain using a dedicated CDK Data Availability (DA) layer and a Data Availability Committee (DAC). This approach reduces the load on the main chain and can offer improved scalability and lower costs. -> In this mode, the components will run the `cdk_node_image`, the consensus contract will be `PolygonValidiumEtrog` and the CDK DAC will be deployed and configured. +> In this mode, the components will run CDK in `validium` mode, the consensus contract will be `PolygonValidiumEtrog` and the CDK DAC will be deployed and configured. For more detailed information and technical specifications, refer to the [Polygon Knowledge Layer](https://docs.polygon.technology/cdk/spec/validium-vs-rollup/). diff --git a/input_parser.star b/input_parser.star index 5aa6db33..3c6060fc 100644 --- a/input_parser.star +++ b/input_parser.star @@ -1,9 +1,11 @@ DEFAULT_ARGS = { "deployment_suffix": "-001", + "sequencer_type": "erigon", "data_availability_mode": "cdk-validium", - "zkevm_prover_image": "hermeznetwork/zkevm-prover:v6.0.2", + "zkevm_prover_image": "hermeznetwork/zkevm-prover:v6.0.3-RC18", "zkevm_node_image": "hermeznetwork/zkevm-node:v0.7.0", - "cdk_node_image": "0xpolygon/cdk-validium-node:0.7.0-cdk", + "cdk_validium_node_image": "0xpolygon/cdk-validium-node:0.7.0-cdk", + "cdk_node_image": "ghcr.io/0xpolygon/cdk:0.0.9", "zkevm_da_image": "0xpolygon/cdk-data-availability:0.0.7", "zkevm_contracts_image": "leovct/zkevm-contracts", "zkevm_agglayer_image": "ghcr.io/agglayer/agglayer-rs:main", @@ -12,9 +14,8 @@ DEFAULT_ARGS = { "zkevm_bridge_ui_image": "leovct/zkevm-bridge-ui:multi-network", "zkevm_bridge_proxy_image": "haproxy:2.9.9-bookworm", "zkevm_sequence_sender_image": "hermeznetwork/zkevm-sequence-sender:v0.2.0-RC4", - "cdk_erigon_node_image": "hermeznetwork/cdk-erigon:v1.0.9", + "cdk_erigon_node_image": "hermeznetwork/cdk-erigon:2.0.0-beta13", "toolbox_image": "leovct/toolbox:0.0.1", - "sequencer_type": "zkevm-node", "zkevm_hash_db_port": 50061, "zkevm_executor_port": 50071, "zkevm_aggregator_port": 50081, @@ -55,7 +56,7 @@ DEFAULT_ARGS = { "l1_ws_url": "ws://el-1-geth-lighthouse:8546", "l1_additional_services": [], "l1_preset": "minimal", - "l1_seconds_per_slot": 12, + "l1_seconds_per_slot": 1, "zkevm_rollup_chain_id": 10101, "zkevm_rollup_fork_id": 9, "polygon_zkevm_explorer": "https://explorer.private/", @@ -66,11 +67,11 @@ DEFAULT_ARGS = { "genesis_file": "templates/permissionless-node/genesis.json", "polycli_version": "v0.1.42", "workload_commands": [ - "polycli_loadtest_on_l2.sh t", # eth transfers - "polycli_loadtest_on_l2.sh 2", # erc20 transfers - "polycli_loadtest_on_l2.sh 7", # erc721 mints - "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps - "polycli_rpcfuzz_on_l2.sh", # rpc calls + # "polycli_loadtest_on_l2.sh t", # eth transfers + # "polycli_loadtest_on_l2.sh 2", # erc20 transfers + # "polycli_loadtest_on_l2.sh 7", # erc721 mints + # "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps + # "polycli_rpcfuzz_on_l2.sh", # rpc calls "bridge.sh", # bridge tokens l1 -> l2 and l2 -> l1 ], "blutgang_image": "makemake1337/blutgang:0.3.5", diff --git a/kurtosis.yml b/kurtosis.yml index 0e8a9757..688b5594 100644 --- a/kurtosis.yml +++ b/kurtosis.yml @@ -28,6 +28,8 @@ description: |- # Note: It should be a string. deployment_suffix: "-001" + sequencer_type: erigon + # The type of data availability to use. # Options: # - 'rollup': Transaction data is stored on-chain on L1. @@ -36,12 +38,12 @@ description: |- data_availability_mode: cdk-validium # Docker images and repositories used to spin up services. - zkevm_prover_image: hermeznetwork/zkevm-prover:v6.0.2 + zkevm_prover_image: hermeznetwork/zkevm-prover:v6.0.3-RC18 # zkevm_prover_image: hermeznetwork/zkevm-prover:v4.0.19 zkevm_node_image: hermeznetwork/zkevm-node:v0.7.0 - cdk_node_image: 0xpolygon/cdk-validium-node:0.7.0-cdk - # cdk_node_image: 0xpolygon/cdk-validium-node:0.5.13-cdk.3 + cdk_validium_node_image: 0xpolygon/cdk-validium-node:0.7.0-cdk + cdk_node_image: ghcr.io/0xpolygon/cdk:0.0.9 zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.7 # zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.6 @@ -56,9 +58,8 @@ description: |- zkevm_bridge_proxy_image: haproxy:2.9.9-bookworm zkevm_sequence_sender_image: hermeznetwork/zkevm-sequence-sender:v0.2.0-RC4 - cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.0.9 + cdk_erigon_node_image: hermeznetwork/cdk-erigon:2.0.0-beta13 toolbox_image: leovct/toolbox:0.0.1 - sequencer_type: zkevm-node # Port configuration. zkevm_hash_db_port: 50061 @@ -122,7 +123,7 @@ description: |- # el_forkmon, # fork monitor tool ] l1_preset: minimal - l1_seconds_per_slot: 12 + l1_seconds_per_slot: 1 ## Rollup configuration. @@ -149,11 +150,11 @@ description: |- ## Workload configuration. workload_commands: [ - "polycli_loadtest_on_l2.sh t", # eth transfers - "polycli_loadtest_on_l2.sh 2", # erc20 transfers - "polycli_loadtest_on_l2.sh 7", # erc721 mints - "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps - "polycli_rpcfuzz_on_l2.sh", # rpc calls + # "polycli_loadtest_on_l2.sh t", # eth transfers + # "polycli_loadtest_on_l2.sh 2", # erc20 transfers + # "polycli_loadtest_on_l2.sh 7", # erc721 mints + # "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps + # "polycli_rpcfuzz_on_l2.sh", # rpc calls "bridge.sh", # bridge tokens l1 -> l2 and l2 -> l1 ] diff --git a/lib/cdk_node.star b/lib/cdk_node.star new file mode 100644 index 00000000..98615d1d --- /dev/null +++ b/lib/cdk_node.star @@ -0,0 +1,51 @@ +data_availability_package = import_module("./data_availability.star") + +NODE_COMPONENTS = struct( + sequence_sender="sequence-sender", + aggregator="aggregator", +) + + +def create_cdk_node_service_config( + args, + config_artifact, + genesis_artifact, + keystore_artifact, +): + cdk_node_name = "cdk-node" + args["deployment_suffix"] + + cdk_node_service_config = ServiceConfig( + image=args["cdk_node_image"], + ports={ + "aggregator": PortSpec( + args["zkevm_aggregator_port"], application_protocol="grpc" + ), + }, + files={ + "/etc/cdk": Directory( + artifact_names=[ + config_artifact, + genesis_artifact, + keystore_artifact.aggregator, + keystore_artifact.sequencer, + ], + ), + "/data": Directory( + artifact_names=[], + ), + }, + entrypoint=["sh", "-c"], + # Sleep for 20 seconds in order to wait for datastream server getting ready + # TODO: find a better way instead of waiting + cmd=[ + "sleep 20 && cdk-node run " + + "-cfg=/etc/cdk/cdk-node-config.toml " + + "-custom-network-file=/etc/cdk/genesis.json " + + "-components=" + + NODE_COMPONENTS.sequence_sender + + "," + + NODE_COMPONENTS.aggregator, + ], + ) + + return {cdk_node_name: cdk_node_service_config} diff --git a/lib/data_availability.star b/lib/data_availability.star index c6ab9f46..6ab10e37 100644 --- a/lib/data_availability.star +++ b/lib/data_availability.star @@ -18,7 +18,7 @@ def get_node_image(args): # Map data availability modes to node images. node_images = { DATA_AVAILABILITY_MODES.rollup: args["zkevm_node_image"], - DATA_AVAILABILITY_MODES.cdk_validium: args["cdk_node_image"], + DATA_AVAILABILITY_MODES.cdk_validium: args["cdk_validium_node_image"], } return node_images.get(args["data_availability_mode"]) diff --git a/lib/zkevm_node.star b/lib/zkevm_node.star index 2e63d33f..6db588f5 100644 --- a/lib/zkevm_node.star +++ b/lib/zkevm_node.star @@ -226,7 +226,7 @@ def create_zkevm_node_components_config( aggregator_config | rpc_config | eth_tx_manager_config | l2_gas_pricer_config ) - if args["sequencer_type"] == "zkevm-node": + if args["sequencer_type"] == "zkevm": sequencer_config = create_sequencer_service_config( args, config_artifact, genesis_artifact ) diff --git a/main.star b/main.star index 703b1827..76c80ff5 100644 --- a/main.star +++ b/main.star @@ -19,8 +19,8 @@ def run( deploy_databases=True, deploy_cdk_bridge_infra=True, deploy_cdk_central_environment=True, - deploy_zkevm_permissionless_node=True, - deploy_cdk_erigon_node=False, + deploy_zkevm_permissionless_node=False, + deploy_cdk_erigon_node=True, deploy_observability=True, deploy_l2_blockscout=False, deploy_blutgang=False, @@ -110,6 +110,13 @@ def run( else: plan.print("Skipping the deployment of cdk-erigon sequencer") + # Deploy cdk-erigon node. + if deploy_cdk_erigon_node: + plan.print("Deploying cdk-erigon node") + cdk_erigon_package.run_rpc(plan, args) + else: + plan.print("Skipping the deployment of cdk-erigon node") + plan.print("Deploying cdk central/trusted environment") central_environment_args = dict(args) central_environment_args["genesis_artifact"] = genesis_artifact @@ -119,13 +126,6 @@ def run( else: plan.print("Skipping the deployment of cdk central/trusted environment") - # Deploy cdk-erigon node. - if deploy_cdk_erigon_node: - plan.print("Deploying cdk-erigon node") - cdk_erigon_package.run_rpc(plan, args) - else: - plan.print("Skipping the deployment of cdk-erigon node") - # Deploy cdk/bridge infrastructure. if deploy_cdk_bridge_infra: plan.print("Deploying cdk/bridge infrastructure") diff --git a/params.yml b/params.yml index 71cdfba3..f703ebab 100644 --- a/params.yml +++ b/params.yml @@ -20,6 +20,9 @@ deploy_cdk_bridge_infra: true # Deploy permissionless node. deploy_zkevm_permissionless_node: false +# Deploy cdk-erigon node. +deploy_cdk_erigon_node: true + # Deploy observability stack. deploy_observability: false @@ -37,6 +40,9 @@ args: # Note: It should be a string. deployment_suffix: "-001" + # Sequence type. Choose from ["erigon", "zkevm-node"] + sequencer_type: "erigon" + # The type of data availability to use. # Options: # - 'rollup': Transaction data is stored on-chain on L1. @@ -45,12 +51,12 @@ args: data_availability_mode: cdk-validium # Docker images and repositories used to spin up services. - zkevm_prover_image: hermeznetwork/zkevm-prover:v6.0.2 + zkevm_prover_image: hermeznetwork/zkevm-prover:v6.0.3-RC18 # zkevm_prover_image: hermeznetwork/zkevm-prover:v4.0.19 zkevm_node_image: hermeznetwork/zkevm-node:v0.7.0 - cdk_node_image: 0xpolygon/cdk-validium-node:0.7.0-cdk - # cdk_node_image: 0xpolygon/cdk-validium-node:0.5.13-cdk.3 + cdk_validium_node_image: 0xpolygon/cdk-validium-node:0.7.0-cdk + cdk_node_image: ghcr.io/0xpolygon/cdk:0.0.9 zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.7 # zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.6 @@ -64,9 +70,8 @@ args: zkevm_bridge_ui_image: leovct/zkevm-bridge-ui:multi-network zkevm_bridge_proxy_image: haproxy:2.9.9-bookworm zkevm_sequence_sender_image: "hermeznetwork/zkevm-sequence-sender:v0.2.0-RC4" - cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.0.9 + cdk_erigon_node_image: hermeznetwork/cdk-erigon:2.0.0-beta13 toolbox_image: leovct/toolbox:0.0.1 - sequencer_type: "zkevm-node" # Port configuration. zkevm_hash_db_port: 50061 @@ -123,14 +128,14 @@ args: l1_funding_amount: 100ether l1_rpc_url: http://el-1-geth-lighthouse:8545 l1_ws_url: ws://el-1-geth-lighthouse:8546 - # https://github.com/ethpandaops/ethereum-package/tree/main?tab=readme-ov-file#configuration + # https://github.com/kurtosis-tech/ethereum-package/tree/main?tab=readme-ov-file#configuration l1_additional_services: [ # blockscout, # block explorer # dora, # beaconchain explorer # el_forkmon, # fork monitor tool ] l1_preset: minimal - l1_seconds_per_slot: 12 + l1_seconds_per_slot: 1 ## Rollup configuration. @@ -167,11 +172,11 @@ args: ## Workload configuration. workload_commands: [ - "polycli_loadtest_on_l2.sh t", # eth transfers - "polycli_loadtest_on_l2.sh 2", # erc20 transfers - "polycli_loadtest_on_l2.sh 7", # erc721 mints - "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps - "polycli_rpcfuzz_on_l2.sh", # rpc calls + # "polycli_loadtest_on_l2.sh t", # eth transfers + # "polycli_loadtest_on_l2.sh 2", # erc20 transfers + # "polycli_loadtest_on_l2.sh 7", # erc721 mints + # "polycli_loadtest_on_l2.sh v3", # uniswapv3 swaps + # "polycli_rpcfuzz_on_l2.sh", # rpc calls "bridge.sh", # bridge tokens l1 -> l2 and l2 -> l1 ] diff --git a/scripts/reset_postgres.sh b/scripts/reset_postgres.sh index 9be14cf7..125017a7 100755 --- a/scripts/reset_postgres.sh +++ b/scripts/reset_postgres.sh @@ -8,7 +8,7 @@ # 2. update PGPASSWORD, PGUSER, and PGHOST params per your use case (modify configs) # 3. run ./scripts/reset_postgres.sh (drop/recreate dbs and permissions) # 4. kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always . (deploy with fresh dbs) -DB_NAMES=("event_db" "pool_db" "prover_db" "state_db" "agglayer_db" "bridge_db" "dac_db") +DB_NAMES=("event_db" "pool_db" "prover_db" "state_db" "bridge_db" "dac_db") DB_USERS=("event_user" "pool_user" "prover_user" "state_user" "agglayer_user" "bridge_user" "dac_user") # User must update credentials with master postgres IP/hostname and username diff --git a/templates/bridge-infra/agglayer-config.toml b/templates/bridge-infra/agglayer-config.toml index e43de3af..6d43303b 100644 --- a/templates/bridge-infra/agglayer-config.toml +++ b/templates/bridge-infra/agglayer-config.toml @@ -17,15 +17,6 @@ Environment = "production" # "production" or "development" Level = "info" Outputs = ["stderr"] -[DB] -User = "{{.agglayer_db.user}}" -Password = "{{.agglayer_db.password}}" -Name = "{{.agglayer_db.name}}" -Host = "{{.agglayer_db.hostname}}" -Port = "{{.agglayer_db.port}}" -EnableLog = false -MaxConns = 200 - [EthTxManager] FrequencyToMonitorTxs = "1s" WaitTxToBeMined = "2m" @@ -43,4 +34,4 @@ NodeURL = "{{.l1_rpc_url}}" RollupManagerContract = "{{.zkevm_rollup_manager_address}}" [Telemetry] -PrometheusAddr = "0.0.0.0:{{.zkevm_prometheus_port}}" \ No newline at end of file +PrometheusAddr = "0.0.0.0:{{.zkevm_prometheus_port}}" diff --git a/templates/trusted-node/cdk-node-config.toml b/templates/trusted-node/cdk-node-config.toml new file mode 100644 index 00000000..dfee685e --- /dev/null +++ b/templates/trusted-node/cdk-node-config.toml @@ -0,0 +1,133 @@ +ForkUpgradeBatchNumber = 0 +ForkUpgradeNewForkId = 0 + +[Common] +IsValidiumMode = {{.is_cdk_validium}} +ContractVersions = "elderberry" + +[Log] +Environment = "development" # "production" or "development" +Level = "debug" +Outputs = ["stderr"] + +[SequenceSender] +WaitPeriodSendSequence = "15s" +LastBatchVirtualizationTimeMaxWaitPeriod = "10s" +MaxTxSizeForL1 = 131072 +L2Coinbase = "{{.zkevm_l2_sequencer_address}}" +PrivateKey = {Path = "/etc/cdk/sequencer.keystore", Password = "{{.zkevm_l2_keystore_password}}"} +SequencesTxFileName = "/data/sequencesender.json" +GasOffset = 80000 +WaitPeriodPurgeTxFile = "15m" +MaxPendingTx = 1 + [SequenceSender.StreamClient] + Server = "{{.sequencer_name}}{{.deployment_suffix}}:{{.zkevm_data_streamer_port}}" + [SequenceSender.EthTxManager] + FrequencyToMonitorTxs = "1s" + WaitTxToBeMined = "2m" + ConsolidationL1ConfirmationBlocks = 5 + FinalizationL1ConfirmationBlocks = 10 + WaitReceiptToBeGenerated = "8s" + PrivateKeys = [ + {Path = "/etc/cdk/sequencer.keystore", Password = "{{.zkevm_l2_keystore_password}}"}, + ] + ForcedGas = 0 + GasPriceMarginFactor = 1 + MaxGasPriceLimit = 0 + PersistenceFilename = "/data/ethtxmanager.json" + [SequenceSender.EthTxManager.Etherman] + URL = "{{.l1_rpc_url}}" + L1ChainID = {{.l1_chain_id}} + HTTPHeaders = [] + +[Aggregator] + Host = "0.0.0.0" + Port = "{{.zkevm_aggregator_port}}" + RetryTime = "30s" + VerifyProofInterval = "30s" + ProofStatePollingInterval = "5s" + TxProfitabilityCheckerType = "acceptall" + TxProfitabilityMinReward = "1.1" + IntervalAfterWhichBatchConsolidateAnyway = "0s" + ChainID = "{{.zkevm_rollup_chain_id}}" + ForkId = 9 + CleanupLockedProofsInterval = "2m0s" + GeneratingProofCleanupThreshold = "10m" + GasOffset = 150000 + UpgradeEtrogBatchNumber = 0 + WitnessURL = "http://{{.l2_rpc_name}}{{.deployment_suffix}}:{{.zkevm_rpc_http_port}}" + {{if .is_cdk_validium}} + SenderAddress = "{{.zkevm_l2_agglayer_address}}" + SettlementBackend = "agglayer" + AggLayerTxTimeout = "600s" + AggLayerURL = "http://zkevm-agglayer{{.deployment_suffix}}:{{.zkevm_agglayer_port}}" + {{else}} + + SenderAddress = "{{.zkevm_l2_aggregator_address}}" + {{end}} + + [Aggregator.SequencerPrivateKey] + Path = "/etc/cdk/sequencer.keystore" + Password = "{{.zkevm_l2_keystore_password}}" + + [Aggregator.DB] + Name = "{{.aggregator_db.name}}" + User = "{{.aggregator_db.user}}" + Password = "{{.aggregator_db.password}}" + Host = "{{.aggregator_db.hostname}}" + Port = "{{.aggregator_db.port}}" + EnableLog = false + MaxConns = 200 + [Aggregator.Log] + Environment = "development" # "production" or "development" + Level = "debug" + Outputs = ["stderr"] + [Aggregator.StreamClient] + Server = "{{.sequencer_name}}{{.deployment_suffix}}:{{.zkevm_data_streamer_port}}" + [Aggregator.EthTxManager] + FrequencyToMonitorTxs = "1s" + WaitTxToBeMined = "2m" + GetReceiptMaxTime = "250ms" + GetReceiptWaitInterval = "1s" + PrivateKeys = [ + {Path = "/etc/cdk/aggregator.keystore", Password = "{{.zkevm_l2_keystore_password}}"}, + ] + ForcedGas = 0 + GasPriceMarginFactor = 1 + MaxGasPriceLimit = 0 + PersistenceFilename = "" + ReadPendingL1Txs = false + SafeStatusL1NumberOfBlocks = 0 + FinalizedStatusL1NumberOfBlocks = 0 + [Aggregator.EthTxManager.Etherman] + URL = "{{.l1_rpc_url}}" + L1ChainID = {{.l1_chain_id}} + HTTPHeaders = [] + [Aggregator.Synchronizer] + [Aggregator.Synchronizer.DB] + Name = "{{.aggregator_syncer_db.name}}" + User = "{{.aggregator_syncer_db.user}}" + Password = "{{.aggregator_syncer_db.password}}" + Host = "{{.aggregator_syncer_db.hostname}}" + Port = "{{.aggregator_syncer_db.port}}" + EnableLog = false + MaxConns = 10 + [Aggregator.Synchronizer.Synchronizer] + SyncInterval = "10s" + SyncChunkSize = 1000 + GenesisBlockNumber = 1 + SyncUpToBlock = "latest" + BlockFinality = "latest" + OverrideStorageCheck = false + [Aggregator.Synchronizer.Etherman] + [Aggregator.Synchronizer.Etherman.Validium] + Enabled = {{.is_cdk_validium}} + +[RPC] + +[NetworkConfig.L1] +ChainID = "{{.l1_chain_id}}" +PolAddr = "{{.pol_token_address}}" +ZkEVMAddr = "{{.zkevm_rollup_address}}" +RollupManagerAddr = "{{.zkevm_rollup_manager_address}}" +GlobalExitRootManagerAddr = "{{.zkevm_global_exit_root_address}}" diff --git a/templates/trusted-node/prover-config.json b/templates/trusted-node/prover-config.json index 5570ca5c..7c4e33c2 100644 --- a/templates/trusted-node/prover-config.json +++ b/templates/trusted-node/prover-config.json @@ -143,7 +143,11 @@ * aggregatorClientHost is the hostname that this prover will * attempt to use while connecting to the aggregator */ -}} - "aggregatorClientHost": "zkevm-node-aggregator{{.deployment_suffix}}", + {{if eq .sequencer_type "zkevm"}} + "aggregatorClientHost": "zkevm-node-aggregator{{.deployment_suffix}}", + {{else if eq .sequencer_type "erigon"}} + "aggregatorClientHost": "cdk-node{{.deployment_suffix}}", + {{end}} {{- /* * keccakScriptFile is the keccak-f state machine script file diff --git a/workload.star b/workload.star index 96a85aad..254f8b77 100644 --- a/workload.star +++ b/workload.star @@ -11,7 +11,9 @@ def run(plan, args): bridge_template = read_file(src="./templates/workload/bridge.sh") contract_setup_addresses = service_package.get_contract_setup_addresses(plan, args) - zkevm_rpc_service = plan.get_service("zkevm-node-rpc" + args["deployment_suffix"]) + zkevm_rpc_service = plan.get_service( + args["l2_rpc_name"] + args["deployment_suffix"] + ) zkevm_rpc_url = "http://{}:{}".format( zkevm_rpc_service.ip_address, zkevm_rpc_service.ports["http-rpc"].number )