Skip to content

Commit

Permalink
Merge branch 'main' into feat/multilinear_sumcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
diegokingston authored Oct 1, 2024
2 parents 9c3dde1 + 9617e52 commit e70098c
Show file tree
Hide file tree
Showing 200 changed files with 8,329 additions and 10,441 deletions.
59 changes: 36 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ jobs:
- name: Run cargo check
run: cargo check

- name: Run cargo check cli and stark instruments
- name: Run cargo check and stark instruments
run: |
cargo check --features cli,instruments
cargo check --features instruments
- name: Run cargo check cli, stark instruments and parallel
run: |
cargo check --features cli,instruments,parallel
cargo check --features instruments,parallel
- name: Run cargo check for math with no-std
run: cargo check --package lambdaworks-math --no-default-features

- name: Run cargo check for math with wasm target
run: cargo check --package lambdaworks-math --no-default-features --target wasm32-unknown-unknown

Expand All @@ -52,6 +52,10 @@ jobs:
cd ensure-no_std
cargo build
- name: Run cargo build for all workspace
run: |
cargo build --workspace
- name: Run cargo build ensure-no_std crate for wasm
run: |
cd ensure-no_std
Expand Down Expand Up @@ -100,29 +104,39 @@ jobs:
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

- name: Python3 build
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"

- name: Install cairo-lang toolchain and dependencies
run: pip install -r provers/cairo/requirements.txt

- name: Install testing tools
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov

- name: Run tests with no std
run: cargo test --package lambdaworks-math --package lambdaworks-crypto --no-default-features

- name: Run tests for math with no std + alloc
run: cargo test --package lambdaworks-math --no-default-features --features=alloc,lambdaworks-serde-string,lambdaworks-serde-binary
run: cargo test --package lambdaworks-math --no-default-features --features=alloc,lambdaworks-serde-string,lambdaworks-serde-binary

- name: Run tests and generate code coverage
run: make coverage

- name: Cache coverage data
uses: actions/cache/save@v4
with:
path: lcov.info
key: coverage-${{ github.sha }}

coverage:
name: Upload Coverage to Codecov
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Fetch coverage data
uses: actions/cache/restore@v4
with:
path: lcov.info
key: coverage-${{ github.sha }}
fail-on-cache-miss: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -148,20 +162,19 @@ jobs:
- name: Install wasm-pack tools for testing
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Run wasm-pack tests in firefox
run: cd provers/cairo && wasm-pack test --release --firefox --headless -- --features wasm

- name: Run wasm-pack tests in chrome
run: cd provers/cairo && wasm-pack test --release --chrome --headless -- --features wasm

test_macos:
name: Test (macOS, Apple sillicon)
runs-on: [self-hosted, macOS]
runs-on: macos-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3

- name: install GCC/GMP
run: |
brew install gcc
brew install gmp
- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
Expand Down
79 changes: 42 additions & 37 deletions .github/workflows/criterion_benchs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]

permissions:
# deployments permission to deploy GitHub pages website
Expand All @@ -17,46 +17,51 @@ jobs:
env:
CARGO_TERM_COLOR: always
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/checkout@v3
- name: Run benchmark
run: |
cargo bench --no-fail-fast --bench "criterion_fft" \
--bench "criterion_polynomial" \
-- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo'
output-file-path: output.txt
benchmark-data-dir-path: "./bench"
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: ${{ github.event_name != 'pull_request' }}
- uses: actions/checkout@v3
- name: Run benchmark
run: |
cargo bench --no-fail-fast --bench "criterion_fft" \
--bench "criterion_polynomial" \
-- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "cargo"
output-file-path: output.txt
benchmark-data-dir-path: "./bench"
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: ${{ github.event_name != 'pull_request' }}
criterion_bench_macos:
name: Criterion benches (macOS, Apple sillicon)
runs-on: [self-hosted, macOS]
runs-on: macos-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: actions/checkout@v3
- name: Run benchmark
run: |
cargo bench -F metal --no-fail-fast --bench "criterion_metal" \
-- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'cargo'
output-file-path: output.txt
benchmark-data-dir-path: "./bench"
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: ${{ github.event_name != 'pull_request' }}
- uses: actions/checkout@v3
- name: install GCC/GMP
run: |
brew install gcc
brew install gmp
- name: Run benchmark
run: |
cargo bench -F metal --no-fail-fast --bench "criterion_metal" \
-- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "cargo"
output-file-path: output.txt
benchmark-data-dir-path: "./bench"
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: ${{ github.event_name != 'pull_request' }}
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
[workspace]

