Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Adding AdditiveGroup and PrimeGroup (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: Michele Orrù <[email protected]>
Co-authored-by: Weikeng Chen <[email protected]>
Co-authored-by: Pratyush Mishra <[email protected]>
  • Loading branch information
4 people authored Aug 19, 2023
1 parent 5a41d7f commit 32b487e
Show file tree
Hide file tree
Showing 42 changed files with 49 additions and 44 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Rust (${{ matrix.rust }})
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-unknown-none
target: thumbv6m-none-eabi
override: true

- uses: actions/cache@v2
Expand All @@ -183,10 +183,10 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: check
args: --examples --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none
args: --examples --workspace --exclude ark-curve-constraint-tests --target thumbv6m-none-eabi

- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none
args: --workspace --exclude ark-curve-constraint-tests --target thumbv6m-none-eabi
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ 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-algebra-test-templates = { git = "https://github.com/arkworks-rs/algebra/" }
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std/" }
ark-algebra-bench-templates = { git = "https://github.com/arkworks-rs/algebra/" }
ark-r1cs-std = { git = "https://github.com/mmaker/ark-r1cs-std/", branch = "feature/additive-groups" }
2 changes: 1 addition & 1 deletion bls12_377/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ark_ec::{
},
CurveConfig,
};
use ark_ff::{Field, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, PrimeField, Zero};
use ark_std::{ops::Neg, One};

use super::g1_swu_iso::{SwuIsoConfig, ISOGENY_MAP_TO_G1};
Expand Down
4 changes: 2 additions & 2 deletions bls12_377/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use ark_ec::{
hashing::curve_maps::wb::{IsogenyMap, WBConfig},
models::CurveConfig,
short_weierstrass::{Affine, Projective, SWCurveConfig},
AffineRepr, CurveGroup, Group,
AffineRepr, CurveGroup, PrimeGroup,
};

use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};
use ark_std::ops::Neg;

use crate::*;
Expand Down
1 change: 0 additions & 1 deletion bls12_381/benches/bls12_381.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use ark_algebra_bench_templates::*;

use ark_bls12_381::{
fq::Fq, fq2::Fq2, fr::Fr, Bls12_381, Fq12, G1Projective as G1, G2Projective as G2,
};
Expand Down
4 changes: 2 additions & 2 deletions bls12_381/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use ark_ec::{
hashing::curve_maps::wb::{IsogenyMap, WBConfig},
models::CurveConfig,
short_weierstrass::{Affine, SWCurveConfig},
AffineRepr, Group,
AffineRepr, PrimeGroup,
};
use ark_ff::{Field, MontFp, PrimeField, Zero};
use ark_ff::{AdditiveGroup, MontFp, PrimeField, Zero};
use ark_serialize::{Compress, SerializationError};
use ark_std::{ops::Neg, One};

Expand Down
4 changes: 2 additions & 2 deletions bls12_381/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use ark_ec::{
hashing::curve_maps::wb::{IsogenyMap, WBConfig},
models::CurveConfig,
short_weierstrass::{Affine, Projective, SWCurveConfig},
AffineRepr, CurveGroup, Group,
AffineRepr, CurveGroup, PrimeGroup,
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};
use ark_serialize::{Compress, SerializationError};

use super::{
Expand Down
2 changes: 1 addition & 1 deletion bls12_381/src/curves/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ark_algebra_test_templates::*;
use ark_ec::{AffineRepr, CurveGroup, Group};
use ark_ec::{AffineRepr, CurveGroup, PrimeGroup};
use ark_ff::{fields::Field, One, UniformRand, Zero};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, Compress, Validate};
use ark_std::{rand::Rng, test_rng, vec};
Expand Down
1 change: 1 addition & 0 deletions bls12_381/src/fields/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ark_algebra_test_templates::*;
use ark_ec::AdditiveGroup;
use ark_ff::{
biginteger::{BigInt, BigInteger, BigInteger384},
fields::{FftField, Field, Fp12Config, Fp2Config, Fp6Config, PrimeField},
Expand Down
2 changes: 1 addition & 1 deletion bn254/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{short_weierstrass::SWCurveConfig, CurveConfig},
short_weierstrass::Affine,
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};

use crate::{Fq, Fr};

Expand Down
2 changes: 1 addition & 1 deletion bn254/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{short_weierstrass::SWCurveConfig, CurveConfig},
short_weierstrass::Affine,
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, MontFp, Zero};

use crate::{Fq, Fq2, Fr};

Expand Down
2 changes: 1 addition & 1 deletion bw6_761/src/curves/g1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{short_weierstrass::SWCurveConfig, CurveConfig},
short_weierstrass::{Affine, Projective},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{Fq, Fr};

Expand Down
2 changes: 1 addition & 1 deletion bw6_761/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::{short_weierstrass::SWCurveConfig, CurveConfig},
short_weierstrass::{Affine, Projective},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{Fq, Fr};

Expand Down
2 changes: 1 addition & 1 deletion bw6_761/src/fields/fq3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::Fq;
Expand Down
2 changes: 1 addition & 1 deletion bw6_761/src/fields/fq6.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq3, Fq3Config};
Expand Down
2 changes: 1 addition & 1 deletion cp6_782/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
short_weierstrass::{Affine, Projective, SWCurveConfig},
AffineRepr, CurveGroup,
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::vec::Vec;

Expand Down
3 changes: 2 additions & 1 deletion cp6_782/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use ark_ec::{
pairing::{MillerLoopOutput, Pairing, PairingOutput},
};
use ark_ff::{
biginteger::BigInteger832, BigInt, BitIteratorBE, CyclotomicMultSubgroup, Field, One,
biginteger::BigInteger832, AdditiveGroup, BigInt, BitIteratorBE, CyclotomicMultSubgroup, Field,
One,
};
use itertools::Itertools;

