88 incorrectly sets the bit-length of an element in BaseField to ScalarField::MODULUS_BIT_SIZE in NonNativeAffineVar::inputize. This works for Pasta curves and BN254, but is problematic for curves with ScalarField::MODULUS_BIT_SIZE != BaseField::MODULUS_BIT_SIZE, e.g., the test below will fail for BLS12_381.
#[test]
fn test_inputize() {
let cs = ConstraintSystem::<ark_bls12_381::Fr>::new_ref();
// check that point_to_nonnative_limbs returns the expected values
let mut rng = ark_std::test_rng();
let p = ark_bls12_381::G1Projective::rand(&mut rng);
let pVar = NonNativeAffineVar::<ark_bls12_381::G1Projective>::new_witness(cs.clone(), || Ok(p)).unwrap();
let (x, y) = NonNativeAffineVar::inputize(p).unwrap();
assert_eq!(pVar.x.0.value().unwrap(), x);
assert_eq!(pVar.y.0.value().unwrap(), y);
}
This PR is a hotfix that ensures it works correctly.
88 incorrectly sets the bit-length of an element in
BaseField
toScalarField::MODULUS_BIT_SIZE
inNonNativeAffineVar::inputize
. This works for Pasta curves and BN254, but is problematic for curves withScalarField::MODULUS_BIT_SIZE != BaseField::MODULUS_BIT_SIZE
, e.g., the test below will fail for BLS12_381.This PR is a hotfix that ensures it works correctly.