diff --git a/extensions/native/compiler/src/ir/utils.rs b/extensions/native/compiler/src/ir/utils.rs index 79cddbd431..05565e484d 100644 --- a/extensions/native/compiler/src/ir/utils.rs +++ b/extensions/native/compiler/src/ir/utils.rs @@ -141,8 +141,7 @@ impl Builder { /// Exponentiates a variable to a list of reversed bits with a given length. /// - /// Example: if power_bits = [1, 0, 1, 0] and bit_len = Const(4), then - /// the result should be x^8 * x^2 = x^10. + /// Example: if power_bits = [1, 0, 1, 0], then the result should be x^8 * x^2 = x^10. /// /// Reference: [`openvm_stark_backend::p3_util::reverse_bits_len`] pub fn exp_reverse_bits_len(&mut self, x: V, power_bits: &Array>) -> V diff --git a/extensions/native/recursion/src/challenger/duplex.rs b/extensions/native/recursion/src/challenger/duplex.rs index 180f2c155b..c77a92e2c8 100644 --- a/extensions/native/recursion/src/challenger/duplex.rs +++ b/extensions/native/recursion/src/challenger/duplex.rs @@ -139,7 +139,6 @@ impl DuplexChallengerVariable { builder.range(nb_bits, bits.len()).for_each(|i, builder| { builder.set(&bits, i, C::N::ZERO); }); - bits } diff --git a/extensions/native/recursion/src/fri/mod.rs b/extensions/native/recursion/src/fri/mod.rs index 8ed8655469..abb0da2c0d 100644 --- a/extensions/native/recursion/src/fri/mod.rs +++ b/extensions/native/recursion/src/fri/mod.rs @@ -51,7 +51,8 @@ where let two_adic_gen_ext = two_adic_generator_f.to_operand().symbolic(); let two_adic_generator_ef: Ext<_, _> = builder.eval(two_adic_gen_ext); - let x = builder.exp_reverse_bits_len(two_adic_generator_ef, index_bits); + let index_bits_truncated = index_bits.slice(builder, 0, log_max_height); + let x = builder.exp_reverse_bits_len(two_adic_generator_ef, &index_bits_truncated); builder .range(0, commit_phase_commits.len()) diff --git a/extensions/native/recursion/src/fri/two_adic_pcs.rs b/extensions/native/recursion/src/fri/two_adic_pcs.rs index 49441e034a..3897747c6c 100644 --- a/extensions/native/recursion/src/fri/two_adic_pcs.rs +++ b/extensions/native/recursion/src/fri/two_adic_pcs.rs @@ -197,13 +197,19 @@ pub fn verify_two_adic_pcs( let cur_alpha_pow = builder.get(&alpha_pow, log_height); let bits_reduced: Usize<_> = builder.eval(log_max_height - log_height); - let index_bits_shifted = index_bits.shift(builder, bits_reduced); + let index_bits_shifted = + index_bits.shift(builder, bits_reduced.clone()); let two_adic_generator = config.get_two_adic_generator(builder, log_height); builder.cycle_tracker_start("exp-reverse-bits-len"); - let two_adic_generator_exp = builder - .exp_reverse_bits_len(two_adic_generator, &index_bits_shifted); + + let index_bits_shifted_truncated = + index_bits_shifted.slice(builder, 0, log_height); + let two_adic_generator_exp = builder.exp_reverse_bits_len( + two_adic_generator, + &index_bits_shifted_truncated, + ); builder.cycle_tracker_end("exp-reverse-bits-len"); let x: Felt = builder.eval(two_adic_generator_exp * g);