jf_pcs::multilinear_kzg

Struct MultilinearKzgPCS

Source
pub struct MultilinearKzgPCS<E: Pairing> { /* private fields */ }
Expand description

KZG Polynomial Commitment Scheme on multilinear polynomials.

Trait Implementations§

Source§

impl<E: Pairing> PolynomialCommitmentScheme for MultilinearKzgPCS<E>

Source§

fn trim( srs: impl Borrow<Self::SRS>, supported_log_degree: usize, supported_num_vars: Option<usize>, ) -> Result<(<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::ProverParam, <(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::VerifierParam), PCSError>

Trim the universal parameters to specialize the public parameters. Input both supported_log_degree for univariate and supported_num_vars for multilinear.

Source§

fn commit( prover_param: impl Borrow<<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::ProverParam>, poly: &Self::Polynomial, ) -> Result<Self::Commitment, PCSError>

Generate a commitment for a polynomial.

This function takes 2^num_vars number of scalar multiplications over G1.

Source§

fn batch_commit( prover_param: impl Borrow<<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::ProverParam>, polys: &[Self::Polynomial], ) -> Result<Self::Commitment, PCSError>

Batch commit a list of polynomials.

This function takes 2^(num_vars + log(polys.len()) number of scalar multiplications over G1.

Source§

fn open( prover_param: impl Borrow<<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::ProverParam>, 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. This function does not need to take the evaluation value as an input.

This function takes 2^{num_var +1} number of scalar multiplications over G1:

  • it proceeds with num_var number of rounds,
  • at round i, we compute an MSM for 2^{num_var - i + 1} number of G2 elements.
Source§

fn batch_open( prover_param: impl Borrow<<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::ProverParam>, batch_commitment: &Self::BatchCommitment, polynomials: &[Self::Polynomial], points: &[Self::Point], ) -> Result<(Self::BatchProof, Vec<Self::Evaluation>), PCSError>

Input

  • the prover parameters for univariate KZG,
  • the prover parameters for multilinear KZG,
  • a list of polynomials,
  • a (batch) commitment to all polynomials,
  • and the same number of points, compute a batch opening for all the polynomials.

For simplicity, this API requires each MLE to have only one point. If the caller wish to use more than one point per MLE, it should be handled at the caller layer.

Returns an error if the lengths do not match.

Returns the proof, consists of

  • the multilinear KZG opening
  • the univariate KZG commitment to q(x)
  • the openings and evaluations of q(x) at omega^i and r

Steps:

  1. build l(points) which is a list of univariate polynomials that goes through the points
  2. build MLE w which is the merge of all MLEs.
  3. build q(x) which is a univariate polynomial W circ l
  4. commit to q(x) and sample r from transcript transcript contains: w commitment, points, q(x)’s commitment
  5. build q(omega^i) and their openings
  6. build q(r) and its opening
  7. get a point p := l(r)
  8. output an opening of w over point p
  9. output w(p)
Source§

fn verify( verifier_param: &<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::VerifierParam, 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.

This function takes

  • num_var number of pairing product.
  • num_var number of MSM
Source§

fn batch_verify<R: RngCore + CryptoRng>( verifier_param: &<(MultilinearUniversalParams<E>, UnivariateUniversalParams<E>) as StructuredReferenceString>::VerifierParam, batch_commitment: &Self::BatchCommitment, points: &[Self::Point], values: &[E::ScalarField], batch_proof: &Self::BatchProof, _rng: &mut R, ) -> Result<bool, PCSError>

Verifies that value is the evaluation at x_i of the polynomial poly_i committed inside commitment. steps:

  1. put q(x)’s evaluations over (1, omega,...) into transcript
  2. sample r from transcript
  3. check q(r) == value
  4. build l(points) which is a list of univariate polynomials that goes through the points
  5. get a point p := l(r)
  6. verifies p is verifies against proof
Source§

type SRS = (MultilinearUniversalParams<E>, UnivariateUniversalParams<E>)

Structured reference string
Source§

type Polynomial = Arc<DenseMultilinearExtension<<E as Pairing>::ScalarField>>

Polynomial and its associated types
Source§

type Point = Vec<<E as Pairing>::ScalarField>

Polynomial input domain
Source§

type Evaluation = <E as Pairing>::ScalarField

Polynomial Evaluation
Source§

type Commitment = Commitment<E>

Commitments
Source§

type BatchCommitment = Commitment<E>

Batch commitments
Source§

type Proof = MultilinearKzgProof<E>

Proofs
Source§

type BatchProof = MultilinearKzgBatchProof<E>

Batch proofs
Source§

fn load_srs_from_file( supported_degree: usize, file: Option<&str>, ) -> Result<Self::SRS, PCSError>

Load public parameter in production environment. These parameters are loaded from files with serialized 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 more
Source§

fn multi_open( prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>, polynomial: &Self::Polynomial, points: &[Self::Point], ) -> Result<(Vec<Self::Proof>, Vec<Self::Evaluation>), PCSError>

Open a single polynomial at multiple points. The naive default implementation just open them individually.

Auto Trait Implementations§

§

impl<E> Freeze for MultilinearKzgPCS<E>

§

impl<E> RefUnwindSafe for MultilinearKzgPCS<E>
where E: RefUnwindSafe,

§

impl<E> Send for MultilinearKzgPCS<E>

§

impl<E> Sync for MultilinearKzgPCS<E>

§

impl<E> Unpin for MultilinearKzgPCS<E>
where E: Unpin,

§

impl<E> UnwindSafe for MultilinearKzgPCS<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V