Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-deng committed Nov 1, 2024
1 parent fc46e07 commit 99c3ccb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion starky/src/fibonacci_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ mod tests {
init_logger();

let config = StarkConfig::standard_fast_config();
let num_rows = 1 << 5;
let degree_bits = 5;
let num_rows = 1 << degree_bits;
let public_inputs = [F::ZERO, F::ONE, fibonacci(num_rows - 1, F::ZERO, F::ONE)];

// Test first STARK
Expand Down
26 changes: 15 additions & 11 deletions starky/src/recursive_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,24 @@ pub fn verify_stark_proof_with_challenges_circuit<
.collect::<Vec<_>>(),
);

let max_degree_bits = log2_ceil(F::TWO_ADICITY);
let degree_bits_bits = builder.split_le(proof.degree_bits, max_degree_bits);

// degree_bits should be nonzero.
let mut or_all_bits = builder._false();
for i in 0..max_degree_bits {
or_all_bits = builder.or(or_all_bits, degree_bits_bits[i]);
let max_num_degree_bits = F::TWO_ADICITY;
{
// degree_bits should be nonzero.
let max_num_degree_bits_bits = log2_ceil(F::TWO_ADICITY);
let degree_bits_bits = builder.split_le(proof.degree_bits, max_num_degree_bits_bits);
let mut or_all_bits = builder._false();
for i in 0..max_num_degree_bits_bits {
or_all_bits = builder.or(or_all_bits, degree_bits_bits[i]);
}
builder.assert_one(or_all_bits.target);
}
builder.assert_one(or_all_bits.target);

let zeta_pow_deg = builder.exp_extension_from_bits(challenges.stark_zeta, &degree_bits_bits);
let z_h_zeta = builder.sub_extension(zeta_pow_deg, one);
let two = builder.two();
let degree = builder.exp(two, proof.degree_bits, max_degree_bits);
let degree = builder.exp(two, proof.degree_bits, max_num_degree_bits);
let degree_bits_vec = builder.split_le(degree, max_num_degree_bits);

let zeta_pow_deg = builder.exp_extension_from_bits(challenges.stark_zeta, &degree_bits_vec);
let z_h_zeta = builder.sub_extension(zeta_pow_deg, one);
let degree_ext = builder.convert_to_ext(degree);

// Calculate primitive_root_of_unity(degree_bits)
Expand Down

0 comments on commit 99c3ccb

Please sign in to comment.