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: remove TODO in cosets module #198

Merged
merged 1 commit into from
Aug 14, 2024
Merged
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
7 changes: 5 additions & 2 deletions cryptography/kzg_multi_open/src/fk20/cosets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ pub fn coset_gens(num_points: usize, num_cosets: usize, bit_reversed: bool) -> V
use bls12_381::ff::Field;

// Compute the generator for the group containing all of the points.
// TODO: generating the whole group, just to get the generator is inefficient
//
// Note: generating the whole group, just to get the generator is inefficient
// However, this code is not on the hot path, so we don't optimize it.
Comment on lines +47 to +48
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only called upon startup, we could just compute the generator given we know the largest primitive root of unity. I would only do this if we benchmark it to be an issue

let domain = Domain::new(num_points);
let coset_gen = domain.generator;

Expand All @@ -52,7 +54,8 @@ pub fn coset_gens(num_points: usize, num_cosets: usize, bit_reversed: bool) -> V
let mut coset_gens = Vec::new();
for i in 0..num_cosets {
let generator = if bit_reversed {
// TODO: We could just bit-reverse the `coset_gens` method instead
// Note: We could bit-reverse the `coset_gens` vector instead
// instead of bit-reversing the exponent.
let rev_i = reverse_bits(i, log2(num_cosets as u32)) as u64;
coset_gen.pow_vartime([rev_i])
} else {
Expand Down
Loading