pub struct UnivariateKzgPCS<E> { /* private fields */ }
Expand description
KZG Polynomial Commitment Scheme on univariate polynomial.
Trait Implementations§
Source§impl<E: Pairing> PolynomialCommitmentScheme for UnivariateKzgPCS<E>
impl<E: Pairing> PolynomialCommitmentScheme for UnivariateKzgPCS<E>
Source§fn trim(
srs: impl Borrow<Self::SRS>,
supported_degree: usize,
supported_num_vars: Option<usize>,
) -> Result<(UnivariateProverParam<E>, UnivariateVerifierParam<E>), PCSError>
fn trim( srs: impl Borrow<Self::SRS>, supported_degree: usize, supported_num_vars: Option<usize>, ) -> Result<(UnivariateProverParam<E>, UnivariateVerifierParam<E>), PCSError>
Trim the universal parameters to specialize the public parameters.
Input max_degree
for univariate.
supported_num_vars
must be None or an error is returned.
Source§fn commit(
prover_param: impl Borrow<UnivariateProverParam<E>>,
poly: &Self::Polynomial,
) -> Result<Self::Commitment, PCSError>
fn commit( prover_param: impl Borrow<UnivariateProverParam<E>>, poly: &Self::Polynomial, ) -> Result<Self::Commitment, PCSError>
Generate a commitment for a polynomial Note that the scheme is not hiding
Source§fn batch_commit(
prover_param: impl Borrow<UnivariateProverParam<E>>,
polys: &[Self::Polynomial],
) -> Result<Self::BatchCommitment, PCSError>
fn batch_commit( prover_param: impl Borrow<UnivariateProverParam<E>>, polys: &[Self::Polynomial], ) -> Result<Self::BatchCommitment, PCSError>
Generate a commitment for a list of polynomials
Source§fn open(
prover_param: impl Borrow<UnivariateProverParam<E>>,
polynomial: &Self::Polynomial,
point: &Self::Point,
) -> Result<(Self::Proof, Self::Evaluation), PCSError>
fn open( prover_param: impl Borrow<UnivariateProverParam<E>>, polynomial: &Self::Polynomial, point: &Self::Point, ) -> Result<(Self::Proof, Self::Evaluation), PCSError>
On input a polynomial p
and a point point
, outputs a proof for the
same.
Source§fn batch_open(
prover_param: impl Borrow<UnivariateProverParam<E>>,
_multi_commitment: &Self::BatchCommitment,
polynomials: &[Self::Polynomial],
points: &[Self::Point],
) -> Result<(Self::BatchProof, Vec<Self::Evaluation>), PCSError>
fn batch_open( prover_param: impl Borrow<UnivariateProverParam<E>>, _multi_commitment: &Self::BatchCommitment, polynomials: &[Self::Polynomial], points: &[Self::Point], ) -> Result<(Self::BatchProof, Vec<Self::Evaluation>), PCSError>
Input a list of polynomials, and the same number of points, compute a multi-opening for all the polynomials.
Source§fn verify(
verifier_param: &UnivariateVerifierParam<E>,
commitment: &Self::Commitment,
point: &Self::Point,
value: &E::ScalarField,
proof: &Self::Proof,
) -> Result<bool, PCSError>
fn verify( verifier_param: &UnivariateVerifierParam<E>, commitment: &Self::Commitment, point: &Self::Point, value: &E::ScalarField, proof: &Self::Proof, ) -> Result<bool, PCSError>
Verifies that value
is the evaluation at x
of the polynomial
committed inside comm
.
Source§fn batch_verify<R: RngCore + CryptoRng>(
verifier_param: &UnivariateVerifierParam<E>,
multi_commitment: &Self::BatchCommitment,
points: &[Self::Point],
values: &[E::ScalarField],
batch_proof: &Self::BatchProof,
rng: &mut R,
) -> Result<bool, PCSError>
fn batch_verify<R: RngCore + CryptoRng>( verifier_param: &UnivariateVerifierParam<E>, multi_commitment: &Self::BatchCommitment, points: &[Self::Point], values: &[E::ScalarField], batch_proof: &Self::BatchProof, rng: &mut R, ) -> Result<bool, PCSError>
Verifies that value_i
is the evaluation at x_i
of the polynomial
poly_i
committed inside comm
.
Source§fn multi_open(
prover_param: impl Borrow<UnivariateProverParam<E>>,
polynomial: &Self::Polynomial,
points: &[Self::Point],
) -> Result<(Vec<Self::Proof>, Vec<Self::Evaluation>), PCSError>
fn multi_open( prover_param: impl Borrow<UnivariateProverParam<E>>, polynomial: &Self::Polynomial, points: &[Self::Point], ) -> Result<(Vec<Self::Proof>, Vec<Self::Evaluation>), PCSError>
Fast computation of batch opening for a single polynomial at multiple arbitrary points. Details see Sec 2.1~2.3 of FK23.
Only accept polynomial
with power-of-two degree, no constraint on the
size of points
Source§type SRS = UnivariateUniversalParams<E>
type SRS = UnivariateUniversalParams<E>
Source§type Polynomial = DensePolynomial<<E as Pairing>::ScalarField>
type Polynomial = DensePolynomial<<E as Pairing>::ScalarField>
Source§type Evaluation = <E as Pairing>::ScalarField
type Evaluation = <E as Pairing>::ScalarField
Source§type Commitment = Commitment<E>
type Commitment = Commitment<E>
Source§type BatchCommitment = Vec<<UnivariateKzgPCS<E> as PolynomialCommitmentScheme>::Commitment>
type BatchCommitment = Vec<<UnivariateKzgPCS<E> as PolynomialCommitmentScheme>::Commitment>
Source§type Proof = UnivariateKzgProof<E>
type Proof = UnivariateKzgProof<E>
Source§type BatchProof = Vec<UnivariateKzgProof<E>>
type BatchProof = Vec<UnivariateKzgProof<E>>
Source§fn load_srs_from_file(
supported_degree: usize,
file: Option<&str>,
) -> Result<Self::SRS, PCSError>
fn load_srs_from_file( supported_degree: usize, file: Option<&str>, ) -> Result<Self::SRS, PCSError>
pp
bytes, and
the actual setup is usually carried out via MPC and should be
implemented else where. We only load them into memory here. Read moreSource§impl<E: Pairing> UnivariatePCS for UnivariateKzgPCS<E>
impl<E: Pairing> UnivariatePCS for UnivariateKzgPCS<E>
Source§fn multi_open_rou_evals(
polynomial: &Self::Polynomial,
num_points: usize,
domain: &Radix2EvaluationDomain<Self::Evaluation>,
) -> Result<Vec<Self::Evaluation>, PCSError>
fn multi_open_rou_evals( polynomial: &Self::Polynomial, num_points: usize, domain: &Radix2EvaluationDomain<Self::Evaluation>, ) -> Result<Vec<Self::Evaluation>, PCSError>
Compute the evaluations in Self::multi_open_rou()
.
Source§fn multi_point_open(
prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>,
polynomial: &Self::Polynomial,
points: &[Self::Point],
) -> Result<(Self::Proof, Vec<Self::Evaluation>), PCSError>
fn multi_point_open( prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>, polynomial: &Self::Polynomial, points: &[Self::Point], ) -> Result<(Self::Proof, Vec<Self::Evaluation>), PCSError>
Input a polynomial, and multiple evaluation points, compute a batch opening proof for the multiple points of the same polynomial.
Warning: don’t use it when points.len()
is large
Source§fn multi_point_verify(
verifier_param: impl Borrow<<Self::SRS as StructuredReferenceString>::VerifierParam>,
commitment: &Self::Commitment,
points: &[Self::Point],
values: &[Self::Evaluation],
proof: &Self::Proof,
) -> Result<bool, PCSError>
fn multi_point_verify( verifier_param: impl Borrow<<Self::SRS as StructuredReferenceString>::VerifierParam>, commitment: &Self::Commitment, points: &[Self::Point], values: &[Self::Evaluation], proof: &Self::Proof, ) -> Result<bool, PCSError>
Verifies that values
are the evaluation at the points
of the
polynomial committed inside comm
.
Warning: don’t use it when points.len()
is large
Source§fn multi_open_rou_proofs(
prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>,
polynomial: &Self::Polynomial,
num_points: usize,
domain: &Radix2EvaluationDomain<Self::Evaluation>,
) -> Result<Vec<Self::Proof>, PCSError>
fn multi_open_rou_proofs( prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>, polynomial: &Self::Polynomial, num_points: usize, domain: &Radix2EvaluationDomain<Self::Evaluation>, ) -> Result<Vec<Self::Proof>, PCSError>
Self::multi_open_rou()
.Source§fn trim_fft_size(
srs: impl Borrow<Self::SRS>,
supported_degree: usize,
) -> Result<(<Self::SRS as StructuredReferenceString>::ProverParam, <Self::SRS as StructuredReferenceString>::VerifierParam), PCSError>
fn trim_fft_size( srs: impl Borrow<Self::SRS>, supported_degree: usize, ) -> Result<(<Self::SRS as StructuredReferenceString>::ProverParam, <Self::SRS as StructuredReferenceString>::VerifierParam), PCSError>
PolynomialCommitmentScheme::trim()
, but trim to support
the FFT operations, such as Self::multi_open_rou()
or other
operations that involves roots of unity.Source§fn multi_open_rou_eval_domain(
degree: usize,
num_points: usize,
) -> Result<Radix2EvaluationDomain<Self::Evaluation>, PCSError>
fn multi_open_rou_eval_domain( degree: usize, num_points: usize, ) -> Result<Radix2EvaluationDomain<Self::Evaluation>, PCSError>
degree
of the committed polynomial and num_points
to open,
return the evaluation domain for faster computation of opening proofs
and evaluations (both using FFT).Source§fn multi_open_rou(
prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>,
polynomial: &Self::Polynomial,
num_points: usize,
domain: &Radix2EvaluationDomain<Self::Evaluation>,
) -> Result<(Vec<Self::Proof>, Vec<Self::Evaluation>), PCSError>
fn multi_open_rou( prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>, polynomial: &Self::Polynomial, num_points: usize, domain: &Radix2EvaluationDomain<Self::Evaluation>, ) -> Result<(Vec<Self::Proof>, Vec<Self::Evaluation>), PCSError>
PolynomialCommitmentScheme::multi_open()
, except the
points are roots of unity.
The first num_points
of roots will be evaluated (in canonical order).Auto Trait Implementations§
impl<E> Freeze for UnivariateKzgPCS<E>
impl<E> RefUnwindSafe for UnivariateKzgPCS<E>where
E: RefUnwindSafe,
impl<E> Send for UnivariateKzgPCS<E>where
E: Send,
impl<E> Sync for UnivariateKzgPCS<E>where
E: Sync,
impl<E> Unpin for UnivariateKzgPCS<E>where
E: Unpin,
impl<E> UnwindSafe for UnivariateKzgPCS<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more