Trait Commitment

Source
pub trait Commitment:
    AddAssign
    + SubAssign
    + Sized
    + Default
    + Clone
    + Neg<Output = Self>
    + Eq
    + Sub<Output = Self>
    + Debug
    + Sync
    + Send {
    type Scalar: Scalar + for<'a> Mul<&'a Self, Output = Self> + Mul<Self, Output = Self> + Serialize + for<'a> Deserialize<'a>;
    type PublicSetup<'a>;

    // Required methods
    fn compute_commitments(
        committable_columns: &[CommittableColumn<'_>],
        offset: usize,
        setup: &Self::PublicSetup<'_>,
    ) -> Vec<Self>;
    fn to_transcript_bytes(&self) -> Vec<u8> ;
}
Expand description

A trait for using commitment schemes generically.

Required Associated Types§

Source

type Scalar: Scalar + for<'a> Mul<&'a Self, Output = Self> + Mul<Self, Output = Self> + Serialize + for<'a> Deserialize<'a>

The associated scalar that the commitment is for. There are multiple possible commitment schemes for a scalar, but only one scalar for any commitment.

Source

type PublicSetup<'a>

The public setup for the commitment scheme.

Required Methods§

Source

fn compute_commitments( committable_columns: &[CommittableColumn<'_>], offset: usize, setup: &Self::PublicSetup<'_>, ) -> Vec<Self>

Compute the commitments for the given columns.

The resulting commitments are written to the slice in commitments, which is a buffer. commitments is expected to have the same length as committable_columns and the behavior is undefined if it does not. The length of each CommittableColumn should be the same.

offset is the amount that committable_columns is “offset” by. Logically adding offset many 0s to the beginning of each of the committable_columns.

Source

fn to_transcript_bytes(&self) -> Vec<u8>

Converts the commitment to bytes that will be appended to the transcript.

This is also useful for serialization purposes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Commitment for RistrettoPoint

Source§

type Scalar = MontScalar<FrConfig>

Source§

type PublicSetup<'a> = ()

Source§

fn compute_commitments( committable_columns: &[CommittableColumn<'_>], offset: usize, _setup: &Self::PublicSetup<'_>, ) -> Vec<Self>

Source§

fn to_transcript_bytes(&self) -> Vec<u8>

Implementors§