diff --git a/src/field/field_types.rs b/src/field/field_types.rs index 481d87ba..f5d06fdb 100644 --- a/src/field/field_types.rs +++ b/src/field/field_types.rs @@ -206,6 +206,7 @@ pub trait Field: subgroup.into_iter().map(|x| x * shift).collect() } + // TODO: move these to a new `PrimeField` trait (for all prime fields, not just 64-bit ones) fn from_biguint(n: BigUint) -> Self; fn to_biguint(&self) -> BigUint; diff --git a/src/gadgets/biguint.rs b/src/gadgets/biguint.rs index a524a79b..8369bfc4 100644 --- a/src/gadgets/biguint.rs +++ b/src/gadgets/biguint.rs @@ -28,12 +28,10 @@ impl BigUintTarget { impl, const D: usize> CircuitBuilder { pub fn constant_biguint(&mut self, value: &BigUint) -> BigUintTarget { let limb_values = value.to_u32_digits(); - let mut limbs = Vec::new(); - for i in 0..limb_values.len() { - limbs.push(U32Target( - self.constant(F::from_canonical_u32(limb_values[i])), - )); - } + let limbs = limb_values + .iter() + .map(|l| self.constant(F::from_canonical_u32(l))) + .collect(); BigUintTarget { limbs } } diff --git a/src/gates/assert_le.rs b/src/gates/assert_le.rs index 46432c03..98411ef2 100644 --- a/src/gates/assert_le.rs +++ b/src/gates/assert_le.rs @@ -13,6 +13,8 @@ use crate::plonk::plonk_common::{reduce_with_powers, reduce_with_powers_ext_recu use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase}; use crate::util::{bits_u64, ceil_div_usize}; +// TODO: replace/merge this gate with `ComparisonGate`. + /// A gate for checking that one value is less than or equal to another. #[derive(Clone, Debug)] pub struct AssertLessThanGate, const D: usize> {