Trait snarkvm_wasm::PolynomialCommitment[][src]

pub trait PolynomialCommitment<F>: Clone + Debug where
    F: Field
{ type UniversalParams: PCUniversalParams + Clone; type CommitterKey: PCCommitterKey + Clone; type VerifierKey: PCVerifierKey + Clone; type Commitment: PCCommitment + Clone; type Randomness: PCRandomness + Clone; type Proof: PCProof + Clone; type BatchProof: Clone + Into<Vec<Self::Proof, Global>> + From<Vec<Self::Proof, Global>> + Debug + CanonicalSerialize + CanonicalDeserialize; type Error: From<Error> + Error; pub fn setup<R>(
        max_degree: usize,
        rng: &mut R
    ) -> Result<Self::UniversalParams, Self::Error>
    where
        R: RngCore
;
pub fn trim(
        pp: &Self::UniversalParams,
        supported_degree: usize,
        supported_hiding_bound: usize,
        enforced_degree_bounds: Option<&[usize]>
    ) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>;
pub fn commit<'a>(
        ck: &Self::CommitterKey,
        polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
        rng: Option<&mut dyn RngCore>
    ) -> Result<(Vec<LabeledCommitment<Self::Commitment>, Global>, Vec<Self::Randomness, Global>), Self::Error>;
pub 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, Self::Error>
    where
        Self::Randomness: 'a,
        Self::Commitment: 'a
;
pub fn check<'a, R>(
        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
        R: RngCore,
        Self::Commitment: 'a
; pub 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: &BTreeSet<(String, 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
, { ... }
pub fn batch_check<'a, R>(
        vk: &Self::VerifierKey,
        commitments: impl Iterator<Item = LabeledCommitment<Self::Commitment>>,
        query_set: &BTreeSet<(String, F)>,
        evaluations: &BTreeMap<(String, F), F>,
        proof: &Self::BatchProof,
        opening_challenge: F,
        rng: &mut R
    ) -> Result<bool, Self::Error>
    where
        R: RngCore,
        Self::Commitment: 'a
, { ... }
pub 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: &BTreeSet<(String, 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
, { ... }
pub fn check_combinations<'a, R>(
        vk: &Self::VerifierKey,
        linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
        commitments: impl Iterator<Item = LabeledCommitment<Self::Commitment>>,
        eqn_query_set: &BTreeSet<(String, F)>,
        eqn_evaluations: &BTreeMap<(String, F), F>,
        proof: &BatchLCProof<F, Self>,
        opening_challenge: F,
        rng: &mut R
    ) -> Result<bool, Self::Error>
    where
        R: RngCore,
        Self::Commitment: 'a
, { ... } }

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[src]

The universal parameters for the commitment scheme. These are “trimmed” down to Self::CommitterKey and Self::VerifierKey by Self::trim.

type CommitterKey: PCCommitterKey + Clone[src]

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[src]

The verifier key for the scheme; used to check an evaluation proof.

type Commitment: PCCommitment + Clone[src]

The commitment to a polynomial.

type Randomness: PCRandomness + Clone[src]

The commitment randomness.

type Proof: PCProof + Clone[src]

The evaluation proof for a single point.

type BatchProof: Clone + Into<Vec<Self::Proof, Global>> + From<Vec<Self::Proof, Global>> + Debug + CanonicalSerialize + CanonicalDeserialize[src]

The evaluation proof for a query set.

type Error: From<Error> + Error[src]

The error type for the scheme.

Loading content...

Required methods

pub fn setup<R>(
    max_degree: usize,
    rng: &mut R
) -> Result<Self::UniversalParams, Self::Error> where
    R: RngCore
[src]

Constructs public parameters when given as input the maximum degree degree for the polynomial commitment scheme.

pub fn trim(
    pp: &Self::UniversalParams,
    supported_degree: usize,
    supported_hiding_bound: usize,
    enforced_degree_bounds: Option<&[usize]>
) -> Result<(Self::CommitterKey, Self::VerifierKey), Self::Error>
[src]

Specializes the public parameters for polynomials up to the given supported_degree and for enforcing degree bounds in the range 1..=supported_degree.

pub fn commit<'a>(
    ck: &Self::CommitterKey,
    polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
    rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<Self::Commitment>, Global>, Vec<Self::Randomness, Global>), Self::Error>
[src]

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.

pub 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, Self::Error> where
    Self::Randomness: 'a,
    Self::Commitment: 'a, 
[src]

On input a list of labeled polynomials and a query point, open outputs a proof of evaluation of the polynomials at the query point.

pub fn check<'a, R>(
    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
    R: RngCore,
    Self::Commitment: 'a, 
[src]

Verifies that values are the evaluations at point of the polynomials committed inside commitments.

Loading content...

Provided methods

pub 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: &BTreeSet<(String, 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, 
[src]

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.

pub fn batch_check<'a, R>(
    vk: &Self::VerifierKey,
    commitments: impl Iterator<Item = LabeledCommitment<Self::Commitment>>,
    query_set: &BTreeSet<(String, F)>,
    evaluations: &BTreeMap<(String, F), F>,
    proof: &Self::BatchProof,
    opening_challenge: F,
    rng: &mut R
) -> Result<bool, Self::Error> where
    R: RngCore,
    Self::Commitment: 'a, 
