diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index de4586bd..26cca6ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,7 +35,7 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - + - name: List first CDK L2 chain databases (erigon) run: | postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3) @@ -48,7 +48,7 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - + - name: List second CDK L2 chain databases (erigon) run: | postgres2_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-002 postgres | cut -d':' -f3) @@ -137,7 +137,7 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - + - name: List first CDK L2 chain databases (zkevm) run: | postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3) @@ -150,7 +150,7 @@ jobs: - name: Inspect enclave run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }} - + - name: List second CDK L2 chain databases (erigon) run: | postgres2_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-002 postgres | cut -d':' -f3) @@ -206,7 +206,7 @@ jobs: - name: Deploy Kurtosis CDK package with additional services run: | - yq -Y --in-place '.args.additional_services = ["blockscout", "blutgang", "pless_zkevm_node", "prometheus_grafana", "tx_spammer"]' params.yml + yq -Y --in-place '.args.additional_services = ["arpeggio", "blockscout", "blutgang", "pless_zkevm_node", "prometheus_grafana", "tx_spammer"]' params.yml kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=params.yml . - name: Inspect enclave @@ -214,10 +214,13 @@ jobs: - name: Verify Blutgang rpc run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} blutgang-001 http) - + + - name: Verify Arpeggio rpc + run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} arpeggio-001 rpc) + - name: Verify permissionless zkevm-node rpc run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc) - + - name: Verify Prometheus collects Panoptichain metrics run: | echo "Wait for one minute while Prometheus gathers metrics..." diff --git a/README.md b/README.md index e398d836..f5b4115c 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ Below is a list of services available for deployment using Kurtosis: | Service | Description | |-------- | ----------- | +| `arpeggio` | Deploys [Arpeggio](https://github.com/0xPolygon/arpeggio) load balancing reverse-proxy for Eth rpc nodes (currently WIP) | | `blockscout` | Deploys the [Blockscout](https://www.blockscout.com/) stack, a comprehensive blockchain explorer for Ethereum-based networks, allowing exploration of transaction histories, account balances, and smart contract details. | | `blutgang` | Deploys [Blutgang](https://github.com/rainshowerLabs/blutgang), an Ethereum load balancer that distributes network traffic evenly across multiple nodes to ensure high availability. | | `pless_zkevm_node` | Deploys a permissionless [zkevm-node](https://github.com/0xPolygonHermez/zkevm-node). | @@ -155,6 +156,13 @@ Once the services are deployed, you can access their web interfaces and interact Access the different web interfaces: +- Arpeggio (WIP) + +```bash +open $kurtosis port print cdk-v1 arpeggio-001 rpc) +open $kurtosis port print cdk-v1 arpeggio-001 ws) +``` + - Blockscout: ```bash diff --git a/lib/cdk_erigon.star b/lib/cdk_erigon.star index 77688613..c1e69fc3 100644 --- a/lib/cdk_erigon.star +++ b/lib/cdk_erigon.star @@ -39,6 +39,12 @@ def start_node( args["zkevm_rpc_http_port"], application_protocol="http", ) + # Erigon upgrades the http traffic to ws when appropriate (I think?), + # so we use the http port for this config, but there may be another way + # to configure cdk-erigon such that it uses a different port for WS + ports["ws-rpc"] = PortSpec( + args["zkevm_rpc_http_port"], application_protocol="ws" + ) if is_sequencer: ports["data-streamer"] = PortSpec( diff --git a/lib/service.star b/lib/service.star index b4c4d4c3..d11938c4 100644 --- a/lib/service.star +++ b/lib/service.star @@ -56,7 +56,10 @@ def get_l2_rpc_urls(plan, args): name=args["l2_rpc_name"] + args["deployment_suffix"] ) ws = "" - if args["l2_rpc_name"] == "zkevm-node-rpc": + if ( + args["l2_rpc_name"] == "zkevm-node-rpc" + or args["l2_rpc_name"] == "cdk-erigon-node" + ): ws = "ws://{}:{}".format( l2_rpc_service.ip_address, l2_rpc_service.ports["ws-rpc"].number ) diff --git a/main.star b/main.star index c0aa24d2..85e03a21 100644 --- a/main.star +++ b/main.star @@ -8,6 +8,7 @@ input_parser = "./input_parser.star" zkevm_pool_manager_package = import_module("./zkevm_pool_manager.star") # Additional services packages. +arpeggio_package = "./src/additional_services/arpeggio.star" blockscout_package = "./src/additional_services/blockscout.star" blutgang_package = "./src/additional_services/blutgang.star" grafana_package = "./src/additional_services/grafana.star" @@ -153,7 +154,9 @@ def run( # TODO: cdk-erigon pless node for index, additional_service in enumerate(additional_services): - if additional_service == "blockscout": + if additional_service == "arpeggio": + deploy_additional_service(plan, "arpeggio", arpeggio_package, args) + elif additional_service == "blockscout": deploy_additional_service(plan, "blockscout", blockscout_package, args) elif additional_service == "blutgang": deploy_additional_service(plan, "blutgang", blutgang_package, args) diff --git a/params.yml b/params.yml index 8878e10a..9948de95 100644 --- a/params.yml +++ b/params.yml @@ -47,6 +47,7 @@ args: # Additional services to run alongside the network. # Options: + # - arpeggio # - blockscout # - blutgang # - pless_zkevm_node diff --git a/src/additional_services/arpeggio.star b/src/additional_services/arpeggio.star new file mode 100644 index 00000000..ed544bdb --- /dev/null +++ b/src/additional_services/arpeggio.star @@ -0,0 +1,42 @@ +service_package = import_module("../../lib/service.star") + +ARPEGGIO_IMAGE = "christophercampbell/arpeggio:v0.0.1" +RPC_PROXY_PORT = 8545 +WS_PROXY_PORT = 8546 +# METRICS_PORT = 9105 + + +def run(plan, args): + arpeggio_config_artifact = get_arpeggio_config(plan, args) + plan.add_service( + name="arpeggio" + args["deployment_suffix"], + config=ServiceConfig( + image=ARPEGGIO_IMAGE, + ports={ + "rpc": PortSpec(RPC_PROXY_PORT, application_protocol="http"), + "ws": PortSpec(WS_PROXY_PORT, application_protocol="ws"), + # "prometheus": PortSpec(METRICS_PORT, application_protocol="http"), + }, + files={"/etc/arpeggio": arpeggio_config_artifact}, + ), + ) + + +def get_arpeggio_config(plan, args): + arpeggio_config_template = read_file( + src="../../static_files/additional_services/arpeggio-config/config.yml" + ) + l2_rpc_urls = service_package.get_l2_rpc_urls(plan, args) + return plan.render_templates( + name="arpeggio-config", + config={ + "config.yml": struct( + template=arpeggio_config_template, + data={ + "l2_rpc_name": args["l2_rpc_name"], + "l2_rpc_url": l2_rpc_urls.http, + "l2_ws_url": l2_rpc_urls.ws, + }, + ) + }, + ) diff --git a/static_files/additional_services/arpeggio-config/config.yml b/static_files/additional_services/arpeggio-config/config.yml new file mode 100644 index 00000000..ce3f004d --- /dev/null +++ b/static_files/additional_services/arpeggio-config/config.yml @@ -0,0 +1,24 @@ +--- +logging: + level: info + +providers: + chainId: 1 + nodes: + - name: "{{.l2_rpc_name}}" + rpc: "{{.l2_rpc_url}}" + ws: "{{.l2_ws_url}}" + +proxy: + poolSize: + http: 1000 + ws: 2000 + + rateLimit: + active: false + + metrics: + active: true + http: + host: localhost + port: 9105