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§
Sourcetype Scalar: Scalar + for<'a> Mul<&'a Self, Output = Self> + Mul<Self, Output = Self> + Serialize + for<'a> Deserialize<'a>
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.
Sourcetype PublicSetup<'a>
type PublicSetup<'a>
The public setup for the commitment scheme.
Required Methods§
Sourcefn compute_commitments(
committable_columns: &[CommittableColumn<'_>],
offset: usize,
setup: &Self::PublicSetup<'_>,
) -> Vec<Self>
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
.
Sourcefn to_transcript_bytes(&self) -> Vec<u8> ⓘ
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.