Fix entrypoint offset in test (#1904) #9628
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
name: QA | |
on: | |
merge_group: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ '**' ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
CARGO_TERM_COLOR: always | |
CAIRO_PROGRAMS_PATH: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
!cairo_programs/manually_compiled/* | |
examples/wasm-demo/src/array_sum.json | |
TEST_COLLECT_COVERAGE: 1 | |
PROPTEST_CASES: 100 | |
jobs: | |
# We need to use the same files across all jobs or else hashing will fail | |
upload_proof_programs_symlinks: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create proof_programs symlinks | |
run: make create-proof-programs-symlinks | |
- uses: actions/upload-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/*.cairo | |
build-programs: | |
needs: upload_proof_programs_symlinks | |
strategy: | |
matrix: | |
# NOTE: we build cairo_bench_programs so clippy can check the benchmarks too | |
program-target: [ | |
cairo_bench_programs, | |
cairo_proof_programs, | |
cairo_test_programs, | |
cairo_1_test_contracts, | |
cairo_2_test_contracts, | |
] | |
name: Build Cairo programs | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch from cache | |
uses: actions/cache@v3 | |
id: cache-programs | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
restore-keys: ${{ matrix.program-target }}-cache- | |
# This is not pretty, but we need `make` to see the compiled programs are | |
# actually newer than the sources, otherwise it will try to rebuild them | |
- name: Restore timestamps | |
uses: chetan/git-restore-mtime-action@v1 | |
- name: Python3 Build | |
if: steps.cache-programs.outputs.cache-hit != 'true' | |
&& matrix.program-target != 'cairo_1_test_contracts' | |
&& matrix.program-target != 'cairo_2_test_contracts' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
if: | | |
steps.cache-programs.outputs.cache-hit != 'true' | |
&& matrix.program-target != 'cairo_1_test_contracts' | |
&& matrix.program-target != 'cairo_2_test_contracts' | |
run: pip install -r requirements.txt | |
- name: Install cairo 1 compiler | |
if: steps.cache-programs.outputs.cache-hit != 'true' && matrix.program-target == 'cairo_1_test_contracts' | |
run: make build-cairo-1-compiler | |
- name: Install cairo 2 compiler | |
if: steps.cache-programs.outputs.cache-hit != 'true' && matrix.program-target == 'cairo_2_test_contracts' | |
run: make build-cairo-2-compiler | |
- name: Build programs | |
if: steps.cache-programs.outputs.cache-hit != 'true' | |
run: make -j ${{ matrix.program-target }} | |
# NOTE: used to reduce the amount of cache steps we need in later jobs | |
# TODO: remove this cache once the workflow finishes | |
merge-caches: | |
name: Merge Cairo programs cache | |
runs-on: ubuntu-22.04 | |
needs: build-programs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch test programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_test_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch proof programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_proof_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch bench programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_bench_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch test contracts (Cairo 1) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_1_test_contracts-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch test contracts (Cairo 2) | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_2_test_contracts-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Merge caches | |
uses: actions/cache/save@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
lint: | |
needs: build-programs | |
name: Run Lints | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
with: | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Format | |
run: make check-fmt | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Run clippy | |
run: make clippy | |
# NOTE: the term "smoke test" comes from electronics design: the minimal | |
# expectations anyone has in their device is to not catch fire on boot. | |
smoke: | |
needs: merge-caches | |
name: Make sure all builds work | |
strategy: | |
fail-fast: false | |
matrix: | |
crate: ["vm", "cairo-vm-cli", "cairo1-run"] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-all-features | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
# NOTE: we do this separately because --workspace operates in weird ways | |
- name: Check all features (${{ matrix.crate }}) | |
run: | | |
cd ${{ matrix.crate }} | |
cargo check-all-features | |
cargo check-all-features --workspace --all-targets | |
smoke-workspace: | |
needs: merge-caches | |
name: Make sure all builds work (workspace) | |
strategy: | |
fail-fast: false | |
matrix: | |
chunk: [1, 2, 3, 4, 5, 6] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Install cargo-all-features | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-all-features | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download proof programs symlinks | |
uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Check all features (workspace) | |
run: | | |
cargo check-all-features --n-chunks 6 --chunk ${{ matrix.chunk }} --workspace --all-targets | |
smoke-no-std: | |
needs: merge-caches | |
name: Make sure all builds work (no_std) | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download proof programs symlinks | |
uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Check no-std | |
run: | | |
cd ensure-no_std | |
cargo check --no-default-features | |
cargo check | |
tests: | |
needs: merge-caches | |
strategy: | |
fail-fast: false | |
matrix: | |
special_features: ["", "extensive_hints", "mod_builtin", "cairo-0-secp-hints"] | |
target: [ test#1, test#2, test#3, test#4, test-no_std#1, test-no_std#2, test-no_std#3, test-no_std#4, test-wasm ] | |
name: Run tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
with: | |
components: llvm-tools-preview | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: all-programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Install testing tools | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-nextest@0.9.49,cargo-llvm-cov,wasm-pack | |
- name: Install cairo 1 dependencies for running programs | |
run: | | |
cd cairo1-run | |
make deps | |
- name: Run ${{ matrix.target }} | |
run: | | |
# this splits the `test#1` into `test` and `1` | |
export MATRIX_TARGET=${{ matrix.target }} | |
export NAME=${MATRIX_TARGET%#*} | |
export PARTITION=${MATRIX_TARGET#*#} | |
# FIXME: we need to update the Makefile to do this correctly | |
case ${NAME} in | |
'test') | |
cargo llvm-cov nextest --lcov --output-path lcov-${{ matrix.target }}-${{ matrix.special_features }}.info \ | |
--partition count:${PARTITION}/4 \ | |
--workspace --features "cairo-1-hints, test_utils, ${{ matrix.special_features }}" | |
;; | |
'test-no_std') | |
cargo llvm-cov nextest --lcov --output-path lcov-${{ matrix.target }}-${{ matrix.special_features }}.info \ | |
--partition count:${PARTITION}/4 \ | |
--workspace --no-default-features --features "${{ matrix.special_features }}" | |
;; | |
'test-wasm') | |
# NOTE: release mode is needed to avoid "too many locals" error | |
wasm-pack test --release --node vm --no-default-features --features "${{ matrix.special_features }}" | |
;; | |
esac | |
- name: Save coverage | |
if: matrix.target != 'test-wasm' | |
uses: actions/cache/save@v3 | |
with: | |
path: lcov-${{ matrix.target }}-${{ matrix.special_features }}.info | |
key: codecov-cache-${{ matrix.target }}-${{ matrix.special_features }}-${{ github.sha }} | |
build-release: | |
name: Build release binary for comparisons | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.81.0 | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
run: cargo b --release -p cairo-vm-cli | |
# We don't read from cache because it should always miss | |
- name: Store in cache | |
uses: actions/cache/save@v3 | |
with: | |
key: cli-bin-rel-${{ github.sha }} | |
path: target/release/cairo-vm-cli | |
run-cairo-reference: | |
strategy: | |
matrix: | |
include: | |
- program-target: cairo_proof_programs | |
trace-target: cairo_proof_trace | |
nprocs: 1 | |
- program-target: cairo_test_programs | |
trace-target: cairo_trace | |
nprocs: 2 | |
name: Compute memory and execution traces with cairo-lang | |
needs: build-programs | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Check cache | |
uses: actions/cache@v3 | |
id: trace-cache | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
restore-keys: ${{ matrix.program-target }}-reference-trace-cache- | |
- name: Python3 Build | |
if: steps.trace-cache.outputs.cache-hit != 'true' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
if: steps.trace-cache.outputs.cache-hit != 'true' | |
run: pip install -r requirements.txt | |
- name: Fetch programs | |
if: steps.trace-cache.outputs.cache-hit != 'true' | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
# This is not pretty, but we need `make` to see the compiled programs are | |
# actually newer than the sources, otherwise it will try to rebuild them | |
- name: Restore timestamps | |
if: steps.trace-cache.outputs.cache-hit != 'true' | |
uses: chetan/git-restore-mtime-action@v1 | |
- name: Generate traces | |
if: steps.trace-cache.outputs.cache-hit != 'true' | |
run: make -j ${{ matrix.nprocs }} ${{ matrix.trace-target }} | |
run-cairo-release: | |
strategy: | |
matrix: | |
include: | |
- program-target: cairo_proof_programs | |
programs-dir: cairo_programs/proof_programs | |
extra-args: '--proof_mode --air_public_input {program}.rs.air_public_input --air_private_input {program}.rs.air_private_input ' | |
- program-target: cairo_test_programs | |
programs-dir: cairo_programs | |
extra-args: '--cairo_pie_output {program}.rs.pie.zip' | |
name: Compute memory and execution traces with cairo-vm | |
needs: [ build-programs, build-release ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch release binary | |
uses: actions/cache/restore@v3 | |
with: | |
key: cli-bin-rel-${{ github.sha }} | |
path: target/release/cairo-vm-cli | |
fail-on-cache-miss: true | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Generate traces | |
run: | | |
ls ${{ matrix.programs-dir }}/*.json | cut -f1 -d'.' | \ | |
xargs -P 2 -I '{program}' \ | |
./target/release/cairo-vm-cli '{program}'.json --layout starknet_with_keccak \ | |
--memory_file '{program}'.rs.memory --trace_file '{program}'.rs.trace \ | |
${{ matrix.extra-args }} | |
- name: Update cache | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: ${{ matrix.program-target }}-release-trace-cache-${{ github.sha }} | |
upload-coverage: | |
name: Upload coverage results to codecov.io | |
needs: tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch results for tests with stdlib (part. 1) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#1-.info | |
key: codecov-cache-test#1--${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (part. 2) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#2-.info | |
key: codecov-cache-test#2--${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (part. 3) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#3-.info | |
key: codecov-cache-test#3--${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (part. 4) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#4-.info | |
key: codecov-cache-test#4--${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests without stdlib | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test-no_std-.info | |
key: codecov-cache-test-no_std--${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/extensive_hints; part. 1) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#1-extensive_hints.info | |
key: codecov-cache-test#1-extensive_hints-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/extensive_hints; part. 2) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#2-extensive_hints.info | |
key: codecov-cache-test#2-extensive_hints-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/extensive_hints; part. 3) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#3-extensive_hints.info | |
key: codecov-cache-test#3-extensive_hints-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/extensive_hints; part. 4) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#4-extensive_hints.info | |
key: codecov-cache-test#4-extensive_hints-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests without stdlib (w/extensive_hints) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-no_std-extensive_hints.info | |
key: codecov-cache-test-no_std-extensive_hints-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/mod_builtin; part. 1) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#1-mod_builtin.info | |
key: codecov-cache-test#1-mod_builtin-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/mod_builtin; part. 2) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#2-mod_builtin.info | |
key: codecov-cache-test#2-mod_builtin-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/mod_builtin; part. 3) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#3-mod_builtin.info | |
key: codecov-cache-test#3-mod_builtin-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests with stdlib (w/mod_builtin; part. 4) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test#4-mod_builtin.info | |
key: codecov-cache-test#4-mod_builtin-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Fetch results for tests without stdlib (w/mod_builtin) | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-no_std-mod_builtin.info | |
key: codecov-cache-test-no_std-mod_builtin-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: '*.info' | |
fail_ci_if_error: true | |
compare-memory-and-trace: | |
strategy: | |
matrix: | |
program-target: [ cairo_proof_programs, cairo_test_programs ] | |
name: Compare memory and execution traces from cairo-lang and cairo-vm | |
needs: [ run-cairo-reference, run-cairo-release ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch traces for cairo-lang | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch traces for cairo-vm | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: ${{ matrix.program-target }}-release-trace-cache-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run comparison script | |
run: | | |
if [ ${{ matrix.program-target }} = cairo_proof_programs ]; then | |
PROOF=proof_mode | |
AIR_PUBLIC_INPUT=air_public_input | |
AIR_PRIVATE_INPUT=air_private_input | |
else | |
PIE=pie | |
fi | |
./vm/src/tests/compare_vm_state.sh trace memory $PROOF $AIR_PUBLIC_INPUT $AIR_PRIVATE_INPUT $PIE | |
wasm-demo: | |
name: Build the wasm demo | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Python3 Build | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
run: | | |
pip install -r requirements.txt | |
npm install -g wasm-pack | |
- name: Build wasm-demo | |
run: | | |
cairo-compile cairo_programs/array_sum.cairo --no_debug_info --output cairo_programs/array_sum.json | |
cd examples/wasm-demo | |
wasm-pack build --target=web | |
compare-factorial-outputs-all-layouts: | |
name: Compare factorial outputs for all layouts | |
needs: [ build-programs, build-release ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Python3 Build | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
run: pip install -r requirements.txt | |
- name: Fetch release binary | |
uses: actions/cache/restore@v3 | |
with: | |
key: cli-bin-rel-${{ github.sha }} | |
path: target/release/cairo-vm-cli | |
fail-on-cache-miss: true | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_proof_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Run script | |
run: ./vm/src/tests/compare_factorial_outputs_all_layouts.sh | |
compare-outputs-dynamic-layouts: | |
name: Compare outputs with dynamic layouts | |
needs: [ build-programs, build-release, run-cairo-release ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Python3 Build | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
run: pip install -r requirements.txt | |
- name: Fetch release binary | |
uses: actions/cache/restore@v3 | |
with: | |
key: cli-bin-rel-${{ github.sha }} | |
path: target/release/cairo-vm-cli | |
fail-on-cache-miss: true | |
- uses: actions/download-artifact@master | |
with: | |
name: proof_programs | |
path: cairo_programs/proof_programs/ | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CAIRO_PROGRAMS_PATH }} | |
key: cairo_proof_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} | |
fail-on-cache-miss: true | |
- name: Fetch pie | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: cairo_test_programs-release-trace-cache-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run script | |
run: ./vm/src/tests/compare_outputs_dynamic_layouts.sh | |
compare-run-from-cairo-pie-all-outputs: | |
name: Compare all outputs from running Cairo PIEs | |
needs: [ build-programs, build-release, run-cairo-release ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Python3 Build | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Install cairo-lang and deps | |
run: pip install -r requirements.txt | |
- name: Fetch release binary | |
uses: actions/cache/restore@v3 | |
with: | |
key: cli-bin-rel-${{ github.sha }} | |
path: target/release/cairo-vm-cli | |
fail-on-cache-miss: true | |
- name: Fetch traces for cairo-vm | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
cairo_programs/**/*.air_public_input | |
cairo_programs/**/*.air_private_input | |
cairo_programs/**/*.pie.zip | |
key: cairo_test_programs-release-trace-cache-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Run comparison | |
run: ./vm/src/tests/compare_all_pie_outputs.sh |