Skip to content

Commit

Permalink
Merge release v0.3.0 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpwang committed Jul 7, 2023
1 parent 5293793 commit 3ee7608
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 139 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

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

env:
CARGO_TERM_COLOR: always
Expand Down
24 changes: 19 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 @@ -130,7 +130,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 +172,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 +215,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 +258,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 +275,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.
2 changes: 1 addition & 1 deletion halo2-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde_json = "1.0"
log = "0.4"

# 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 = { git = "https://github.com/axiom-crypto/halo2.git", branch = "main", package = "halo2_proofs", 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 }

Expand Down
5 changes: 1 addition & 4 deletions halo2-base/src/gates/tests/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use crate::gates::{
flex_gate::{GateChip, GateInstructions},
range::{RangeChip, RangeInstructions},
};
use crate::halo2_proofs::{
dev::MockProver,
halo2curves::bn256::Fr,
};
use crate::halo2_proofs::{dev::MockProver, halo2curves::bn256::Fr};
use crate::utils::{BigPrimeField, ScalarField};
use crate::{Context, QuantumCell::Constant};
use ff::Field;
Expand Down
6 changes: 3 additions & 3 deletions halo2-base/src/gates/tests/idx_to_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ use crate::{
GateChip, GateInstructions,
},
halo2_proofs::{
halo2curves::bn256::Fr,
plonk::keygen_pk,
plonk::{keygen_vk, Assigned},
poly::kzg::commitment::ParamsKZG,
halo2curves::bn256::Fr,
},
utils::testing::{gen_proof, check_proof},
utils::testing::{check_proof, gen_proof},
QuantumCell::Witness,
};
use ff::Field;
use itertools::Itertools;
use rand::{thread_rng, Rng, rngs::OsRng};
use rand::{rngs::OsRng, thread_rng, Rng};

// soundness checks for `idx_to_indicator` function
fn test_idx_to_indicator_gen(k: u32, len: usize) {
Expand Down
6 changes: 3 additions & 3 deletions halo2-base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Base library to build Halo2 circuits.
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
#![feature(const_cmp)]
#![allow(incomplete_features)]
#![feature(stmt_expr_attributes)]
#![feature(trait_alias)]
#![deny(clippy::perf)]
Expand Down Expand Up @@ -41,10 +41,10 @@ use utils::ScalarField;

/// Module that contains the main API for creating and working with circuits.
pub mod gates;
/// Utility functions for converting between different types of field elements.
pub mod utils;
/// Module for SafeType which enforce value range and realted functions.
pub mod safe_types;
/// Utility functions for converting between different types of field elements.
pub mod utils;

/// Constant representing whether the Layouter calls `synthesize` once just to get region shape.
#[cfg(feature = "halo2-axiom")]
Expand Down
Loading

0 comments on commit 3ee7608

Please sign in to comment.