Trait proof_of_sql::base::commitment::VecCommitmentExt
source · pub trait VecCommitmentExt {
type CommitmentPublicSetup;
type DecompressedCommitment: Commitment;
// Required methods
fn from_columns_with_offset<'a, C>(
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Self
where C: Into<CommittableColumn<'a>>;
fn from_commitable_columns_with_offset(
committable_columns: &[CommittableColumn<'_>],
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Self;
fn try_append_rows_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Result<(), NumColumnsMismatch>
where C: Into<CommittableColumn<'a>>;
fn extend_columns_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
)
where C: Into<CommittableColumn<'a>>;
fn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized;
fn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized;
fn num_commitments(&self) -> usize;
fn to_decompressed(&self) -> Option<Vec<Self::DecompressedCommitment>>;
fn get_decompressed_commitment(
&self,
i: usize,
) -> Option<Self::DecompressedCommitment>;
}
Expand description
Extension trait intended for collections of commitments.
Implemented for Vec<CompressedRistretto>
.
Required Associated Types§
sourcetype CommitmentPublicSetup
type CommitmentPublicSetup
The public setup parameters required to compute the commitments. This is simply precomputed data that is required to compute the commitments.
sourcetype DecompressedCommitment: Commitment
type DecompressedCommitment: Commitment
The decompressed commitment type.
Required Methods§
sourcefn from_columns_with_offset<'a, C>(
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Selfwhere
C: Into<CommittableColumn<'a>>,
fn from_columns_with_offset<'a, C>(
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Selfwhere
C: Into<CommittableColumn<'a>>,
Returns a collection of commitments to the provided columns using the given generator offset.
sourcefn from_commitable_columns_with_offset(
committable_columns: &[CommittableColumn<'_>],
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Self
fn from_commitable_columns_with_offset( committable_columns: &[CommittableColumn<'_>], offset: usize, setup: &Self::CommitmentPublicSetup, ) -> Self
Returns a collection of commitments to the provided slice of CommittableColumn
s using the given generator offset.
sourcefn try_append_rows_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Result<(), NumColumnsMismatch>where
C: Into<CommittableColumn<'a>>,
fn try_append_rows_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
) -> Result<(), NumColumnsMismatch>where
C: Into<CommittableColumn<'a>>,
Append rows of data from the provided columns to the existing commitments.
The given generator offset will be used for committing to the new rows. You most likely want this to be equal to the 0-indexed row number of the first new row.
The number of columns provided must match the number of columns already committed to.
sourcefn extend_columns_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
)where
C: Into<CommittableColumn<'a>>,
fn extend_columns_with_offset<'a, C>(
&mut self,
columns: impl IntoIterator<Item = C>,
offset: usize,
setup: &Self::CommitmentPublicSetup,
)where
C: Into<CommittableColumn<'a>>,
Add commitments to new columns to this collection using the given generator offset.
sourcefn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>where
Self: Sized,
fn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>where
Self: Sized,
Add two collections of commitments if they have equal column counts.
sourcefn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>where
Self: Sized,
fn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>where
Self: Sized,
Subtract two collections of commitments if they have equal column counts.
sourcefn num_commitments(&self) -> usize
fn num_commitments(&self) -> usize
Returns the number of commitments in the collection.
sourcefn to_decompressed(&self) -> Option<Vec<Self::DecompressedCommitment>>
fn to_decompressed(&self) -> Option<Vec<Self::DecompressedCommitment>>
Decompresses the commitments in the collection.
Note: this could be made to return an iterator, but the usage does not currently require it.
sourcefn get_decompressed_commitment(
&self,
i: usize,
) -> Option<Self::DecompressedCommitment>
fn get_decompressed_commitment( &self, i: usize, ) -> Option<Self::DecompressedCommitment>
Decompresses a single commitment in the collection.