mirror of
https://github.com/arnaucube/ark-r1cs-std.git
synced 2026-01-09 07:21:29 +01:00
Make ToBitsGadget for FpVar's output constant-length (#12)
This is related to a Zexe issue https://github.com/scipr-lab/zexe/issues/289 Basically, ToBitsGadget for FpVar may produce shorter output for a constant value, which is undesired for a few reasons.
This commit is contained in:
@@ -876,7 +876,8 @@ impl<F: PrimeField> ToBitsGadget<F> for FpVar<F> {
|
||||
fn to_non_unique_bits_le(&self) -> Result<Vec<Boolean<F>>, SynthesisError> {
|
||||
use ark_ff::BitIteratorLE;
|
||||
match self {
|
||||
Self::Constant(c) => Ok(BitIteratorLE::without_trailing_zeros(&c.into_repr())
|
||||
Self::Constant(c) => Ok(BitIteratorLE::new(&c.into_repr())
|
||||
.take((F::Params::MODULUS_BITS) as usize)
|
||||
.map(Boolean::constant)
|
||||
.collect::<Vec<_>>()),
|
||||
Self::Var(v) => v.to_non_unique_bits_le(),
|
||||
|
||||
Reference in New Issue
Block a user