Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish necessary properties for external use of KZG commitment #232

Merged
merged 5 commits into from
Nov 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 37 additions & 14 deletions halo2_proofs/src/poly/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,30 @@ pub trait Query<F>: Sized + Clone + Send + Sync {
}

/// A polynomial query at a point
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy)]
pub struct ProverQuery<'com, C: CurveAffine> {
/// point at which polynomial is queried
/// Point at which polynomial is queried
pub(crate) point: C::Scalar,
/// coefficients of polynomial
/// Coefficients of polynomial
pub(crate) poly: &'com Polynomial<C::Scalar, Coeff>,
/// blinding factor of polynomial
/// Blinding factor of polynomial
pub(crate) 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(
chiro-hiro marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -79,22 +93,31 @@ impl<'com, C: CurveAffine, M: MSM<C>> VerifierQuery<'com, C, M> {
}

/// A polynomial query at a point
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct VerifierQuery<'com, C: CurveAffine, M: MSM<C>> {
/// point at which polynomial is queried
/// Point at which polynomial is queried
pub(crate) point: C::Scalar,
/// commitment to polynomial
/// Commitment to polynomial
pub(crate) commitment: CommitmentReference<'com, C, M>,
/// evaluation of polynomial at query point
/// Evaluation of polynomial at query point
pub(crate) eval: C::Scalar,
}

impl<'com, C: CurveAffine, M: MSM<C>> Clone for VerifierQuery<'com, C, M> {
chiro-hiro marked this conversation as resolved.
Show resolved Hide resolved
fn clone(&self) -> Self {
Self {
point: self.point,
commitment: self.commitment,
eval: self.eval,
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(
chiro-hiro marked this conversation as resolved.
Show resolved Hide resolved
point: C::Scalar,
commitment: CommitmentReference<'com, C, M>,
eval: C::Scalar,
) -> Self {
VerifierQuery {
point,
commitment,
eval,
}
}
}
Expand Down
Loading