Skip to content
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
59 changes: 37 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,48 @@ jobs:
- 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_secp
cargo test -- test_ecdsa
cargo test -- test_ec_add
cargo test -- test_fixed
cargo test -- test_msm
cargo test -- test_fb
cargo test -- test_pairing
cd ..
- name: Run halo2-ecc tests real prover
cargo test --lib -- --skip bench --test-threads=2
- 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
cargo test --release -- --nocapture bench_secp256k1_ecdsa
cargo test --release -- --nocapture bench_ec_add
mv configs/bn254/bench_fixed_msm.t.config configs/bn254/bench_fixed_msm.config
cargo test --release -- --nocapture bench_fixed_base_msm
mv configs/bn254/bench_msm.t.config configs/bn254/bench_msm.config
cargo test --release -- --nocapture bench_msm
mv configs/bn254/bench_pairing.t.config configs/bn254/bench_pairing.config
cargo test --release -- --nocapture bench_pairing
cd ..
- name: Run zkevm-keccak tests
working-directory: "hashes/zkevm-keccak"
run: |
cargo test

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 -- -D warnings
2 changes: 1 addition & 1 deletion halo2-base/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "halo2-base"
version = "0.3.0"
version = "0.3.1"
edition = "2021"

[dependencies]
Expand Down
8 changes: 4 additions & 4 deletions halo2-base/benches/inner_product.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(unused_imports)]
#![allow(unused_variables)]
use halo2_base::gates::builder::{GateCircuitBuilder, GateThreadBuilder};
use halo2_base::gates::builder::{GateCircuitBuilder, GateThreadBuilder, RangeCircuitBuilder};
use halo2_base::gates::flex_gate::{FlexGateConfig, GateChip, GateInstructions, GateStrategy};
use halo2_base::halo2_proofs::{
arithmetic::Field,
Expand Down Expand Up @@ -50,7 +50,7 @@ fn bench(c: &mut Criterion) {
let mut builder = GateThreadBuilder::new(false);
inner_prod_bench(builder.main(0), vec![Fr::zero(); 5], vec![Fr::zero(); 5]);
builder.config(k as usize, Some(20));
let circuit = GateCircuitBuilder::mock(builder);
let circuit = RangeCircuitBuilder::mock(builder);

// check the circuit is correct just in case
MockProver::run(k, &circuit, vec![]).unwrap().assert_satisfied();
Expand All @@ -59,7 +59,7 @@ fn bench(c: &mut Criterion) {
let vk = keygen_vk(&params, &circuit).expect("vk should not fail");
let pk = keygen_pk(&params, vk, &circuit).expect("pk should not fail");

let break_points = circuit.break_points.take();
let break_points = circuit.0.break_points.take();
drop(circuit);

let mut group = c.benchmark_group("plonk-prover");
Expand All @@ -73,7 +73,7 @@ fn bench(c: &mut Criterion) {
let a = (0..5).map(|_| Fr::random(OsRng)).collect_vec();
let b = (0..5).map(|_| Fr::random(OsRng)).collect_vec();
inner_prod_bench(builder.main(0), a, b);
let circuit = GateCircuitBuilder::prover(builder, break_points.clone());
let circuit = RangeCircuitBuilder::prover(builder, break_points.clone());

let mut transcript = Blake2bWrite::<_, _, Challenge255<_>>::init(vec![]);
create_proof::<
Expand Down
8 changes: 4 additions & 4 deletions halo2-base/benches/mul.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ff::Field;
use halo2_base::gates::builder::{GateCircuitBuilder, GateThreadBuilder};
use halo2_base::gates::builder::{GateThreadBuilder, RangeCircuitBuilder};
use halo2_base::gates::flex_gate::{GateChip, GateInstructions};
use halo2_base::halo2_proofs::{
halo2curves::bn256::{Bn256, Fr, G1Affine},
Expand Down Expand Up @@ -37,13 +37,13 @@ fn bench(c: &mut Criterion) {
let mut builder = GateThreadBuilder::new(false);
mul_bench(builder.main(0), [Fr::zero(); 2]);
builder.config(K as usize, Some(9));
let circuit = GateCircuitBuilder::keygen(builder);
let circuit = RangeCircuitBuilder::keygen(builder);

let params = ParamsKZG::<Bn256>::setup(K, OsRng);
let vk = keygen_vk(&params, &circuit).expect("vk should not fail");
let pk = keygen_pk(&params, vk, &circuit).expect("pk should not fail");

let break_points = circuit.break_points.take();
let break_points = circuit.0.break_points.take();

let a = Fr::random(OsRng);
let b = Fr::random(OsRng);
Expand All @@ -56,7 +56,7 @@ fn bench(c: &mut Criterion) {
let mut builder = GateThreadBuilder::new(true);
// do the computation
mul_bench(builder.main(0), inputs);
let circuit = GateCircuitBuilder::prover(builder, break_points.clone());
let circuit = RangeCircuitBuilder::prover(builder, break_points.clone());

let mut transcript = Blake2bWrite::<_, _, Challenge255<_>>::init(vec![]);
create_proof::<
Expand Down
8 changes: 4 additions & 4 deletions halo2-base/examples/inner_product.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(unused_imports)]
#![allow(unused_variables)]
use halo2_base::gates::builder::{GateCircuitBuilder, GateThreadBuilder};
use halo2_base::gates::builder::{GateThreadBuilder, RangeCircuitBuilder};
use halo2_base::gates::flex_gate::{FlexGateConfig, GateChip, GateInstructions, GateStrategy};
use halo2_base::halo2_proofs::{
arithmetic::Field,
Expand Down Expand Up @@ -53,7 +53,7 @@ fn main() {
let mut builder = GateThreadBuilder::new(false);
inner_prod_bench(builder.main(0), vec![Fr::zero(); 5], vec![Fr::zero(); 5]);
builder.config(k as usize, Some(20));
let circuit = GateCircuitBuilder::mock(builder);
let circuit = RangeCircuitBuilder::mock(builder);

// check the circuit is correct just in case
MockProver::run(k, &circuit, vec![]).unwrap().assert_satisfied();
Expand All @@ -62,13 +62,13 @@ fn main() {
let vk = keygen_vk(&params, &circuit).expect("vk should not fail");
let pk = keygen_pk(&params, vk, &circuit).expect("pk should not fail");

let break_points = circuit.break_points.take();
let break_points = circuit.0.break_points.take();

let mut builder = GateThreadBuilder::new(true);
let a = (0..5).map(|_| Fr::random(OsRng)).collect_vec();
let b = (0..5).map(|_| Fr::random(OsRng)).collect_vec();
inner_prod_bench(builder.main(0), a, b);
let circuit = GateCircuitBuilder::prover(builder, break_points);
let circuit = RangeCircuitBuilder::prover(builder, break_points);

let mut transcript = Blake2bWrite::<_, _, Challenge255<_>>::init(vec![]);
create_proof::<
Expand Down
Loading