Skip to content

Commit

Permalink
Import AdditiveGroup. (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: mmagician <[email protected]>
Co-authored-by: Pratyush Mishra <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2023
1 parent f85e92d commit 529c8dc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
21 changes: 18 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ keywords = ["zero-knowledge", "cryptography", "zkSNARK", "SNARK", "r1cs"]
categories = ["cryptography"]
include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
license = "MIT/Apache-2.0"
edition = "2018"
edition = "2021"
resolver = "2"

[dependencies]
ark-ff = { version = "0.4.0", default-features = false }
Expand All @@ -20,8 +21,8 @@ ark-relations = { version = "0.4.0", default-features = false }

derivative = { version = "2", features = ["use_core"] }
tracing = { version = "0.1", default-features = false, features = [ "attributes" ] }
num-bigint = {version = "0.4", default-features = false }
num-traits = {version = "0.2", default-features = false }
num-bigint = { version = "0.4", default-features = false }
num-traits = { version = "0.2", default-features = false }
num-integer = { version = "0.1.44", default-features = false }

[dev-dependencies]
Expand Down Expand Up @@ -70,3 +71,17 @@ lto = "thin"
incremental = true
debug-assertions = true
debug = true

[patch.crates-io]
ark-ff = { git = "https://github.com/arkworks-rs/algebra/" }
ark-ec = { git = "https://github.com/arkworks-rs/algebra/" }
ark-poly = { git = "https://github.com/arkworks-rs/algebra/" }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra/" }
ark-test-curves = { git = "https://github.com/arkworks-rs/algebra/" }
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves/" }
ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves/" }
ark-mnt4-298 = { git = "https://github.com/arkworks-rs/curves/" }
ark-mnt4-753 = { git = "https://github.com/arkworks-rs/curves/" }
ark-mnt6-298 = { git = "https://github.com/arkworks-rs/curves/" }
ark-mnt6-753 = { git = "https://github.com/arkworks-rs/curves/" }
ark-pallas = { git = "https://github.com/arkworks-rs/curves/" }
4 changes: 3 additions & 1 deletion src/bits/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/groups/curves/short_weierstrass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
)?;
(
Expand Down
2 changes: 1 addition & 1 deletion src/groups/curves/short_weierstrass/non_zero_affine.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/groups/curves/twisted_edwards/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
)?;
(
Expand Down

0 comments on commit 529c8dc

Please sign in to comment.