Browse Source

Adding `AdditiveGroup` and `PrimeGroup` (#159)

Co-authored-by: Michele Orrù <michele.orru@berkeley.edu>
Co-authored-by: Weikeng Chen <w.k@berkeley.edu>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
master
Hossein Moghaddas 1 year ago
committed by GitHub
parent
commit
32b487e7fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 49 additions and 44 deletions
  1. +4
    -4
      .github/workflows/ci.yml
  2. +2
    -1
      Cargo.toml
  3. +1
    -1
      bls12_377/src/curves/g1.rs
  4. +2
    -2
      bls12_377/src/curves/g2.rs
  5. +0
    -1
      bls12_381/benches/bls12_381.rs
  6. +2
    -2
      bls12_381/src/curves/g1.rs
  7. +2
    -2
      bls12_381/src/curves/g2.rs
  8. +1
    -1
      bls12_381/src/curves/tests/mod.rs
  9. +1
    -0
      bls12_381/src/fields/tests.rs
  10. +1
    -1
      bn254/src/curves/g1.rs
  11. +1
    -1
      bn254/src/curves/g2.rs
  12. +1
    -1
      bw6_761/src/curves/g1.rs
  13. +1
    -1
      bw6_761/src/curves/g2.rs
  14. +1
    -1
      bw6_761/src/fields/fq3.rs
  15. +1
    -1
      bw6_761/src/fields/fq6.rs
  16. +1
    -1
      cp6_782/src/curves/g2.rs
  17. +2
    -1
      cp6_782/src/curves/mod.rs
  18. +1
    -1
      cp6_782/src/fields/fq3.rs
  19. +1
    -1
      cp6_782/src/fields/fq6.rs
  20. +1
    -1
      curve-constraint-tests/src/lib.rs
  21. +1
    -0
      ed_on_bls12_381/src/fields/tests.rs
  22. +1
    -1
      ed_on_bls12_381_bandersnatch/src/curves/mod.rs
  23. +1
    -0
      ed_on_bls12_381_bandersnatch/src/fields/tests.rs
  24. +1
    -0
      ed_on_bn254/src/fields/tests.rs
  25. +1
    -1
      mnt4_298/src/curves/g2.rs
  26. +1
    -1
      mnt4_298/src/curves/mod.rs
  27. +1
    -1
      mnt4_298/src/fields/fq4.rs
  28. +1
    -1
      mnt4_753/src/curves/g2.rs
  29. +1
    -1
      mnt4_753/src/curves/mod.rs
  30. +1
    -1
      mnt4_753/src/fields/fq4.rs
  31. +1
    -1
      mnt6_298/src/curves/g2.rs
  32. +1
    -1
      mnt6_298/src/curves/mod.rs
  33. +1
    -1
      mnt6_298/src/fields/fq3.rs
  34. +1
    -1
      mnt6_298/src/fields/fq6.rs
  35. +1
    -1
      mnt6_753/src/curves/g2.rs
  36. +1
    -1
      mnt6_753/src/curves/mod.rs
  37. +1
    -1
      mnt6_753/src/fields/fq3.rs
  38. +1
    -1
      mnt6_753/src/fields/fq6.rs
  39. +1
    -1
      pallas/src/curves/mod.rs
  40. +1
    -1
      secp256k1/src/curves/mod.rs
  41. +1
    -1
      secq256k1/src/curves/mod.rs
  42. +1
    -1
      vesta/src/curves/mod.rs

+ 4
- 4
.github/workflows/ci.yml

@ -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
@ -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

+ 2
- 1
Cargo.toml

@ -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" }

+ 1
- 1
bls12_377/src/curves/g1.rs

@ -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};

+ 2
- 2
bls12_377/src/curves/g2.rs

@ -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::*;

+ 0
- 1
bls12_381/benches/bls12_381.rs

@ -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,
};

+ 2
- 2
bls12_381/src/curves/g1.rs

@ -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};

+ 2
- 2
bls12_381/src/curves/g2.rs

@ -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::{

+ 1
- 1
bls12_381/src/curves/tests/mod.rs

@ -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};

+ 1
- 0
bls12_381/src/fields/tests.rs

@ -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},

+ 1
- 1
bn254/src/curves/g1.rs

@ -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};

+ 1
- 1
bn254/src/curves/g2.rs

@ -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};

+ 1
- 1
bw6_761/src/curves/g1.rs

@ -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};

+ 1
- 1
bw6_761/src/curves/g2.rs

@ -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};

+ 1
- 1
bw6_761/src/fields/fq3.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::Fq;

+ 1
- 1
bw6_761/src/fields/fq6.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq3, Fq3Config};

+ 1
- 1
cp6_782/src/curves/g2.rs

@ -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;

+ 2
- 1
cp6_782/src/curves/mod.rs

@ -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;

+ 1
- 1
cp6_782/src/fields/fq3.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::Fq;

+ 1
- 1
cp6_782/src/fields/fq6.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq3, Fq3Config};

+ 1
- 1
curve-constraint-tests/src/lib.rs

@ -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};

+ 1
- 0
ed_on_bls12_381/src/fields/tests.rs

@ -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::*},

+ 1
- 1
ed_on_bls12_381_bandersnatch/src/curves/mod.rs

@ -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};

+ 1
- 0
ed_on_bls12_381_bandersnatch/src/fields/tests.rs

@ -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::*},

+ 1
- 0
ed_on_bn254/src/fields/tests.rs

@ -1,4 +1,5 @@
use ark_algebra_test_templates::*;
use ark_ec::AdditiveGroup;
use ark_ff::{
biginteger::BigInteger256 as BigInteger,
fields::{Field, LegendreSymbol::*},

+ 1
- 1
mnt4_298/src/curves/g2.rs

@ -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};

+ 1
- 1
mnt4_298/src/curves/mod.rs

@ -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};

+ 1
- 1
mnt4_298/src/fields/fq4.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp4::{Fp4, Fp4Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq2, Fq2Config};

+ 1
- 1
mnt4_753/src/curves/g2.rs

@ -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};

+ 1
- 1
mnt4_753/src/curves/mod.rs

@ -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};

+ 1
- 1
mnt4_753/src/fields/fq4.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp4::{Fp4, Fp4Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq2, Fq2Config};

+ 1
- 1
mnt6_298/src/curves/g2.rs

@ -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};

+ 1
- 1
mnt6_298/src/curves/mod.rs

@ -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};

+ 1
- 1
mnt6_298/src/fields/fq3.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::fq::Fq;

+ 1
- 1
mnt6_298/src/fields/fq6.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq3, Fq3Config};

+ 1
- 1
mnt6_753/src/curves/g2.rs

@ -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};

+ 1
- 1
mnt6_753/src/curves/mod.rs

@ -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};

+ 1
- 1
mnt6_753/src/fields/fq3.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp3::{Fp3, Fp3Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::fq::Fq;

+ 1
- 1
mnt6_753/src/fields/fq6.rs

@ -1,6 +1,6 @@
use ark_ff::{
fields::fp6_2over3::{Fp6, Fp6Config},
Field, MontFp,
AdditiveGroup, Field, MontFp,
};
use crate::{Fq, Fq3, Fq3Config};

+ 1
- 1
pallas/src/curves/mod.rs

@ -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};

+ 1
- 1
secp256k1/src/curves/mod.rs

@ -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};

+ 1
- 1
secq256k1/src/curves/mod.rs

@ -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};

+ 1
- 1
vesta/src/curves/mod.rs

@ -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;

Loading…
Cancel
Save