Closed weikengchen closed 3 years ago
When implementing ThreeBitCondNegLookupGadget, FpVar would invoke the implementation for constants (no CS needed), or the implementation for allocated bits. https://github.com/scipr-lab/zexe/blob/master/r1cs-std/src/fields/fp/mod.rs#L978
fn three_bit_cond_neg_lookup( b: &[Boolean<F>], b0b1: &Boolean<F>, c: &[Self::TableConstant], ) -> Result<Self, SynthesisError> { debug_assert_eq!(b.len(), 3); debug_assert_eq!(c.len(), 4); if !b.cs().or(b0b1.cs()).is_none() { // We only have constants let lsb = usize::from(b[0].value()?); let msb = usize::from(b[1].value()?); let index = lsb + (msb << 1); let intermediate = c[index]; let is_negative = b[2].value()?; let y = if is_negative { -intermediate } else { intermediate }; Ok(Self::Constant(y)) } else { AllocatedFp::three_bit_cond_neg_lookup(b, b0b1, c).map(Self::Var) } }
However, it seems that
if !b.cs().or(b0b1.cs()).is_none()
should be
if b.cs().or(b0b1.cs()).is_none()
This has been fixed in arkworks. Closed.
When implementing ThreeBitCondNegLookupGadget, FpVar would invoke the implementation for constants (no CS needed), or the implementation for allocated bits. https://github.com/scipr-lab/zexe/blob/master/r1cs-std/src/fields/fp/mod.rs#L978
However, it seems that
should be