Skip to content

Commit

Permalink
Merge pull request #289 from 0xPolygon/jhilliard/process-manager
Browse files Browse the repository at this point in the history
Wrapper Process for Erigon
  • Loading branch information
praetoriansentry authored Sep 27, 2024
2 parents a104232 + 6db2de2 commit df5eb26
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 155 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Monitor verified batches (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)
run: ./monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 rpc)

list-ymls:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -95,13 +95,13 @@ jobs:
exit 1
fi
echo "RPC name: $rpc_name"
./.github/scripts/monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} $rpc_name http-rpc)
./.github/scripts/monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} $rpc_name rpc)
- name: Monitor verified batches (zkEVM Permissionless RPC)
run: |
result=$(yq --raw-output '.args.additional_services // [] | contains(["pless_zkevm_node"])' ${{ matrix.file_name }})
if [[ "$result" == "true" ]]; then
./.github/scripts/monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)
./.github/scripts/monitor-verified-batches.sh --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 rpc)
else
echo "Skipping batch verification as there is no zkevm permissionless RPC in the environment"
fi
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:

# zkevm-node doesn't work with fork12.
#- name: Verify permissionless zkevm-node rpc
# run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)
# run: cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 rpc)

- name: Verify that Prometheus collects Panoptichain metrics
run: |
Expand Down Expand Up @@ -184,8 +184,8 @@ jobs:
- name: Monitor verified batches of the first L2 chain (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 rpc)"

- name: Monitor verified batches of the second L2 chain (CDK Erigon Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-002 http-rpc)"
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-002 rpc)"
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Monitor verified batches (zkEVM Node Permissionless RPC)
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 http-rpc)"
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-001 rpc)"

# Deploy the CDK environment against a local l1 chain with pre-deployed zkevm contracts.
# TODO: Fix this job.
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

# - name: Monitor verified batches (CDK Erigon Permissionless RPC)
# working-directory: .github/scripts
# run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"
# run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 rpc)"

# Deploy the CDK environment incrementally, stage by stage.
# TODO: Fix this job.
Expand Down Expand Up @@ -175,4 +175,4 @@ jobs:

# - name: Monitor verified batches (CDK Erigon Permissionless RPC)
# working-directory: .github/scripts
# run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"
# run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 rpc)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ kurtosis enclave inspect cdk-v1
That output, while quite useful, might also be a little overwhelming. Let's store the RPC URL in an environment variable. Note that you may need to adjust the various commands slightly if you deployed the legacy [zkevm-node](https://github.com/0xPolygonHermez/zkevm-node) as the sequencer. You should target the `zkevm-node-rpc-001` service instead of `cdk-erigon-node-001`.

