Import AdditiveGroup. (#122)

Co-authored-by: mmagician <marcin.gorny.94@protonmail.com>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
This commit is contained in:
Michele Orrù
2023-08-19 21:53:45 +02:00
committed by GitHub
parent f85e92d685
commit 529c8dc29e
5 changed files with 26 additions and 10 deletions

View File

@@ -956,7 +956,9 @@ impl<F: Field> CondSelectGadget<F> for Boolean<F> {
mod test {
use super::{AllocatedBool, Boolean};
use crate::prelude::*;
use ark_ff::{BitIteratorBE, BitIteratorLE, Field, One, PrimeField, UniformRand, Zero};
use ark_ff::{
AdditiveGroup, BitIteratorBE, BitIteratorLE, Field, One, PrimeField, UniformRand, Zero,
};
use ark_relations::r1cs::{ConstraintSystem, Namespace, SynthesisError};
use ark_test_curves::bls12_381::Fr;

View File

@@ -4,7 +4,7 @@ use ark_ec::{
},
AffineRepr, CurveGroup,
};
use ark_ff::{BigInteger, BitIteratorBE, Field, One, PrimeField, Zero};
use ark_ff::{AdditiveGroup, BigInteger, BitIteratorBE, Field, One, PrimeField, Zero};
use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError};
use ark_std::{borrow::Borrow, marker::PhantomData, ops::Mul};
use non_zero_affine::NonZeroAffineVar;
@@ -838,7 +838,7 @@ where
let (mut ge, iter) = if cofactor_weight < modulus_minus_1_weight {
let ge = Self::new_variable_omit_prime_order_check(
ark_relations::ns!(cs, "Witness without subgroup check with cofactor mul"),
|| f().map(|g| g.borrow().into_affine().mul_by_cofactor_inv().into()),
|| f().map(|g| g.into_affine().mul_by_cofactor_inv().into()),
mode,
)?;
(

View File

@@ -1,5 +1,5 @@
use super::*;
use ark_ec::Group;
use ark_ec::AdditiveGroup;
use ark_std::ops::Add;
/// An affine representation of a prime order curve point that is guaranteed

View File

@@ -3,7 +3,7 @@ use ark_ec::{
Affine as TEAffine, MontCurveConfig as MontgomeryModelParameter,
Projective as TEProjective, TECurveConfig as TEModelParameters,
},
AffineRepr, CurveGroup, Group,
AdditiveGroup, AffineRepr, CurveGroup,
};
use ark_ff::{BigInteger, BitIteratorBE, Field, One, PrimeField, Zero};
use ark_relations::r1cs::{ConstraintSystemRef, Namespace, SynthesisError};
@@ -337,7 +337,6 @@ where
.iter()
.zip(segment_powers.borrow())
{
let base_power = base_power.borrow();
let mut acc_power = *base_power;
let mut coords = vec![];
for _ in 0..4 {
@@ -609,7 +608,7 @@ where
let (mut ge, iter) = if cofactor_weight < modulus_minus_1_weight {
let ge = Self::new_variable_omit_prime_order_check(
ark_relations::ns!(cs, "Witness without subgroup check with cofactor mul"),
|| f().map(|g| g.borrow().into_affine().mul_by_cofactor_inv().into()),
|| f().map(|g| g.into_affine().mul_by_cofactor_inv().into()),
mode,
)?;
(