Skip to content

Commit

Permalink
fix: regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Aug 28, 2024
1 parent 8c4309e commit 97addb4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .github/actions/monitor-cdk-verified-batches/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: monitor-cdk-verified-batches
description: Check that batches are being verified in a CDK environment

inputs:
verified_batches_target:
description: The minimum number of batches to be verified
required: false
default: '30'
timeout:
description: The script timeout in seconds
required: false
default: '600' # 10 minutes

runs:
using: "composite"
steps:
- 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 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# This script monitors the verification progress of zkEVM batches.
# Usage: ./batch_verification_monitor <verified_batches_target> <timeout>

# The number of batches to be verified.
verified_batches_target="$1"

# The script timeout (in seconds).
timeout="$2"

start_time=$(date +%s)
end_time=$((start_time + timeout))

rpc_url="$(kurtosis port print cdk-v1 cdk-erigon-node-001 http-rpc)"
while true; do
verified_batches="$(cast to-dec "$(cast rpc --rpc-url "$rpc_url" zkevm_verifiedBatchNumber | sed 's/"//g')")"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Verified Batches: $verified_batches"

current_time=$(date +%s)
if (( current_time > end_time )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ❌ Exiting... Timeout reached!"
exit 1
fi

if (( verified_batches > verified_batches_target )); then
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Exiting... $verified_batches batches were verified!"
exit 0
fi

sleep 10
done
8 changes: 6 additions & 2 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 0xPolygon/kurtosis-cdk
ref: feat/cdk-erigon-zkevm
ref: main
path: kurtosis-cdk

- name: Install Kurtosis CDK tools
Expand All @@ -39,7 +39,11 @@ jobs:
working-directory: ./kurtosis-cdk
run: kurtosis run --enclave cdk-v1 --args-file params.yml --image-download always .

- name: Set executable permissions for the script
working-directory: ./cdk-data-availability
run: sudo chmod +x .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh

- name: Monitor verified batches
working-directory: ./kurtosis-cdk
working-directory: ./cdk-data-availability
shell: bash
run: .github/actions/monitor-cdk-verified-batches/batch_verification_monitor.sh 19 600
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist

test/gethData
test/coverage.out
coverage.out

0 comments on commit 97addb4

Please sign in to comment.