pub trait PolynomialCommitment<F: PrimeField, P: Polynomial<F>, S: CryptographicSponge>: Sized {
type UniversalParams: PCUniversalParams;
type CommitterKey: PCCommitterKey;
type VerifierKey: PCVerifierKey;
type PreparedVerifierKey: PCPreparedVerifierKey<Self::VerifierKey> + Clone;
type Commitment: PCCommitment + Default;
type PreparedCommitment: PCPreparedCommitment<Self::Commitment>;
type Randomness: PCRandomness;
type Proof: Clone;
type BatchProof: Clone + From<Vec<Self::Proof>> + Into<Vec<Self::Proof>> + CanonicalSerialize + CanonicalDeserialize;
type Error: Error + From<Error>;
// Required methods
fn setup<R: RngCore>(
max_degree: usize,
num_vars: Option<usize>,
rng: &mut R
) -> Result<Self::UniversalParams, Self::Error>;
fn trim(
pp: &Self::UniversalParams,
supported_degree: usize,
supported_hiding_bound: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>;
fn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>
where P: 'a;
fn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: &'a P::Point,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Self::Error>
where P: 'a,
Self::Randomness: 'a,
Self::Commitment: 'a;
fn check<'a>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: &'a P::Point,
values: impl IntoIterator<Item = F>,
proof: &Self::Proof,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: Option<&mut dyn RngCore>
) -> Result<bool, Self::Error>
where Self::Commitment: 'a;
// Provided methods
fn batch_check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
evaluations: &Evaluations<P::Point, F>,
proof: &Self::BatchProof,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: &mut R
) -> Result<bool, Self::Error>
where Self::Commitment: 'a { ... }
fn open_combinations<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<F, Self::BatchProof>, Self::Error>
where Self::Randomness: 'a,
Self::Commitment: 'a,
P: 'a { ... }
fn check_combinations<'a, R: RngCore>(
vk: &Self::VerifierKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
eqn_query_set: &QuerySet<P::Point>,
eqn_evaluations: &Evaluations<P::Point, F>,
proof: &BatchLCProof<F, Self::BatchProof>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: &mut R
) -> Result<bool, Self::Error>
where Self::Commitment: 'a { ... }
fn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::BatchProof, Self::Error>
where P: 'a,
Self::Randomness: 'a,
Self::Commitment: 'a { ... }
}
Expand description
Describes the interface for a polynomial commitment scheme that allows
a sender to commit to multiple polynomials and later provide a succinct proof
of evaluation for the corresponding commitments at a query set Q
, while
enforcing per-polynomial degree bounds.
Required Associated Types§
sourcetype UniversalParams: PCUniversalParams
type UniversalParams: PCUniversalParams
The universal parameters for the commitment scheme. These are “trimmed”
down to Self::CommitterKey
and Self::VerifierKey
by Self::trim
.
sourcetype CommitterKey: PCCommitterKey
type CommitterKey: PCCommitterKey
The committer key for the scheme; used to commit to a polynomial and then open the commitment to produce an evaluation proof.
sourcetype VerifierKey: PCVerifierKey
type VerifierKey: PCVerifierKey
The verifier key for the scheme; used to check an evaluation proof.
sourcetype PreparedVerifierKey: PCPreparedVerifierKey<Self::VerifierKey> + Clone
type PreparedVerifierKey: PCPreparedVerifierKey<Self::VerifierKey> + Clone
The prepared verifier key for the scheme; used to check an evaluation proof.
sourcetype Commitment: PCCommitment + Default
type Commitment: PCCommitment + Default
The commitment to a polynomial.
sourcetype PreparedCommitment: PCPreparedCommitment<Self::Commitment>
type PreparedCommitment: PCPreparedCommitment<Self::Commitment>
The prepared commitment to a polynomial.
sourcetype Randomness: PCRandomness
type Randomness: PCRandomness
The commitment randomness.
sourcetype BatchProof: Clone + From<Vec<Self::Proof>> + Into<Vec<Self::Proof>> + CanonicalSerialize + CanonicalDeserialize
type BatchProof: Clone + From<Vec<Self::Proof>> + Into<Vec<Self::Proof>> + CanonicalSerialize + CanonicalDeserialize
The evaluation proof for a query set.
Required Methods§
sourcefn setup<R: RngCore>(
max_degree: usize,
num_vars: Option<usize>,
rng: &mut R
) -> Result<Self::UniversalParams, Self::Error>
fn setup<R: RngCore>( max_degree: usize, num_vars: Option<usize>, rng: &mut R ) -> Result<Self::UniversalParams, Self::Error>
Constructs public parameters when given as input the maximum degree degree
for the polynomial commitment scheme. num_vars
specifies the number of
variables for multivariate setup
sourcefn trim(
pp: &Self::UniversalParams,
supported_degree: usize,
supported_hiding_bound: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>
fn trim( pp: &Self::UniversalParams, supported_degree: usize, supported_hiding_bound: usize, enforced_degree_bounds: Option<&[usize]> ) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>
Specializes the public parameters for polynomials up to the given supported_degree
and for enforcing degree bounds in the range 1..=supported_degree
.
sourcefn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>where
P: 'a,
fn commit<'a>( ck: &Self::CommitterKey, polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, rng: Option<&mut dyn RngCore> ) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>where P: 'a,
Outputs a commitments to polynomials
. If polynomials[i].is_hiding()
,
then the i
-th commitment is hiding up to polynomials.hiding_bound()
queries.
rng
should not be None
if polynomials[i].is_hiding() == true
for any i
.
If for some i
, polynomials[i].is_hiding() == false
, then the
corresponding randomness is Self::Randomness::empty()
.
If for some i
, polynomials[i].degree_bound().is_some()
, then that
polynomial will have the corresponding degree bound enforced.
sourcefn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: &'a P::Point,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Self::Error>where
P: 'a,
Self::Randomness: 'a,
Self::Commitment: 'a,
fn open<'a>( ck: &Self::CommitterKey, labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, point: &'a P::Point, challenge_generator: &mut ChallengeGenerator<F, S>, rands: impl IntoIterator<Item = &'a Self::Randomness>, rng: Option<&mut dyn RngCore> ) -> Result<Self::Proof, Self::Error>where P: 'a, Self::Randomness: 'a, Self::Commitment: 'a,
open but with individual challenges
sourcefn check<'a>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: &'a P::Point,
values: impl IntoIterator<Item = F>,
proof: &Self::Proof,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: Option<&mut dyn RngCore>
) -> Result<bool, Self::Error>where
Self::Commitment: 'a,
fn check<'a>( vk: &Self::VerifierKey, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, point: &'a P::Point, values: impl IntoIterator<Item = F>, proof: &Self::Proof, challenge_generator: &mut ChallengeGenerator<F, S>, rng: Option<&mut dyn RngCore> ) -> Result<bool, Self::Error>where Self::Commitment: 'a,
check but with individual challenges
Provided Methods§
sourcefn batch_check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
evaluations: &Evaluations<P::Point, F>,
proof: &Self::BatchProof,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: &mut R
) -> Result<bool, Self::Error>where
Self::Commitment: 'a,
fn batch_check<'a, R: RngCore>( vk: &Self::VerifierKey, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, query_set: &QuerySet<P::Point>, evaluations: &Evaluations<P::Point, F>, proof: &Self::BatchProof, challenge_generator: &mut ChallengeGenerator<F, S>, rng: &mut R ) -> Result<bool, Self::Error>where Self::Commitment: 'a,
batch_check but with individual challenges
sourcefn open_combinations<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<F, Self::BatchProof>, Self::Error>where
Self::Randomness: 'a,
Self::Commitment: 'a,
P: 'a,
fn open_combinations<'a>( ck: &Self::CommitterKey, linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>, polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, query_set: &QuerySet<P::Point>, challenge_generator: &mut ChallengeGenerator<F, S>, rands: impl IntoIterator<Item = &'a Self::Randomness>, rng: Option<&mut dyn RngCore> ) -> Result<BatchLCProof<F, Self::BatchProof>, Self::Error>where Self::Randomness: 'a, Self::Commitment: 'a, P: 'a,
open_combinations but with individual challenges
sourcefn check_combinations<'a, R: RngCore>(
vk: &Self::VerifierKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
eqn_query_set: &QuerySet<P::Point>,
eqn_evaluations: &Evaluations<P::Point, F>,
proof: &BatchLCProof<F, Self::BatchProof>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rng: &mut R
) -> Result<bool, Self::Error>where
Self::Commitment: 'a,
fn check_combinations<'a, R: RngCore>( vk: &Self::VerifierKey, linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, eqn_query_set: &QuerySet<P::Point>, eqn_evaluations: &Evaluations<P::Point, F>, proof: &BatchLCProof<F, Self::BatchProof>, challenge_generator: &mut ChallengeGenerator<F, S>, rng: &mut R ) -> Result<bool, Self::Error>where Self::Commitment: 'a,
check_combinations with individual challenges
sourcefn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<P::Point>,
challenge_generator: &mut ChallengeGenerator<F, S>,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::BatchProof, Self::Error>where
P: 'a,
Self::Randomness: 'a,
Self::Commitment: 'a,
fn batch_open<'a>( ck: &Self::CommitterKey, labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F, P>>, commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>, query_set: &QuerySet<P::Point>, challenge_generator: &mut ChallengeGenerator<F, S>, rands: impl IntoIterator<Item = &'a Self::Randomness>, rng: Option<&mut dyn RngCore> ) -> Result<Self::BatchProof, Self::Error>where P: 'a, Self::Randomness: 'a, Self::Commitment: 'a,
batch_open with individual challenges