Reorganization of multicore/qap/spair.

This commit is contained in:
Sean Bowe 2016-09-16 17:25:50 -06:00
parent 5f50eea70d
commit 1571ff5f90
No known key found for this signature in database
GPG Key ID: 95684257D8F8B031
8 changed files with 12 additions and 22 deletions

View File

@ -13,10 +13,7 @@ extern crate env_logger;
extern crate time; extern crate time;
extern crate ansi_term; extern crate ansi_term;
mod multicore;
mod qap;
mod protocol; mod protocol;
mod spair;
use snark::*; use snark::*;
use self::protocol::*; use self::protocol::*;

View File

@ -8,12 +8,7 @@ extern crate crossbeam;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate bincode; extern crate bincode;
mod multicore;
mod protocol; mod protocol;
mod spair;
#[cfg(feature = "snark")]
mod qap;
use self::protocol::*; use self::protocol::*;
use rand::Rng; use rand::Rng;

View File

@ -35,16 +35,19 @@
use crossbeam; use crossbeam;
use bn::*; use bn::*;
use spair::*;
use multicore::*;
#[cfg(feature = "snark")]
use qap::*;
#[cfg(feature = "snark")] #[cfg(feature = "snark")]
use snark::*; use snark::*;
mod secrets; mod secrets;
mod spair;
mod multicore;
pub use self::secrets::*; pub use self::secrets::*;
use self::spair::*;
use self::multicore::*;
#[cfg(feature = "snark")]
mod qap;
/// The powers of tau. /// The powers of tau.
#[derive(Clone, RustcEncodable, RustcDecodable)] #[derive(Clone, RustcEncodable, RustcDecodable)]
@ -123,7 +126,7 @@ impl Stage2Contents {
#[cfg(feature = "snark")] #[cfg(feature = "snark")]
pub fn new(cs: &CS, stage1: &Stage1Contents) -> Self { pub fn new(cs: &CS, stage1: &Stage1Contents) -> Self {
// evaluate QAP for the next round // evaluate QAP for the next round
let (at, bt1, bt2, ct) = evaluate_qap(&stage1.v1, &stage1.v2, cs); let (at, bt1, bt2, ct) = qap::evaluate(&stage1.v1, &stage1.v2, cs);
Stage2Contents { Stage2Contents {
vk_a: G2::one(), vk_a: G2::one(),

View File

@ -1,11 +1,11 @@
use bn::*; use bn::*;
use snark::*; use snark::*;
use multicore::*; use super::multicore::*;
/// Evaluates the QAP A, B and C polynomials at tau given the powers of tau. /// Evaluates the QAP A, B and C polynomials at tau given the powers of tau.
/// Converts the powers of tau in G1 and G2 into the lagrange basis with an FFT /// Converts the powers of tau in G1 and G2 into the lagrange basis with an FFT
/// Extends with Z(tau) as (effectively) done in libsnark. /// Extends with Z(tau) as (effectively) done in libsnark.
pub fn evaluate_qap(g1_powers: &[G1], g2_powers: &[G2], cs: &CS) -> (Vec<G1>, Vec<G1>, Vec<G2>, Vec<G1>) pub fn evaluate(g1_powers: &[G1], g2_powers: &[G2], cs: &CS) -> (Vec<G1>, Vec<G1>, Vec<G2>, Vec<G1>)
{ {
assert_eq!(g1_powers.len(), cs.d+1); assert_eq!(g1_powers.len(), cs.d+1);
assert_eq!(g2_powers.len(), cs.d+1); assert_eq!(g2_powers.len(), cs.d+1);

View File

@ -1,7 +1,7 @@
use bn::*; use bn::*;
use rand::Rng; use rand::Rng;
use spair::*; use super::spair::{Spair, same_power};
#[cfg(feature = "snark")] #[cfg(test)]
use snark::*; use snark::*;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
@ -231,7 +231,6 @@ impl PrivateKey {
self.gamma = self.gamma * other.gamma; self.gamma = self.gamma * other.gamma;
} }
#[cfg(feature = "snark")]
#[cfg(test)] #[cfg(test)]
pub fn libsnark_keypair(&self, cs: &CS) -> Keypair { pub fn libsnark_keypair(&self, cs: &CS) -> Keypair {
Keypair::generate( Keypair::generate(

View File

@ -1,7 +1,6 @@
use rand::Rng; use rand::Rng;
use bn::*; use bn::*;
use crossbeam; use crossbeam;
use multicore::*;
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
#[derive(Clone, PartialEq, Eq)] #[derive(Clone, PartialEq, Eq)]

View File

@ -5,10 +5,7 @@ extern crate crossbeam;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate bincode; extern crate bincode;
mod multicore;
mod qap;
mod protocol; mod protocol;
mod spair;
use std::fs::File; use std::fs::File;
use std::io::{Read, Write}; use std::io::{Read, Write};