diff --git a/halo2_proofs/src/poly/query.rs b/halo2_proofs/src/poly/query.rs index b9894edd38..233dc84f23 100644 --- a/halo2_proofs/src/poly/query.rs +++ b/halo2_proofs/src/poly/query.rs @@ -19,12 +19,26 @@ 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, +} + +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)] @@ -81,12 +95,31 @@ 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, 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> {