diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4df574e7..00500b8ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/configure.py b/configure.py index 934c96748..86371dc9f 100644 --- a/configure.py +++ b/configure.py @@ -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: @@ -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__": diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..6ad893532 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +colorama==0.4.6 +inquirer==3.2.4 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..457524456 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "stable" +profile = "minimal" \ No newline at end of file diff --git a/test_layouts.py b/test_layouts.py index 95d67d9fd..bcb7ceb8f 100644 --- a/test_layouts.py +++ b/test_layouts.py @@ -24,7 +24,7 @@ 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 @@ -32,9 +32,9 @@ 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=".",