Skip to content

Commit

Permalink
feat: integrate arpeggio (0xPolygon#249)
Browse files Browse the repository at this point in the history
* wip

* add arpeggio to additional services

* doc additions for arpeggio

* fix port spec name

* ws port spec for cdk-erigon-node

* ws port config for cdk-erigon-node

* lint

* add arpeggio health check to deploy workflow
  • Loading branch information
christophercampbell authored Sep 5, 2024
1 parent 0053336 commit dae0801
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 9 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -206,18 +206,21 @@ 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
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}

- 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..."
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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). |
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/cdk_erigon.star
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion lib/service.star
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
5 changes: 4 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ args:

# Additional services to run alongside the network.
# Options:
# - arpeggio
# - blockscout
# - blutgang
# - pless_zkevm_node
Expand Down
42 changes: 42 additions & 0 deletions src/additional_services/arpeggio.star
Original file line number Diff line number Diff line change
@@ -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,
},
)
},
)
24 changes: 24 additions & 0 deletions static_files/additional_services/arpeggio-config/config.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dae0801

Please sign in to comment.