From 4d11a0a03a1c8a2686fa213b9e33144238861a20 Mon Sep 17 00:00:00 2001 From: Chiro Hiro Date: Sat, 18 Nov 2023 10:15:08 +0300 Subject: [PATCH 1/2] Publish properties of `ProverQuery` and `VerifierQuery` to external --- halo2_proofs/src/poly/query.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/halo2_proofs/src/poly/query.rs b/halo2_proofs/src/poly/query.rs index b9894edd38..5034652de2 100644 --- a/halo2_proofs/src/poly/query.rs +++ b/halo2_proofs/src/poly/query.rs @@ -19,12 +19,12 @@ pub trait Query: Sized + Clone + Send + Sync { /// A polynomial query at a point #[derive(Debug, Clone)] pub struct ProverQuery<'com, C: CurveAffine> { - /// point at which polynomial is queried - pub(crate) point: C::Scalar, - /// coefficients of polynomial - pub(crate) poly: &'com Polynomial, - /// blinding factor of polynomial - pub(crate) blind: Blind, + /// Point at which polynomial is queried + pub point: C::Scalar, + /// Coefficients of polynomial + pub poly: &'com Polynomial, + /// Blinding factor of polynomial + pub blind: Blind, } #[doc(hidden)] @@ -81,12 +81,12 @@ impl<'com, C: CurveAffine, M: MSM> VerifierQuery<'com, C, M> { /// A polynomial query at a point #[derive(Debug)] pub struct VerifierQuery<'com, C: CurveAffine, M: MSM> { - /// point at which polynomial is queried - pub(crate) point: C::Scalar, - /// commitment to polynomial - pub(crate) commitment: CommitmentReference<'com, C, M>, - /// evaluation of polynomial at query point - pub(crate) eval: C::Scalar, + /// Point at which polynomial is queried + pub point: C::Scalar, + /// Commitment to polynomial + pub commitment: CommitmentReference<'com, C, M>, + /// Evaluation of polynomial at query point + pub eval: C::Scalar, } impl<'com, C: CurveAffine, M: MSM> Clone for VerifierQuery<'com, C, M> { From 47fe617527ec159eef3f9f13a8f24f0e6982e5fd Mon Sep 17 00:00:00 2001 From: Chiro Hiro Date: Sat, 18 Nov 2023 10:31:52 +0300 Subject: [PATCH 2/2] Add method to create new instance of `ProverQuery` and `VerifierQuery` --- halo2_proofs/src/poly/query.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/halo2_proofs/src/poly/query.rs b/halo2_proofs/src/poly/query.rs index 5034652de2..233dc84f23 100644 --- a/halo2_proofs/src/poly/query.rs +++ b/halo2_proofs/src/poly/query.rs @@ -27,6 +27,20 @@ pub struct ProverQuery<'com, C: CurveAffine> { pub blind: Blind, } +impl<'com, C> ProverQuery<'com, C> +where + C: CurveAffine, +{ + /// Create a new prover query based on a polynomial + pub fn new( + point: C::Scalar, + poly: &'com Polynomial, + blind: Blind, + ) -> Self { + ProverQuery { point, poly, blind } + } +} + #[doc(hidden)] #[derive(Copy, Clone)] pub struct PolynomialPointer<'com, C: CurveAffine> { @@ -89,6 +103,25 @@ pub struct VerifierQuery<'com, C: CurveAffine, M: MSM> { pub eval: C::Scalar, } +impl<'com, C, M> VerifierQuery<'com, C, M> +where + C: CurveAffine, + M: MSM, +{ + /// Create a new verifier query based on a commitment + pub fn new( + point: C::Scalar, + commitment: CommitmentReference<'com, C, M>, + eval: C::Scalar, + ) -> Self { + VerifierQuery { + point, + commitment, + eval, + } + } +} + impl<'com, C: CurveAffine, M: MSM> Clone for VerifierQuery<'com, C, M> { fn clone(&self) -> Self { Self {