Make pairing and groth16 optional 🎉

This commit is contained in:
Jack Grigg 2018-07-06 21:51:22 +01:00
parent 276e09f1fb
commit 4272cfa5b0
No known key found for this signature in database
GPG Key ID: 1B8D649257DB0829
4 changed files with 14 additions and 1 deletions

View File

@ -22,6 +22,13 @@ byteorder = "1"
[dependencies.pairing]
git = "https://github.com/str4d/pairing"
rev = "3d41ee5abaa4888ff3607689aba007be8856816d"
optional = true
[features]
default = []
groth16 = ["pairing"]
default = ["groth16"]
[[test]]
name = "mimc"
path = "tests/mimc.rs"
required-features = ["groth16"]

View File

@ -371,6 +371,7 @@ fn parallel_fft<E: ScalarEngine, T: Group<E>>(
// Test multiplying various (low degree) polynomials together and
// comparing with naive evaluations.
#[cfg(feature = "pairing")]
#[test]
fn polynomial_arith() {
use pairing::bls12_381::Bls12;
@ -418,6 +419,7 @@ fn polynomial_arith() {
test_mul::<Bls12, _>(rng);
}
#[cfg(feature = "pairing")]
#[test]
fn fft_composition() {
use pairing::bls12_381::Bls12;
@ -456,6 +458,7 @@ fn fft_composition() {
test_comp::<Bls12, _>(rng);
}
#[cfg(feature = "pairing")]
#[test]
fn parallel_fft_consistency() {
use pairing::bls12_381::Bls12;

View File

@ -1,5 +1,6 @@
extern crate ff;
extern crate group;
#[cfg(feature = "pairing")]
extern crate pairing;
extern crate rand;
extern crate num_cpus;
@ -12,6 +13,7 @@ extern crate byteorder;
pub mod multicore;
mod multiexp;
pub mod domain;
#[cfg(feature = "groth16")]
pub mod groth16;
use ff::{Field, ScalarEngine};

View File

@ -255,6 +255,7 @@ pub fn multiexp<Q, D, G, S>(
multiexp_inner(pool, bases, density_map, exponents, 0, c, true)
}
#[cfg(feature = "pairing")]
#[test]
fn test_with_bls12() {
fn naive_multiexp<G: CurveAffine>(