Skip to content

Commit

Permalink
Add method to create new instance of ProverQuery and VerifierQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
chiro-hiro committed Nov 18, 2023
1 parent 4d11a0a commit 47fe617
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions halo2_proofs/src/poly/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ pub struct ProverQuery<'com, C: CurveAffine> {
pub blind: Blind<C::Scalar>,
}

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<C::Scalar, Coeff>,
blind: Blind<C::Scalar>,
) -> Self {
ProverQuery { point, poly, blind }
}
}

#[doc(hidden)]
#[derive(Copy, Clone)]
pub struct PolynomialPointer<'com, C: CurveAffine> {
Expand Down Expand Up @@ -89,6 +103,25 @@ pub struct VerifierQuery<'com, C: CurveAffine, M: MSM<C>> {
pub eval: C::Scalar,
}

impl<'com, C, M> VerifierQuery<'com, C, M>
where
C: CurveAffine,
M: MSM<C>,
{
/// 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<C>> Clone for VerifierQuery<'com, C, M> {
fn clone(&self) -> Self {
Self {
Expand Down

0 comments on commit 47fe617

Please sign in to comment.