Change ec_op_impl() to use ProjectivePoint. #7445
Workflow file for this run
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: [ '**' ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-programs: | |
strategy: | |
matrix: | |
# NOTE: we build cairo_proof_programs so clippy can check the benchmarks too | |
program-target: [ cairo_bench_programs, cairo_proof_programs, cairo_test_programs, cairo_1_test_contracts ] | |
name: Build Cairo programs | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Fetch from cache | |
uses: actions/cache@v3 | |
id: cache-programs | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles( 'cairo_programs/**/*.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' }} | |
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' }} | |
run: pip install -r requirements.txt | |
- name: Install cairo 1 compiler | |
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} | |
run: make build-cairo-1-compiler | |
- name: Build programs | |
if: ${{ steps.cache-programs.outputs.cache-hit != 'true' }} | |
run: make -j ${{ matrix.program-target }} | |
lint: | |
needs: build-programs | |
name: Run Lints | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Format | |
run: cargo fmt --all -- --check | |
- name: Fetch test programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_test_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch proof programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_proof_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch bench programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_bench_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch test contracts | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_1_test_contracts-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- 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: build-programs | |
name: Make sure all builds work | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
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: Fetch test programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_test_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch proof programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_proof_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch bench programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_bench_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch test contracts | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_1_test_contracts-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
# NOTE: we do this separately because --workspace operates in weird ways | |
- name: Check all features (felt) | |
run: | | |
cd felt | |
cargo check-all-features | |
cargo check-all-features --workspace --all-targets | |
- name: Check all features (vm) | |
run: | | |
cd vm | |
cargo check-all-features | |
- name: Check all features (CLI) | |
run: | | |
cd cairo-vm-cli | |
cargo check-all-features | |
- name: Check all features (workspace) | |
run: | | |
cargo check-all-features --workspace --all-targets | |
- name: Check no-std | |
run: | | |
cd ensure-no_std | |
cargo build --no-default-features | |
cargo build | |
tests: | |
needs: build-programs | |
strategy: | |
fail-fast: false | |
matrix: | |
special_features: ["", "lambdaworks-felt"] | |
target: [ test, test-no_std, test-wasm ] | |
# TODO: features | |
name: Run tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: check and free hdd space left | |
run: | | |
echo "Listing 20 largest packages" | |
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20 | |
df -h | |
sudo apt-get update | |
sudo apt-get remove -y '^llvm-.*' | |
sudo apt-get remove -y 'php.*' | |
sudo apt-get remove -y '^dotnet-.*' | |
sudo apt-get remove -y '^temurin-.*' | |
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
df -h | |
echo "Removing large directories" | |
# deleting 15GB | |
sudo rm -rf /usr/share/dotnet/ | |
sudo rm -rf /usr/local/lib/android | |
df -h | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
with: | |
components: llvm-tools-preview | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# 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: Fetch test programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_test_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch proof programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_proof_programs-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Fetch test contracts | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: cairo_1_test_contracts-cache-${{ hashFiles( 'cairo_programs/**/*.cairo' ) }} | |
- name: Install testing tools | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-nextest,cargo-llvm-cov,wasm-pack | |
- name: Run | |
run: | | |
# FIXME: we need to update the Makefile to do this correctly | |
case ${{ matrix.target }} in | |
'test') | |
cargo llvm-cov nextest --lcov --output-path lcov-${{ matrix.target }}.info --workspace --features "cairo-1-hints, test_utils, ${{ matrix.special_features }}" | |
;; | |
'test-no_std') | |
cargo llvm-cov nextest --lcov --output-path lcov-${{ matrix.target }}.info --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 }}.info | |
key: codecov-cache-${{ matrix.target }}-${{ github.sha }} | |
build-release: | |
name: Build release binary for comparisons | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Rust | |
uses: dtolnay/[email protected] | |
- 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 | |
- name: Check cache | |
uses: actions/cache@v3 | |
id: trace-cache | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles( 'cairo_programs/**/*.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: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles( 'cairo_programs/**/*.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 | |
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' | |
- program-target: cairo_test_programs | |
programs-dir: cairo_programs | |
extra-args: '' | |
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 | |
- name: Fetch programs | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.casm | |
cairo_programs/**/*.json | |
key: ${{ matrix.program-target }}-cache-${{ hashFiles( 'cairo_programs/**/*.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 | |
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 | |
uses: actions/cache/restore@v3 | |
with: | |
path: lcov-test.info | |
key: codecov-cache-test-${{ 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: Upload coverage to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
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 | |
- name: Fetch traces for cairo-lang | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
cairo_programs/**/*.memory | |
cairo_programs/**/*.trace | |
key: ${{ matrix.program-target }}-reference-trace-cache-${{ hashFiles( 'cairo_programs/**/*.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 | |
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 | |
fi | |
./vm/src/tests/compare_vm_state.sh trace memory $PROOF |