Skip to content

Commit

Permalink
versions stabilized& ci added
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Mar 20, 2024
1 parent 3e2efe4 commit 1856643
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 9 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,35 @@ on:
merge_group:
pull_request:
jobs:
check:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
- run: scarb fmt --check

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
- run: scarb test

verify-layout:
strategy:
matrix:
layout: ["dex", "recursive", "recursive_with_poseidon", "small", "starknet"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- uses: software-mansion/setup-scarb@v1
- run: python configure.py -l {${{ matrix.layout }}} -s keccak
- run: scarb build
- run: cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json < examples/proofs/{${{ matrix.layout }}}/example_proof.json
10 changes: 5 additions & 5 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from pathlib import Path
from utils import process_file

LAYOUT_TYPES = ("DEX", "RECURSIVE", "RECURSIVE_WITH_POSEIDON", "SMALL", "STARKNET")
HASH_TYPES = ("KECCAK", "BLAKE")
LAYOUT_TYPES = ("dex", "recursive", "recursive_with_poseidon", "small", "starknet")
HASH_TYPES = ("keccak", "blake")


def select_types() -> str:
Expand All @@ -23,18 +23,18 @@ def main(layout_type=None, hash_type=None):
if layout_type is None or hash_type is None:
layout_type, hash_type = select_types()

if layout_type.upper() not in LAYOUT_TYPES:
if layout_type.lower() not in LAYOUT_TYPES:
print(f"Invalid layout type: {layout_type}")
sys.exit(1)

if hash_type.upper() not in HASH_TYPES:
if hash_type.lower() not in HASH_TYPES:
print(f"Invalid hash type: {hash_type}")
sys.exit(1)

current_directory = Path("src")
for file_path in current_directory.rglob("*.cairo"):
if file_path.is_file():
process_file(file_path, [layout_type, hash_type])
process_file(file_path, [layout_type.upper(), hash_type.upper()])


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
colorama==0.4.6
inquirer==3.2.4
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
profile = "minimal"
6 changes: 3 additions & 3 deletions test_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ def log_and_run(commands, description, cwd=None):


# List of layouts to test
LAYOUTS = ["DEX", "RECURSIVE", "RECURSIVE_WITH_POSEIDON", "SMALL"]
LAYOUTS = ["dex", "recursive", "recursive_with_poseidon", "small"]


# Main function to run the tests and optionally restore the src folder
def main(restore_src=None):
for layout in LAYOUTS:
log_and_run(
[
f"python configure.py -l {layout} -s KECCAK",
f"python configure.py -l {layout} -s keccak",
"scarb build",
f"cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json < examples/proofs/{layout.lower()}/example_proof.json",
f"cargo run --release --bin runner -- target/dev/cairo_verifier.sierra.json < examples/proofs/{layout}/example_proof.json",
],
f"Testing {layout.lower()} layout",
cwd=".",
Expand Down

0 comments on commit 1856643

Please sign in to comment.