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

Add experimental use of icicle GPU Acceleration on pse feature #234

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
282ee8e
fix: change all `1` to `1u64` to prevent unexpected overflow (#72)
jonathanpwang Jun 3, 2023
8b9bdc2
[Fix] Panic when dealing with identity point (#71)
jonathanpwang Jun 6, 2023
05cfc1c
fix: redundant check in `ec_sub_unequal`
jonathanpwang Jun 7, 2023
0be26d4
Add SafeType (#26)
nyunyunyunyu May 23, 2023
d3ed3a9
feat(CI): switch to larger runner
jonathanpwang Jun 9, 2023
e4b956b
fix(builder): handle empty ctx with only equality constraints
jonathanpwang Jun 9, 2023
5293793
feat: add SafeAddress and SafeUint160 (#85)
PatStiles Jun 14, 2023
ca8e11c
Release 0.3.0 (#86)
jonathanpwang Jun 20, 2023
4060f2a
chore: fix halo2_proofs_axiom SHA commit
jonathanpwang Jun 20, 2023
f6b22ab
Merge release v0.3.0 into develop (#90)
jonathanpwang Jul 7, 2023
da451da
feat: `FpChip::range_check` now works with `max_bits < n * (k-1)` (#91)
jonathanpwang Jul 7, 2023
70c5cc0
fix(test): zkevm-keccak test should have `first_pass = SKIP_FIRST_PAS…
jonathanpwang Jul 20, 2023
08a16ce
Feat: test suite (#92)
jonathanpwang Jul 20, 2023
d1beb92
chore: make `bit_length` const function
jonathanpwang Jul 21, 2023
160f503
feat: add debugging functions (#99)
jonathanpwang Jul 26, 2023
081d475
chore: remove cfg(test) for debug functions
jonathanpwang Jul 26, 2023
2b3dd5d
feat(halo2-base): add `GateChip::pow_var` (#103)
jonathanpwang Aug 6, 2023
0b16812
Use halo2curves v0.4.0 and ff v0.13 (#107)
jonathanpwang Aug 15, 2023
3408b7a
Add `sub_mul` to GateInstructions (#102)
mmagician Aug 8, 2023
a62ae5d
fix(test): `select_from_idx` wasn't calling the right function (#105)
mmagician Aug 9, 2023
7100c23
chore: add back RangeCircuitBuilder::config (#111)
jonathanpwang Aug 17, 2023
49aeedd
fix: `RangeCircuitBuilder::config` remember `lookup_bits`
jonathanpwang Aug 17, 2023
a7b5433
[Feat] Add Poseidon Hasher Chip (#110)
nyunyunyunyu Aug 17, 2023
f724c9b
feat: add VariableByteArray (#88)
PatStiles Aug 18, 2023
3bacff7
chore: reduce CI real prover load
jonathanpwang Aug 18, 2023
cd9b6a4
Rename PoseidonHasherChip to PoseidonHasher (#113)
nyunyunyunyu Aug 18, 2023
25e211a
chore(safe_types): add conversion `SafeType` to/from `FixLenBytes`
jonathanpwang Aug 21, 2023
b58046c
chore(safe_type): add `unsafe_to_safe_type` unsafe conversion fn
jonathanpwang Aug 21, 2023
204a699
feat: add `select_array_by_indicator` to `GateInstructions` (#115)
jonathanpwang Aug 21, 2023
1c33fbc
cleanup: use test-utils for benching (#112)
jonathanpwang Aug 22, 2023
83ca65e
fix(safe_types): `VarLenBytes` should allow `len == MAX_LEN` (#117)
jonathanpwang Aug 22, 2023
7b23747
[feat] Add Poseidon Chip (#114)
nyunyunyunyu Aug 22, 2023
9798c85
[chore] Reorg Folder Structure of hashes/zkevm (#118)
nyunyunyunyu Aug 22, 2023
9fac2a8
[fix] CI for zkevm hashes (#119)
nyunyunyunyu Aug 23, 2023
154cd8c
[chore] Split keccak implementation into multiple files (#120)
nyunyunyunyu Aug 23, 2023
89da366
feat: keccak constant visibility changes (#121)
MonkeyKing-1 Aug 24, 2023
eb4fe65
[feat] Keccak Raw Output (#122)
nyunyunyunyu Aug 27, 2023
15bca77
Virtual region managers and dynamic lookup support (#123)
jonathanpwang Aug 27, 2023
f4c7e2a
Use `raw_assign_{advice,fixed}` in keccak (#125)
jonathanpwang Aug 28, 2023
7831b00
[feat] PoseidonHasher supports multiple inputs in compact format (#127)
nyunyunyunyu Aug 28, 2023
7bdf089
[feat] Expose Keccack Raw Inputs in Bytes instead of Input RLCs (#124)
nyunyunyunyu Aug 29, 2023
d07b0d4
Bump `zkevm-hashes` to v0.1.4
jonathanpwang Aug 29, 2023
6c80289
chore: clippy fix
jonathanpwang Aug 29, 2023
f2cf3e8
Generic vertical gate assignment (#129)
jonathanpwang Aug 29, 2023
be52d1d
Add `deep_clone` to `BaseCircuitBuilder` (#131)
jonathanpwang Sep 1, 2023
edd239f
fix: `SingleCorePhaseManager` should not create thread in constructor
jonathanpwang Sep 2, 2023
f39fef3
chore: make `new_context` public
jonathanpwang Sep 3, 2023
608b8f2
Convenience functions and fixes for multi-phase (#133)
jonathanpwang Sep 4, 2023
2b03c17
chore: add `BaseCircuitBuilder::set_k` fn
jonathanpwang Sep 5, 2023
64c8123
fix: `CopyConstraintManager::clear` was dropping
jonathanpwang Sep 5, 2023
04a40d4
feat: impl `From<SafeByte>` for `AssignedValue`
jonathanpwang Sep 5, 2023
671f0cc
chore(poseidon): add `derive` statements
jonathanpwang Sep 5, 2023
d27e46a
fix(copy_constraints): backend permutation argument depends on order
jonathanpwang Sep 6, 2023
a1fec64
feat: add `left_pad` functions for var length arrays (#137)
jonathanpwang Sep 6, 2023
72b53bf
chore: use `PrimeField` for `OptimizedPoseidonSpec` (#139)
jonathanpwang Sep 8, 2023
0acc05a
chore: add getter functions to Poseidon spec (#140)
jonathanpwang Sep 8, 2023
61fda9d
feat: use `(TypeId, usize)` instead of `usize` for lookup tag (#142)
jonathanpwang Sep 9, 2023
58155d7
chore: add `ContextTag` type alias
jonathanpwang Sep 9, 2023
3a35050
feat(base): add `GateInstructions::inner_product_left` function (#143)
jonathanpwang Sep 9, 2023
9377d90
[feat] Keccak Coprocessor Leaf Circuit (#130)
nyunyunyunyu Sep 9, 2023
54044c9
[feat] App Circuit Utils for Keccak Coprocessor (#141)
nyunyunyunyu Sep 9, 2023
14bec5a
[chore] Fix fmt (#144)
nyunyunyunyu Sep 10, 2023
c2a9341
chore: add misc utility functions (#146)
jonathanpwang Sep 10, 2023
482bed6
feat(keccak): add `ingestion` module for Rust native input formatting…
jonathanpwang Sep 10, 2023
41ea795
chore(keccak): use `snark-verifier` native Poseidon for encoding (#148)
jonathanpwang Sep 10, 2023
1ea4f84
feat: optimize leaf poseidon with `hash_compact_chunk_inputs` (#149)
jonathanpwang Sep 11, 2023
2ccfc43
[chore] cleanup code (#150)
jonathanpwang Sep 11, 2023
18057d3
chore: get halo2-pse working again
jonathanpwang Sep 11, 2023
46c5769
Merge branch 'main' into release-0.4.0-rc0
jonathanpwang Sep 11, 2023
eb5b284
chore: fix fmt
jonathanpwang Sep 11, 2023
92277ce
[Doc] Keccak Doc (#145)
nyunyunyunyu Sep 11, 2023
1bf36b1
chore: pin snark-verifier branch
jonathanpwang Sep 11, 2023
12f190a
[fix] max_rows in BaseCircuitBuilder in Keccak Leaf Circuit (#152)
nyunyunyunyu Sep 12, 2023
9a2fc70
[chore] Remove Unnecessary Lookup in Keccak Coprocessor Leaf Circuit …
nyunyunyunyu Sep 18, 2023
17d297b
Revert "chore: pin snark-verifier branch"
jonathanpwang Sep 11, 2023
26b81a3
[rename] (coprocessor, leaf) -> (component, shard) (#161)
jonathanpwang Sep 18, 2023
712d889
[rename] (coprocessor, leaf) -> (component, shard) (#161)
jonathanpwang Sep 18, 2023
e36c45b
[fix] Multiple Phase Lookup (#162)
nyunyunyunyu Sep 19, 2023
d3828a4
[fix] Multiple Phase Lookup (#162)
nyunyunyunyu Sep 19, 2023
215fe1c
[chore] add conversion `SafePrimitive` to `QuantumCell::Existing` (#169)
jonathanpwang Sep 26, 2023
524c818
fix: bad import on halo2-pse
jonathanpwang Sep 26, 2023
7acbe4d
[chore] add conversion `SafePrimitive` to `QuantumCell::Existing` (#169)
jonathanpwang Sep 26, 2023
5a43f96
fix: bad import on halo2-pse
jonathanpwang Sep 26, 2023
4cd0844
chore: make `{Fixed,Var}LenBytes*` constructor public
jonathanpwang Sep 26, 2023
3f84ec2
chore: make `{Fixed,Var}LenBytes*` constructor public
jonathanpwang Sep 26, 2023
16fa9e5
chore(keccak): `format_requests` always returns true capacity (#171)
jonathanpwang Sep 28, 2023
dff0e63
[chore] derive `Hash` for `BaseCircuitParams` (#172)
jonathanpwang Sep 29, 2023
8a5d469
[chore] impl `AsRef, AsMut` for `BaseCircuitBuilder` to self (#173)
jonathanpwang Oct 1, 2023
addfbec
[chore] impl `AsRef, AsMut` for `BaseConfig` to self (#174)
jonathanpwang Oct 1, 2023
9e6c9a1
[chore] Add getters to `KeccakComponentShardCircuit` (#178)
jonathanpwang Oct 7, 2023
fef7316
[chore] Expose Keccak Packing (#180)
nyunyunyunyu Oct 10, 2023
5411321
[chore] Expose Keccak Format (#181)
nyunyunyunyu Oct 11, 2023
bf71f0e
[feat] basic dynamic lookup table gadget (#182)
jonathanpwang Oct 11, 2023
9ff8994
[chore] expose `spec` in `PoseidonHasher` (#183)
jonathanpwang Oct 16, 2023
ff0cadf
[chore] fix halo2-pse build error (#184)
jonathanpwang Oct 18, 2023
582f671
[feat] expose keccak table loading/packing functions for external cra…
jonathanpwang Oct 20, 2023
eef553c
[chore] add getters to `PoseidonCompactChunkInput` (#196)
jonathanpwang Oct 20, 2023
ca498e5
[chore] fix deref after using CopyGetters (#197)
jonathanpwang Oct 21, 2023
2e996ae
[feat] implement `CircuitExt` for `KeccakComponentShardCircuit` (#198)
jonathanpwang Oct 22, 2023
ee822b9
Merge branch 'release-0.4.0-rc' into develop
jonathanpwang Oct 23, 2023
267123f
chore: fix `snark-verifier-sdk` version
jonathanpwang Oct 23, 2023
4ba2efc
[chore] add `cargo audit` to CI (#207)
jonathanpwang Nov 2, 2023
d4bf2fa
[fix] `FieldChip::range_check` should take `FieldPoint` instead of `U…
jonathanpwang Nov 2, 2023
4bc9f0a
[feat] update docs (#211)
jonathanpwang Nov 3, 2023
4e78e40
[chore] fix dev graph tests (#212)
jonathanpwang Nov 3, 2023
a30e3b1
[fix] `BasicDynLookupConfig` needs selector on advice table to preven…
jonathanpwang Nov 3, 2023
6cc92c6
[feat] add keccak circuit tests against Known Answer Test vectors (#213)
jonathanpwang Nov 3, 2023
cba20ed
[chore] fix documentation (#215)
jonathanpwang Nov 3, 2023
67e3a0e
[chore] fix doc comment (#216)
jonathanpwang Nov 3, 2023
5e2706f
chore: fix halo2-pse compile
jonathanpwang Nov 12, 2023
70d6d8a
fix: `TypeId` in `ContextTag` not stable across builds (#217)
jonathanpwang Nov 13, 2023
dacb885
Merge branch 'release-0.4.0-rc' into release-0.4.1-rc
jonathanpwang Nov 13, 2023
b880af1
chore: fix RAM test to use `&str` type id
jonathanpwang Nov 13, 2023
adb9694
[chore] add crate prefix to `type_id`s (#218)
jonathanpwang Nov 14, 2023
b6a5750
chore: use halo2-axiom from crates.io
jonathanpwang Nov 16, 2023
d45800d
chore: use poseidon-primitives from crates.io
jonathanpwang Nov 16, 2023
26a4504
chore: Bump halo2-axiom to v0.4
jonathanpwang Nov 20, 2023
12e07e1
chore: add `get_mut` for keccak circuit params
jonathanpwang Nov 20, 2023
b6625fa
[fix] soundness bug in `BasicDynLookupConfig::assign_virtual_table_to…
jonathanpwang Nov 30, 2023
6c9b8a5
integrate icicle on pse feature. setup integration on axiom feature
jeremyfelder Dec 13, 2023
3840018
Add GPU details in README
jeremyfelder Dec 13, 2023
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
72 changes: 50 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,73 @@ name: Tests

on:
push:
branches: ["main", "release-0.3.0"]
pull_request:
branches: ["main"]
pull_request:
branches: ["main", "develop", "community-edition", "release-*"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-64core-256ram

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run halo2-base tests
working-directory: "halo2-base"
run: |
cd halo2-base
cargo test -- --test-threads=1
cd ..
- name: Run halo2-ecc tests MockProver
cargo test
- name: Run halo2-ecc tests (mock prover)
working-directory: "halo2-ecc"
run: |
cd halo2-ecc
cargo test -- --test-threads=1 test_fp
cargo test -- test_ecc
cargo test -- test_secp256k1_ecdsa
cargo test -- test_ecdsa
cargo test -- test_ec_add
cargo test -- test_fixed_base_msm
cargo test -- test_msm
cargo test -- test_pairing
cd ..
- name: Run halo2-ecc tests real prover
cargo test --lib -- --skip bench
- name: Run halo2-ecc tests (real prover)
working-directory: "halo2-ecc"
run: |
cd halo2-ecc
cargo test --release -- test_fp_assert_eq
mv configs/bn254/bench_fixed_msm.t.config configs/bn254/bench_fixed_msm.config
mv configs/bn254/bench_msm.t.config configs/bn254/bench_msm.config
mv configs/bn254/bench_pairing.t.config configs/bn254/bench_pairing.config
mv configs/secp256k1/bench_ecdsa.t.config configs/secp256k1/bench_ecdsa.config
cargo test --release -- --nocapture bench_secp256k1_ecdsa
cargo test --release -- --nocapture bench_ec_add
cargo test --release -- --nocapture bench_fixed_base_msm
cargo test --release -- --nocapture bench_msm
cargo test --release -- --nocapture bench_pairing
cd ..
- name: Run zkevm tests
working-directory: "hashes/zkevm"
run: |
cargo test packed_multi_keccak_prover::k_14
cargo t test_vanilla_keccak_kat_vectors

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: false
components: rustfmt, clippy

- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- name: Run fmt
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all --all-targets -- -D warnings

- name: Generate Cargo.lock
run: cargo generate-lockfile

- name: Run cargo audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# Local IDE configs
.idea/
.vscode/
=======
/target

Expand Down
16 changes: 6 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[workspace]
members = [
"halo2-base",
"halo2-ecc",
"hashes/zkevm-keccak",
]
members = ["halo2-base", "halo2-ecc", "hashes/zkevm"]
resolver = "2"

[profile.dev]
opt-level = 3
debug = 1 # change to 0 or 2 for more or less debug info
debug = 2 # change to 0 or 2 for more or less debug info
overflow-checks = true
incremental = true

Expand All @@ -28,7 +25,7 @@ codegen-units = 16
opt-level = 3
debug = false
debug-assertions = false
lto = "fat"
lto = "fat"
# `codegen-units = 1` can lead to WORSE performance - always bench to find best profile for your machine!
# codegen-units = 1
panic = "unwind"
Expand All @@ -39,7 +36,6 @@ incremental = false
inherits = "release"
debug = true

# patch so snark-verifier uses this crate's halo2-base
[patch."https://github.com/axiom-crypto/halo2-lib.git"]
halo2-base = { path = "./halo2-base" }
halo2-ecc = { path = "./halo2-ecc" }
halo2-base = { path = "../halo2-lib/halo2-base" }
halo2-ecc = { path = "../halo2-lib/halo2-ecc" }
48 changes: 43 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# halo2-lib

This repository aims to provide basic primitives for writing zero-knowledge proof circuits using the [Halo 2](https://zcash.github.io/halo2/) proving stack.
This repository aims to provide basic primitives for writing zero-knowledge proof circuits using the [Halo 2](https://zcash.github.io/halo2/) proving stack. To discuss or collaborate, join our community on [Telegram](https://t.me/halo2lib).

## Getting Started

Expand Down Expand Up @@ -45,6 +45,30 @@ cargo bench --bench inner_product

These benchmarks use the `criterion` crate to run `create_proof` 10 times for statistical analysis. Note the benchmark circuits perform more than a one multiplication / inner product per circuit.

### GPU Acceleration

If you have access to NVIDIA GPUs, you can enable acceleration by building with the feature `halo2-icicle` and setting the following environment variable:

```sh
export ENABLE_ICICLE_GPU=true
```

GPU acceleration is provided by [Icicle](https://github.com/ingonyama-zk/icicle)

To go back to running with CPU, the previous environment variable must be **unset** instead of being switched to a value of false:

```sh
unset ENABLE_ICICLE_GPU
```

> [!NOTE]
> Even with the above environment variable set, for circuits where k <= 8, icicle is only enabled in certain areas where batching MSMs will help; all other places will fallback to using CPU MSM. To change the value of `k` where icicle is enabled, you can set the environment variable `ICICLE_SMALL_CIRCUIT`.
>
> Example: The following will cause icicle single MSM to be used throughout when k > 10 and CPU single MSM with certain locations using icicle batched MSM when k <= 10
> ```sh
> export ICICLE_SMALL_CIRCUIT=10
> ```

## halo2-ecc

This crate uses `halo2-base` to provide a library of elliptic curve cryptographic primitives. In particular, we support elliptic curves over base fields that are larger than the scalar field used in the proving system (e.g., `F_r` for bn254 when using Halo 2 with a KZG backend).
Expand Down Expand Up @@ -130,7 +154,7 @@ The test config file locations are (relative to `halo2-ecc` directory):
| `test_msm` | `src/bn254/configs/msm_circuit.config` |
| `test_pairing` | `src/bn254/configs/pairing_circuit.config` |

### Benchmarks
## Benchmarks

We have tests that are actually benchmarks using the production Halo2 prover.
As mentioned [above](#Configurable-Circuits), there are different configurations for each circuit that lead to _very_ different proving times. The following benchmarks will take a list of possible configurations and benchmark each one. The results are saved in a file in the `results` directory. We currently supply the configuration lists, which should provide optimal configurations for a given circuit degree `k` (however you can check versus the stdout suggestions to see if they really are optimal!).
Expand Down Expand Up @@ -172,7 +196,7 @@ cargo bench --bench fp_mul

This run the same proof generation over 10 runs and collect the average. Each circuit has a fixed configuration chosen for optimal speed. These benchmarks are mostly for use in performance optimization.

## Secp256k1 ECDSA
### Secp256k1 ECDSA

We provide benchmarks for ECDSA signature verification for the Secp256k1 curve on several different machines. All machines only use CPUs.

Expand Down Expand Up @@ -215,7 +239,7 @@ The other columns provide information about the [PLONKish arithmetization](https

The r6a has a higher clock speed than the r6g.

## BN254 Pairing
### BN254 Pairing

We provide benchmarks of the optimal Ate pairing for BN254 on several different machines. All machines only use CPUs.

Expand Down Expand Up @@ -258,7 +282,7 @@ The other columns provide information about the [PLONKish arithmetization](https

The r6a has a higher clock speed than the r6g. We hypothesize that the Apple Silicon integrated memory leads to the faster performance on the M2 Max.

## BN254 MSM
### BN254 MSM

We provide benchmarks of multi-scalar multiplication (MSM, multi-exp) with a batch size of `100` for BN254.

Expand All @@ -275,3 +299,17 @@ cargo test --release --no-default-features --features "halo2-axiom, mimalloc" --
| 19 | 20 | 3 | 1 | 32.6s |
| 20 | 11 | 2 | 1 | 41.3s |
| 21 | 6 | 1 | 1 | 51.9s |

## Projects built with `halo2-lib`

- [Axiom](https://github.com/axiom-crypto/axiom-eth) -- Prove facts about Ethereum on-chain data via aggregate block header, account, and storage proofs.
- [Proof of Email](https://github.com/zkemail/) -- Prove facts about emails with the same trust assumption as the email domain.
- [halo2-regex](https://github.com/zkemail/halo2-regex)
- [halo2-zk-email](https://github.com/zkemail/halo2-zk-email)
- [halo2-base64](https://github.com/zkemail/halo2-base64)
- [halo2-rsa](https://github.com/zkemail/halo2-rsa/tree/feat/new_bigint)
- [halo2-fri-gadget](https://github.com/maxgillett/halo2-fri-gadget) -- FRI verifier in halo2.
- [eth-voice-recovery](https://github.com/SoraSuegami/voice_recovery_circuit)
- [zkevm tx-circuit](https://github.com/scroll-tech/zkevm-circuits/tree/develop/zkevm-circuits/src/tx_circuit)
- [webauthn-halo2](https://github.com/zkwebauthn/webauthn-halo2) -- Proving and verifying WebAuthn with halo2.
- [Fixed Point Arithmetic](https://github.com/DCMMC/halo2-scaffold/tree/main/src/gadget) -- Fixed point arithmetic library in halo2.
41 changes: 27 additions & 14 deletions halo2-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
[package]
name = "halo2-base"
version = "0.3.0"
version = "0.4.0"
edition = "2021"

[dependencies]
itertools = "0.10"
itertools = "0.11"
num-bigint = { version = "0.4", features = ["rand"] }
num-integer = "0.1"
num-traits = "0.2"
rand_chacha = "0.3"
rustc-hash = "1.1"
ff = "0.12"
rayon = "1.6.1"
rayon = "1.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
log = "0.4"
getset = "0.1.2"
ark-std = { version = "0.3.0", features = ["print-trace"], optional = true }

# Use Axiom's custom halo2 monorepo for faster proving when feature = "halo2-axiom" is on
halo2_proofs_axiom = { git = "https://github.com/axiom-crypto/halo2.git", branch = "axiom/dev", package = "halo2_proofs", optional = true }
halo2_proofs_axiom = { version = "0.4", package = "halo2-axiom", optional = true }
# Use PSE halo2 and halo2curves for compatibility when feature = "halo2-pse" is on
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_02_02", optional = true }
halo2_proofs = { git = "https://github.com/ingonyama-zk/halo2", branch = "axiom-icicle", package = "halo2_proofs", optional = true }

# This is Scroll's audited poseidon circuit. We only use it for the Native Poseidon spec. We do not use the halo2 circuit at all (and it wouldn't even work because the halo2_proofs tag is not compatbile).
# We forked it to upgrade to ff v0.13 and removed the circuit module
poseidon-rs = { package = "poseidon-primitives", version = "=0.1.1" }
# plotting circuit layout
plotters = { version = "0.3.0", optional = true }
tabbycat = { version = "0.1", features = ["attributes"], optional = true }

# test-utils
rand = { version = "0.8", optional = true }

[dev-dependencies]
ark-std = { version = "0.3.0", features = ["print-trace"] }
rand = "0.8"
pprof = { version = "0.11", features = ["criterion", "flamegraph"] }
criterion = "0.4"
pprof = { version = "0.13", features = ["criterion", "flamegraph"] }
criterion = "0.5.1"
criterion-macro = "0.4"
rayon = "1.6.1"
test-case = "3.1.0"
test-log = "0.2.12"
env_logger = "0.10.0"
proptest = "1.1.0"
# native poseidon for testing
pse-poseidon = { git = "https://github.com/axiom-crypto/pse-poseidon.git" }

# memory allocation
[target.'cfg(not(target_env = "msvc"))'.dependencies]
Expand All @@ -45,13 +51,16 @@ jemallocator = { version = "0.5", optional = true }
mimalloc = { version = "0.1", default-features = false, optional = true }

[features]
default = ["halo2-axiom", "display"]
dev-graph = ["halo2_proofs?/dev-graph", "halo2_proofs_axiom?/dev-graph", "plotters"]
halo2-pse = ["halo2_proofs"]
default = ["halo2-axiom", "display", "test-utils"]
asm = ["halo2_proofs_axiom?/asm"]
dev-graph = ["halo2_proofs/dev-graph", "plotters"] # only works with halo2-pse for now
halo2-pse = ["halo2_proofs/circuit-params"]
halo2-icicle = ["halo2_proofs/icicle_gpu", "halo2_proofs/circuit-params"]
halo2-axiom = ["halo2_proofs_axiom"]
halo2-axiom-icicle = ["halo2_proofs_axiom"]
display = []
profile = ["halo2_proofs_axiom?/profile"]
test-utils = ["dep:rand"]
test-utils = ["dep:rand", "ark-std"]

[[bench]]
name = "mul"
Expand All @@ -60,3 +69,7 @@ harness = false
[[bench]]
name = "inner_product"
harness = false

[[example]]
name = "inner_product"
required-features = ["test-utils"]
Loading