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 append_to_transcript(&self, transcript: &mut impl Transcript);
}
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 append_to_transcript(&self, transcript: &mut impl Transcript)
fn append_to_transcript(&self, transcript: &mut impl Transcript)
Appends the commitment to the given transcript.
§Arguments
transcript
- The transcript to append the commitment to.
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.