From 8e62ca332c11609d661a517f8f44d421b6bb255e Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Thu, 1 Feb 2024 15:20:09 +0800 Subject: [PATCH] simplify trait bound --- snark-verifier/src/pcs/kzg/decider.rs | 10 +++------- snark-verifier/src/pcs/kzg/multiopen/bdfg21.rs | 9 +++++---- snark-verifier/src/pcs/kzg/multiopen/gwc19.rs | 9 ++++----- snark-verifier/src/system/halo2/test/kzg.rs | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/snark-verifier/src/pcs/kzg/decider.rs b/snark-verifier/src/pcs/kzg/decider.rs index bd2d8f5e..a39ca1ae 100644 --- a/snark-verifier/src/pcs/kzg/decider.rs +++ b/snark-verifier/src/pcs/kzg/decider.rs @@ -132,9 +132,9 @@ mod evm { impl AccumulationDecider> for KzgAs where M: MultiMillerLoop, - M::G1Affine: CurveAffine, + M::Fr: PrimeField, + M::G1Affine: CurveAffine, M::G2Affine: CurveAffine, - ::ScalarExt: PrimeField, MOS: Clone + Debug, { type DecidingKey = KzgDecidingKey; @@ -183,11 +183,7 @@ mod evm { loader.code_mut().runtime_append(code); let challenge = loader.scalar(Value::Memory(challenge_ptr)); - let powers_of_challenge = - LoadedScalar::<::ScalarExt>::powers( - &challenge, - lhs.len(), - ); + let powers_of_challenge = LoadedScalar::::powers(&challenge, lhs.len()); let [lhs, rhs] = [lhs, rhs].map(|msms| { msms.iter() .zip(powers_of_challenge.iter()) diff --git a/snark-verifier/src/pcs/kzg/multiopen/bdfg21.rs b/snark-verifier/src/pcs/kzg/multiopen/bdfg21.rs index 7c2313b5..0321d4ad 100644 --- a/snark-verifier/src/pcs/kzg/multiopen/bdfg21.rs +++ b/snark-verifier/src/pcs/kzg/multiopen/bdfg21.rs @@ -1,4 +1,4 @@ -use halo2_curves::{ff::PrimeField, group::prime::PrimeCurveAffine}; +use halo2_curves::ff::PrimeField; use crate::{ cost::{Cost, CostEstimation}, @@ -29,7 +29,8 @@ pub struct Bdfg21; impl PolynomialCommitmentScheme for KzgAs where M: MultiMillerLoop, - M::G1Affine: CurveAffine, + M::Fr: Ord, + M::G1Affine: CurveAffine, L: Loader, { type VerifyingKey = KzgSuccinctVerifyingKey; @@ -38,7 +39,7 @@ where fn read_proof( _: &KzgSuccinctVerifyingKey, - _: &[Query<::Scalar>], + _: &[Query], transcript: &mut T, ) -> Result, Error> where @@ -51,7 +52,7 @@ where svk: &KzgSuccinctVerifyingKey, commitments: &[Msm], z: &L::LoadedScalar, - queries: &[Query<::Scalar, L::LoadedScalar>], + queries: &[Query], proof: &Bdfg21Proof, ) -> Result { let sets = query_sets(queries); diff --git a/snark-verifier/src/pcs/kzg/multiopen/gwc19.rs b/snark-verifier/src/pcs/kzg/multiopen/gwc19.rs index aa5b800b..54cf8b3a 100644 --- a/snark-verifier/src/pcs/kzg/multiopen/gwc19.rs +++ b/snark-verifier/src/pcs/kzg/multiopen/gwc19.rs @@ -1,5 +1,3 @@ -use halo2_curves::group::prime::PrimeCurveAffine; - use crate::{ cost::{Cost, CostEstimation}, loader::{LoadedScalar, Loader}, @@ -25,7 +23,8 @@ pub struct Gwc19; impl PolynomialCommitmentScheme for KzgAs where M: MultiMillerLoop, - M::G1Affine: CurveAffine, + M::Fr: Ord, + M::G1Affine: CurveAffine, L: Loader, { type VerifyingKey = KzgSuccinctVerifyingKey; @@ -34,7 +33,7 @@ where fn read_proof( _: &Self::VerifyingKey, - queries: &[Query<::Scalar>], + queries: &[Query], transcript: &mut T, ) -> Result where @@ -47,7 +46,7 @@ where svk: &Self::VerifyingKey, commitments: &[Msm], z: &L::LoadedScalar, - queries: &[Query<::Scalar, L::LoadedScalar>], + queries: &[Query], proof: &Self::Proof, ) -> Result { let sets = query_sets(queries); diff --git a/snark-verifier/src/system/halo2/test/kzg.rs b/snark-verifier/src/system/halo2/test/kzg.rs index 6528a822..7b5ee136 100644 --- a/snark-verifier/src/system/halo2/test/kzg.rs +++ b/snark-verifier/src/system/halo2/test/kzg.rs @@ -30,7 +30,7 @@ where pub fn main_gate_with_range_with_mock_kzg_accumulator< C: CurveAffine, M: MultiMillerLoop, ->() -> MainGateWithRange<::ScalarExt> +>() -> MainGateWithRange where M::G2Affine: CurveAffine + SerdeObject, M::G1Affine: CurveAffine + SerdeObject,