diff --git a/.github/workflows/cairo-ci.yaml b/.github/workflows/cairo-ci.yaml index 0869d3a7..853ae501 100644 --- a/.github/workflows/cairo-ci.yaml +++ b/.github/workflows/cairo-ci.yaml @@ -37,15 +37,14 @@ jobs: working-directory: ./stwo_cairo_prover steps: - uses: actions/checkout@v3 - with: - lfs: false + - run: ./scripts/fetch_large_files.sh - uses: dtolnay/rust-toolchain@master with: components: rustfmt profile: minimal toolchain: nightly-2024-12-16 - uses: Swatinem/rust-cache@v2 - - run: cargo +nightly-2024-12-16 test --release + - run: cargo +nightly-2024-12-16 test --release --features slow-tests format: runs-on: ubuntu-latest diff --git a/README.md b/README.md index cc5ab447..73e06b77 100644 --- a/README.md +++ b/README.md @@ -1,11 +1 @@ # stwo-cairo-air - -This repo is using Git LFS -``` -https://packagecloud.io/github/git-lfs/install -sudo apt-get update -sudo apt-get install git-lfs -git lfs install -git lfs fetch --all -git lfs pull -``` diff --git a/stwo_cairo_prover/.gitignore b/stwo_cairo_prover/.gitignore index ea8c4bf7..eaa5f8a1 100644 --- a/stwo_cairo_prover/.gitignore +++ b/stwo_cairo_prover/.gitignore @@ -1 +1,2 @@ /target +/crates/prover/test_data diff --git a/stwo_cairo_prover/crates/prover/Cargo.toml b/stwo_cairo_prover/crates/prover/Cargo.toml index 5f5b9e00..66565a6d 100644 --- a/stwo_cairo_prover/crates/prover/Cargo.toml +++ b/stwo_cairo_prover/crates/prover/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [features] parallel = ["rayon"] +slow-tests = [] [dependencies] air_structs_derive = { path = "../air_structs_derive" } diff --git a/stwo_cairo_prover/crates/prover/src/input/README.md b/stwo_cairo_prover/crates/prover/src/input/README.md new file mode 100644 index 00000000..c314ef59 --- /dev/null +++ b/stwo_cairo_prover/crates/prover/src/input/README.md @@ -0,0 +1,31 @@ +# Slow Tests Using Google Cloud Storage + +[Google Cloud Storage Browser](https://console.cloud.google.com/storage/browser/stwo-cairo-testing-artifacts?project=starkware-thirdparties) + +## How to Test + +1. **Download Tests Files** + ```bash + ./scripts/fetch_large_files.sh + ``` + +2. **Execute Tests** + ```bash + cargo test test_read_from_large_files --features "slow-tests" + cargo test test_read_from_small_file --features "slow-tests" + ``` + +## Adding a New "Slow-Test" + +1. **Create a Directory** + Create a new directory at the Google Cloud Storage URL above and add the required files. + +2. **Mark the Test** + Mark the new test with `#[cfg(feature = "slow-tests")]`. + +3. **Run Tests Locally** + Run the test locally using: + ```bash + cargo test "" --features "slow-tests" + + diff --git a/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs b/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs index c7f28f3e..756081aa 100644 --- a/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs +++ b/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs @@ -127,14 +127,13 @@ impl Iterator for MemEntryIter<'_, R> { #[cfg(test)] pub mod tests { - use std::path::PathBuf; use super::*; pub fn large_cairo_input() -> CairoInput { let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - d.push("test_data/large_cairo_input"); + d.push("test_data/test_read_from_large_files"); import_from_vm_output( d.join("pub.json").as_path(), @@ -143,13 +142,13 @@ pub mod tests { ) .expect( " - Failed to read test files. Maybe git-lfs is not installed? Checkout README.md.", + Failed to read test files. Checkout input/README.md.", ) } pub fn small_cairo_input() -> CairoInput { let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - d.push("test_data/small_cairo_input"); + d.push("test_data/test_read_from_small_files"); import_from_vm_output( d.join("pub.json").as_path(), d.join("priv.json").as_path(), @@ -157,13 +156,13 @@ pub mod tests { ) .expect( " - Failed to read test files. Maybe git-lfs is not installed? Checkout README.md.", + Failed to read test files. Checkout input/README.md.", ) } // TODO (Stav): Once all the components are in, verify the proof to ensure the sort was correct. - #[ignore] #[test] + #[cfg(feature = "slow-tests")] fn test_read_from_large_files() { let input = large_cairo_input(); let components = input.state_transitions.casm_states_by_opcode; @@ -228,7 +227,8 @@ pub mod tests { assert_eq!(components.ret_opcode.len(), 49472); } - #[ignore] + // TODO (Stav): Once all the components are in, verify the proof to ensure the sort was correct. + #[cfg(feature = "slow-tests")] #[test] fn test_read_from_small_files() { let input = small_cairo_input(); diff --git a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/fact.json b/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/fact.json deleted file mode 100644 index d1bcae2f..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/fact.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b5d5f82af5dcee0c8ca35e78d0736bb7853983ae419be77a73612812a42dc179 -size 72 diff --git a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/mem b/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/mem deleted file mode 100644 index 662b422a..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/mem +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a44a8436ae665b4a036fdec303c08d0c62b75d6ba7d029c8d0cea921746b676 -size 90049080 diff --git a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/priv.json b/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/priv.json deleted file mode 100644 index 1605de16..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/priv.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:446250961d452ccccd9bab08cd2400fd26c76ce4a9e8fae7618ecc14922f559a -size 29278724 diff --git a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/pub.json b/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/pub.json deleted file mode 100644 index b632c7cf..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/pub.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a59ecb57bb03f1382a37184be61b6eafeddb3c683c35ac4505c02f2b896d9ca -size 57085 diff --git a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/trace b/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/trace deleted file mode 100644 index b3ce597a..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/large_cairo_input/trace +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6330415e78b9b0d98bea3ad1b22a5311eeba8fd596bfd08467ccec358ca27a44 -size 805306368 diff --git a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/mem b/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/mem deleted file mode 100644 index 52e3f6bf..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/mem +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:540fc38ccb798424419f13e654a01d569ebba3c1dd9f67d2389d14d8a2340409 -size 258680 diff --git a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/priv.json b/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/priv.json deleted file mode 100644 index 2eff1d32..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/priv.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d60ee898ac4bea17b765fe4b74844dc715a63d502cd6dbb4a92c5bf84a44e31d -size 79307 diff --git a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/pub.json b/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/pub.json deleted file mode 100644 index 2897ba35..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/pub.json +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9d90bd39b52f0cb34f9577bb94371b4e60fe935ab940a838671977f290f6837b -size 62350 diff --git a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/trace b/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/trace deleted file mode 100644 index d263d0fc..00000000 --- a/stwo_cairo_prover/crates/prover/test_data/small_cairo_input/trace +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:30915e090603755f907402c30c604da14d2122a138fa427a9d33f061df69710c -size 3145728 diff --git a/stwo_cairo_prover/scripts/fetch_large_files.sh b/stwo_cairo_prover/scripts/fetch_large_files.sh new file mode 100755 index 00000000..e81a9848 --- /dev/null +++ b/stwo_cairo_prover/scripts/fetch_large_files.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +BUCKET_URL="https://storage.googleapis.com/stwo-cairo-testing-artifacts" +DEST_DIR="crates/prover/test_data" + +# Create the destination directory +mkdir -p "${DEST_DIR}" + +curl -s "${BUCKET_URL}" | grep -oP '(?<=).*?(?=)' | while read -r FILE; do + echo "Downloading ${FILE}..." + + # Create the necessary directories + mkdir -p "${DEST_DIR}/$(dirname "${FILE}")" + + # Download the file + curl -Lo "${DEST_DIR}/${FILE}" "${BUCKET_URL}/${FILE}" || { + echo "Failed to download ${FILE}" >&2 + } +done