Expand Down
2 changes: 1 addition & 1 deletion cp6_782/src/fields/fq3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::Fq;
Expand Down
2 changes: 1 addition & 1 deletion cp6_782/src/fields/fq6.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq3, Fq3Config};
Expand Down
2 changes: 1 addition & 1 deletion curve-constraint-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub mod fields {
pub mod curves {
use ark_ec::{
short_weierstrass::Projective as SWProjective, twisted_edwards::Projective as TEProjective,
CurveGroup, Group,
AdditiveGroup, CurveGroup,
};
use ark_ff::{BitIteratorLE, Field, One, PrimeField};
use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
Expand Down
1 change: 1 addition & 0 deletions ed_on_bls12_381/src/fields/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{Fq, Fr};
use ark_algebra_test_templates::*;
use ark_ec::AdditiveGroup;
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
fields::{Field, LegendreSymbol::*},
Expand Down
2 changes: 1 addition & 1 deletion ed_on_bls12_381_bandersnatch/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
short_weierstrass::{self, SWCurveConfig},
twisted_edwards::{Affine, MontCurveConfig, Projective, TECurveConfig},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{Fq, Fr};

Expand Down
1 change: 1 addition & 0 deletions ed_on_bls12_381_bandersnatch/src/fields/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{Fq, Fr};
use ark_algebra_test_templates::*;
use ark_ec::AdditiveGroup;
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
fields::{Field, LegendreSymbol::*},
Expand Down
1 change: 1 addition & 0 deletions ed_on_bn254/src/fields/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use ark_algebra_test_templates::*;
use ark_ec::AdditiveGroup;
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
fields::{Field, LegendreSymbol::*},
Expand Down
2 changes: 1 addition & 1 deletion mnt4_298/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt4::MNT4Config,
models::{short_weierstrass::SWCurveConfig, CurveConfig},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{Fq, Fq2, Fr, G1_COEFF_A_NON_RESIDUE};

Expand Down
2 changes: 1 addition & 1 deletion mnt4_298/src/curves/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ark_ec::models::mnt4::{MNT4Config, MNT4};
use ark_ff::{biginteger::BigInteger320, BigInt, Field, MontFp};
use ark_ff::{biginteger::BigInteger320, AdditiveGroup, BigInt, Field, MontFp};

use crate::{Fq, Fq2, Fq2Config, Fq4Config, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt4_298/src/fields/fq4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp4::{Fp4, Fp4Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq2, Fq2Config};
Expand Down
2 changes: 1 addition & 1 deletion mnt4_753/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt4::MNT4Config,
models::{short_weierstrass::SWCurveConfig, CurveConfig},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{Fq, Fq2, Fr, G1_COEFF_A_NON_RESIDUE};

Expand Down
2 changes: 1 addition & 1 deletion mnt4_753/src/curves/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ark_ec::models::mnt4::{MNT4Config, MNT4};
use ark_ff::{
biginteger::{BigInt, BigInteger768},
Field, Fp2, MontFp,
AdditiveGroup, Field, Fp2, MontFp,
};

use crate::{Fq, Fq2Config, Fq4Config, Fr};
Expand Down
2 changes: 1 addition & 1 deletion mnt4_753/src/fields/fq4.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp4::{Fp4, Fp4Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq2, Fq2Config};
Expand Down
2 changes: 1 addition & 1 deletion mnt6_298/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt6::MNT6Config,
models::{short_weierstrass::SWCurveConfig, CurveConfig},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{g1, Fq, Fq3, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_298/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::mnt6::{MNT6Config, MNT6},
short_weierstrass::SWCurveConfig,
};
use ark_ff::{biginteger::BigInteger320, BigInt, Field, Fp3};
use ark_ff::{biginteger::BigInteger320, AdditiveGroup, BigInt, Field, Fp3};

use crate::{Fq, Fq3Config, Fq6Config, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_298/src/fields/fq3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::fq::Fq;
Expand Down
2 changes: 1 addition & 1 deletion mnt6_298/src/fields/fq6.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq3, Fq3Config};
Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/curves/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
mnt6::MNT6Config,
models::{short_weierstrass::SWCurveConfig, CurveConfig},
};
use ark_ff::{Field, MontFp};
use ark_ff::{AdditiveGroup, MontFp};

use crate::{g1, Fq, Fq3, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::models::{
mnt6::{MNT6Config, MNT6},
short_weierstrass::SWCurveConfig,
};
use ark_ff::{biginteger::BigInteger768, BigInt, Field, Fp3};
use ark_ff::{biginteger::BigInteger768, AdditiveGroup, BigInt, Field, Fp3};

use crate::{Fq, Fq3Config, Fq6Config, Fr};

Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/fields/fq3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::fq::Fq;
Expand Down
2 changes: 1 addition & 1 deletion mnt6_753/src/fields/fq6.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};

use crate::{Fq, Fq3, Fq3Config};
Expand Down
2 changes: 1 addition & 1 deletion pallas/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};

use crate::{fq::Fq, fr::Fr};

Expand Down
2 changes: 1 addition & 1 deletion secp256k1/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};

use crate::{fq::Fq, fr::Fr};

Expand Down
2 changes: 1 addition & 1 deletion secq256k1/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};

use crate::{fq::Fq, fr::Fr};

Expand Down
2 changes: 1 addition & 1 deletion vesta/src/curves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ark_ec::{
models::CurveConfig,
short_weierstrass::{self as sw, SWCurveConfig},
};
use ark_ff::{Field, MontFp, Zero};
use ark_ff::{AdditiveGroup, Field, MontFp, Zero};

#[cfg(test)]
mod tests;
Expand Down

0 comments on commit 32b487e

Please sign in to comment.