Skip to content

Commit

Permalink
move ZAL to middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
mratsim committed Feb 19, 2024
1 parent 6d19779 commit 3c2c652
Show file tree
Hide file tree
Showing 32 changed files with 272 additions and 36 deletions.
2 changes: 1 addition & 1 deletion halo2_backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
backtrace = { version = "0.3", optional = true }
ff = "0.13"
group = "0.13"
halo2curves = { git = 'https://github.com/taikoxyz/halo2curves', branch = "pr-pse-exec-engine", default-features = false }
halo2curves = { version = "0.6.0", default-features = false }
rand_core = { version = "0.6", default-features = false }
tracing = "0.1"
blake2b_simd = "1" # MSRV 1.66.0
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use group::Curve;
use halo2_middleware::ff::{Field, FromUniformBytes};
use halo2curves::zal::H2cEngine;
use halo2_middleware::zal::impls::H2cEngine;

use super::{evaluation::Evaluator, permutation, Polynomial, ProvingKey, VerifyingKey};
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/lookup/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use halo2_common::plonk::{
};
use halo2_middleware::ff::WithSmallOrderMulGroup;
use halo2_middleware::poly::Rotation;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_core::RngCore;
use std::{
collections::BTreeMap,
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/permutation/keygen.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use group::Curve;
use halo2_middleware::ff::{Field, PrimeField};
use halo2curves::zal::H2cEngine;
use halo2_middleware::zal::impls::H2cEngine;

use super::{Argument, ProvingKey, VerifyingKey};
use crate::{
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/permutation/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use group::{
Curve,
};
use halo2_middleware::ff::PrimeField;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_core::RngCore;
use std::iter::{self, ExactSizeIterator};

Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/prover.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use group::Curve;
use halo2_middleware::ff::{Field, FromUniformBytes, WithSmallOrderMulGroup};
use halo2curves::zal::{H2cEngine, MsmAccel};
use halo2_middleware::zal::{impls::H2cEngine, traits::MsmAccel};
use rand_core::RngCore;
use std::collections::{BTreeSet, HashSet};
use std::{collections::HashMap, iter};
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/shuffle/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use group::{ff::BatchInvert, Curve};
use halo2_common::plonk::{ChallengeGamma, ChallengeTheta, ChallengeX, Error, Expression};
use halo2_middleware::ff::WithSmallOrderMulGroup;
use halo2_middleware::poly::Rotation;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_core::RngCore;
use std::{
iter,
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/vanishing/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{collections::HashMap, iter};
use group::Curve;
use halo2_common::plonk::{ChallengeX, Error};
use halo2_middleware::ff::Field;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_chacha::ChaCha20Rng;
use rand_core::{RngCore, SeedableRng};

Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use halo2_common::plonk::{
ChallengeBeta, ChallengeGamma, ChallengeTheta, ChallengeX, ChallengeY, Error,
};
use halo2_middleware::ff::{Field, FromUniformBytes, WithSmallOrderMulGroup};
use halo2curves::zal::H2cEngine;
use halo2_middleware::zal::impls::H2cEngine;
use std::iter;

use super::{vanishing, VerifyingKey};
Expand Down
3 changes: 2 additions & 1 deletion halo2_backend/src/plonk/verifier/batch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use group::ff::Field;
use halo2_common::plonk::Error;
use halo2_middleware::ff::FromUniformBytes;
use halo2curves::{zal::H2cEngine, CurveAffine};
use halo2_middleware::zal::impls::H2cEngine;
use halo2curves::CurveAffine;
use rand_core::OsRng;

use super::{verify_proof, VerificationStrategy};
Expand Down
6 changes: 2 additions & 4 deletions halo2_backend/src/poly/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use super::{
use crate::poly::Error;
use crate::transcript::{EncodedChallenge, TranscriptRead, TranscriptWrite};
use halo2_middleware::ff::Field;
use halo2curves::{
zal::{H2cEngine, MsmAccel},
CurveAffine,
};
use halo2_middleware::zal::{impls::H2cEngine, traits::MsmAccel};
use halo2curves::CurveAffine;
use rand_core::RngCore;
use std::{
fmt::Debug,
Expand Down
4 changes: 2 additions & 2 deletions halo2_backend/src/poly/ipa/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::poly::ipa::msm::MSMIPA;
use crate::poly::{Coeff, LagrangeCoeff, Polynomial};

use group::{Curve, Group};
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use std::marker::PhantomData;

mod prover;
Expand Down Expand Up @@ -243,7 +243,7 @@ mod test {

use group::Curve;
use halo2_middleware::ff::Field;
use halo2curves::zal::H2cEngine;
use halo2_middleware::zal::impls::H2cEngine;

#[test]
fn test_commit_lagrange_epaffine() {
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/ipa/commitment/prover.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use halo2_middleware::ff::Field;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_core::RngCore;

use super::ParamsIPA;
Expand Down
4 changes: 2 additions & 2 deletions halo2_backend/src/poly/ipa/msm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::arithmetic::CurveAffine;
use crate::poly::{commitment::MSM, ipa::commitment::ParamsVerifierIPA};
use group::Group;
use halo2_middleware::ff::Field;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use std::collections::BTreeMap;

/// A multiscalar multiplication in the polynomial commitment scheme
Expand Down Expand Up @@ -222,9 +222,9 @@ mod tests {
commitment::{ParamsProver, MSM},
ipa::{commitment::ParamsIPA, msm::MSMIPA},
};
use halo2_middleware::zal::impls::H2cEngine;
use halo2curves::{
pasta::{Ep, EpAffine, Fp, Fq},
zal::H2cEngine,
CurveAffine,
};

Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/ipa/multiopen/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::transcript::{EncodedChallenge, TranscriptWrite};

use group::Curve;
use halo2_middleware::ff::Field;
use halo2curves::zal::MsmAccel;
use halo2_middleware::zal::traits::MsmAccel;
use rand_core::RngCore;
use std::io;
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/ipa/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
};
use group::Curve;
use halo2_middleware::ff::Field;
use halo2curves::zal::{H2cEngine, MsmAccel};
use halo2_middleware::zal::{impls::H2cEngine, traits::MsmAccel};
use halo2curves::CurveAffine;
use rand_core::OsRng;

Expand Down
4 changes: 2 additions & 2 deletions halo2_backend/src/poly/kzg/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::SerdeFormat;

use group::{prime::PrimeCurveAffine, Curve, Group};
use halo2_middleware::ff::{Field, PrimeField};
use halo2_middleware::zal::traits::MsmAccel;
use halo2curves::pairing::Engine;
use halo2curves::zal::MsmAccel;
use rand_core::{OsRng, RngCore};
use std::fmt::Debug;
use std::marker::PhantomData;
Expand Down Expand Up @@ -376,7 +376,7 @@ mod test {
use crate::poly::commitment::{Blind, Params};
use crate::poly::kzg::commitment::ParamsKZG;
use halo2_middleware::ff::Field;
use halo2curves::zal::H2cEngine;
use halo2_middleware::zal::impls::H2cEngine;

#[test]
fn test_commit_lagrange() {
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/kzg/msm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::fmt::Debug;
use super::commitment::ParamsKZG;
use crate::{arithmetic::parallelize, poly::commitment::MSM};
use group::{Curve, Group};
use halo2_middleware::zal::traits::MsmAccel;
use halo2curves::{
pairing::{Engine, MillerLoopResult, MultiMillerLoop},
zal::MsmAccel,
CurveAffine, CurveExt,
};

Expand Down
3 changes: 2 additions & 1 deletion halo2_backend/src/poly/kzg/multiopen/gwc/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use crate::poly::{commitment::Blind, Polynomial};
use crate::transcript::{EncodedChallenge, TranscriptWrite};

use group::Curve;
use halo2_middleware::zal::traits::MsmAccel;
use halo2curves::pairing::Engine;
use halo2curves::CurveExt;
use halo2curves::{pairing::Engine, zal::MsmAccel};
use rand_core::RngCore;
use std::fmt::Debug;
use std::io;
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/kzg/multiopen/shplonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use crate::transcript::{EncodedChallenge, TranscriptWrite};
use crate::multicore::{IntoParallelIterator, ParallelIterator};
use group::Curve;
use halo2_middleware::ff::Field;
use halo2_middleware::zal::traits::MsmAccel;
use halo2curves::pairing::Engine;
use halo2curves::zal::MsmAccel;
use halo2curves::CurveExt;
use rand_core::RngCore;
use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/kzg/strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use crate::{
},
};
use halo2_middleware::ff::Field;
use halo2_middleware::zal::impls::H2cEngine;
use halo2curves::{
pairing::{Engine, MultiMillerLoop},
zal::H2cEngine,
CurveAffine, CurveExt,
};
use rand_core::OsRng;
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/poly/multiopen_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod test {
};
use group::Curve;
use halo2_middleware::ff::WithSmallOrderMulGroup;
use halo2curves::zal::{H2cEngine, MsmAccel};
use halo2_middleware::zal::{impls::H2cEngine, traits::MsmAccel};
use rand_core::OsRng;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion halo2_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
[dependencies]
backtrace = { version = "0.3", optional = true }
group = "0.13"
halo2curves = { git = 'https://github.com/taikoxyz/halo2curves', branch = "pr-pse-exec-engine", default-features = false }
halo2curves = { version = "0.6.0", default-features = false }
rand_core = { version = "0.6", default-features = false }
blake2b_simd = "1" # MSRV 1.66.0
sha3 = "0.9.1"
Expand Down
2 changes: 1 addition & 1 deletion halo2_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]
backtrace = { version = "0.3", optional = true }
ff = "0.13"
group = "0.13"
halo2curves = { git = 'https://github.com/taikoxyz/halo2curves', branch = "pr-pse-exec-engine", default-features = false }
halo2curves = { version = "0.6.0", default-features = false }
tracing = "0.1"
blake2b_simd = "1" # MSRV 1.66.0
serde = { version = "1", optional = true, features = ["derive"] }
Expand Down
4 changes: 3 additions & 1 deletion halo2_middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ rustdoc-args = ["--cfg", "docsrs", "--html-in-header", "katex-header.html"]

[dependencies]
ff = "0.13"
halo2curves = { version = "0.6.0", default-features = false }
serde = { version = "1", optional = true, features = ["derive"] }
serde_derive = { version = "1", optional = true}
rayon = "1.8"

[dev-dependencies]
ark-std = { version = "0.3" }
proptest = "1"
group = "0.13"
halo2curves = { git = 'https://github.com/taikoxyz/halo2curves', branch = "pr-pse-exec-engine", default-features = false }
rand_core = { version = "0.6", default-features = false }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
getrandom = { version = "0.2", features = ["js"] }
Expand Down
1 change: 1 addition & 0 deletions halo2_middleware/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ pub mod metadata;
pub mod permutation;
pub mod poly;
pub mod shuffle;
pub mod zal;

pub use ff;
Loading

0 comments on commit 3c2c652

Please sign in to comment.