Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
54c4d8a
speed up generate vk pk with multi-thread
LuozhuZhang Jul 15, 2022
d8d7235
Add parallel verifying process.
spherel Jun 24, 2022
81c654a
use binary_search to check if an input is included in table
kunxian-xia Aug 4, 2022
48c5fa9
make blinding rows for advice columns are 0, only last row is 1
lispc Jun 14, 2022
4a67031
random poly is full of 0
lispc Jul 6, 2022
15a90b3
add brief transcript with poseidon
lanbones Apr 4, 2022
ae82f75
make some struct fields pub for aggregation; use gwc by default
lispc Sep 1, 2022
a1b4726
clean up after merge
zhenfeizhang Sep 5, 2022
4b53eee
address comments
zhenfeizhang Sep 10, 2022
be443ce
bring back reader and writer
zhenfeizhang Sep 11, 2022
8c6b166
revert halo2_proofs/src/dev.rs as upstream
lispc Sep 20, 2022
1bd4afd
add is_none to Value
lispc Sep 21, 2022
b04667b
expose inner
lispc Sep 27, 2022
3a5a600
log pairing
lispc Oct 11, 2022
85bf2ed
poseidon hash to 63
lispc Oct 13, 2022
a960c7e
make query index public
lispc Oct 14, 2022
6f18f38
make g_lagrange public
lispc Oct 15, 2022
879487c
Merge commit 'a9e99a72a65d7c98e8a4258c2c94269c834d1c10' into scroll-d…
lispc Dec 13, 2022
9c2e786
lint
lispc Dec 13, 2022
5b38c99
fix
lispc Dec 13, 2022
3f85679
better logging with region shape
lispc Dec 13, 2022
255634a
better logging with region shape
lispc Dec 13, 2022
dedbb5e
lint
lispc Dec 13, 2022
15dd976
log region shape
lispc Dec 14, 2022
8860f03
log::warn region piling
lispc Dec 15, 2022
b46c23b
make num_fixed_columns public
lispc Dec 19, 2022
88f6fda
change some log level
lispc Dec 19, 2022
b46b5ac
fix empty region failure panic
lispc Dec 21, 2022
849b7b6
Merge branch 'scroll-dev-0902' into scroll-dev-1220
lispc Dec 21, 2022
aa09e10
feat: read `VerifyingKey` and `ProvingKey` does not require `params` as
jonathanpwang Dec 21, 2022
db67f11
feat: add features "serde-raw" and "raw-unchecked" to
jonathanpwang Dec 21, 2022
2739742
add meta.max_phase()
lispc Dec 29, 2022
a6312fe
fix log level
lispc Dec 29, 2022
75a602b
add assignment timer
lispc Jan 2, 2023
9520076
add assignment timer
lispc Jan 2, 2023
0950603
creating pk no longer needs vk; avoid assignment twice
lispc Jan 3, 2023
7a444d3
chore: switch to halo2curves 0.3.1 tag
jonathanpwang Jan 5, 2023
3370852
multi-phases: make phases related field public
xgaozoyoe Jan 9, 2023
7724ce2
Revert "optimize fft"
Velaciela Jan 11, 2023
d5a75d7
optimize parallel fft
Velaciela Jan 11, 2023
18af374
disable profile by default
lispc Jan 11, 2023
ac93e82
Merge remote-tracking branch 'scroll/xgao/multi-phase' into scroll-de…
lispc Jan 12, 2023
b050cd9
Merge remote-tracking branch 'scroll/parallel_fft_opt' into scroll-de…
lispc Jan 12, 2023
fe81922
Merge remote-tracking branch 'upstream/main' into feat/serde-raw
jonathanpwang Jan 16, 2023
607c3a4
feat: add enum `SerdeFormat` for user to select
jonathanpwang Jan 16, 2023
1a92fa8
fmt
lispc Jan 18, 2023
7a62a6b
add phase-check feature
lispc Jan 18, 2023
c7c72fd
allow later phase to assign prev phase columns
lispc Jan 20, 2023
d984f82
part-wise computation of extended h poly
spherel Jan 29, 2023
3b04a01
part-wise computation of extended h poly
spherel Jan 29, 2023
a2caa33
Merge branch 'scroll-mem-opt' of github.com:scroll-tech/halo2 into sc…
spherel Jan 29, 2023
e28317a
compute fixed_cosets and permutation_(product)_cosets when computing h
spherel Jan 29, 2023
b533a62
add benchmark for coeff_to_extended_parts
spherel Feb 2, 2023
d02aa10
Merge remote-tracking branch 'origin/main' into feat/tianyi/fft-mem-opt
lispc Feb 3, 2023
ffd33d7
fix conflicts; remove Infinity rand poly commitment
lispc Feb 3, 2023
68b5aab
test/mock-prover-values: MockProver exposes the generated columns to …
Feb 5, 2023
65fd377
change poseidon repo url
lispc Feb 8, 2023
df552be
make ParamsKZG.n public
lispc Feb 8, 2023
c9a9ab7
revert instance commitment in gwc; don't store selector values in vk …
lispc Feb 8, 2023
52246e1
Merge pull request #33 from scroll-tech/test/mock-prover-values
lispc Feb 13, 2023
49f4c58
reduce logging
lispc Feb 14, 2023
d292643
keep value.inner private to avoid being misused
lispc Feb 20, 2023
5689a74
test/unwrap_value: escape Value safety in the dev module (#34)
naure Feb 20, 2023
3b029f9
Merge remote-tracking branch 'axiom/feat/serde-raw' into scroll-dev-0220
zhenfeizhang Mar 6, 2023
3185d06
fix errors after sync with axiom's feat/serde_raw
zhenfeizhang Mar 6, 2023
f913a1a
upgrade to group/ff 0.13.0
zhenfeizhang Mar 8, 2023
4fdb7da
upgrade to group/ff 0.13.0 for halo2_gadgets
zhenfeizhang Mar 8, 2023
401e218
fix clippy
zhenfeizhang Mar 8, 2023
0ea1a1e
remove ff and group as dependencies
zhenfeizhang Mar 13, 2023
b7b4312
fix fieldext in examples
zhenfeizhang Mar 13, 2023
e072052
cargo fmt
zhenfeizhang Mar 14, 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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
with:
command: test
args: --verbose --release --all --all-features
if: ${{ false }}

fmt:
name: Rustfmt
Expand Down
12 changes: 12 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ members = [
"halo2_gadgets",
"halo2_proofs",
]


# remove once
# https://github.com/privacy-scaling-explorations/poseidon/pull/7
# https://github.com/privacy-scaling-explorations/halo2curves/pull/31
# are merged
[patch."https://github.com/privacy-scaling-explorations/poseidon.git"]
poseidon = { git = "https://github.com/scroll-tech/poseidon.git", branch = "halo2-ecc-snark-verifier-0220" }


[patch."https://github.com/privacy-scaling-explorations/halo2curves.git"]
halo2curves = { git = "https://github.com/scroll-tech/halo2curves.git", branch = "halo2-ecc-snark-verifier-0220" }
3 changes: 0 additions & 3 deletions halo2_gadgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
[dependencies]
arrayvec = "0.7.0"
bitvec = "1"
ff = "0.12"
group = "0.12"
halo2_proofs = { version = "0.2", path = "../halo2_proofs" }
lazy_static = "1"
halo2curves = { git = 'https://github.com/privacy-scaling-explorations/halo2curves', tag = '0.3.0' }
proptest = { version = "1.0.0", optional = true }
rand = "0.8"
subtle = "2.3"
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/benches/poseidon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ff::Field;
use halo2_proofs::curves::pasta::{pallas, vesta, EqAffine, Fp};
use halo2_proofs::ff::Field;
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
plonk::{
Expand All @@ -18,7 +19,6 @@ use halo2_proofs::{
Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer,
},
};
use halo2curves::pasta::{pallas, vesta, EqAffine, Fp};

use halo2_gadgets::poseidon::{
primitives::{self as poseidon, ConstantLength, Spec},
Expand Down
4 changes: 2 additions & 2 deletions halo2_gadgets/benches/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use ff::Field;
use halo2_gadgets::{
poseidon::primitives::{self as poseidon, ConstantLength, P128Pow5T3},
sinsemilla::primitives as sinsemilla,
};
use halo2_proofs::ff::Field;

use halo2curves::pasta::pallas;
use halo2_proofs::curves::pasta::pallas;
#[cfg(unix)]
use pprof::criterion::{Output, PProfProfiler};
use rand::{rngs::OsRng, Rng};
Expand Down
2 changes: 1 addition & 1 deletion halo2_gadgets/benches/sha256.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use halo2_proofs::curves::pasta::{pallas, EqAffine};
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
plonk::{create_proof, keygen_pk, keygen_vk, verify_proof, Circuit, ConstraintSystem, Error},
poly::commitment::Params,
transcript::{Blake2bRead, Blake2bWrite, Challenge255},
};
use halo2curves::pasta::{pallas, EqAffine};
use rand::rngs::OsRng;

use std::{
Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,15 @@ impl<C: CurveAffine, EccChip: EccInstructions<C>> FixedPointShort<C, EccChip> {

#[cfg(test)]
pub(crate) mod tests {
use ff::PrimeField;
use group::{prime::PrimeCurveAffine, Curve, Group};
use halo2_proofs::ff::PrimeField;
use halo2_proofs::group::{prime::PrimeCurveAffine, Curve, Group};

use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
dev::MockProver,
plonk::{Circuit, ConstraintSystem, Error},
};
use halo2curves::pasta::pallas;
use lazy_static::lazy_static;

use super::{
Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/ecc/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::{
};
use arrayvec::ArrayVec;

use ff::PrimeField;
use group::prime::PrimeCurveAffine;
use halo2_proofs::curves::{pasta::pallas, CurveAffine};
use halo2_proofs::ff::PrimeField;
use halo2_proofs::group::prime::PrimeCurveAffine;
use halo2_proofs::{
circuit::{AssignedCell, Chip, Layouter, Value},
plonk::{Advice, Assigned, Column, ConstraintSystem, Error, Fixed},
};
use halo2curves::{pasta::pallas, CurveAffine};

use std::convert::TryInto;

Expand Down
9 changes: 5 additions & 4 deletions halo2_gadgets/src/ecc/chip/add.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::EccPoint;
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::ff::PrimeField;
use halo2_proofs::{
circuit::Region,
plonk::{Advice, Assigned, Column, ConstraintSystem, Constraints, Error, Expression, Selector},
poly::Rotation,
};
use halo2curves::{pasta::pallas, FieldExt};
use std::collections::HashSet;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -323,7 +324,7 @@ impl Config {
#[cfg(test)]
// Check that the correct sum is obtained.
{
use group::Curve;
use halo2_proofs::group::Curve;

let p = p.point();
let q = q.point();
Expand All @@ -341,12 +342,12 @@ impl Config {

#[cfg(test)]
pub mod tests {
use group::{prime::PrimeCurveAffine, Curve};
use halo2_proofs::curves::{pasta::pallas, CurveExt};
use halo2_proofs::group::{prime::PrimeCurveAffine, Curve};
use halo2_proofs::{
circuit::{Layouter, Value},
plonk::Error,
};
use halo2curves::{pasta::pallas, CurveExt};

use crate::ecc::{chip::EccPoint, EccInstructions, NonIdentityPoint};

Expand Down
6 changes: 3 additions & 3 deletions halo2_gadgets/src/ecc/chip/add_incomplete.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::collections::HashSet;

use super::NonIdentityEccPoint;
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::{
circuit::Region,
plonk::{Advice, Column, ConstraintSystem, Constraints, Error, Selector},
poly::Rotation,
};
use halo2curves::pasta::pallas;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct Config {
Expand Down Expand Up @@ -147,12 +147,12 @@ impl Config {

#[cfg(test)]
pub mod tests {
use group::Curve;
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::group::Curve;
use halo2_proofs::{
circuit::{Layouter, Value},
plonk::Error,
};
use halo2curves::pasta::pallas;

use crate::ecc::{EccInstructions, NonIdentityPoint};

Expand Down
22 changes: 11 additions & 11 deletions halo2_gadgets/src/ecc/chip/constants.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! Constants required for the ECC chip.

use arrayvec::ArrayVec;
use group::{
use halo2_proofs::arithmetic::lagrange_interpolate;
use halo2_proofs::curves::{pasta::pallas, CurveAffine};
use halo2_proofs::group::{
ff::{Field, PrimeField},
Curve,
};
use halo2_proofs::arithmetic::lagrange_interpolate;
use halo2curves::{pasta::pallas, CurveAffine, FieldExt};

/// Window size for fixed-base scalar multiplication
pub const FIXED_BASE_WINDOW_SIZE: usize = 3;
Expand Down Expand Up @@ -61,7 +61,7 @@ fn compute_window_table<C: CurveAffine>(base: C, num_windows: usize) -> Vec<[C;
// Generate window table entries for the last window, w = `num_windows - 1`.
// For the last window, we compute [k * (2^3)^w - sum]B, where sum is defined
// as sum = \sum_{j = 0}^{`num_windows - 2`} 2^{3j+1}
let sum = (0..(num_windows - 1)).fold(C::Scalar::zero(), |acc, j| {
let sum = (0..(num_windows - 1)).fold(C::Scalar::ZERO, |acc, j| {
acc + C::Scalar::from(2).pow(&[FIXED_BASE_WINDOW_SIZE as u64 * j as u64 + 1, 0, 0, 0])
});
window_table.push(
Expand Down Expand Up @@ -181,7 +181,7 @@ pub fn test_lagrange_coeffs<C: CurveAffine>(base: C, num_windows: usize) {
.rev()
.cloned()
.reduce(|acc, coeff| acc * x + coeff)
.unwrap_or_else(C::Base::zero)
.unwrap_or(C::Base::ZERO)
}

let lagrange_coeffs = compute_lagrange_coeffs(base, num_windows);
Expand Down Expand Up @@ -213,7 +213,7 @@ pub fn test_lagrange_coeffs<C: CurveAffine>(base: C, num_windows: usize) {

// Compute the actual x-coordinate of the multiple [k * (8^84) - offset]B,
// where offset = \sum_{j = 0}^{83} 2^{3j+1}
let offset = (0..(num_windows - 1)).fold(C::Scalar::zero(), |acc, w| {
let offset = (0..(num_windows - 1)).fold(C::Scalar::ZERO, |acc, w| {
acc + C::Scalar::from(2).pow(&[FIXED_BASE_WINDOW_SIZE as u64 * w as u64 + 1, 0, 0, 0])
});
let scalar = C::Scalar::from(bits as u64)
Expand All @@ -229,19 +229,19 @@ pub fn test_lagrange_coeffs<C: CurveAffine>(base: C, num_windows: usize) {

#[cfg(test)]
mod tests {
use group::{ff::Field, Curve, Group};
use halo2curves::{pasta::pallas, CurveAffine, FieldExt};
use proptest::prelude::*;

use super::{compute_window_table, find_zs_and_us, test_lagrange_coeffs, H, NUM_WINDOWS};
use halo2_proofs::curves::{pasta::pallas, CurveAffine};
use halo2_proofs::ff::FromUniformBytes;
use halo2_proofs::group::{ff::Field, Curve, Group};
use proptest::prelude::*;

prop_compose! {
/// Generate an arbitrary Pallas point.
pub fn arb_point()(bytes in prop::array::uniform32(0u8..)) -> pallas::Point {
// Instead of rejecting out-of-range bytes, let's reduce them.
let mut buf = [0; 64];
buf[..32].copy_from_slice(&bytes);
let scalar = pallas::Scalar::from_bytes_wide(&buf);
let scalar = pallas::Scalar::from_uniform_bytes(&buf);
pallas::Point::generator() * scalar
}
}
Expand Down
23 changes: 11 additions & 12 deletions halo2_gadgets/src/ecc/chip/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ use std::{
ops::{Deref, Range},
};

use ff::PrimeField;
use halo2_proofs::ff::PrimeField;
use halo2_proofs::{
arithmetic::FieldExt,
circuit::{AssignedCell, Layouter, Region, Value},
plonk::{Advice, Assigned, Column, ConstraintSystem, Constraints, Error, Selector},
poly::Rotation,
};
use uint::construct_uint;

use halo2curves::pasta::pallas;
use halo2_proofs::curves::pasta::pallas;

mod complete;
pub(super) mod incomplete;
Expand Down Expand Up @@ -261,7 +260,7 @@ impl Config {
#[cfg(test)]
// Check that the correct multiple is obtained.
{
use group::Curve;
use halo2_proofs::group::Curve;

let base = base.point();
let alpha = alpha
Expand Down Expand Up @@ -389,8 +388,8 @@ impl Config {

#[derive(Clone, Debug)]
// `x`-coordinate of the accumulator.
struct X<F: FieldExt>(AssignedCell<Assigned<F>, F>);
impl<F: FieldExt> Deref for X<F> {
struct X<F: PrimeField>(AssignedCell<Assigned<F>, F>);
impl<F: PrimeField> Deref for X<F> {
type Target = AssignedCell<Assigned<F>, F>;

fn deref(&self) -> &Self::Target {
Expand All @@ -400,8 +399,8 @@ impl<F: FieldExt> Deref for X<F> {

#[derive(Clone, Debug)]
// `y`-coordinate of the accumulator.
struct Y<F: FieldExt>(AssignedCell<Assigned<F>, F>);
impl<F: FieldExt> Deref for Y<F> {
struct Y<F: PrimeField>(AssignedCell<Assigned<F>, F>);
impl<F: PrimeField> Deref for Y<F> {
type Target = AssignedCell<Assigned<F>, F>;

fn deref(&self) -> &Self::Target {
Expand All @@ -411,8 +410,8 @@ impl<F: FieldExt> Deref for Y<F> {

#[derive(Clone, Debug)]
// Cumulative sum `z` used to decompose the scalar.
struct Z<F: FieldExt>(AssignedCell<F, F>);
impl<F: FieldExt> Deref for Z<F> {
struct Z<F: PrimeField>(AssignedCell<F, F>);
impl<F: PrimeField> Deref for Z<F> {
type Target = AssignedCell<F, F>;

fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -461,15 +460,15 @@ fn decompose_for_scalar_mul(scalar: Value<&pallas::Base>) -> Vec<Value<bool>> {

#[cfg(test)]
pub mod tests {
use group::{
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::group::{
ff::{Field, PrimeField},
Curve,
};
use halo2_proofs::{
circuit::{Chip, Layouter, Value},
plonk::Error,
};
use halo2curves::pasta::pallas;
use rand::rngs::OsRng;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion halo2_gadgets/src/ecc/chip/mul/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use halo2_proofs::{
poly::Rotation,
};

use halo2curves::pasta::pallas;
use halo2_proofs::curves::pasta::pallas;

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct Config {
Expand Down
3 changes: 2 additions & 1 deletion halo2_gadgets/src/ecc/chip/mul/incomplete.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use super::super::NonIdentityEccPoint;
use super::{X, Y, Z};
use crate::utilities::bool_check;
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::ff::PrimeField;
use halo2_proofs::{
circuit::{Region, Value},
plonk::{
Advice, Column, ConstraintSystem, Constraints, Error, Expression, Selector, VirtualCells,
},
poly::Rotation,
};
use halo2curves::{pasta::pallas, FieldExt};

/// A helper struct for implementing single-row double-and-add using incomplete addition.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
Expand Down
5 changes: 2 additions & 3 deletions halo2_gadgets/src/ecc/chip/mul/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ use super::{T_Q, Z};
use crate::{
sinsemilla::primitives as sinsemilla, utilities::lookup_range_check::LookupRangeCheckConfig,
};

use halo2_proofs::circuit::AssignedCell;
use halo2_proofs::curves::pasta::pallas;
use halo2_proofs::ff::PrimeField;
use halo2_proofs::{
circuit::Layouter,
plonk::{Advice, Assigned, Column, ConstraintSystem, Constraints, Error, Expression, Selector},
poly::Rotation,
};

use halo2curves::{pasta::pallas, FieldExt};

use std::iter;

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
Expand Down
Loading