Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add test matrix #245

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/tests/additional_services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
args:
additional_services:
- blockscout
- blutgang
- pless_zkevm_node
- prometheus_grafana
- tx_spammer
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
args:
sequencer_type: erigon
sequence_sender_aggregator_type: new-zkevm
data_availability_mode: cdk-validium
zkevm_rollup_fork_id: 9
additional_services:
- pless_zkevm_node
- tx_spammer
2 changes: 2 additions & 0 deletions .github/tests/gas_token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
args:
zkevm_use_gas_token_contract: true
236 changes: 163 additions & 73 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,139 @@ env:
ENCLAVE_NAME: cdk

jobs:
cdk:
# List all .yml files in the .github/tests directory.
list-ymls:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "matrix=$(ls ./.github/tests/*.yml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT

run-without-args:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Run Starlark
run: |
kurtosis run \
--enclave=${{ env.ENCLAVE_NAME }} \
--show-enclave-inspect=false \
${{ github.workspace }}

- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}

- name: List databases
run: |
postgres_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres_port" --username master_user --dbname master --list

- name: Monitor verified batches (Central 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-with-args:
needs: list-ymls
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
file_name: ${{ fromJson(needs.list-ymls.outputs.matrix) }}

steps:
- uses: actions/checkout@v4

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- name: Run Starlark
run: |
kurtosis run \
--enclave=${{ env.ENCLAVE_NAME }} \
--args-file=${{ matrix.file_name }} \
--show-enclave-inspect=false \
${{ github.workspace }}

- name: Inspect enclave
run: kurtosis enclave inspect ${{ env.ENCLAVE_NAME }}

- name: Monitor verified batches (Central RPC)
run: |
sequencer_type=$(yq --raw-output '.args.sequencer_type' ${{ matrix.file_name }})
rpc_name=""
if [[ "$sequencer_type" == "erigon" ]]; then
rpc_name="cdk-erigon-node-001"
elif [[ "$sequencer_type" == "zkevm" ]]; then
rpc_name="zkevm-node-rpc-001"
elif [[ "$sequencer_type" == "null" ]]; then
rpc_name="cdk-erigon-node-001"
else
echo "Unknown sequencer type: $sequencer_type"
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)

- 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)
else
echo "Skipping batch verification as there is no zkevm permissionless RPC in the environment"
fi

- name: Verify Blutgang RPC
run: |
if [ "${{ matrix.file_name }}" == "./.github/tests/additional-services.yml" ]; then
result=$(yq --raw-output '.args.additional_services | contains(["blutgang"])' ${{ matrix.file_name }})
if [[ "$result" == "true" ]]; then
cast bn --rpc-url $(kurtosis port print ${{ env.ENCLAVE_NAME }} blutgang-001 http)
else
echo "Blutgang RPC should be deployed"
exit 1
fi
else
echo "Skipping the verification of blutgang RPC"
fi

- name: Verify Prometheus collects Panoptichain metrics
run: |
if [ "${{ matrix.file_name }}" == "./.github/tests/additional-services.yml" ]; then
result=$(yq --raw-output '.args.additional_services // [] | contains(["prometheus_grafana"])' ${{ matrix.file_name }})
if [[ "$result" == "true" ]]; then
echo "Waiting for one minute while Prometheus gathers metrics..."
sleep 60

echo "Retrieving Panoptichain metrics from Prometheus..."
panoptichain_metric="panoptichain_system_uptime"
prometheus_url=$(kurtosis port print ${{ env.ENCLAVE_NAME }} prometheus-001 http)
prometheus_query=$(curl "$prometheus_url/api/v1/query?query=$panoptichain_metric")
echo $prometheus_query | jq
if [ "$(jq -r '.data.result[0].metric.__name__' <<<$prometheus_query)" == "$panoptichain_metric" ]; then
echo "Prometheus collected panoptichain metrics!"
else
echo "Prometheus did not collect any panoptichain metrics..."
exit 1
fi
else
echo "Prometheus and Grafana should be deployed"
exit 1
fi
else
echo "Skipping the verification of Prometheus metrics"
fi

zkevm:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
Expand All @@ -25,62 +157,62 @@ jobs:
- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy the CDK environment with cdk-erigon, serving as the sequencer.
# Set up the cdk-node for the remaining components.
# Additionally, deploy cdk-erigon and zkevm-node as permissionless nodes or RPCs.
- name: Deploy L1 chain and a first CDK L2 chain (erigon)
# Deploy the CDK environment with zkevm-node, serving as the sequencer.
# Also set up the zkevm-node for the remaining components.
# Additionally, deploy zkevm-node as permissionless node or RPC.
- name: Deploy L1 chain and a first CDK L2 chain (zkevm)
run: |
yq -Y --in-place '.deploy_cdk_erigon_node = false' params.yml
yq -Y --in-place '.args.sequencer_type = "zkevm"' params.yml
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "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: List first CDK L2 chain databases (erigon)

- name: List first CDK L2 chain databases (zkevm)
run: |
postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres1_port" --username master_user --dbname master --list

- name: Attach a second CDK L2 chain (erigon)
run: |
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' agglayer-attach-cdk-params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=agglayer-attach-cdk-params.yml .

- 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)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres2_port" --username master_user --dbname master --list

