pub trait PolynomialCommitment<F: PrimeField, CF: PrimeField>: Sized + Clone + Debug + PartialEq + Eq {
type UniversalParams: PCUniversalParams + Clone;
type CommitterKey: PCCommitterKey + ToBytes + FromBytes + Clone + Send + Sync;
type VerifierKey: PCVerifierKey + Prepare<Self::PreparedVerifierKey> + ToConstraintField<CF> + Clone + Send + Sync;
type PreparedVerifierKey: Clone;
type Commitment: PCCommitment + Prepare<Self::PreparedCommitment> + ToConstraintField<CF> + ToMinimalBits + Clone + Debug + PartialEq + Eq + Send + Sync;
type PreparedCommitment: Clone;
type Randomness: PCRandomness + Clone + Send + Sync;
type Proof: PCProof + Clone + Sync + Send;
type BatchProof: CanonicalSerialize + CanonicalDeserialize + Clone + PCProof + From<Vec<Self::Proof>> + Into<Vec<Self::Proof>> + PartialEq + Eq + Debug + Send + Sync;
fn setup<R: RngCore>(
max_degree: usize,
rng: &mut R
) -> Result<Self::UniversalParams, Error>;
fn trim(
parameters: &Self::UniversalParams,
supported_degree: usize,
supported_hiding_bound: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Error>;
fn commit_with_terminator<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
terminator: &AtomicBool,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error>;
fn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Error>
where
Self::Randomness: 'a,
Self::Commitment: 'a;
fn check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
values: impl IntoIterator<Item = F>,
proof: &Self::Proof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error>
where
Self::Commitment: 'a;
fn open_combinations_individual_opening_challenges<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenges: &dyn Fn(u64) -> F,
rands: impl IntoIterator<Item = &'a Self::Randomness>
) -> Result<BatchLCProof<F, CF, Self>, Error>
where
Self::Randomness: 'a,
Self::Commitment: 'a;
fn check_combinations_individual_opening_challenges<'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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenges: &dyn Fn(u64) -> F,
rng: &mut R
) -> Result<bool, Error>
where
Self::Commitment: 'a;
fn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error> { ... }
fn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
_rng: Option<&mut dyn RngCore>
) -> Result<Self::BatchProof, Error>
where
Self::Randomness: 'a,
Self::Commitment: 'a,
{ ... }
fn batch_check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
evaluations: &Evaluations<'_, F>,
proof: &Self::BatchProof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, 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>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<F, CF, Self>, Error>
where
Self::Randomness: 'a,
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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error>
where
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.
Associated Types
The universal parameters for the commitment scheme. These are “trimmed”
down to Self::CommitterKey
and Self::VerifierKey
by Self::trim
.
type CommitterKey: PCCommitterKey + ToBytes + FromBytes + Clone + Send + Sync
type CommitterKey: PCCommitterKey + ToBytes + FromBytes + Clone + Send + Sync
The committer key for the scheme; used to commit to a polynomial and then open the commitment to produce an evaluation proof.
type VerifierKey: PCVerifierKey + Prepare<Self::PreparedVerifierKey> + ToConstraintField<CF> + Clone + Send + Sync
type VerifierKey: PCVerifierKey + Prepare<Self::PreparedVerifierKey> + ToConstraintField<CF> + Clone + Send + Sync
The verifier key for the scheme; used to check an evaluation proof.
The prepared verifier key for the scheme; used to check an evaluation proof.
type Commitment: PCCommitment + Prepare<Self::PreparedCommitment> + ToConstraintField<CF> + ToMinimalBits + Clone + Debug + PartialEq + Eq + Send + Sync
type Commitment: PCCommitment + Prepare<Self::PreparedCommitment> + ToConstraintField<CF> + ToMinimalBits + Clone + Debug + PartialEq + Eq + Send + Sync
The commitment to a polynomial.
The prepared commitment to a polynomial.
type Randomness: PCRandomness + Clone + Send + Sync
type Randomness: PCRandomness + Clone + Send + Sync
The commitment randomness.
Required methods
Constructs public parameters when given as input the maximum degree degree
for the polynomial commitment scheme.
fn trim(
parameters: &Self::UniversalParams,
supported_degree: usize,
supported_hiding_bound: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Error>
fn trim(
parameters: &Self::UniversalParams,
supported_degree: usize,
supported_hiding_bound: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Error>
Specializes the public parameters for polynomials up to the given supported_degree
and for enforcing degree bounds in the range 1..=supported_degree
.
fn commit_with_terminator<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
terminator: &AtomicBool,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error>
fn commit_with_terminator<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
terminator: &AtomicBool,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error>
Like [commit
] but with an added early termination signal, [terminator
].
fn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
fn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
On input a list of labeled polynomials and a query point, open
outputs a proof of evaluation
of the polynomials at the query point.
fn check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
values: impl IntoIterator<Item = F>,
proof: &Self::Proof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
fn check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: F,
values: impl IntoIterator<Item = F>,
proof: &Self::Proof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
Verifies that values
are the evaluations at point
of the polynomials
committed inside commitments
.
fn open_combinations_individual_opening_challenges<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenges: &dyn Fn(u64) -> F,
rands: impl IntoIterator<Item = &'a Self::Randomness>
) -> Result<BatchLCProof<F, CF, Self>, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
fn open_combinations_individual_opening_challenges<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenges: &dyn Fn(u64) -> F,
rands: impl IntoIterator<Item = &'a Self::Randomness>
) -> Result<BatchLCProof<F, CF, Self>, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
On input a list of polynomials, linear combinations of those polynomials,
and a query set, open_combination
outputs a proof of evaluation of
the combinations at the points in the query set.
fn check_combinations_individual_opening_challenges<'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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenges: &dyn Fn(u64) -> F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
fn check_combinations_individual_opening_challenges<'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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenges: &dyn Fn(u64) -> F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
Check combinations with individual challenges.
Provided methods
fn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error>
fn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Error>
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.
fn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
_rng: Option<&mut dyn RngCore>
) -> Result<Self::BatchProof, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
fn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
_rng: Option<&mut dyn RngCore>
) -> Result<Self::BatchProof, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
On input a list of labeled polynomials and a query set, open
outputs a proof of evaluation
of the polynomials at the points in the query set.
fn batch_check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
evaluations: &Evaluations<'_, F>,
proof: &Self::BatchProof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, 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<'_, F>,
evaluations: &Evaluations<'_, F>,
proof: &Self::BatchProof,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
Checks that values
are the true evaluations at query_set
of the polynomials
committed in labeled_commitments
.
fn open_combinations<'a>(
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<F, CF, Self>, Error> where
Self::Randomness: 'a,
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>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, F>,
opening_challenge: F,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<F, CF, Self>, Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
On input a list of polynomials, linear combinations of those polynomials,
and a query set, open_combination
outputs a proof of evaluation of
the combinations at the points in the query set.
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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenge: F,
rng: &mut R
) -> Result<bool, 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<'_, F>,
eqn_evaluations: &Evaluations<'_, F>,
proof: &BatchLCProof<F, CF, Self>,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Error> where
Self::Commitment: 'a,
Checks that evaluations
are the true evaluations at query_set
of the
linear combinations of polynomials committed in commitments
.