Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename for maximum aggregation factor #132

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/range_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ impl<P> RangeParameters<P>
where P: FromUniformBytes + Compressable + Clone + Precomputable
{
/// Initialize a new 'RangeParameters' with sanity checks
pub fn init(bit_length: usize, aggregation_factor: usize, pc_gens: PedersenGens<P>) -> Result<Self, ProofError> {
if !aggregation_factor.is_power_of_two() {
pub fn init(
bit_length: usize,
max_aggregation_factor: usize,
pc_gens: PedersenGens<P>,
) -> Result<Self, ProofError> {
if !max_aggregation_factor.is_power_of_two() {
return Err(ProofError::InvalidArgument(
"Aggregation factor size must be a power of two".to_string(),
));
Expand All @@ -48,7 +52,7 @@ where P: FromUniformBytes + Compressable + Clone + Precomputable
}

Ok(Self {
bp_gens: BulletproofGens::new(bit_length, aggregation_factor)?,
bp_gens: BulletproofGens::new(bit_length, max_aggregation_factor)?,
pc_gens,
})
}
Expand All @@ -58,8 +62,8 @@ where P: FromUniformBytes + Compressable + Clone + Precomputable
&self.pc_gens
}

/// Returns the aggregation factor
pub fn aggregation_factor(&self) -> usize {
/// Returns the maximum aggregation factor
pub fn max_aggregation_factor(&self) -> usize {
self.bp_gens.party_capacity
}

Expand Down Expand Up @@ -95,12 +99,12 @@ where P: FromUniformBytes + Compressable + Clone + Precomputable

/// Return the non-public value iterator to the bulletproof generators
pub fn hi_base_iter(&self) -> impl Iterator<Item = &P> {
self.bp_gens.h_iter(self.bit_length(), self.aggregation_factor())
self.bp_gens.h_iter(self.bit_length(), self.max_aggregation_factor())
}

/// Return the non-public mask iterator to the bulletproof generators
pub fn gi_base_iter(&self) -> impl Iterator<Item = &P> {
self.bp_gens.g_iter(self.bit_length(), self.aggregation_factor())
self.bp_gens.g_iter(self.bit_length(), self.max_aggregation_factor())
}

/// Return the interleaved precomputation tables
Expand Down
4 changes: 2 additions & 2 deletions src/range_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ where
let padding = compute_generator_padding(
statement.generators.bit_length(),
statement.commitments.len(),
statement.generators.aggregation_factor(),
statement.generators.max_aggregation_factor(),
)?;
let a = statement.generators.precomp().vartime_mixed_multiscalar_mul(
a_li.iter()
Expand Down Expand Up @@ -1034,7 +1034,7 @@ where
let padding = compute_generator_padding(
max_statement.generators.bit_length(),
max_statement.commitments.len(),
max_statement.generators.aggregation_factor(),
max_statement.generators.max_aggregation_factor(),
)?;
if precomp.vartime_mixed_multiscalar_mul(
gi_base_scalars
Expand Down
2 changes: 1 addition & 1 deletion src/range_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<P: Compressable + FromUniformBytes + Clone + Precomputable> RangeStatement<
"Incorrect number of minimum value promises".to_string(),
));
}
if generators.aggregation_factor() < commitments.len() {
if generators.max_aggregation_factor() < commitments.len() {
return Err(ProofError::InvalidArgument(
"Not enough generators for this statement".to_string(),
));
Expand Down