From 7a0177e8c7d61a3daaff8c0a47bdf0c9daf6925f Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Wed, 10 Jun 2020 13:27:49 -0700 Subject: [PATCH] Re-export `edwards_on_cp6_782` as `edwards_on_bw6_761` --- r1cs-std/Cargo.toml | 8 ++++++-- .../src/instantiated/edwards_on_bw6_761/curves.rs | 11 +++++++++++ .../src/instantiated/edwards_on_bw6_761/fields.rs | 9 +++++++++ r1cs-std/src/instantiated/edwards_on_bw6_761/mod.rs | 1 + .../src/instantiated/edwards_on_cp6_782/curves.rs | 2 +- r1cs-std/src/instantiated/edwards_on_cp6_782/mod.rs | 2 ++ r1cs-std/src/instantiated/mod.rs | 6 ++++++ 7 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 r1cs-std/src/instantiated/edwards_on_bw6_761/curves.rs create mode 100644 r1cs-std/src/instantiated/edwards_on_bw6_761/fields.rs create mode 100644 r1cs-std/src/instantiated/edwards_on_bw6_761/mod.rs diff --git a/r1cs-std/Cargo.toml b/r1cs-std/Cargo.toml index 42e0a98..04078e4 100644 --- a/r1cs-std/Cargo.toml +++ b/r1cs-std/Cargo.toml @@ -30,17 +30,21 @@ derivative = { version = "2", features = ["use_core"] } rand = { version = "0.7", default-features = false } rand_xorshift = { version = "0.2" } # Currently this means that all downstream users of `r1cs-std` will be using -# `algebra` with the `bls12_381` feature. +# `algebra` with the `bls12_381` feature. This is because of a cargo bug. algebra = { path = "../algebra", default-features = false, features = [ "bls12_381" ] } [features] default = ["std"] -full = [ "bls12_377", "edwards_on_bls12_381", "edwards_on_bls12_377", "edwards_on_cp6_782", "mnt4_298", "mnt4_753", "mnt6_298", "mnt6_753" ] +full = [ + "bls12_377", "edwards_on_bls12_381", "edwards_on_bls12_377", "edwards_on_cp6_782", + "edwards_on_bw6_761", "mnt4_298", "mnt4_753", "mnt6_298", "mnt6_753" +] bls12_377 = [ "algebra/bls12_377" ] edwards_on_bls12_381 = [ "algebra/edwards_on_bls12_381" ] edwards_on_bls12_377 = [ "algebra/edwards_on_bls12_377" ] edwards_on_cp6_782 = [ "algebra/edwards_on_cp6_782" ] +edwards_on_bw6_761 = [ "algebra/edwards_on_bw6_761", "algebra/edwards_on_cp6_782" ] mnt4_298 = [ "algebra/mnt4_298" ] mnt4_753 = [ "algebra/mnt4_753" ] mnt6_298 = [ "algebra/mnt6_298" ] diff --git a/r1cs-std/src/instantiated/edwards_on_bw6_761/curves.rs b/r1cs-std/src/instantiated/edwards_on_bw6_761/curves.rs new file mode 100644 index 0000000..9850916 --- /dev/null +++ b/r1cs-std/src/instantiated/edwards_on_bw6_761/curves.rs @@ -0,0 +1,11 @@ +use crate::groups::curves::twisted_edwards::AffineGadget; +use algebra::edwards_on_cp6_782::*; + +use crate::edwards_on_cp6_782::FqGadget; + +pub type EdwardsGadget = AffineGadget; + +#[test] +fn test() { + crate::groups::curves::twisted_edwards::test::<_, EdwardsParameters, EdwardsGadget>(); +} diff --git a/r1cs-std/src/instantiated/edwards_on_bw6_761/fields.rs b/r1cs-std/src/instantiated/edwards_on_bw6_761/fields.rs new file mode 100644 index 0000000..3031843 --- /dev/null +++ b/r1cs-std/src/instantiated/edwards_on_bw6_761/fields.rs @@ -0,0 +1,9 @@ +use crate::fields::fp::FpGadget; +use algebra::edwards_on_cp6_782::fq::Fq; + +pub type FqGadget = FpGadget; + +#[test] +fn test() { + crate::fields::tests::field_test::<_, Fq, FqGadget>(); +} diff --git a/r1cs-std/src/instantiated/edwards_on_bw6_761/mod.rs b/r1cs-std/src/instantiated/edwards_on_bw6_761/mod.rs new file mode 100644 index 0000000..3f5df40 --- /dev/null +++ b/r1cs-std/src/instantiated/edwards_on_bw6_761/mod.rs @@ -0,0 +1 @@ +pub use crate::instantiated::edwards_on_cp6_782::*; diff --git a/r1cs-std/src/instantiated/edwards_on_cp6_782/curves.rs b/r1cs-std/src/instantiated/edwards_on_cp6_782/curves.rs index 9850916..7a402a7 100644 --- a/r1cs-std/src/instantiated/edwards_on_cp6_782/curves.rs +++ b/r1cs-std/src/instantiated/edwards_on_cp6_782/curves.rs @@ -1,7 +1,7 @@ use crate::groups::curves::twisted_edwards::AffineGadget; use algebra::edwards_on_cp6_782::*; -use crate::edwards_on_cp6_782::FqGadget; +use crate::instantiated::edwards_on_cp6_782::FqGadget; pub type EdwardsGadget = AffineGadget; diff --git a/r1cs-std/src/instantiated/edwards_on_cp6_782/mod.rs b/r1cs-std/src/instantiated/edwards_on_cp6_782/mod.rs index cd5e758..0119106 100644 --- a/r1cs-std/src/instantiated/edwards_on_cp6_782/mod.rs +++ b/r1cs-std/src/instantiated/edwards_on_cp6_782/mod.rs @@ -1,3 +1,5 @@ +#![allow(unreachable_pub)] + mod curves; mod fields; diff --git a/r1cs-std/src/instantiated/mod.rs b/r1cs-std/src/instantiated/mod.rs index d88452d..f0eab03 100644 --- a/r1cs-std/src/instantiated/mod.rs +++ b/r1cs-std/src/instantiated/mod.rs @@ -7,6 +7,12 @@ pub mod edwards_on_bls12_377; #[cfg(feature = "edwards_on_cp6_782")] pub mod edwards_on_cp6_782; +#[cfg(all(not(feature = "edwards_on_cp6_782"), feature = "edwards_on_bw6_761"))] +pub(crate) mod edwards_on_cp6_782; + +#[cfg(feature = "edwards_on_bw6_761")] +pub mod edwards_on_bw6_761; + #[cfg(feature = "edwards_on_bls12_381")] pub mod edwards_on_bls12_381;