diff --git a/executor/src/witgen/global_constraints.rs b/executor/src/witgen/global_constraints.rs index face80d4e..30cb82c2c 100644 --- a/executor/src/witgen/global_constraints.rs +++ b/executor/src/witgen/global_constraints.rs @@ -353,7 +353,7 @@ fn smallest_period_candidate(fixed: &[T]) -> Option { if fixed.first() != Some(&0.into()) { return None; } - (1..63).find(|bit| fixed.get(1usize << bit) == Some(&0.into())) + (1..63).find(|bit| fixed.last() == Some(&((1u64 << bit) - 1).into())) } #[cfg(test)] @@ -380,7 +380,7 @@ mod test { #[test] fn zero_one() { - let fixed = [0, 1, 0, 1, 0].map(|v| v.into()); + let fixed = [0, 1, 0, 1].map(|v| v.into()); assert_eq!( process_fixed_column::(&fixed), Some((RangeConstraint::from_mask(1_u32), true)) @@ -389,7 +389,7 @@ mod test { #[test] fn zero_one_two_three() { - let fixed = [0, 1, 2, 3, 0].map(|v| v.into()); + let fixed = [0, 1, 2, 3].map(|v| v.into()); assert_eq!( process_fixed_column::(&fixed), Some((RangeConstraint::from_mask(3_u32), true))