prepare for publishing
This commit is contained in:
parent
219929ee33
commit
4ed620ebf2
14
Cargo.toml
14
Cargo.toml
@ -1,12 +1,12 @@
|
||||
[package]
|
||||
authors = ["Sean Bowe <ewillbefull@gmail.com>", "Alex Vlasov <alex.m.vlasov@gmail.com>", "Alex Gluchowski <alex@gluchowski.net"]
|
||||
description = "zk-SNARK library"
|
||||
documentation = "https://github.com/matterinc/bellman"
|
||||
homepage = "https://github.com/matterinc/bellman"
|
||||
documentation = "https://github.com/matter-labs/bellman"
|
||||
homepage = "https://github.com/matter-labs/bellman"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bellman"
|
||||
repository = "https://github.com/matterinc/bellman"
|
||||
version = "0.2.0"
|
||||
name = "bellman_ce"
|
||||
repository = "https://github.com/matter-labs/bellman"
|
||||
version = "0.3.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
@ -18,8 +18,8 @@ bit-vec = "0.4.4"
|
||||
futures = "0.1"
|
||||
cfg-if = "0.1.7"
|
||||
|
||||
pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" }
|
||||
#pairing = { path = "../pairing" }
|
||||
#pairing = { git = 'https://github.com/matterinc/pairing', tag = "0.16.2" }
|
||||
pairing_ce = { version = "0.17.0" }
|
||||
byteorder = "1"
|
||||
|
||||
futures-cpupool = {version = "0.1", optional = true}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# bellman "Community edition"
|
||||
|
||||
Originally developed for ZCash, with extensions from us to make it a little more pleasant. Uses our "community edition" pairing for Ethereum's BN256 curve.
|
||||
Originally developed for ZCash, with extensions from us to make it a little more pleasant. Uses our "community edition" pairing for Ethereum's BN256 curve. Now published as `bellman_ce` on `crate.io` to allow ease of use.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use pairing::{Engine};
|
||||
use pairing::ff::Field;
|
||||
use crate::pairing::{Engine};
|
||||
use crate::pairing::ff::Field;
|
||||
|
||||
use std::ops::{Add, Sub};
|
||||
use std::fmt;
|
||||
|
@ -10,12 +10,12 @@
|
||||
//! This allows us to perform polynomial operations in O(n)
|
||||
//! by performing an O(n log n) FFT over such a domain.
|
||||
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine,
|
||||
CurveProjective
|
||||
};
|
||||
|
||||
use pairing::ff::{
|
||||
use crate::pairing::ff::{
|
||||
Field,
|
||||
PrimeField
|
||||
};
|
||||
@ -51,7 +51,7 @@ impl<E: Engine, G: Group<E>> EvaluationDomain<E, G> {
|
||||
|
||||
pub fn from_coeffs(mut coeffs: Vec<G>) -> Result<EvaluationDomain<E, G>, 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<E: Engine, G: Group<E>> EvaluationDomain<E, G> {
|
||||
// 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<G>, size: usize) -> Result<EvaluationDomain<E, G>, 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<E: Engine, T: Group<E>>(
|
||||
// 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<E: Engine, R: rand::Rng>(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<E: Engine, R: rand::Rng>(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();
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine,
|
||||
CurveAffine,
|
||||
EncodedPoint
|
||||
@ -474,8 +474,8 @@ impl<E: Engine> PartialEq for Parameters<E> {
|
||||
// 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() {
|
||||
|
@ -1,8 +1,8 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine
|
||||
};
|
||||
|
||||
use pairing::ff:: {
|
||||
use crate::pairing::ff:: {
|
||||
Field,
|
||||
PrimeField,
|
||||
};
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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() {
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine
|
||||
};
|
||||
|
||||
use pairing::ff:: {
|
||||
use crate::pairing::ff:: {
|
||||
Field,
|
||||
PrimeField,
|
||||
};
|
||||
|
@ -1,10 +1,10 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine,
|
||||
CurveProjective,
|
||||
CurveAffine
|
||||
};
|
||||
|
||||
use pairing::ff::{PrimeField};
|
||||
use crate::pairing::ff::{PrimeField};
|
||||
|
||||
use super::{
|
||||
Proof,
|
||||
|
@ -1,9 +1,9 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine,
|
||||
CurveProjective
|
||||
};
|
||||
|
||||
use pairing::ff::{
|
||||
use crate::pairing::ff::{
|
||||
Field,
|
||||
PrimeField
|
||||
};
|
||||
|
15
src/lib.rs
15
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"
|
||||
}
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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};
|
||||
|
@ -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<E: Engine, C: Circuit<E> + 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};
|
||||
|
||||
|
@ -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<E: Engine, C: Circuit<E> + 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};
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
@ -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<E: Engine> Proof<E> {
|
||||
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<E: Engine> Parameters<E> {
|
||||
fn parameters_generation() {
|
||||
use crate::{ConstraintSystem, Circuit};
|
||||
|
||||
use pairing::bls12_381::{Bls12, Fr};
|
||||
use crate::pairing::bls12_381::{Bls12, Fr};
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MySillyCircuit<E: Engine> {
|
||||
|
@ -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};
|
||||
|
@ -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<E: Engine, C: Circuit<E>, 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::<Bls12>::new(
|
||||
20,
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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};
|
||||
|
@ -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<E: Engine> SRS<E> {
|
||||
checked: bool
|
||||
) -> io::Result<Self>
|
||||
{
|
||||
use pairing::EncodedPoint;
|
||||
use crate::pairing::EncodedPoint;
|
||||
|
||||
let read_g1 = |reader: &mut R| -> io::Result<E::G1Affine> {
|
||||
let mut repr = <E::G1Affine as CurveAffine>::Uncompressed::empty();
|
||||
|
@ -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<E> 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,
|
||||
|
@ -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;
|
||||
|
@ -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<E: Engine> GrandProductArgument<E> {
|
||||
|
||||
#[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;
|
||||
|
||||
|
@ -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<E: Engine> PermutationArgument<E> {
|
||||
|
||||
#[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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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<E: Engine> WellformednessArgument<E> {
|
||||
|
||||
#[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;
|
||||
|
||||
|
@ -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<E: Engine>(
|
||||
|
||||
#[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<T> OptionExt<T> for Option<T> {
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
CurveAffine,
|
||||
CurveProjective,
|
||||
Engine
|
||||
};
|
||||
|
||||
use pairing::ff::{
|
||||
use crate::pairing::ff::{
|
||||
PrimeField,
|
||||
Field,
|
||||
PrimeFieldRepr,
|
||||
|
@ -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,
|
||||
|
@ -1,8 +1,8 @@
|
||||
use pairing::{
|
||||
use crate::pairing::{
|
||||
Engine
|
||||
};
|
||||
|
||||
use pairing::ff:: {
|
||||
use crate::pairing::ff:: {
|
||||
Field,
|
||||
PrimeField,
|
||||
};
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user