snarkvm_algorithms::polycommit::kzg10

Struct KZG10

Source
pub struct KZG10<E: PairingEngine>(/* private fields */);
Expand description

KZG10 is an implementation of the polynomial commitment scheme of Kate, Zaverucha and Goldbgerg

Implementations§

Source§

impl<E: PairingEngine> KZG10<E>

Source

pub fn load_srs(max_degree: usize) -> Result<UniversalParams<E>, PCError>

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

Source

pub fn commit( powers: &Powers<'_, E>, polynomial: &Polynomial<'_, E::Fr>, hiding_bound: Option<usize>, rng: Option<&mut dyn RngCore>, ) -> Result<(KZGCommitment<E>, KZGRandomness<E>), PCError>

Outputs a commitment to polynomial.

Source

pub fn commit_lagrange( lagrange_basis: &LagrangeBasis<'_, E>, evaluations: &[E::Fr], hiding_bound: Option<usize>, rng: Option<&mut dyn RngCore>, ) -> Result<(KZGCommitment<E>, KZGRandomness<E>), PCError>

Outputs a commitment to polynomial.

Source

pub fn compute_witness_polynomial( polynomial: &DensePolynomial<E::Fr>, point: E::Fr, randomness: &KZGRandomness<E>, ) -> Result<(DensePolynomial<E::Fr>, Option<DensePolynomial<E::Fr>>), PCError>

Compute witness polynomial.

The witness polynomial w(x) the quotient of the division (p(x) - p(z)) / (x - z) Observe that this quotient does not change with z because p(z) is the remainder term. We can therefore omit p(z) when computing the quotient.

Source

pub fn open_lagrange( lagrange_basis: &LagrangeBasis<'_, E>, domain_elements: &[E::Fr], evaluations: &[E::Fr], point: E::Fr, evaluation_at_point: E::Fr, ) -> Result<KZGProof<E>>

On input a polynomial p in Lagrange basis, and a point point, outputs an evaluation proof for the same.

Source

pub fn open( powers: &Powers<'_, E>, polynomial: &DensePolynomial<E::Fr>, point: E::Fr, rand: &KZGRandomness<E>, ) -> Result<KZGProof<E>, PCError>

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

Source

pub fn check( vk: &VerifierKey<E>, commitment: &KZGCommitment<E>, point: E::Fr, value: E::Fr, proof: &KZGProof<E>, ) -> Result<bool, PCError>

Verifies that value is the evaluation at point of the polynomial committed inside commitment.

Source

pub fn batch_check<R: RngCore>( vk: &VerifierKey<E>, commitments: &[KZGCommitment<E>], points: &[E::Fr], values: &[E::Fr], proofs: &[KZGProof<E>], rng: &mut R, ) -> Result<bool>

Check that each proof_i in proofs is a valid proof of evaluation for commitment_i at point_i.

Trait Implementations§

Source§

impl<E: Clone + PairingEngine> Clone for KZG10<E>

Source§

fn clone(&self) -> KZG10<E>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug + PairingEngine> Debug for KZG10<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<E> Freeze for KZG10<E>

§

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

§

impl<E> Send for KZG10<E>

§

impl<E> Sync for KZG10<E>

§

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

§

impl<E> UnwindSafe for KZG10<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V