-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing: Allow proving of blocks in CI (#322)
Problem: Currently there is no way to run the prove_block command against several blocks in the CI. Solution: Implement a way to start pathfinder and prove blocks.
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Sepolia integration tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
|
||
- name: "Install Rust" | ||
uses: "actions-rs/toolchain@v1" | ||
with: | ||
toolchain: "stable" | ||
|
||
- name: "Cache cargo" | ||
id: cache-cargo | ||
uses: "actions/cache@v4" | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
save-always: true | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Create and activate Python virtual environment | ||
run: | | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
- name: Setup the tests | ||
run: | | ||
source venv/bin/activate | ||
pip install cairo-lang==0.13.1 "sympy<1.13.0" | ||
bash scripts/setup-tests.sh | ||
- name: Prove Blocks | ||
run: bash scripts/prove-blocks.sh -p ${{ secrets.PATHFINDER_RPC_URL }} -b 76793,76766,76775 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Function to show usage | ||
usage() { | ||
echo "Usage: $0 -p <rpc-provider> -b <block-number1,block-number2,...>" | ||
exit 1 | ||
} | ||
|
||
# Parse command-line options | ||
while getopts "p:b:" opt; do | ||
case ${opt} in | ||
p ) | ||
PROVIDER=$OPTARG | ||
;; | ||
b ) | ||
IFS=',' read -r -a BLOCK_NUMBERS <<< "$OPTARG" | ||
;; | ||
* ) | ||
usage | ||
;; | ||
esac done | ||
|
||
# Check if both provider and block numbers are provided | ||
if [ -z "$PROVIDER" ] || [ -z "$BLOCK_NUMBERS" ]; then | ||
usage | ||
fi | ||
|
||
# Loop through each block number and execute the cargo command | ||
for BLOCK_NUMBER in "${BLOCK_NUMBERS[@]}"; do | ||
echo "Executing for block number: $BLOCK_NUMBER" | ||
cargo run -p prove_block --release -- --block-number "$BLOCK_NUMBER" --rpc-provider "$PROVIDER" | ||
|
||
# Check if the cargo command failed | ||
if [ $? -ne 0 ]; then | ||
echo "Command failed for block number: $BLOCK_NUMBER. Exiting." | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "All blocks proven successfully." |