[−][src]Trait snarkos_polycommit::PolynomialCommitment
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
type UniversalParams: PCUniversalParams + Clone
The universal parameters for the commitment scheme. These are "trimmed"
down to Self::CommitterKey
and Self::VerifierKey
by Self::trim
.
type CommitterKey: PCCommitterKey + Clone
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 + Clone
The verifier key for the scheme; used to check an evaluation proof.
type Commitment: PCCommitment + Clone
The commitment to a polynomial.
type Randomness: PCRandomness + Clone
The commitment randomness.
type Proof: PCProof + Clone
The evaluation proof for a single point.
type BatchProof: CanonicalSerialize + CanonicalDeserialize + Clone + From<Vec<Self::Proof>> + Into<Vec<Self::Proof>> + Debug
The evaluation proof for a query set.
type Error: Error + From<Error>
The error type for the scheme.
Required methods
fn setup<R: RngCore>(
max_degree: usize,
rng: &mut R
) -> Result<Self::UniversalParams, Self::Error>
max_degree: 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.
fn trim(
pp: &Self::UniversalParams,
supported_degree: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>
pp: &Self::UniversalParams,
supported_degree: 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
.
fn commit<'a>(
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, F>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, F>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::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 open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, 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, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, 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, Self::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, Self::Error> where
Self::Commitment: 'a,
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, Self::Error> where
Self::Commitment: 'a,
Verifies that values
are the evaluations at point
of the polynomials
committed inside commitments
.
Provided methods
fn batch_open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, 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, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, 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, Self::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, Self::Error> where
Self::Commitment: 'a,
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, Self::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<'a, 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, Self>, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
ck: &Self::CommitterKey,
linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, 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, Self>, 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, Self>,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
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, Self>,
opening_challenge: F,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
Checks that evaluations
are the true evaluations at query_set
of the
linear combinations of polynomials committed in commitments
.
Implementors
impl<E: PairingEngine> PolynomialCommitment<<E as PairingEngine>::Fr> for MarlinKZG10<E>
[src]
type BatchProof = Vec<Self::Proof>
type Commitment = Commitment<E>
type CommitterKey = CommitterKey<E>
type Error = Error
type Proof = Proof<E>
type Randomness = Randomness<E>
type UniversalParams = UniversalParams<E>
type VerifierKey = VerifierKey<E>
fn setup<R: RngCore>(
max_degree: usize,
rng: &mut R
) -> Result<Self::UniversalParams, Self::Error>
[src]
max_degree: usize,
rng: &mut R
) -> Result<Self::UniversalParams, Self::Error>
Constructs public parameters when given as input the maximum degree max_degree
for the polynomial commitment scheme.
fn trim(
pp: &Self::UniversalParams,
supported_degree: usize,
enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>
[src]
pp: &Self::UniversalParams,
supported_degree: 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<'a, E::Fr>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>
[src]
ck: &Self::CommitterKey,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, E::Fr>>,
rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>>, Vec<Self::Randomness>), Self::Error>
Outputs a commitment to polynomial
.
fn open<'a>(
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, E::Fr>>,
_commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: E::Fr,
opening_challenge: E::Fr,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
_rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
[src]
ck: &Self::CommitterKey,
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, E::Fr>>,
_commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: E::Fr,
opening_challenge: E::Fr,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
_rng: Option<&mut dyn RngCore>
) -> Result<Self::Proof, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
On input a polynomial p
and a point point
, outputs a proof for the same.
fn check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: E::Fr,
values: impl IntoIterator<Item = E::Fr>,
proof: &Self::Proof,
opening_challenge: E::Fr,
_rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
[src]
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
point: E::Fr,
values: impl IntoIterator<Item = E::Fr>,
proof: &Self::Proof,
opening_challenge: E::Fr,
_rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
Verifies that value
is the evaluation at x
of the polynomial
committed inside comm
.
fn batch_check<'a, R: RngCore>(
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
values: &Evaluations<'_, E::Fr>,
proof: &Self::BatchProof,
opening_challenge: E::Fr,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
[src]
vk: &Self::VerifierKey,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
values: &Evaluations<'_, E::Fr>,
proof: &Self::BatchProof,
opening_challenge: E::Fr,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
fn open_combinations<'a>(
ck: &Self::CommitterKey,
lc_s: impl IntoIterator<Item = &'a LinearCombination<E::Fr>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, E::Fr>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
opening_challenge: E::Fr,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<E::Fr, Self>, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
[src]
ck: &Self::CommitterKey,
lc_s: impl IntoIterator<Item = &'a LinearCombination<E::Fr>>,
polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<'a, E::Fr>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
opening_challenge: E::Fr,
rands: impl IntoIterator<Item = &'a Self::Randomness>,
rng: Option<&mut dyn RngCore>
) -> Result<BatchLCProof<E::Fr, Self>, Self::Error> where
Self::Randomness: 'a,
Self::Commitment: 'a,
fn check_combinations<'a, R: RngCore>(
vk: &Self::VerifierKey,
lc_s: impl IntoIterator<Item = &'a LinearCombination<E::Fr>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
evaluations: &Evaluations<'_, E::Fr>,
proof: &BatchLCProof<E::Fr, Self>,
opening_challenge: E::Fr,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
[src]
vk: &Self::VerifierKey,
lc_s: impl IntoIterator<Item = &'a LinearCombination<E::Fr>>,
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
query_set: &QuerySet<'_, E::Fr>,
evaluations: &Evaluations<'_, E::Fr>,
proof: &BatchLCProof<E::Fr, Self>,
opening_challenge: E::Fr,
rng: &mut R
) -> Result<bool, Self::Error> where
Self::Commitment: 'a,
Checks that values
are the true evaluations at query_set
of the polynomials
committed in labeled_commitments
.