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

fix(boojum): compute the correct number of PoW seed challenges #43

Merged
merged 1 commit into from
Nov 18, 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
6 changes: 2 additions & 4 deletions crates/boojum/src/cs/implementations/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2111,11 +2111,9 @@ impl<

let now = std::time::Instant::now();

const SEED_BITS: usize = 256;
// pull enough challenges from the transcript
let mut num_challenges = 256 / F::CHAR_BITS;
if num_challenges % F::CHAR_BITS != 0 {
num_challenges += 1;
}
let num_challenges = SEED_BITS.next_multiple_of(F::CHAR_BITS) / F::CHAR_BITS;
let challenges = transcript.get_multiple_challenges(num_challenges);
let pow_challenge = POW::run_from_field_elements(challenges, new_pow_bits, worker);

Expand Down
6 changes: 2 additions & 4 deletions crates/boojum/src/cs/implementations/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,11 +1958,9 @@ impl<F: SmallField, EXT: FieldExtension<2, BaseField = F>> Verifier<F, EXT> {
log!("Doing PoW verification for {} bits", new_pow_bits);
log!("Prover gave challenge 0x{:016x}", proof.pow_challenge);

const SEED_BITS: usize = 256;
// pull enough challenges from the transcript
let mut num_challenges = 256 / F::CHAR_BITS;
if num_challenges % F::CHAR_BITS != 0 {
num_challenges += 1;
}
let num_challenges = SEED_BITS.next_multiple_of(F::CHAR_BITS) / F::CHAR_BITS;
let challenges = transcript.get_multiple_challenges(num_challenges);
let pow_challenge = proof.pow_challenge;

Expand Down
6 changes: 2 additions & 4 deletions crates/boojum/src/gadgets/recursion/recursive_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,11 +1493,9 @@ impl<F: SmallField, EXT: FieldExtension<2, BaseField = F>, CS: ConstraintSystem<
log!("Doing PoW verification for {} bits", new_pow_bits);
// log!("Prover gave challenge 0x{:016x}", proof.pow_challenge);

const SEED_BITS: usize = 256;
// pull enough challenges from the transcript
let mut num_challenges = 256 / F::CHAR_BITS;
if num_challenges % F::CHAR_BITS != 0 {
num_challenges += 1;
}
let num_challenges = SEED_BITS.next_multiple_of(F::CHAR_BITS) / F::CHAR_BITS;
let _challenges: Vec<_> = transcript.get_multiple_challenges(cs, num_challenges);

todo!()
Expand Down
Loading