Skip to content

Commit

Permalink
Merge pull request #1 from orochi-network/feature/publish_properties_…
Browse files Browse the repository at this point in the history
…of_query

Publish properties of `ProverQuery` and `VerifierQuery` to external
  • Loading branch information
chiro-hiro authored Nov 18, 2023
2 parents 324c886 + 47fe617 commit bb57084
Showing 1 changed file with 45 additions and 12 deletions.
57 changes: 45 additions & 12 deletions halo2_proofs/src/poly/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,26 @@ pub trait Query<F>: 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<C::Scalar, Coeff>,
/// blinding factor of polynomial
pub(crate) blind: Blind<C::Scalar>,
/// Point at which polynomial is queried
pub point: C::Scalar,
/// Coefficients of polynomial
pub poly: &'com Polynomial<C::Scalar, Coeff>,
/// Blinding factor of polynomial
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)]
Expand Down Expand Up @@ -81,12 +95,31 @@ impl<'com, C: CurveAffine, M: MSM<C>> VerifierQuery<'com, C, M> {
/// A polynomial query at a point
#[derive(Debug)]
pub struct VerifierQuery<'com, C: CurveAffine, M: MSM<C>> {
/// 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<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> {
Expand Down

0 comments on commit bb57084

Please sign in to comment.