pub struct PolyComm<C> {
    pub chunks: Vec<C>,
}
Expand description

Represent a polynomial commitment when the type is instantiated with a curve.

The structure also handles chunking, i.e. when we aim to handle polynomials whose degree is higher than the SRS size. For this reason, we do use a vector for the field chunks.

Note that the parameter C is not constrained to be a curve, therefore in some places in the code, C can refer to a scalar field element. For instance, PolyComm<G::ScalarField> is used to represent the evaluation of the polynomial bound by a specific commitment, at a particular evaluation point.

Fields§

§chunks: Vec<C>

Implementations§

source§

impl<C> PolyComm<C>where C: CommitmentCurve,

source

pub fn chunk_commitment(&self, zeta_n: C::ScalarField) -> Self

Multiplies each commitment chunk of f with powers of zeta^n

source§

impl<F> PolyComm<F>where F: Field,

source

pub fn chunk_blinding(&self, zeta_n: F) -> F

Multiplies each blinding chunk of f with powers of zeta^n

source§

impl<T> PolyComm<T>

source

pub fn new(chunks: Vec<T>) -> Self

source§

impl<A: Copy + Clone + CanonicalDeserialize + CanonicalSerialize> PolyComm<A>

source

pub fn map<B, F>(&self, f: F) -> PolyComm<B>where F: FnMut(A) -> B, B: CanonicalDeserialize + CanonicalSerialize,

source

pub fn len(&self) -> usize

Returns the number of chunks.

source

pub fn is_empty(&self) -> bool

Returns true if the commitment is empty.

source

pub fn zip<B: Copy + CanonicalDeserialize + CanonicalSerialize>( &self, other: &PolyComm<B> ) -> Option<PolyComm<(A, B)>>

source

pub fn get_first_chunk(&self) -> A

Return only the first chunk Getting this single value is relatively common in the codebase, even though we should not do this, and abstract the chunks in the structure.

source§

impl<C: AffineRepr> PolyComm<C>

source

pub fn scale(&self, c: C::ScalarField) -> PolyComm<C>

source

pub fn multi_scalar_mul(com: &[&PolyComm<C>], elm: &[C::ScalarField]) -> Self

Performs a multi-scalar multiplication between scalars elm and commitments com. If both are empty, returns a commitment of length 1 containing the point at infinity.

Panics

Panics if com and elm are not of the same size.

Trait Implementations§

source§

impl<'a, 'b, C: AffineRepr> Add<&'a PolyComm<C>> for &'b PolyComm<C>

§

type Output = PolyComm<C>

The resulting type after applying the + operator.
source§

fn add(self, other: &'a PolyComm<C>) -> PolyComm<C>

Performs the + operation. Read more
source§

impl<C: Clone> Clone for PolyComm<C>

source§

fn clone(&self) -> PolyComm<C>

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<C: Debug> Debug for PolyComm<C>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de, C> Deserialize<'de> for PolyComm<C>where C: CanonicalDeserialize + CanonicalSerialize,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'de, T, U> DeserializeAs<'de, PolyComm<T>> for PolyComm<U>where U: DeserializeAs<'de, T>,

source§

fn deserialize_as<D>(deserializer: D) -> Result<PolyComm<T>, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.
source§

impl<'a, G, CamlG> From<&'a CamlPolyComm<CamlG>> for PolyComm<G>where G: AffineRepr + From<&'a CamlG> + From<CamlG>,

source§

fn from(camlpolycomm: &'a CamlPolyComm<CamlG>) -> PolyComm<G>

Converts to this type from the input type.
source§

impl<'a, G, CamlG> From<&'a PolyComm<G>> for CamlPolyComm<CamlG>where G: AffineRepr, CamlG: From<G> + From<&'a G>,

source§

fn from(polycomm: &'a PolyComm<G>) -> Self

Converts to this type from the input type.
source§

impl<G, CamlG> From<CamlPolyComm<CamlG>> for PolyComm<G>where G: AffineRepr + From<CamlG>,

source§

fn from(camlpolycomm: CamlPolyComm<CamlG>) -> PolyComm<G>

Converts to this type from the input type.
source§

impl<G, CamlG> From<PolyComm<G>> for CamlPolyComm<CamlG>where G: AffineRepr, CamlG: From<G>,

source§

fn from(polycomm: PolyComm<G>) -> Self

Converts to this type from the input type.
source§

impl<'a, G> IntoIterator for &'a PolyComm<G>

§

type Item = &'a G

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, G>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<C: PartialEq> PartialEq<PolyComm<C>> for PolyComm<C>

source§

fn eq(&self, other: &PolyComm<C>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<C> Serialize for PolyComm<C>where C: CanonicalDeserialize + CanonicalSerialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T, U> SerializeAs<PolyComm<T>> for PolyComm<U>where U: SerializeAs<T>,

source§

fn serialize_as<S>( source: &PolyComm<T>, serializer: S ) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer.
source§

impl<'a, 'b, C: AffineRepr + Sub<Output = C::Group>> Sub<&'a PolyComm<C>> for &'b PolyComm<C>

§

type Output = PolyComm<C>

The resulting type after applying the - operator.
source§

fn sub(self, other: &'a PolyComm<C>) -> PolyComm<C>

Performs the - operation. Read more
source§

impl<C: Eq> Eq for PolyComm<C>

source§

impl<C> StructuralEq for PolyComm<C>

source§

impl<C> StructuralPartialEq for PolyComm<C>

Auto Trait Implementations§

§

impl<C> RefUnwindSafe for PolyComm<C>where C: RefUnwindSafe,

§

impl<C> Send for PolyComm<C>where C: Send,

§

impl<C> Sync for PolyComm<C>where C: Sync,

§

impl<C> Unpin for PolyComm<C>where C: Unpin,

§

impl<C> UnwindSafe for PolyComm<C>where C: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,