- name: Update the agglayer config
run: |
# Download the agglayer config file.
kurtosis files download ${{ env.ENCLAVE_NAME }} agglayer-config-artifact
cd agglayer-config-artifact

# Update the config by adding the rpc and proof signer of the second chain.
tomlq -Y --toml-output --in-place '.FullNodeRPCs += {"2": "http://cdk-erigon-node-002:8123"}' agglayer-config.toml
proof_signer_2="$(yq --raw-output .args.zkevm_l2_sequencer_address ../agglayer-attach-cdk-params.yml)"
tomlq -Y --toml-output --arg proofSigner2 "$proof_signer_2" --in-place '.ProofSigners += {"2": $proofSigner2}' agglayer-config.toml

# Replace the agglayer config.
agglayer_container_id="$(docker ps --filter "name=zkevm-agglayer" --format "{{.ID}}")"
docker cp agglayer-config.toml "$agglayer_container_id:/etc/zkevm/agglayer-config.toml"

# Restart the agglayer service.
kurtosis service stop ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
kurtosis service start ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001

- name: Monitor verified batches of the first L2 chain (CDK Erigon Permissionless RPC)
- name: Monitor verified batches of the first L2 chain (zkEVM Node Trusted 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 }} zkevm-node-rpc-001 http-rpc)"

- name: Monitor verified batches of the first L2 chain (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)"

# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.

- 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)"
Expand All @@ -89,34 +221,36 @@ jobs:
working-directory: .github/scripts
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} zkevm-node-rpc-pless-002 http-rpc)"

zkevm:
# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.

attach_cdks:
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

# Deploy the CDK environment with zkevm-node, serving as the sequencer.
# Also set up the zkevm-node for the remaining components.
# Additionally, deploy zkevm-node as permissionless node or RPC.
- name: Deploy L1 chain and a first CDK L2 chain (zkevm)
# Deploy the CDK environment with cdk-erigon, serving as the sequencer.
# Set up the cdk-node for the remaining components.
# Additionally, deploy cdk-erigon and zkevm-node as permissionless nodes or RPCs.
- name: Deploy L1 chain and a first CDK L2 chain (new stack)
run: |
yq -Y --in-place '.deploy_cdk_erigon_node = false' params.yml
yq -Y --in-place '.args.sequencer_type = "zkevm"' params.yml
yq -Y --in-place '.args.sequencer_type = "erigon"' params.yml
yq -Y --in-place '.args.sequence_sender_aggregator_type = "cdk"' params.yml
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "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: List first CDK L2 chain databases (zkevm)
- name: List first CDK L2 chain databases (erigon)
run: |
postgres1_port=$(kurtosis port print ${{ env.ENCLAVE_NAME }} postgres-001 postgres | cut -d':' -f3)
PGPASSWORD=master_password psql --host 127.0.0.1 --port "$postgres1_port" --username master_user --dbname master --list

- name: Attach a second CDK L2 chain (erigon)
- name: Attach a second CDK L2 chain (new stack)
run: |
yq -Y --in-place '.args.additional_services = ["pless_zkevm_node", "tx_spammer"]' agglayer-attach-cdk-params.yml
kurtosis run --enclave=${{ env.ENCLAVE_NAME }} --show-enclave-inspect=false --args-file=agglayer-attach-cdk-params.yml .
Expand Down Expand Up @@ -148,62 +282,18 @@ jobs:
kurtosis service stop ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001
kurtosis service start ${{ env.ENCLAVE_NAME }} zkevm-agglayer-001

- name: Monitor verified batches of the first L2 chain (zkEVM Node Trusted RPC)
- 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 }} zkevm-node-rpc-001 http-rpc)"
run: ./monitor-verified-batches.sh --rpc-url "$(kurtosis port print ${{ env.ENCLAVE_NAME }} cdk-erigon-node-001 http-rpc)"

- name: Monitor verified batches of the first L2 chain (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)"

# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.

- 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)"

- name: Monitor verified batches of the second L2 chain (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-002 http-rpc)"

# TODO(nit): Deploy a CDK Erigon Permissionless RPC and check that it can sync.

additional_services:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- name: Install Kurtosis CDK tools
uses: ./.github/actions/setup-kurtosis-cdk

- 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
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 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..."
sleep 60

echo "Retrieve Panoptichain metrics from Prometheus..."
panoptichain_metric="panoptichain_system_uptime"
prometheus_url=$(kurtosis port print ${{ env.ENCLAVE_NAME }} prometheus-001 http)
prometheus_query=$(curl "$prometheus_url/api/v1/query?query=$panoptichain_metric")
echo $prometheus_query | jq
if [ "$(jq -r '.data.result[0].metric.__name__' <<<$prometheus_query)" == "$panoptichain_metric" ]; then
echo "✅ Prometheus collects panoptichain metrics!"
else
echo "❌ Prometheus does not collect panoptichain metrics..."
exit 1
fi
3 changes: 2 additions & 1 deletion input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ DEFAULT_ARGS = {


def parse_args(args):
args = DEFAULT_ARGS | args
validate_global_log_level(args["global_log_level"])
return DEFAULT_ARGS | args
return args


def validate_global_log_level(global_log_level):
Expand Down
Loading