```bash
export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-node-001 http-rpc)"
export ETH_RPC_URL="$(kurtosis port print cdk-v1 cdk-erigon-node-001 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.
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ runs:
- name: Perform load test
shell: bash
run: |
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 http-rpc)"
export ETH_RPC_URL="$(kurtosis port print cdk-v1 zkevm-node-rpc-001 rpc)"
export PK="$(yq .args.zkevm_l2_admin_private_key params.yml)"
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 5 --mode t
polycli loadtest --rpc-url "$ETH_RPC_URL" --legacy --private-key "$PK" --verbosity 700 --requests 500 --rate-limit 10 --mode t
Expand Down
2 changes: 1 addition & 1 deletion cdk_bridge_infra.star
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def create_reverse_proxy_config_artifact(plan, args):
"l1rpc_ip": l1rpc_service.ip_address,
"l1rpc_port": l1rpc_service.ports["rpc"].number,
"l2rpc_ip": l2rpc_service.ip_address,
"l2rpc_port": l2rpc_service.ports["http-rpc"].number,
"l2rpc_port": l2rpc_service.ports["rpc"].number,
"bridgeservice_ip": bridge_service.ip_address,
"bridgeservice_port": bridge_service.ports["rpc"].number,
"bridgeui_ip": bridgeui_service.ip_address,
Expand Down
2 changes: 1 addition & 1 deletion input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DEFAULT_ARGS = {
"cdk_node_image": "ghcr.io/0xpolygon/cdk:0.1.1",
"zkevm_da_image": "0xpolygon/cdk-data-availability:0.0.10",
"agglayer_image": "ghcr.io/agglayer/agglayer-rs:pr-96",
"zkevm_bridge_service_image": "hermeznetwork/zkevm-bridge-service:v0.5.0",
"zkevm_bridge_service_image": "hermeznetwork/zkevm-bridge-service:v0.6.0-RC1",
"zkevm_bridge_ui_image": "leovct/zkevm-bridge-ui:multi-network",
"zkevm_bridge_proxy_image": "haproxy:3.0-bookworm",
"zkevm_sequence_sender_image": "hermeznetwork/zkevm-sequence-sender:v0.2.0-RC12",
Expand Down
41 changes: 16 additions & 25 deletions lib/cdk_erigon.star
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,30 @@ def start_node(
application_protocol="http",
wait=None,
)
ports["rpc"] = PortSpec(
args["zkevm_rpc_http_port"],
application_protocol="http",
)

ports["ws-rpc"] = PortSpec(
args["zkevm_rpc_http_port"],
application_protocol="ws",
)

if is_sequencer:
name = args["sequencer_name"] + args["deployment_suffix"]
# TODO these port names seem weird... http-rpc / rpc? I don't
# get it. There seem to be a bunch of weird dependencies on
# both of these existing. It seems likt they should be called
# the same thing and the only difference is if this a
# sequencer or an rpc.. the port itself shouldn't be named
# differently and there certainly shouldn't be dependencies on
# those names
ports["rpc"] = PortSpec(
args["zkevm_rpc_http_port"],
application_protocol="http",
)
else:
name = args["l2_rpc_name"] + args["deployment_suffix"]
ports["http-rpc"] = PortSpec(
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(
args["zkevm_data_streamer_port"], application_protocol="datastream"
)

proc_runner_file_artifact = plan.upload_files(
src="../templates/proc-runner.sh",
# leaving the name out for now. This might cause some idempotency issues, but we're not currently relying on that for now
)
plan.add_service(
name=name,
config=ServiceConfig(
Expand All @@ -72,12 +64,11 @@ def start_node(
cdk_erigon_node_chain_allocs_artifact,
]
),
"/usr/local/share/proc-runner": proc_runner_file_artifact,
},
entrypoint=["sh", "-c"],
# Sleep for 10 seconds in order to wait for datastream server getting ready
# TODO: find a better way instead of waiting
entrypoint=["/usr/local/share/proc-runner/proc-runner.sh"],
cmd=[
"sleep 10 && cdk-erigon --pprof=true --pprof.addr 0.0.0.0 --config /etc/cdk-erigon/config.yaml & tail -f /dev/null"
"cdk-erigon --pprof=true --pprof.addr 0.0.0.0 --config /etc/cdk-erigon/config.yaml"
],
env_vars=envs,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/service.star
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_l2_rpc_urls(plan, args):
return struct(
http="http://{}:{}".format(
l2_rpc_service.ip_address,
l2_rpc_service.ports["http-rpc"].number,
l2_rpc_service.ports["rpc"].number,
),
ws=ws,
)
4 changes: 1 addition & 3 deletions lib/zkevm_node.star
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ def create_rpc_service_config(args, config_artifact, genesis_artifact):
rpc_service_config = _create_node_component_service_config(
image=data_availability_package.get_node_image(args),
ports={
"http-rpc": PortSpec(
args["zkevm_rpc_http_port"], application_protocol="http"
),
"rpc": PortSpec(args["zkevm_rpc_http_port"], application_protocol="http"),
"ws-rpc": PortSpec(args["zkevm_rpc_ws_port"], application_protocol="ws"),
"pprof": PortSpec(args["zkevm_pprof_port"], application_protocol="http"),
"prometheus": PortSpec(
Expand Down
14 changes: 8 additions & 6 deletions params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,26 @@ args:
# - tx_spammer
additional_services: []

# Docker images and repositories used to spin up services.
# This is a transitional image that includes a fix on top of version v8.0.0-rc.2-fork.12.
# https://github.com/0xPolygonHermez/zkevm-contracts/pull/323
# FORK 12 IMAGES
zkevm_contracts_image: leovct/zkevm-contracts:v8.0.0-rc.4-fork.12
#zkevm_contracts_image: leovct/zkevm-contracts:v8.0.0-rc.2-fork.12
zkevm_prover_image: hermeznetwork/zkevm-prover:v8.0.0-RC12-fork.12
cdk_erigon_node_image: hermeznetwork/cdk-erigon:4cf9ba7

# FORK 11 IMAGES
# zkevm_contracts_image: leovct/zkevm-contracts:v7.0.0-rc.2-fork.11
# zkevm_prover_image: hermeznetwork/zkevm-prover:v7.0.2-fork.11
# cdk_erigon_node_image: hermeznetwork/cdk-erigon:v1.2.22

zkevm_node_image: hermeznetwork/zkevm-node:v0.7.3-RC1
cdk_validium_node_image: 0xpolygon/cdk-validium-node:0.7.0-cdk

cdk_node_image: ghcr.io/0xpolygon/cdk:0.1.1
zkevm_da_image: 0xpolygon/cdk-data-availability:0.0.10
agglayer_image: ghcr.io/agglayer/agglayer-rs:pr-96
zkevm_bridge_service_image: hermeznetwork/zkevm-bridge-service:v0.5.0
zkevm_bridge_service_image: hermeznetwork/zkevm-bridge-service:v0.6.0-RC1
zkevm_bridge_ui_image: leovct/zkevm-bridge-ui:multi-network
zkevm_bridge_proxy_image: haproxy:3.0-bookworm
zkevm_sequence_sender_image: hermeznetwork/zkevm-sequence-sender:v0.2.0-RC12
cdk_erigon_node_image: hermeznetwork/cdk-erigon:4cf9ba7
zkevm_pool_manager_image: hermeznetwork/zkevm-pool-manager:v0.1.0

# Port configuration.
Expand Down
2 changes: 1 addition & 1 deletion src/additional_services/blutgang.star
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_blutgang_config(plan, args):
)
zkevm_rpc_pless_http_url = "http://{}:{}".format(
zkevm_rpc_pless_service.ip_address,
zkevm_rpc_pless_service.ports["http-rpc"].number,
zkevm_rpc_pless_service.ports["rpc"].number,
)
zkevm_rpc_pless_ws_url = "ws://{}:{}".format(
zkevm_rpc_pless_service.ip_address,
Expand Down
2 changes: 1 addition & 1 deletion src/additional_services/tx_spammer.star
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_tx_spammer_config(plan, args):
args["l2_rpc_name"] + args["deployment_suffix"]
)
zkevm_rpc_url = "http://{}:{}".format(
zkevm_rpc_service.ip_address, zkevm_rpc_service.ports["http-rpc"].number
zkevm_rpc_service.ip_address, zkevm_rpc_service.ports["rpc"].number
)

zkevm_bridge_service = plan.get_service(
Expand Down
Loading

0 comments on commit df5eb26

Please sign in to comment.