Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean repo, remove cairo prover and update readme #920

Merged
merged 10 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ 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
Expand Down Expand Up @@ -104,15 +104,6 @@ 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:
Expand Down Expand Up @@ -171,12 +162,6 @@ 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: macos-latest
Expand All @@ -196,18 +181,6 @@ jobs:
toolchain: stable
components: clippy

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

- name: Install cairo-lang toolchain and dependencies
env:
CFLAGS: "-I/opt/homebrew/opt/gmp/include"
LDFLAGS: "-L/opt/homebrew/opt/gmp/lib"
run: pip install -r provers/cairo/requirements.txt

- name: Run clippy
run: make clippy-metal

Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/criterion_benchs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,7 @@ jobs:
run: |
brew install gcc
brew install gmp
- name: Python3 build
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
- name: Install cairo-lang toolchain and dependencies
env:
CFLAGS: "-I/opt/homebrew/opt/gmp/include"
LDFLAGS: "-L/opt/homebrew/opt/gmp/lib"
run: pip install -r provers/cairo/requirements.txt

- name: Run benchmark
run: |
cargo bench -F metal --no-fail-fast --bench "criterion_metal" \
Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[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/pinocchio", "examples/prove-verify-circom", "provers/cairo/ffi", "examples/baby-snark"]
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"

Expand All @@ -16,7 +16,6 @@ lambdaworks-crypto = { path = "./crypto", version = "0.10.0", default-features =
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
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ So, we decided to build our library, focusing on performance, with clear documen
- [Crypto primitives](https://github.com/lambdaclass/lambdaworks/tree/main/crypto)
- [STARK Prover](https://github.com/lambdaclass/lambdaworks/tree/main/provers/stark)
- [Plonk Prover](https://github.com/lambdaclass/lambdaworks/tree/main/provers/plonk)
- [Cairo Prover](https://github.com/lambdaclass/lambdaworks/tree/main/provers/cairo)
- [Groth 16](https://github.com/lambdaclass/lambdaworks/tree/main/provers/groth16)

### Crypto
Expand Down Expand Up @@ -83,9 +82,10 @@ List of symbols:
| Mersenne 31 | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Baby Bear | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| MiniGoldilocks | :heavy_check_mark: | :x: | :x: | :heavy_check_mark: | :x: |
| Binary fields | :x: | :x: | :x: | :x: | :x: |
| **ZK friendly Hash function** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| Poseidon | 🏗️ | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
| Pedersen | 🏗️ | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
| Poseidon | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
| Pedersen | 🏗️ | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
| Rescue Prime XLIX | :x: | :x: | :x: | :x: | :x: |
| **Elliptic Curves** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| BLS12-381 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Expand All @@ -99,24 +99,16 @@ List of symbols:
| secq256r1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: |
| **STARKs** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| STARK Prover | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| CAIRO Prover | 🏗️ | :x: | :x: | :x: | :x: |
| Circle STARKs | :x: | :x: | :x: | :x: | :x: |
| **SNARKs** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| Groth16 | :heavy_check_mark: | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: |
| Plonk | 🏗️ | :heavy_check_mark: | ✔️ | :heavy_check_mark: | :x: |
| Spartan | :x: | :heavy_check_mark: | :x: | :x: | :x: |
| Marlin | :x: | :heavy_check_mark: | :x: | :x: | :x: |
| GKR | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: |
| **Polynomial Commitment Schemes** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| KZG10 | :heavy_check_mark: | ✔️ | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| FRI | 🏗️ | :x: | :x: | :heavy_check_mark: | :x: |
| IPA | 🏗️ | ✔️ | :heavy_check_mark: | :x: | :x: |
| Brakedown | :x: | :x: | :x: | :x: | :x: |
| Basefold | :x: | :x: | :x: | :x: | :x: |
| **Folding Schemes** | **Lambdaworks** | **Arkworks** | **Halo2** | **gnark** | **Constantine** |
| Nova | :x: | :heavy_check_mark: | :x: | :x: | :x: |
| Supernova | :x: | :x: | :x: | :x: | :x: |
| Protostar | :x: | :x: | :x: | :x: | :x: |
| Protogalaxy | :x: | :heavy_check_mark: | :x: | :x: | :x: |
| Binius | :x: | :x: | :x: | :x: | :x: |
| Circle FRI | :x: | :x: | :x: | :x: | :x: |

Additionally, provers are compatible with the following frontends and VMs:

Expand All @@ -129,7 +121,6 @@ Additionally, provers are compatible with the following frontends and VMs:
| Plonk | Noir | :x: |
| Stark | Winterfell | :heavy_check_mark: |
| Stark | Miden | :heavy_check_mark: |
| Stark | Cairo | :heavy_check_mark: |

This can be used in a multi prover setting for extra security, or as a standalone to be used with Rust.

Expand Down
3 changes: 1 addition & 2 deletions provers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This folder contains the different provers currently supported by lambdaworks:
- [Groth 16](https://github.com/lambdaclass/lambdaworks/tree/main/provers/groth16)
- [Plonk](https://github.com/lambdaclass/lambdaworks/tree/main/provers/plonk)
- [STARKs](https://github.com/lambdaclass/lambdaworks/tree/main/provers/stark)
- [Cairo](https://github.com/lambdaclass/lambdaworks/tree/main/provers/cairo)
- [Cairo](https://github.com/lambdaclass/lambdaworks/tree/a591186e6c4dd53301b03b4ddd69369abe99f960/provers/cairo) - This is only for learning purposes and no longer supported. The [docs](../docs/src/starks/) still contain information that could be useful to understand and learn how Cairo works.

The reference papers for each of the provers is given below:
- [Groth 16](https://eprint.iacr.org/2016/260)
Expand All @@ -22,5 +22,4 @@ Using one prover or another depends on usecase and other desired properties. We

## Using provers

- [Cairo prover](https://github.com/lambdaclass/lambdaworks/blob/main/provers/cairo/README.md)
- [Plonk prover](https://github.com/lambdaclass/lambdaworks/blob/main/provers/plonk/README.md)
121 changes: 0 additions & 121 deletions provers/cairo/Cargo.toml

This file was deleted.

Loading
Loading