[src]

Checks that values are the true evaluations at query_set of the polynomials committed in labeled_commitments.

pub 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: &BTreeSet<(String, 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, 
[src]

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.

pub fn check_combinations<'a, R>(
    vk: &Self::VerifierKey,
    linear_combinations: impl IntoIterator<Item = &'a LinearCombination<F>>,
    commitments: impl Iterator<Item = LabeledCommitment<Self::Commitment>>,
    eqn_query_set: &BTreeSet<(String, F)>,
    eqn_evaluations: &BTreeMap<(String, F), F>,
    proof: &BatchLCProof<F, Self>,
    opening_challenge: F,
    rng: &mut R
) -> Result<bool, Self::Error> where
    R: RngCore,
    Self::Commitment: 'a, 
[src]

Checks that evaluations are the true evaluations at query_set of the linear combinations of polynomials committed in commitments.

Loading content...

Implementors

impl<E> PolynomialCommitment<<E as PairingEngine>::Fr> for MarlinKZG10<E> where
    E: PairingEngine
[src]

type BatchProof = Vec<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Proof, Global>

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>

pub fn setup<R>(
    max_degree: usize,
    rng: &mut R
) -> Result<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::UniversalParams, <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error> where
    R: RngCore
[src]

Constructs public parameters when given as input the maximum degree max_degree for the polynomial commitment scheme.

pub fn commit<'a>(
    ck: &<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::CommitterKey,
    polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<<E as PairingEngine>::Fr>>,
    rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>, Global>, Vec<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Randomness, Global>), <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error>
[src]

Outputs a commitment to polynomial.

pub fn open<'a>(
    ck: &<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::CommitterKey,
    labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<<E as PairingEngine>::Fr>>,
    _commitments: impl IntoIterator<Item = &'a LabeledCommitment<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>>,
    point: <E as PairingEngine>::Fr,
    opening_challenge: <E as PairingEngine>::Fr,
    rands: impl IntoIterator<Item = &'a <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Randomness>,
    _rng: Option<&mut dyn RngCore>
) -> Result<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Proof, <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error> where
    <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Randomness: 'a,
    <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment: 'a, 
[src]

On input a polynomial p and a point point, outputs a proof for the same.

pub fn check<'a, R>(
    vk: &<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::VerifierKey,
    commitments: impl IntoIterator<Item = &'a LabeledCommitment<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>>,
    point: <E as PairingEngine>::Fr,
    values: impl IntoIterator<Item = <E as PairingEngine>::Fr>,
    proof: &<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Proof,
    opening_challenge: <E as PairingEngine>::Fr,
    _rng: &mut R
) -> Result<bool, <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error> where
    R: RngCore,
    <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment: 'a, 
[src]

Verifies that value is the evaluation at x of the polynomial committed inside comm.

pub fn check_combinations<'a, R>(
    vk: &<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::VerifierKey,
    lc_s: impl IntoIterator<Item = &'a LinearCombination<<E as PairingEngine>::Fr>>,
    commitments: impl Iterator<Item = LabeledCommitment<<MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>>,
    query_set: &BTreeSet<(String, <E as PairingEngine>::Fr)>,
    evaluations: &BTreeMap<(String, <E as PairingEngine>::Fr), <E as PairingEngine>::Fr>,
    proof: &BatchLCProof<<E as PairingEngine>::Fr, MarlinKZG10<E>>,
    opening_challenge: <E as PairingEngine>::Fr,
    rng: &mut R
) -> Result<bool, <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error> where
    R: RngCore,
    <MarlinKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment: 'a, 
[src]

Checks that values are the true evaluations at query_set of the polynomials committed in labeled_commitments.

impl<E> PolynomialCommitment<<E as PairingEngine>::Fr> for SonicKZG10<E> where
    E: PairingEngine
[src]

type BatchProof = Vec<<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Proof, Global>

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>

pub fn commit<'a>(
    ck: &<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::CommitterKey,
    polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<<E as PairingEngine>::Fr>>,
    rng: Option<&mut dyn RngCore>
) -> Result<(Vec<LabeledCommitment<<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>, Global>, Vec<<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Randomness, Global>), <SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error>
[src]

Outputs a commitment to polynomial.

pub fn check_combinations<'a, R>(
    vk: &<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::VerifierKey,
    lc_s: impl IntoIterator<Item = &'a LinearCombination<<E as PairingEngine>::Fr>>,
    commitments: impl Iterator<Item = LabeledCommitment<<SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment>>,
    query_set: &BTreeSet<(String, <E as PairingEngine>::Fr)>,
    evaluations: &BTreeMap<(String, <E as PairingEngine>::Fr), <E as PairingEngine>::Fr>,
    proof: &BatchLCProof<<E as PairingEngine>::Fr, SonicKZG10<E>>,
    opening_challenge: <E as PairingEngine>::Fr,
    rng: &mut R
) -> Result<bool, <SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Error> where
    R: RngCore,
    <SonicKZG10<E> as PolynomialCommitment<<E as PairingEngine>::Fr>>::Commitment: 'a, 
[src]

Checks that values are the true evaluations at query_set of the polynomials committed in labeled_commitments.

Loading content...