diff --git a/Cargo.toml b/Cargo.toml index 2ff1eb8..7313947 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] authors = ["Sean Bowe ", "Alex Vlasov ", "Alex Gluchowski > EvaluationDomain { pub fn from_coeffs(mut coeffs: Vec) -> Result, SynthesisError> { - use pairing::ff::PrimeField; + use crate::pairing::ff::PrimeField; // Compute the size of our evaluation domain let coeffs_len = coeffs.len(); @@ -101,7 +101,7 @@ impl> EvaluationDomain { // this one does expect coefficients to be smaller than `num_roots_of_unity/2` as we expect multiplication pub fn from_coeffs_into_sized(mut coeffs: Vec, size: usize) -> Result, SynthesisError> { - use pairing::ff::PrimeField; + use crate::pairing::ff::PrimeField; // Compute the size of our evaluation domain assert!(size >= coeffs.len()); @@ -379,7 +379,7 @@ pub(crate) fn parallel_fft>( // comparing with naive evaluations. #[test] fn polynomial_arith() { - use pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Bls12; use rand::{self, Rand}; fn test_mul(rng: &mut R) @@ -426,7 +426,7 @@ fn polynomial_arith() { #[test] fn fft_composition() { - use pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Bls12; use rand; fn test_comp(rng: &mut R) @@ -464,7 +464,7 @@ fn fft_composition() { #[test] fn parallel_fft_consistency() { - use pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Bls12; use rand::{self, Rand}; use std::cmp::min; @@ -498,8 +498,8 @@ fn parallel_fft_consistency() { #[test] fn test_field_element_multiplication_bn256() { use rand::{self, Rand}; - use pairing::bn256::Bn256; - use pairing::bn256::Fr; + use crate::pairing::bn256::Bn256; + use crate::pairing::bn256::Fr; use num_cpus; let cpus = num_cpus::get(); @@ -527,8 +527,8 @@ fn test_field_element_multiplication_bn256() { #[test] fn test_fft_bn256() { use rand::{self, Rand}; - use pairing::bn256::Bn256; - use pairing::bn256::Fr; + use crate::pairing::bn256::Bn256; + use crate::pairing::bn256::Fr; use num_cpus; let cpus = num_cpus::get(); diff --git a/src/gm17/generator.rs b/src/gm17/generator.rs index 320ab07..f1dd3f0 100644 --- a/src/gm17/generator.rs +++ b/src/gm17/generator.rs @@ -4,14 +4,14 @@ use rand::Rng; use std::sync::Arc; -use pairing::{ +use crate::pairing::{ Engine, Wnaf, CurveProjective, CurveAffine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field }; diff --git a/src/gm17/mod.rs b/src/gm17/mod.rs index aee5de6..dc500d7 100644 --- a/src/gm17/mod.rs +++ b/src/gm17/mod.rs @@ -1,4 +1,4 @@ -use pairing::{ +use crate::pairing::{ Engine, CurveAffine, EncodedPoint @@ -474,8 +474,8 @@ impl PartialEq for Parameters { // use {Circuit, SynthesisError, ConstraintSystem}; // use rand::{Rand, thread_rng}; -// use pairing::ff::{Field}; -// use pairing::bls12_381::{Bls12, Fr}; +// use crate::pairing::ff::{Field}; +// use crate::pairing::bls12_381::{Bls12, Fr}; // #[test] // fn serialization() { diff --git a/src/gm17/tests/mod.rs b/src/gm17/tests/mod.rs index ee34ec6..697065a 100644 --- a/src/gm17/tests/mod.rs +++ b/src/gm17/tests/mod.rs @@ -1,8 +1,8 @@ -use pairing::{ +use crate::pairing::{ Engine }; -use pairing::ff:: { +use crate::pairing::ff:: { Field, PrimeField, }; diff --git a/src/groth16/generator.rs b/src/groth16/generator.rs index 961696a..e1dfdaf 100644 --- a/src/groth16/generator.rs +++ b/src/groth16/generator.rs @@ -4,14 +4,14 @@ use rand::Rng; use std::sync::Arc; -use pairing::{ +use crate::pairing::{ Engine, Wnaf, CurveProjective, CurveAffine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field }; diff --git a/src/groth16/mod.rs b/src/groth16/mod.rs index 14fb642..7abdc24 100644 --- a/src/groth16/mod.rs +++ b/src/groth16/mod.rs @@ -1,4 +1,4 @@ -use pairing::{ +use crate::pairing::{ Engine, CurveAffine, EncodedPoint @@ -487,8 +487,8 @@ mod test_with_bls12_381 { use crate::{Circuit, SynthesisError, ConstraintSystem}; use rand::{Rand, thread_rng}; - use pairing::ff::{Field}; - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::ff::{Field}; + use crate::pairing::bls12_381::{Bls12, Fr}; #[test] fn serialization() { diff --git a/src/groth16/prover.rs b/src/groth16/prover.rs index 86981e2..29870ca 100644 --- a/src/groth16/prover.rs +++ b/src/groth16/prover.rs @@ -6,13 +6,13 @@ use std::sync::Arc; use futures::Future; -use pairing::{ +use crate::pairing::{ Engine, CurveProjective, CurveAffine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field }; diff --git a/src/groth16/tests/mod.rs b/src/groth16/tests/mod.rs index 7442501..307f813 100644 --- a/src/groth16/tests/mod.rs +++ b/src/groth16/tests/mod.rs @@ -1,8 +1,8 @@ -use pairing::{ +use crate::pairing::{ Engine }; -use pairing::ff:: { +use crate::pairing::ff:: { Field, PrimeField, }; diff --git a/src/groth16/verifier.rs b/src/groth16/verifier.rs index ad1c210..03de2b9 100644 --- a/src/groth16/verifier.rs +++ b/src/groth16/verifier.rs @@ -1,10 +1,10 @@ -use pairing::{ +use crate::pairing::{ Engine, CurveProjective, CurveAffine }; -use pairing::ff::{PrimeField}; +use crate::pairing::ff::{PrimeField}; use super::{ Proof, diff --git a/src/group.rs b/src/group.rs index f66b776..8671d76 100644 --- a/src/group.rs +++ b/src/group.rs @@ -1,9 +1,9 @@ -use pairing::{ +use crate::pairing::{ Engine, CurveProjective }; -use pairing::ff::{ +use crate::pairing::ff::{ Field, PrimeField }; diff --git a/src/lib.rs b/src/lib.rs index f730ec4..d0760c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ #[macro_use] extern crate cfg_if; -extern crate pairing as pairing_import; +extern crate pairing_ce as pairing_import; extern crate rand; extern crate bit_vec; extern crate byteorder; @@ -50,20 +50,9 @@ pub mod pairing { mod cs; pub use self::cs::*; -// todo move to log module after removing all references -static mut VERBOSE_SWITCH: i8 = -1; - use std::str::FromStr; use std::env; fn verbose_flag() -> bool { - unsafe { - if VERBOSE_SWITCH < 0 { - VERBOSE_SWITCH = FromStr::from_str(&env::var("BELLMAN_VERBOSE").unwrap_or(String::new())).unwrap_or(1); - } - match VERBOSE_SWITCH { - 1 => true, - _ => false, - } - } + option_env!("BELLMAN_VERBOSE").unwrap_or("0") == "1" } \ No newline at end of file diff --git a/src/multiexp.rs b/src/multiexp.rs index e4682f2..5c35fb3 100644 --- a/src/multiexp.rs +++ b/src/multiexp.rs @@ -1,10 +1,10 @@ -use pairing::{ +use crate::pairing::{ CurveAffine, CurveProjective, Engine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field, PrimeFieldRepr, @@ -323,7 +323,7 @@ fn test_with_bls12() { } use rand::{self, Rand}; - use pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Bls12; const SAMPLES: usize = 1 << 14; @@ -348,7 +348,7 @@ fn test_with_bls12() { #[test] fn test_speed_with_bn256() { use rand::{self, Rand}; - use pairing::bn256::Bn256; + use crate::pairing::bn256::Bn256; use num_cpus; let cpus = num_cpus::get(); @@ -380,7 +380,7 @@ fn test_speed_with_bn256() { #[test] fn test_dense_multiexp() { use rand::{XorShiftRng, SeedableRng, Rand, Rng}; - use pairing::bn256::Bn256; + use crate::pairing::bn256::Bn256; use num_cpus; // const SAMPLES: usize = 1 << 22; diff --git a/src/sonic/cs/lc.rs b/src/sonic/cs/lc.rs index 8730473..971eca4 100644 --- a/src/sonic/cs/lc.rs +++ b/src/sonic/cs/lc.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine}; use std::ops::{Add, Sub, Neg}; /// This represents a linear combination of some variables, with coefficients diff --git a/src/sonic/cs/mod.rs b/src/sonic/cs/mod.rs index 0a42dfa..59e39f8 100644 --- a/src/sonic/cs/mod.rs +++ b/src/sonic/cs/mod.rs @@ -1,7 +1,7 @@ extern crate pairing; -use pairing::ff::{Field}; -use pairing::{Engine}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine}; use crate::{SynthesisError}; use std::marker::PhantomData; diff --git a/src/sonic/helped/adapted_helper.rs b/src/sonic/helped/adapted_helper.rs index 0243298..22f3a90 100644 --- a/src/sonic/helped/adapted_helper.rs +++ b/src/sonic/helped/adapted_helper.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use rand::{Rand, Rng}; diff --git a/src/sonic/helped/adapted_prover.rs b/src/sonic/helped/adapted_prover.rs index 68f9565..26034de 100644 --- a/src/sonic/helped/adapted_prover.rs +++ b/src/sonic/helped/adapted_prover.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use super::{Proof, SxyAdvice}; @@ -97,8 +97,8 @@ pub fn create_proof_on_srs + Clone>( // #[test] // fn my_fun_circuit_test() { -// use pairing::ff::PrimeField; -// use pairing::bls12_381::{Bls12, Fr}; +// use crate::pairing::ff::PrimeField; +// use crate::pairing::bls12_381::{Bls12, Fr}; // use super::*; // use crate::sonic::cs::{Basic, ConstraintSystem, LinearCombination}; diff --git a/src/sonic/helped/adapted_verifier.rs b/src/sonic/helped/adapted_verifier.rs index 0a4b159..6085ca3 100644 --- a/src/sonic/helped/adapted_verifier.rs +++ b/src/sonic/helped/adapted_verifier.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use rand::{Rand, Rng}; @@ -53,8 +53,8 @@ pub fn verify_aggregate + Clone, R: Rng>( // #[test] // fn my_fun_circuit_test() { -// use pairing::ff::PrimeField; -// use pairing::bls12_381::{Bls12, Fr}; +// use crate::pairing::ff::PrimeField; +// use crate::pairing::bls12_381::{Bls12, Fr}; // use super::*; // use crate::sonic::cs::{Basic, ConstraintSystem, LinearCombination}; diff --git a/src/sonic/helped/batch.rs b/src/sonic/helped/batch.rs index 3cec29c..ef7f15d 100644 --- a/src/sonic/helped/batch.rs +++ b/src/sonic/helped/batch.rs @@ -8,8 +8,8 @@ //! This submodule contains the `Batch` abstraction for creating a //! context for batch verification. -use pairing::ff::{Field}; -use pairing::{Engine, CurveAffine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveAffine, CurveProjective}; use crate::SynthesisError; diff --git a/src/sonic/helped/generator.rs b/src/sonic/helped/generator.rs index 652c501..44675d6 100644 --- a/src/sonic/helped/generator.rs +++ b/src/sonic/helped/generator.rs @@ -2,14 +2,14 @@ use rand::Rng; use std::sync::Arc; -use pairing::{ +use crate::pairing::{ Engine, Wnaf, CurveProjective, CurveAffine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field }; diff --git a/src/sonic/helped/helper.rs b/src/sonic/helped/helper.rs index a8a853a..e51e95b 100644 --- a/src/sonic/helped/helper.rs +++ b/src/sonic/helped/helper.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use super::{Proof, SxyAdvice}; diff --git a/src/sonic/helped/mod.rs b/src/sonic/helped/mod.rs index 0135b66..fe2b440 100644 --- a/src/sonic/helped/mod.rs +++ b/src/sonic/helped/mod.rs @@ -1,7 +1,7 @@ extern crate pairing; -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; mod batch; diff --git a/src/sonic/helped/parameters.rs b/src/sonic/helped/parameters.rs index 2e000e6..d08ed29 100644 --- a/src/sonic/helped/parameters.rs +++ b/src/sonic/helped/parameters.rs @@ -1,10 +1,10 @@ -use pairing::ff::{ +use crate::pairing::ff::{ Field, PrimeField, PrimeFieldRepr }; -use pairing::{ +use crate::pairing::{ Engine, CurveAffine, EncodedPoint @@ -64,7 +64,7 @@ impl Proof { mut writer: W ) -> io::Result<()> { - use pairing::ff::{PrimeField, PrimeFieldRepr}; + use crate::pairing::ff::{PrimeField, PrimeFieldRepr}; writer.write_all(self.r.into_compressed().as_ref())?; writer.write_all(self.t.into_compressed().as_ref())?; let mut buffer = vec![]; @@ -388,7 +388,7 @@ impl Parameters { fn parameters_generation() { use crate::{ConstraintSystem, Circuit}; - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::bls12_381::{Bls12, Fr}; #[derive(Clone)] struct MySillyCircuit { diff --git a/src/sonic/helped/poly.rs b/src/sonic/helped/poly.rs index 22ce7e7..0c447b5 100644 --- a/src/sonic/helped/poly.rs +++ b/src/sonic/helped/poly.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use crate::sonic::cs::{Backend}; diff --git a/src/sonic/helped/prover.rs b/src/sonic/helped/prover.rs index f3f4645..6fa77fe 100644 --- a/src/sonic/helped/prover.rs +++ b/src/sonic/helped/prover.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use super::{Proof, SxyAdvice}; @@ -397,8 +397,8 @@ pub fn create_proof_on_srs, S: SynthesisDriver>( #[test] fn my_fun_circuit_test() { - use pairing::ff::PrimeField; - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::ff::PrimeField; + use crate::pairing::bls12_381::{Bls12, Fr}; use super::*; use crate::sonic::cs::{Basic, ConstraintSystem, LinearCombination}; use rand::{thread_rng}; @@ -449,13 +449,13 @@ fn my_fun_circuit_test() { #[test] fn polynomial_commitment_test() { - use pairing::ff::PrimeField; - use pairing::ff::PrimeFieldRepr; - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::ff::PrimeField; + use crate::pairing::ff::PrimeFieldRepr; + use crate::pairing::bls12_381::{Bls12, Fr}; use super::*; use crate::sonic::cs::{Basic, ConstraintSystem, LinearCombination}; use rand::{thread_rng}; - use pairing::{CurveAffine}; + use crate::pairing::{CurveAffine}; let srs = SRS::::new( 20, diff --git a/src/sonic/helped/verifier.rs b/src/sonic/helped/verifier.rs index 9a520b7..141bc17 100644 --- a/src/sonic/helped/verifier.rs +++ b/src/sonic/helped/verifier.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field}; +use crate::pairing::{Engine, CurveProjective}; use std::marker::PhantomData; use rand::{Rand, Rng}; diff --git a/src/sonic/paper.rs b/src/sonic/paper.rs index e0eed44..cebe6fc 100644 --- a/src/sonic/paper.rs +++ b/src/sonic/paper.rs @@ -1,7 +1,7 @@ #[test] fn test_paper_results() { - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::bls12_381::{Bls12, Fr}; use std::time::{Instant}; let srs_x = Fr::from_str("23923").unwrap(); @@ -78,8 +78,8 @@ fn test_paper_results() { } { - use pairing::{CurveAffine}; - use pairing::bls12_381::{G1Affine, G2Affine}; + use crate::pairing::{CurveAffine}; + use crate::pairing::bls12_381::{G1Affine, G2Affine}; let a = G1Affine::one(); let b = G2Affine::one(); let c = G1Affine::one(); @@ -106,8 +106,8 @@ fn test_paper_results() { { use sonic::util::multiexp; - use pairing::{CurveAffine}; - use pairing::bls12_381::{G1Affine, G2Affine}; + use crate::pairing::{CurveAffine}; + use crate::pairing::bls12_381::{G1Affine, G2Affine}; // e([\alpha G], [\beta H]) = e(A, B) e(IV, [\gamma] H) e(C, [\delta] H) let a = G1Affine::one(); let b = G2Affine::one(); diff --git a/src/sonic/sonic/adaptor.rs b/src/sonic/sonic/adaptor.rs index 87cd9e7..70012ac 100644 --- a/src/sonic/sonic/adaptor.rs +++ b/src/sonic/sonic/adaptor.rs @@ -1,8 +1,8 @@ extern crate pairing; extern crate rand; -use pairing::ff::{Field, PrimeField}; -use pairing::{Engine, CurveProjective}; +use crate::pairing::ff::{Field, PrimeField}; +use crate::pairing::{Engine, CurveProjective}; // this one is for all external interfaces // use crate::{LinearCombination, ConstraintSystem, Circuit, Variable}; diff --git a/src/sonic/srs/srs.rs b/src/sonic/srs/srs.rs index 7833ab8..16c8887 100644 --- a/src/sonic/srs/srs.rs +++ b/src/sonic/srs/srs.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field, PrimeField}; -use pairing::{CurveAffine, CurveProjective, Engine, Wnaf}; +use crate::pairing::ff::{Field, PrimeField}; +use crate::pairing::{CurveAffine, CurveProjective, Engine, Wnaf}; use std::io::{self, Read, Write}; use std::sync::Arc; @@ -169,7 +169,7 @@ impl SRS { checked: bool ) -> io::Result { - use pairing::EncodedPoint; + use crate::pairing::EncodedPoint; let read_g1 = |reader: &mut R| -> io::Result { let mut repr = ::Uncompressed::empty(); diff --git a/src/sonic/tests/sonics.rs b/src/sonic/tests/sonics.rs index 91d6ddd..a441dea 100644 --- a/src/sonic/tests/sonics.rs +++ b/src/sonic/tests/sonics.rs @@ -9,20 +9,20 @@ use rand::{thread_rng, Rng}; use std::time::{Duration, Instant}; // Bring in some tools for using pairing-friendly curves -use pairing::{ +use crate::pairing::{ Engine }; -use pairing::ff::{ +use crate::pairing::ff::{ Field, }; // We're going to use the BLS12-381 pairing-friendly elliptic curve. -use pairing::bls12_381::{ +use crate::pairing::bls12_381::{ Bls12 }; -use pairing::bn256::{ +use crate::pairing::bn256::{ Bn256 }; @@ -143,9 +143,9 @@ impl<'a, E: Engine> Circuit for MiMCDemoNoInputs<'a, E> { #[test] fn test_sonic_mimc() { - use pairing::ff::{Field, PrimeField}; - use pairing::{Engine, CurveAffine, CurveProjective}; - use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::ff::{Field, PrimeField}; + use crate::pairing::{Engine, CurveAffine, CurveProjective}; + use crate::pairing::bls12_381::{Bls12, Fr}; use std::time::{Instant}; use bellman::sonic::srs::SRS; @@ -247,10 +247,10 @@ fn test_sonic_mimc() { #[test] fn test_inputs_into_sonic_mimc() { - use pairing::ff::{Field, PrimeField}; - use pairing::{Engine, CurveAffine, CurveProjective}; - use pairing::bn256::{Bn256, Fr}; - // use pairing::bls12_381::{Bls12, Fr}; + use crate::pairing::ff::{Field, PrimeField}; + use crate::pairing::{Engine, CurveAffine, CurveProjective}; + use crate::pairing::bn256::{Bn256, Fr}; + // use crate::pairing::bls12_381::{Bls12, Fr}; use std::time::{Instant}; use bellman::sonic::srs::SRS; @@ -354,7 +354,7 @@ fn test_inputs_into_sonic_mimc() { #[test] fn test_high_level_sonic_api() { - use pairing::bn256::{Bn256}; + use crate::pairing::bn256::{Bn256}; use std::time::{Instant}; use bellman::sonic::helped::{ generate_random_parameters, diff --git a/src/sonic/transcript/mod.rs b/src/sonic/transcript/mod.rs index 4525030..7e45f39 100644 --- a/src/sonic/transcript/mod.rs +++ b/src/sonic/transcript/mod.rs @@ -1,7 +1,7 @@ extern crate pairing; -use pairing::ff::{Field, PrimeField, PrimeFieldRepr}; -use pairing::{CurveAffine, CurveProjective, Engine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr}; +use crate::pairing::{CurveAffine, CurveProjective, Engine}; use std::io; mod hasher; diff --git a/src/sonic/unhelped/grand_product_argument.rs b/src/sonic/unhelped/grand_product_argument.rs index 61c914d..1fd2b7c 100644 --- a/src/sonic/unhelped/grand_product_argument.rs +++ b/src/sonic/unhelped/grand_product_argument.rs @@ -2,8 +2,8 @@ /// in those two polynomials are equal (part of the permutation argument) with additional assumption that /// those coefficients are never equal to zero -use pairing::ff::{Field, PrimeField, PrimeFieldRepr}; -use pairing::{Engine, CurveProjective, CurveAffine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr}; +use crate::pairing::{Engine, CurveProjective, CurveAffine}; use std::marker::PhantomData; use crate::sonic::srs::SRS; @@ -658,7 +658,7 @@ impl GrandProductArgument { #[test] fn test_grand_product_argument() { - use pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; + use crate::pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; use rand::{XorShiftRng, SeedableRng, Rand, Rng}; use crate::sonic::srs::SRS; diff --git a/src/sonic/unhelped/permutation_argument.rs b/src/sonic/unhelped/permutation_argument.rs index 1813ae6..65b99e8 100644 --- a/src/sonic/unhelped/permutation_argument.rs +++ b/src/sonic/unhelped/permutation_argument.rs @@ -2,8 +2,8 @@ /// actually a commitment to a vector of values that are equal to `(s^{perm})_i * y^{perm(i)}` /// for some fixed permutation `perm` -use pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine}; -use pairing::{Engine, CurveProjective, CurveAffine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine}; +use crate::pairing::{Engine, CurveProjective, CurveAffine}; use std::marker::PhantomData; use crate::sonic::srs::SRS; @@ -584,7 +584,7 @@ impl PermutationArgument { #[test] fn test_permutation_argument() { - use pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; + use crate::pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; use rand::{XorShiftRng, SeedableRng, Rand, Rng}; use crate::sonic::srs::SRS; diff --git a/src/sonic/unhelped/s2_proof.rs b/src/sonic/unhelped/s2_proof.rs index 77bb8a8..a046e63 100644 --- a/src/sonic/unhelped/s2_proof.rs +++ b/src/sonic/unhelped/s2_proof.rs @@ -1,5 +1,5 @@ -use pairing::ff::{Field, PrimeField, PrimeFieldRepr}; -use pairing::{Engine, CurveProjective, CurveAffine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr}; +use crate::pairing::{Engine, CurveProjective, CurveAffine}; use std::marker::PhantomData; use crate::sonic::srs::SRS; diff --git a/src/sonic/unhelped/wellformed_argument.rs b/src/sonic/unhelped/wellformed_argument.rs index a321278..57b6e01 100644 --- a/src/sonic/unhelped/wellformed_argument.rs +++ b/src/sonic/unhelped/wellformed_argument.rs @@ -1,8 +1,8 @@ /// Wellformedness argument allows to verify that some committment was to multivariate polynomial of degree n, /// with no constant term and negative powers -use pairing::ff::{Field, PrimeField, PrimeFieldRepr}; -use pairing::{Engine, CurveProjective, CurveAffine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr}; +use crate::pairing::{Engine, CurveProjective, CurveAffine}; use std::marker::PhantomData; use crate::sonic::srs::SRS; @@ -132,7 +132,7 @@ impl WellformednessArgument { #[test] fn test_argument() { - use pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; + use crate::pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; use rand::{XorShiftRng, SeedableRng, Rand, Rng}; use crate::sonic::srs::SRS; @@ -158,7 +158,7 @@ fn test_argument() { #[test] fn test_argument_soundness() { - use pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; + use crate::pairing::bls12_381::{Fr, G1Affine, G1, Bls12}; use rand::{XorShiftRng, SeedableRng, Rand, Rng}; use crate::sonic::srs::SRS; diff --git a/src/sonic/util.rs b/src/sonic/util.rs index 9f3e055..32a86e8 100644 --- a/src/sonic/util.rs +++ b/src/sonic/util.rs @@ -1,6 +1,6 @@ use crate::SynthesisError; -use pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine}; -use pairing::{CurveAffine, CurveProjective, Engine}; +use crate::pairing::ff::{Field, PrimeField, PrimeFieldRepr, ScalarEngine}; +use crate::pairing::{CurveAffine, CurveProjective, Engine}; use super::srs::SRS; pub trait ChainExt: Iterator { @@ -437,8 +437,8 @@ pub fn check_polynomial_commitment( #[test] fn laurent_division() { - use pairing::ff::PrimeField; - use pairing::bls12_381::{Fr}; + use crate::pairing::ff::PrimeField; + use crate::pairing::bls12_381::{Fr}; let mut poly = vec![ Fr::from_str("328947234").unwrap(), @@ -696,8 +696,8 @@ impl OptionExt for Option { fn test_mul() { use rand::{self, Rand}; - use pairing::bls12_381::Bls12; - use pairing::bls12_381::Fr; + use crate::pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Fr; const SAMPLES: usize = 100; @@ -715,8 +715,8 @@ fn test_mul() { #[test] fn test_eval_at_powers() { use rand::{self, Rand, Rng}; - use pairing::bls12_381::Bls12; - use pairing::bls12_381::Fr; + use crate::pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Fr; const SAMPLES: usize = 100000; @@ -747,8 +747,8 @@ fn test_eval_at_powers() { #[test] fn test_mut_eval_at_powers() { use rand::{self, Rand, Rng}; - use pairing::bls12_381::Bls12; - use pairing::bls12_381::Fr; + use crate::pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Fr; const SAMPLES: usize = 100000; @@ -780,8 +780,8 @@ fn test_mut_eval_at_powers() { #[test] fn test_mut_distribute_powers() { use rand::{self, Rand, Rng}; - use pairing::bls12_381::Bls12; - use pairing::bls12_381::Fr; + use crate::pairing::bls12_381::Bls12; + use crate::pairing::bls12_381::Fr; const SAMPLES: usize = 100000; diff --git a/src/source.rs b/src/source.rs index 8fa8a94..ad4c065 100644 --- a/src/source.rs +++ b/src/source.rs @@ -1,10 +1,10 @@ -use pairing::{ +use crate::pairing::{ CurveAffine, CurveProjective, Engine }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, Field, PrimeFieldRepr, diff --git a/src/tests/dummy_engine.rs b/src/tests/dummy_engine.rs index 0cc5cdc..52247ab 100644 --- a/src/tests/dummy_engine.rs +++ b/src/tests/dummy_engine.rs @@ -1,4 +1,4 @@ -use pairing::{ +use crate::pairing::{ Engine, CurveProjective, CurveAffine, @@ -6,7 +6,7 @@ use pairing::{ EncodedPoint }; -use pairing::ff::{ +use crate::pairing::ff::{ PrimeField, PrimeFieldRepr, Field, diff --git a/src/tests/mod.rs b/src/tests/mod.rs index e72f954..843d2cf 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,8 +1,8 @@ -use pairing::{ +use crate::pairing::{ Engine }; -use pairing::ff:: { +use crate::pairing::ff:: { Field, PrimeField, }; diff --git a/tests/mimc.rs b/tests/mimc.rs index 89da2eb..933fb54 100644 --- a/tests/mimc.rs +++ b/tests/mimc.rs @@ -9,20 +9,20 @@ use rand::{thread_rng, Rng}; use std::time::{Duration, Instant}; // Bring in some tools for using pairing-friendly curves -use pairing::{ +use crate::pairing::{ Engine }; -use pairing::ff::{ +use crate::pairing::ff::{ Field, }; // We're going to use the BLS12-381 pairing-friendly elliptic curve. -use pairing::bls12_381::{ +use crate::pairing::bls12_381::{ Bls12 }; -use pairing::bn256::{ +use crate::pairing::bn256::{ Bn256 };