members = ["math", "crypto", "gpu", "benches", "provers/plonk", "provers/stark", "provers/cairo", "provers/groth16", "provers/groth16/arkworks-adapter", "provers/groth16/circom-adapter", "examples/merkle-tree-cli", "examples/prove-miden", "provers/winterfell_adapter", "examples/shamir_secret_sharing", "examples/prove-verify-circom", "provers/cairo/ffi"]
members = ["math", "crypto", "gpu", "benches", "provers/plonk", "provers/stark", "provers/groth16", "provers/groth16/arkworks-adapter", "provers/groth16/circom-adapter", "examples/merkle-tree-cli", "examples/prove-miden", "provers/winterfell_adapter", "examples/shamir_secret_sharing","examples/pinocchio", "examples/prove-verify-circom", "examples/baby-snark"]
exclude = ["ensure-no_std"]
resolver = "2"

[workspace.package]
version = "0.5.0"
version = "0.10.0"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/lambdaclass/lambdaworks"

[workspace.dependencies]
iai-callgrind = "0.3.1"
lambdaworks-crypto = { path = "./crypto", version = "0.5.0", default-features = false }
lambdaworks-gpu = { path = "./gpu", version = "0.5.0" }
lambdaworks-math = { path = "./math", version = "0.5.0", default-features = false }
lambdaworks-crypto = { path = "./crypto", version = "0.10.0", default-features = false }
lambdaworks-gpu = { path = "./gpu", version = "0.10.0" }
lambdaworks-math = { path = "./math", version = "0.10.0", default-features = false }
stark-platinum-prover = { path = "./provers/stark" }
cairo-platinum-prover = { path = "./provers/cairo" }
lambdaworks-winterfell-adapter = { path = "./provers/winterfell_adapter"}
lambdaworks-groth16 = { path = "./provers/groth16" }
lambdaworks-circom-adapter = { path = "./provers/groth16/circom-adapter" }
Expand Down
26 changes: 3 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,12 @@ FUZZ_DIR = fuzz/no_gpu_fuzz

ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

CAIRO0_PROGRAMS_DIR=provers/cairo/cairo_programs/cairo0
CAIRO0_PROGRAMS:=$(wildcard $(CAIRO0_PROGRAMS_DIR)/*.cairo)
COMPILED_CAIRO0_PROGRAMS:=$(patsubst $(CAIRO0_PROGRAMS_DIR)/%.cairo, $(CAIRO0_PROGRAMS_DIR)/%.json, $(CAIRO0_PROGRAMS))

# Rule to compile Cairo programs for testing purposes.
# If the `cairo-lang` toolchain is installed, programs will be compiled with it.
# Otherwise, the cairo_compile docker image will be used
# When using the docker version, be sure to build the image using `make docker_build_cairo_compiler`.
$(CAIRO0_PROGRAMS_DIR)/%.json: $(CAIRO0_PROGRAMS_DIR)/%.cairo
@echo "Compiling Cairo program..."
@cairo-compile --cairo_path="$(CAIRO0_PROGRAMS_DIR)" $< --output $@ 2> /dev/null --proof_mode || \
docker run --rm -v $(ROOT_DIR)/$(CAIRO0_PROGRAMS_DIR):/pwd/$(CAIRO0_PROGRAMS_DIR) cairo --proof_mode /pwd/$< > $@

test: $(COMPILED_CAIRO0_PROGRAMS)
test:
cargo test

clippy:
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace --all-targets --features wasm -- -D warnings
cargo clippy --workspace --all-targets --features cli -- -D warnings
cargo clippy --workspace --all-targets --features parallel -- -D warnings
cargo clippy --tests

Expand All @@ -47,7 +33,7 @@ benchmark:
flamegraph_stark:
CARGO_PROFILE_BENCH_DEBUG=true cargo flamegraph --root --bench stark_benchmarks -- --bench

coverage: $(COMPILED_CAIRO0_PROGRAMS)
coverage:
cargo llvm-cov nextest --lcov --output-path lcov.info

METAL_DIR = math/src/gpu/metal
Expand All @@ -57,7 +43,7 @@ build-metal:
clippy-metal:
cargo clippy --workspace --all-targets -F metal -- -D warnings

test-metal: $(COMPILED_CAIRO0_PROGRAMS)
test-metal:
cargo test -F metal

CUDA_DIR = math/src/gpu/cuda/shaders
Expand Down Expand Up @@ -91,9 +77,3 @@ run-metal-fuzzer:
run-cuda-fuzzer:
cd fuzz/cuda_fuzz
cargo hfuzz run $(CUDAFUZZER)

build_wasm:
cd provers/cairo && wasm-pack build --release --target=web -- --features wasm

test_wasm_with_firefox:
cd provers/cairo && wasm-pack test --release --firefox --headless -- --features wasm
Loading

0 comments on commit e70098c

Please sign in to comment.