Merge pull request #113 from Eirik0/edition-2018-clean-up
Edition 2018 clean up
This commit is contained in:
@@ -7,6 +7,7 @@ license = "MIT/Apache-2.0"
|
|||||||
name = "bellman"
|
name = "bellman"
|
||||||
repository = "https://github.com/ebfull/bellman"
|
repository = "https://github.com/ebfull/bellman"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bit-vec = "0.4.4"
|
bit-vec = "0.4.4"
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ mod test {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
for _ in 0..1000 {
|
for _ in 0..1000 {
|
||||||
let mut v = (0..32)
|
let v = (0..32)
|
||||||
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
|
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ mod test {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
for _ in 0..1000 {
|
for _ in 0..1000 {
|
||||||
let mut v = (0..32)
|
let v = (0..32)
|
||||||
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
|
.map(|_| Boolean::constant(rng.next_u32() % 2 != 0))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ use pairing::Engine;
|
|||||||
|
|
||||||
use super::{Parameters, VerifyingKey};
|
use super::{Parameters, VerifyingKey};
|
||||||
|
|
||||||
use {Circuit, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable};
|
use crate::{Circuit, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable};
|
||||||
|
|
||||||
use domain::{EvaluationDomain, Scalar};
|
use crate::domain::{EvaluationDomain, Scalar};
|
||||||
|
|
||||||
use multicore::Worker;
|
use crate::multicore::Worker;
|
||||||
|
|
||||||
/// Generates a random common reference string for
|
/// Generates a random common reference string for
|
||||||
/// a circuit.
|
/// a circuit.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
use group::{CurveAffine, EncodedPoint};
|
use group::{CurveAffine, EncodedPoint};
|
||||||
use pairing::{Engine, PairingCurveAffine};
|
use pairing::{Engine, PairingCurveAffine};
|
||||||
|
|
||||||
use SynthesisError;
|
use crate::SynthesisError;
|
||||||
|
|
||||||
|
use crate::multiexp::SourceBuilder;
|
||||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use multiexp::SourceBuilder;
|
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ impl<'a, E: Engine> ParameterSource<E> for &'a Parameters<E> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_with_bls12_381 {
|
mod test_with_bls12_381 {
|
||||||
use super::*;
|
use super::*;
|
||||||
use {Circuit, ConstraintSystem, SynthesisError};
|
use crate::{Circuit, ConstraintSystem, SynthesisError};
|
||||||
|
|
||||||
use ff::Field;
|
use ff::Field;
|
||||||
use pairing::bls12_381::{Bls12, Fr};
|
use pairing::bls12_381::{Bls12, Fr};
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ use pairing::Engine;
|
|||||||
|
|
||||||
use super::{ParameterSource, Proof};
|
use super::{ParameterSource, Proof};
|
||||||
|
|
||||||
use {Circuit, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable};
|
use crate::{Circuit, ConstraintSystem, Index, LinearCombination, SynthesisError, Variable};
|
||||||
|
|
||||||
use domain::{EvaluationDomain, Scalar};
|
use crate::domain::{EvaluationDomain, Scalar};
|
||||||
|
|
||||||
use multiexp::{multiexp, DensityTracker, FullDensity};
|
use crate::multiexp::{multiexp, DensityTracker, FullDensity};
|
||||||
|
|
||||||
use multicore::Worker;
|
use crate::multicore::Worker;
|
||||||
|
|
||||||
fn eval<E: Engine>(
|
fn eval<E: Engine>(
|
||||||
lc: &LinearCombination<E>,
|
lc: &LinearCombination<E>,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const MODULUS_R: Wrapping<u32> = Wrapping(64513);
|
|||||||
pub struct Fr(Wrapping<u32>);
|
pub struct Fr(Wrapping<u32>);
|
||||||
|
|
||||||
impl fmt::Display for Fr {
|
impl fmt::Display for Fr {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
write!(f, "{}", (self.0).0)
|
write!(f, "{}", (self.0).0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ impl PartialOrd for FrRepr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for FrRepr {
|
impl fmt::Display for FrRepr {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
write!(f, "{}", (self.0)[0])
|
write!(f, "{}", (self.0)[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use self::dummy_engine::*;
|
|||||||
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use {Circuit, ConstraintSystem, SynthesisError};
|
use crate::{Circuit, ConstraintSystem, SynthesisError};
|
||||||
|
|
||||||
use super::{create_proof, generate_parameters, prepare_verifying_key, verify_proof};
|
use super::{create_proof, generate_parameters, prepare_verifying_key, verify_proof};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use pairing::{Engine, PairingCurveAffine};
|
|||||||
|
|
||||||
use super::{PreparedVerifyingKey, Proof, VerifyingKey};
|
use super::{PreparedVerifyingKey, Proof, VerifyingKey};
|
||||||
|
|
||||||
use SynthesisError;
|
use crate::SynthesisError;
|
||||||
|
|
||||||
pub fn prepare_verifying_key<E: Engine>(vk: &VerifyingKey<E>) -> PreparedVerifyingKey<E> {
|
pub fn prepare_verifying_key<E: Engine>(vk: &VerifyingKey<E>) -> PreparedVerifyingKey<E> {
|
||||||
let mut gamma = vk.gamma_g2;
|
let mut gamma = vk.gamma_g2;
|
||||||
|
|||||||
@@ -1,18 +1,6 @@
|
|||||||
extern crate ff;
|
|
||||||
extern crate group;
|
|
||||||
#[cfg(feature = "pairing")]
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand_core;
|
|
||||||
|
|
||||||
extern crate bit_vec;
|
|
||||||
extern crate blake2s_simd;
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate futures;
|
|
||||||
|
|
||||||
#[cfg(feature = "multicore")]
|
#[cfg(feature = "multicore")]
|
||||||
extern crate crossbeam;
|
extern crate crossbeam;
|
||||||
#[cfg(feature = "multicore")]
|
|
||||||
extern crate futures_cpupool;
|
|
||||||
#[cfg(feature = "multicore")]
|
#[cfg(feature = "multicore")]
|
||||||
extern crate num_cpus;
|
extern crate num_cpus;
|
||||||
|
|
||||||
@@ -23,12 +11,6 @@ extern crate hex_literal;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate sha2;
|
|
||||||
|
|
||||||
pub mod domain;
|
pub mod domain;
|
||||||
pub mod gadgets;
|
pub mod gadgets;
|
||||||
#[cfg(feature = "groth16")]
|
#[cfg(feature = "groth16")]
|
||||||
@@ -230,7 +212,7 @@ impl Error for SynthesisError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for SynthesisError {
|
impl fmt::Display for SynthesisError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
if let &SynthesisError::IoError(ref e) = self {
|
if let &SynthesisError::IoError(ref e) = self {
|
||||||
write!(f, "I/O error: ")?;
|
write!(f, "I/O error: ")?;
|
||||||
e.fmt(f)
|
e.fmt(f)
|
||||||
@@ -309,7 +291,7 @@ pub trait ConstraintSystem<E: ScalarEngine>: Sized {
|
|||||||
|
|
||||||
/// This is a "namespaced" constraint system which borrows a constraint system (pushing
|
/// This is a "namespaced" constraint system which borrows a constraint system (pushing
|
||||||
/// a namespace context) and, when dropped, pops out of the namespace context.
|
/// a namespace context) and, when dropped, pops out of the namespace context.
|
||||||
pub struct Namespace<'a, E: ScalarEngine, CS: ConstraintSystem<E> + 'a>(&'a mut CS, PhantomData<E>);
|
pub struct Namespace<'a, E: ScalarEngine, CS: ConstraintSystem<E>>(&'a mut CS, PhantomData<E>);
|
||||||
|
|
||||||
impl<'cs, E: ScalarEngine, CS: ConstraintSystem<E>> ConstraintSystem<E> for Namespace<'cs, E, CS> {
|
impl<'cs, E: ScalarEngine, CS: ConstraintSystem<E>> ConstraintSystem<E> for Namespace<'cs, E, CS> {
|
||||||
type Root = CS::Root;
|
type Root = CS::Root;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ fn multiexp_inner<Q, D, G, S>(
|
|||||||
mut skip: u32,
|
mut skip: u32,
|
||||||
c: u32,
|
c: u32,
|
||||||
handle_trivial: bool,
|
handle_trivial: bool,
|
||||||
) -> Box<Future<Item = <G as CurveAffine>::Projective, Error = SynthesisError>>
|
) -> Box<dyn Future<Item = <G as CurveAffine>::Projective, Error = SynthesisError>>
|
||||||
where
|
where
|
||||||
for<'a> &'a Q: QueryDensity,
|
for<'a> &'a Q: QueryDensity,
|
||||||
D: Send + Sync + 'static + Clone + AsRef<Q>,
|
D: Send + Sync + 'static + Clone + AsRef<Q>,
|
||||||
@@ -256,7 +256,7 @@ pub fn multiexp<Q, D, G, S>(
|
|||||||
bases: S,
|
bases: S,
|
||||||
density_map: D,
|
density_map: D,
|
||||||
exponents: Arc<Vec<<<G::Engine as ScalarEngine>::Fr as PrimeField>::Repr>>,
|
exponents: Arc<Vec<<<G::Engine as ScalarEngine>::Fr as PrimeField>::Repr>>,
|
||||||
) -> Box<Future<Item = <G as CurveAffine>::Projective, Error = SynthesisError>>
|
) -> Box<dyn Future<Item = <G as CurveAffine>::Projective, Error = SynthesisError>>
|
||||||
where
|
where
|
||||||
for<'a> &'a Q: QueryDensity,
|
for<'a> &'a Q: QueryDensity,
|
||||||
D: Send + Sync + 'static + Clone + AsRef<Q>,
|
D: Send + Sync + 'static + Clone + AsRef<Q>,
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
extern crate bellman;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand;
|
|
||||||
|
|
||||||
// For randomness (during paramgen and proof generation)
|
// For randomness (during paramgen and proof generation)
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
|
|
||||||
@@ -90,12 +85,12 @@ impl<'a, E: Engine> Circuit<E> for MiMCDemo<'a, E> {
|
|||||||
let cs = &mut cs.namespace(|| format!("round {}", i));
|
let cs = &mut cs.namespace(|| format!("round {}", i));
|
||||||
|
|
||||||
// tmp = (xL + Ci)^2
|
// tmp = (xL + Ci)^2
|
||||||
let mut tmp_value = xl_value.map(|mut e| {
|
let tmp_value = xl_value.map(|mut e| {
|
||||||
e.add_assign(&self.constants[i]);
|
e.add_assign(&self.constants[i]);
|
||||||
e.square();
|
e.square();
|
||||||
e
|
e
|
||||||
});
|
});
|
||||||
let mut tmp = cs.alloc(
|
let tmp = cs.alloc(
|
||||||
|| "tmp",
|
|| "tmp",
|
||||||
|| tmp_value.ok_or(SynthesisError::AssignmentMissing),
|
|| tmp_value.ok_or(SynthesisError::AssignmentMissing),
|
||||||
)?;
|
)?;
|
||||||
@@ -110,14 +105,14 @@ impl<'a, E: Engine> Circuit<E> for MiMCDemo<'a, E> {
|
|||||||
// new_xL = xR + (xL + Ci)^3
|
// new_xL = xR + (xL + Ci)^3
|
||||||
// new_xL = xR + tmp * (xL + Ci)
|
// new_xL = xR + tmp * (xL + Ci)
|
||||||
// new_xL - xR = tmp * (xL + Ci)
|
// new_xL - xR = tmp * (xL + Ci)
|
||||||
let mut new_xl_value = xl_value.map(|mut e| {
|
let new_xl_value = xl_value.map(|mut e| {
|
||||||
e.add_assign(&self.constants[i]);
|
e.add_assign(&self.constants[i]);
|
||||||
e.mul_assign(&tmp_value.unwrap());
|
e.mul_assign(&tmp_value.unwrap());
|
||||||
e.add_assign(&xr_value.unwrap());
|
e.add_assign(&xr_value.unwrap());
|
||||||
e
|
e
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut new_xl = if i == (MIMC_ROUNDS - 1) {
|
let new_xl = if i == (MIMC_ROUNDS - 1) {
|
||||||
// This is the last round, xL is our image and so
|
// This is the last round, xL is our image and so
|
||||||
// we allocate a public input.
|
// we allocate a public input.
|
||||||
cs.alloc_input(
|
cs.alloc_input(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ documentation = "https://docs.rs/ff/"
|
|||||||
homepage = "https://github.com/ebfull/ff"
|
homepage = "https://github.com/ebfull/ff"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/ebfull/ff"
|
repository = "https://github.com/ebfull/ff"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ documentation = "https://docs.rs/ff/"
|
|||||||
homepage = "https://github.com/ebfull/ff"
|
homepage = "https://github.com/ebfull/ff"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/ebfull/ff"
|
repository = "https://github.com/ebfull/ff"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ fn prime_field_repr_impl(repr: &syn::Ident, limbs: usize) -> proc_macro2::TokenS
|
|||||||
impl ::std::fmt::Debug for #repr
|
impl ::std::fmt::Debug for #repr
|
||||||
{
|
{
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
try!(write!(f, "0x"));
|
write!(f, "0x")?;
|
||||||
for i in self.0.iter().rev() {
|
for i in self.0.iter().rev() {
|
||||||
try!(write!(f, "{:016x}", *i));
|
write!(f, "{:016x}", *i)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -133,9 +133,9 @@ fn prime_field_repr_impl(repr: &syn::Ident, limbs: usize) -> proc_macro2::TokenS
|
|||||||
|
|
||||||
impl ::std::fmt::Display for #repr {
|
impl ::std::fmt::Display for #repr {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||||
try!(write!(f, "0x"));
|
write!(f, "0x")?;
|
||||||
for i in self.0.iter().rev() {
|
for i in self.0.iter().rev() {
|
||||||
try!(write!(f, "{:016x}", *i));
|
write!(f, "{:016x}", *i)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
#![allow(unused_imports)]
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate rand_core;
|
|
||||||
|
|
||||||
#[cfg(feature = "derive")]
|
#[cfg(feature = "derive")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate ff_derive;
|
extern crate ff_derive;
|
||||||
@@ -210,7 +207,7 @@ impl Error for PrimeFieldDecodingError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for PrimeFieldDecodingError {
|
impl fmt::Display for PrimeFieldDecodingError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
match *self {
|
match *self {
|
||||||
PrimeFieldDecodingError::NotInField(ref repr) => {
|
PrimeFieldDecodingError::NotInField(ref repr) => {
|
||||||
write!(f, "{} is not an element of the field", repr)
|
write!(f, "{} is not an element of the field", repr)
|
||||||
@@ -266,7 +263,7 @@ pub trait PrimeField: Field {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert this prime field element into a biginteger representation.
|
/// Convert this prime field element into a biginteger representation.
|
||||||
fn from_repr(Self::Repr) -> Result<Self, PrimeFieldDecodingError>;
|
fn from_repr(_: Self::Repr) -> Result<Self, PrimeFieldDecodingError>;
|
||||||
|
|
||||||
/// Convert a biginteger representation into a prime field element, if
|
/// Convert a biginteger representation into a prime field element, if
|
||||||
/// the number is an element of the field.
|
/// the number is an element of the field.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ description = "Elliptic curve group traits and utilities"
|
|||||||
documentation = "https://docs.rs/group/"
|
documentation = "https://docs.rs/group/"
|
||||||
homepage = "https://github.com/ebfull/group"
|
homepage = "https://github.com/ebfull/group"
|
||||||
repository = "https://github.com/ebfull/group"
|
repository = "https://github.com/ebfull/group"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ff = { path = "../ff" }
|
ff = { path = "../ff" }
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
extern crate ff;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
|
|
||||||
use ff::{PrimeField, PrimeFieldDecodingError, ScalarEngine, SqrtField};
|
use ff::{PrimeField, PrimeFieldDecodingError, ScalarEngine, SqrtField};
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
@@ -180,7 +176,7 @@ impl Error for GroupDecodingError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for GroupDecodingError {
|
impl fmt::Display for GroupDecodingError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
match *self {
|
match *self {
|
||||||
GroupDecodingError::CoordinateDecodingError(description, ref err) => {
|
GroupDecodingError::CoordinateDecodingError(description, ref err) => {
|
||||||
write!(f, "{} decoding error: {}", description, err)
|
write!(f, "{} decoding error: {}", description, err)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use ff::{Field, PrimeField};
|
|||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
use rand_xorshift::XorShiftRng;
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use {CurveAffine, CurveProjective, EncodedPoint};
|
use crate::{CurveAffine, CurveProjective, EncodedPoint};
|
||||||
|
|
||||||
pub fn curve_tests<G: CurveProjective>() {
|
pub fn curve_tests<G: CurveProjective>() {
|
||||||
let mut rng = XorShiftRng::from_seed([
|
let mut rng = XorShiftRng::from_seed([
|
||||||
@@ -71,7 +71,7 @@ pub fn curve_tests<G: CurveProjective>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn random_wnaf_tests<G: CurveProjective>() {
|
fn random_wnaf_tests<G: CurveProjective>() {
|
||||||
use wnaf::*;
|
use crate::wnaf::*;
|
||||||
|
|
||||||
let mut rng = XorShiftRng::from_seed([
|
let mut rng = XorShiftRng::from_seed([
|
||||||
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ authors = [
|
|||||||
"Jay Graber <jay@z.cash>",
|
"Jay Graber <jay@z.cash>",
|
||||||
"Simon Liu <simon@z.cash>"
|
"Simon Liu <simon@z.cash>"
|
||||||
]
|
]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "rustzcash"
|
name = "rustzcash"
|
||||||
|
|||||||
@@ -1,16 +1,4 @@
|
|||||||
extern crate bellman;
|
use lazy_static;
|
||||||
extern crate blake2b_simd;
|
|
||||||
extern crate blake2s_simd;
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate libc;
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand_core;
|
|
||||||
extern crate rand_os;
|
|
||||||
extern crate zcash_primitives;
|
|
||||||
extern crate zcash_proofs;
|
|
||||||
|
|
||||||
extern crate lazy_static;
|
|
||||||
|
|
||||||
use ff::{PrimeField, PrimeFieldRepr};
|
use ff::{PrimeField, PrimeFieldRepr};
|
||||||
use pairing::bls12_381::{Bls12, Fr, FrRepr};
|
use pairing::bls12_381::{Bls12, Fr, FrRepr};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use rand_os::OsRng;
|
|||||||
use zcash_primitives::jubjub::{edwards, JubjubBls12};
|
use zcash_primitives::jubjub::{edwards, JubjubBls12};
|
||||||
use zcash_primitives::primitives::{Diversifier, ViewingKey};
|
use zcash_primitives::primitives::{Diversifier, ViewingKey};
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
librustzcash_sapling_generate_r, librustzcash_sapling_ka_agree,
|
librustzcash_sapling_generate_r, librustzcash_sapling_ka_agree,
|
||||||
librustzcash_sapling_ka_derivepublic,
|
librustzcash_sapling_ka_derivepublic,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use zcash_primitives::{
|
|||||||
|
|
||||||
use super::JUBJUB;
|
use super::JUBJUB;
|
||||||
|
|
||||||
use {
|
use crate::{
|
||||||
librustzcash_ask_to_ak, librustzcash_check_diversifier, librustzcash_crh_ivk,
|
librustzcash_ask_to_ak, librustzcash_check_diversifier, librustzcash_crh_ivk,
|
||||||
librustzcash_ivk_to_pkd, librustzcash_nsk_to_nk,
|
librustzcash_ivk_to_pkd, librustzcash_nsk_to_nk,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use librustzcash_sapling_compute_cm;
|
use crate::librustzcash_sapling_compute_cm;
|
||||||
use librustzcash_sapling_compute_nf;
|
use crate::librustzcash_sapling_compute_nf;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn notes() {
|
fn notes() {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ description = "Pairing-friendly elliptic curve library"
|
|||||||
documentation = "https://docs.rs/pairing/"
|
documentation = "https://docs.rs/pairing/"
|
||||||
homepage = "https://github.com/ebfull/pairing"
|
homepage = "https://github.com/ebfull/pairing"
|
||||||
repository = "https://github.com/ebfull/pairing"
|
repository = "https://github.com/ebfull/pairing"
|
||||||
|
edition ="2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1"
|
byteorder = "1"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ macro_rules! curve_impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Display for $affine {
|
impl ::std::fmt::Display for $affine {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
if self.infinity {
|
if self.infinity {
|
||||||
write!(f, "{}(Infinity)", $name)
|
write!(f, "{}(Infinity)", $name)
|
||||||
} else {
|
} else {
|
||||||
@@ -35,7 +35,7 @@ macro_rules! curve_impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Display for $projective {
|
impl ::std::fmt::Display for $projective {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
write!(f, "{}", self.into_affine())
|
write!(f, "{}", self.into_affine())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -622,11 +622,11 @@ macro_rules! curve_impl {
|
|||||||
pub mod g1 {
|
pub mod g1 {
|
||||||
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
|
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
|
||||||
use super::g2::G2Affine;
|
use super::g2::G2Affine;
|
||||||
|
use crate::{Engine, PairingCurveAffine};
|
||||||
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
|
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use {Engine, PairingCurveAffine};
|
|
||||||
|
|
||||||
curve_impl!(
|
curve_impl!(
|
||||||
"G1",
|
"G1",
|
||||||
@@ -656,7 +656,7 @@ pub mod g1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for G1Uncompressed {
|
impl fmt::Debug for G1Uncompressed {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
self.0[..].fmt(formatter)
|
self.0[..].fmt(formatter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -766,7 +766,7 @@ pub mod g1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for G1Compressed {
|
impl fmt::Debug for G1Compressed {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
self.0[..].fmt(formatter)
|
self.0[..].fmt(formatter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -934,7 +934,7 @@ pub mod g1 {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn g1_generator() {
|
fn g1_generator() {
|
||||||
use SqrtField;
|
use crate::SqrtField;
|
||||||
|
|
||||||
let mut x = Fq::zero();
|
let mut x = Fq::zero();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
@@ -1291,11 +1291,11 @@ pub mod g1 {
|
|||||||
pub mod g2 {
|
pub mod g2 {
|
||||||
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
|
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
|
||||||
use super::g1::G1Affine;
|
use super::g1::G1Affine;
|
||||||
|
use crate::{Engine, PairingCurveAffine};
|
||||||
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
|
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use {Engine, PairingCurveAffine};
|
|
||||||
|
|
||||||
curve_impl!(
|
curve_impl!(
|
||||||
"G2",
|
"G2",
|
||||||
@@ -1325,7 +1325,7 @@ pub mod g2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for G2Uncompressed {
|
impl fmt::Debug for G2Uncompressed {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
self.0[..].fmt(formatter)
|
self.0[..].fmt(formatter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1451,7 @@ pub mod g2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for G2Compressed {
|
impl fmt::Debug for G2Compressed {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||||
self.0[..].fmt(formatter)
|
self.0[..].fmt(formatter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1640,7 +1640,7 @@ pub mod g2 {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn g2_generator() {
|
fn g2_generator() {
|
||||||
use SqrtField;
|
use crate::SqrtField;
|
||||||
|
|
||||||
let mut x = Fq2::zero();
|
let mut x = Fq2::zero();
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
|
|||||||
@@ -2225,10 +2225,10 @@ fn test_fq_root_of_unity() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fq_field_tests() {
|
fn fq_field_tests() {
|
||||||
::tests::field::random_field_tests::<Fq>();
|
crate::tests::field::random_field_tests::<Fq>();
|
||||||
::tests::field::random_sqrt_tests::<Fq>();
|
crate::tests::field::random_sqrt_tests::<Fq>();
|
||||||
::tests::field::random_frobenius_tests::<Fq, _>(Fq::char(), 13);
|
crate::tests::field::random_frobenius_tests::<Fq, _>(Fq::char(), 13);
|
||||||
::tests::field::from_str_tests::<Fq>();
|
crate::tests::field::from_str_tests::<Fq>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -2244,7 +2244,7 @@ fn test_fq_ordering() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fq_repr_tests() {
|
fn fq_repr_tests() {
|
||||||
::tests::repr::random_repr_tests::<Fq>();
|
crate::tests::repr::random_repr_tests::<Fq>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub struct Fq12 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Display for Fq12 {
|
impl ::std::fmt::Display for Fq12 {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
write!(f, "Fq12({} + {} * w)", self.c0, self.c1)
|
write!(f, "Fq12({} + {} * w)", self.c0, self.c1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,6 +187,6 @@ fn test_fq12_mul_by_014() {
|
|||||||
fn fq12_field_tests() {
|
fn fq12_field_tests() {
|
||||||
use ff::PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq12>();
|
crate::tests::field::random_field_tests::<Fq12>();
|
||||||
::tests::field::random_frobenius_tests::<Fq12, _>(super::fq::Fq::char(), 13);
|
crate::tests::field::random_frobenius_tests::<Fq12, _>(super::fq::Fq::char(), 13);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub struct Fq2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Display for Fq2 {
|
impl ::std::fmt::Display for Fq2 {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
write!(f, "Fq2({} + {} * u)", self.c0, self.c1)
|
write!(f, "Fq2({} + {} * u)", self.c0, self.c1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -958,7 +958,7 @@ fn test_fq2_mul_nonresidue() {
|
|||||||
fn fq2_field_tests() {
|
fn fq2_field_tests() {
|
||||||
use ff::PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq2>();
|
crate::tests::field::random_field_tests::<Fq2>();
|
||||||
::tests::field::random_sqrt_tests::<Fq2>();
|
crate::tests::field::random_sqrt_tests::<Fq2>();
|
||||||
::tests::field::random_frobenius_tests::<Fq2, _>(super::fq::Fq::char(), 13);
|
crate::tests::field::random_frobenius_tests::<Fq2, _>(super::fq::Fq::char(), 13);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ pub struct Fq6 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Display for Fq6 {
|
impl ::std::fmt::Display for Fq6 {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
write!(f, "Fq6({} + {} * v, {} * v^2)", self.c0, self.c1, self.c2)
|
write!(f, "Fq6({} + {} * v, {} * v^2)", self.c0, self.c1, self.c2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -378,6 +378,6 @@ fn test_fq6_mul_by_01() {
|
|||||||
fn fq6_field_tests() {
|
fn fq6_field_tests() {
|
||||||
use ff::PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
::tests::field::random_field_tests::<Fq6>();
|
crate::tests::field::random_field_tests::<Fq6>();
|
||||||
::tests::field::random_frobenius_tests::<Fq6, _>(super::fq::Fq::char(), 13);
|
crate::tests::field::random_frobenius_tests::<Fq6, _>(super::fq::Fq::char(), 13);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1015,13 +1015,13 @@ fn test_fr_root_of_unity() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fr_field_tests() {
|
fn fr_field_tests() {
|
||||||
::tests::field::random_field_tests::<Fr>();
|
crate::tests::field::random_field_tests::<Fr>();
|
||||||
::tests::field::random_sqrt_tests::<Fr>();
|
crate::tests::field::random_sqrt_tests::<Fr>();
|
||||||
::tests::field::random_frobenius_tests::<Fr, _>(Fr::char(), 13);
|
crate::tests::field::random_frobenius_tests::<Fr, _>(Fr::char(), 13);
|
||||||
::tests::field::from_str_tests::<Fr>();
|
crate::tests::field::from_str_tests::<Fr>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn fr_repr_tests() {
|
fn fr_repr_tests() {
|
||||||
::tests::repr::random_repr_tests::<Fr>();
|
crate::tests::repr::random_repr_tests::<Fr>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,5 +366,5 @@ impl G2Prepared {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bls12_engine_tests() {
|
fn bls12_engine_tests() {
|
||||||
::tests::engine::engine_tests::<Bls12>();
|
crate::tests::engine::engine_tests::<Bls12>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use ff::PrimeFieldRepr;
|
|||||||
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
use group::{CurveAffine, CurveProjective, EncodedPoint, GroupDecodingError};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use *;
|
use crate::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pairing_result_against_relic() {
|
fn test_pairing_result_against_relic() {
|
||||||
|
|||||||
@@ -11,14 +11,6 @@
|
|||||||
// Force public structures to implement Debug
|
// Force public structures to implement Debug
|
||||||
#![deny(missing_debug_implementations)]
|
#![deny(missing_debug_implementations)]
|
||||||
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate group;
|
|
||||||
extern crate rand_core;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests;
|
pub mod tests;
|
||||||
|
|
||||||
@@ -87,7 +79,7 @@ pub trait Engine: ScalarEngine {
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
/// Perform final exponentiation of the result of a miller loop.
|
/// Perform final exponentiation of the result of a miller loop.
|
||||||
fn final_exponentiation(&Self::Fqk) -> Option<Self::Fqk>;
|
fn final_exponentiation(_: &Self::Fqk) -> Option<Self::Fqk>;
|
||||||
|
|
||||||
/// Performs a complete pairing operation `(p, q)`.
|
/// Performs a complete pairing operation `(p, q)`.
|
||||||
fn pairing<G1, G2>(p: G1, q: G2) -> Self::Fqk
|
fn pairing<G1, G2>(p: G1, q: G2) -> Self::Fqk
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use group::{CurveAffine, CurveProjective};
|
|||||||
use rand_core::SeedableRng;
|
use rand_core::SeedableRng;
|
||||||
use rand_xorshift::XorShiftRng;
|
use rand_xorshift::XorShiftRng;
|
||||||
|
|
||||||
use {Engine, Field, PairingCurveAffine, PrimeField};
|
use crate::{Engine, Field, PairingCurveAffine, PrimeField};
|
||||||
|
|
||||||
pub fn engine_tests<E: Engine>() {
|
pub fn engine_tests<E: Engine>() {
|
||||||
let mut rng = XorShiftRng::from_seed([
|
let mut rng = XorShiftRng::from_seed([
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ version = "0.0.0"
|
|||||||
authors = [
|
authors = [
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
]
|
]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aes = "0.3"
|
aes = "0.3"
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ use std::fmt;
|
|||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use serialize::Vector;
|
use crate::serialize::Vector;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct BlockHash(pub [u8; 32]);
|
pub struct BlockHash(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Display for BlockHash {
|
impl fmt::Display for BlockHash {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut data = self.0.clone();
|
let mut data = self.0.clone();
|
||||||
data.reverse();
|
data.reverse();
|
||||||
formatter.write_str(&hex::encode(data))
|
formatter.write_str(&hex::encode(data))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use jubjub::{edwards, JubjubEngine, PrimeOrder};
|
use crate::jubjub::{edwards, JubjubEngine, PrimeOrder};
|
||||||
|
|
||||||
use ff::PrimeField;
|
use ff::PrimeField;
|
||||||
|
|
||||||
|
use crate::constants;
|
||||||
use blake2s_simd::Params;
|
use blake2s_simd::Params;
|
||||||
use constants;
|
|
||||||
|
|
||||||
/// Produces a random point in the Jubjub curve.
|
/// Produces a random point in the Jubjub curve.
|
||||||
/// The point is guaranteed to be prime order
|
/// The point is guaranteed to be prime order
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ const NEGATIVE_ONE: Fs = Fs(FsRepr([
|
|||||||
pub struct FsRepr(pub [u64; 4]);
|
pub struct FsRepr(pub [u64; 4]);
|
||||||
|
|
||||||
impl ::std::fmt::Display for FsRepr {
|
impl ::std::fmt::Display for FsRepr {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
try!(write!(f, "0x"));
|
write!(f, "0x")?;
|
||||||
for i in self.0.iter().rev() {
|
for i in self.0.iter().rev() {
|
||||||
try!(write!(f, "{:016x}", *i));
|
write!(f, "{:016x}", *i)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -257,7 +257,7 @@ impl PrimeFieldRepr for FsRepr {
|
|||||||
pub struct Fs(FsRepr);
|
pub struct Fs(FsRepr);
|
||||||
|
|
||||||
impl ::std::fmt::Display for Fs {
|
impl ::std::fmt::Display for Fs {
|
||||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
write!(f, "Fs({})", self.into_repr())
|
write!(f, "Fs({})", self.into_repr())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
use ff::{Field, PrimeField, SqrtField};
|
use ff::{Field, PrimeField, SqrtField};
|
||||||
use pairing::Engine;
|
use pairing::Engine;
|
||||||
|
|
||||||
use group_hash::group_hash;
|
use crate::group_hash::group_hash;
|
||||||
|
|
||||||
use constants;
|
use crate::constants;
|
||||||
|
|
||||||
use pairing::bls12_381::{Bls12, Fr};
|
use pairing::bls12_381::{Bls12, Fr};
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ pub trait JubjubParams<E: JubjubEngine>: Sized {
|
|||||||
fn generator(&self, base: FixedGenerators) -> &edwards::Point<E, PrimeOrder>;
|
fn generator(&self, base: FixedGenerators) -> &edwards::Point<E, PrimeOrder>;
|
||||||
/// Returns a window table [0, 1, ..., 8] for different magnitudes of some
|
/// Returns a window table [0, 1, ..., 8] for different magnitudes of some
|
||||||
/// fixed generator.
|
/// fixed generator.
|
||||||
fn circuit_generators(&self, FixedGenerators) -> &[Vec<(E::Fr, E::Fr)>];
|
fn circuit_generators(&self, _: FixedGenerators) -> &[Vec<(E::Fr, E::Fr)>];
|
||||||
/// Returns the window size for exponentiation of Pedersen hash generators
|
/// Returns the window size for exponentiation of Pedersen hash generators
|
||||||
/// outside the circuit
|
/// outside the circuit
|
||||||
fn pedersen_hash_exp_window_size() -> u32;
|
fn pedersen_hash_exp_window_size() -> u32;
|
||||||
@@ -374,7 +374,7 @@ impl JubjubBls12 {
|
|||||||
let mut pedersen_circuit_generators = vec![];
|
let mut pedersen_circuit_generators = vec![];
|
||||||
|
|
||||||
// Process each segment
|
// Process each segment
|
||||||
for mut gen in tmp_params.pedersen_hash_generators.iter().cloned() {
|
for gen in tmp_params.pedersen_hash_generators.iter().cloned() {
|
||||||
let mut gen = montgomery::Point::from_edwards(&gen, &tmp_params);
|
let mut gen = montgomery::Point::from_edwards(&gen, &tmp_params);
|
||||||
let mut windows = vec![];
|
let mut windows = vec![];
|
||||||
for _ in 0..tmp_params.pedersen_hash_chunks_per_generator() {
|
for _ in 0..tmp_params.pedersen_hash_chunks_per_generator() {
|
||||||
|
|||||||
@@ -1,27 +1,10 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
extern crate aes;
|
|
||||||
extern crate blake2b_simd;
|
|
||||||
extern crate blake2s_simd;
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate crypto_api_chachapoly;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate fpe;
|
|
||||||
extern crate hex;
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand;
|
|
||||||
extern crate rand_core;
|
|
||||||
extern crate rand_os;
|
|
||||||
extern crate sha2;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate hex_literal;
|
extern crate hex_literal;
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
|
|
||||||
pub mod block;
|
pub mod block;
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
pub mod group_hash;
|
pub mod group_hash;
|
||||||
@@ -43,7 +26,7 @@ pub mod zip32;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test_vectors;
|
mod test_vectors;
|
||||||
|
|
||||||
use jubjub::JubjubBls12;
|
use crate::jubjub::JubjubBls12;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref JUBJUB: JubjubBls12 = { JubjubBls12::new() };
|
pub static ref JUBJUB: JubjubBls12 = { JubjubBls12::new() };
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use std::collections::VecDeque;
|
|||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
use sapling::SAPLING_COMMITMENT_TREE_DEPTH;
|
use crate::sapling::SAPLING_COMMITMENT_TREE_DEPTH;
|
||||||
use serialize::{Optional, Vector};
|
use crate::serialize::{Optional, Vector};
|
||||||
|
|
||||||
/// A hashable node within a Merkle tree.
|
/// A hashable node within a Merkle tree.
|
||||||
pub trait Hashable: Clone + Copy {
|
pub trait Hashable: Clone + Copy {
|
||||||
@@ -17,13 +17,13 @@ pub trait Hashable: Clone + Copy {
|
|||||||
fn write<W: Write>(&self, writer: W) -> io::Result<()>;
|
fn write<W: Write>(&self, writer: W) -> io::Result<()>;
|
||||||
|
|
||||||
/// Returns the parent node within the tree of the two given nodes.
|
/// Returns the parent node within the tree of the two given nodes.
|
||||||
fn combine(usize, &Self, &Self) -> Self;
|
fn combine(_: usize, _: &Self, _: &Self) -> Self;
|
||||||
|
|
||||||
/// Returns a blank leaf node.
|
/// Returns a blank leaf node.
|
||||||
fn blank() -> Self;
|
fn blank() -> Self;
|
||||||
|
|
||||||
/// Returns the empty root for the given depth.
|
/// Returns the empty root for the given depth.
|
||||||
fn empty_root(usize) -> Self;
|
fn empty_root(_: usize) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PathFiller<Node: Hashable> {
|
struct PathFiller<Node: Hashable> {
|
||||||
@@ -509,7 +509,7 @@ impl<Node: Hashable> CommitmentTreeWitness<Node> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{CommitmentTree, CommitmentTreeWitness, Hashable, IncrementalWitness, PathFiller};
|
use super::{CommitmentTree, CommitmentTreeWitness, Hashable, IncrementalWitness, PathFiller};
|
||||||
use sapling::Node;
|
use crate::sapling::Node;
|
||||||
|
|
||||||
use ff::PrimeFieldRepr;
|
use ff::PrimeFieldRepr;
|
||||||
use hex;
|
use hex;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
use crate::jubjub::*;
|
||||||
use ff::{Field, PrimeField, PrimeFieldRepr};
|
use ff::{Field, PrimeField, PrimeFieldRepr};
|
||||||
use jubjub::*;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub enum Personalization {
|
pub enum Personalization {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
use ff::{Field, PrimeField, PrimeFieldRepr};
|
use ff::{Field, PrimeField, PrimeFieldRepr};
|
||||||
|
|
||||||
use constants;
|
use crate::constants;
|
||||||
|
|
||||||
use group_hash::group_hash;
|
use crate::group_hash::group_hash;
|
||||||
|
|
||||||
use pedersen_hash::{pedersen_hash, Personalization};
|
use crate::pedersen_hash::{pedersen_hash, Personalization};
|
||||||
|
|
||||||
use byteorder::{LittleEndian, WriteBytesExt};
|
use byteorder::{LittleEndian, WriteBytesExt};
|
||||||
|
|
||||||
use jubjub::{edwards, FixedGenerators, JubjubEngine, JubjubParams, PrimeOrder};
|
use crate::jubjub::{edwards, FixedGenerators, JubjubEngine, JubjubParams, PrimeOrder};
|
||||||
|
|
||||||
use blake2s_simd::Params as Blake2sParams;
|
use blake2s_simd::Params as Blake2sParams;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use ff::{Field, PrimeField, PrimeFieldRepr};
|
|||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
|
|
||||||
use util::hash_to_scalar;
|
use crate::util::hash_to_scalar;
|
||||||
|
|
||||||
fn read_scalar<E: JubjubEngine, R: Read>(reader: R) -> io::Result<E::Fs> {
|
fn read_scalar<E: JubjubEngine, R: Read>(reader: R) -> io::Result<E::Fs> {
|
||||||
let mut s_repr = <E::Fs as PrimeField>::Repr::default();
|
let mut s_repr = <E::Fs as PrimeField>::Repr::default();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use std::io::{self, Read, Write};
|
|||||||
|
|
||||||
use crate::merkle_tree::Hashable;
|
use crate::merkle_tree::Hashable;
|
||||||
use crate::redjubjub::{PrivateKey, PublicKey, Signature};
|
use crate::redjubjub::{PrivateKey, PublicKey, Signature};
|
||||||
use JUBJUB;
|
use crate::JUBJUB;
|
||||||
|
|
||||||
pub const SAPLING_COMMITMENT_TREE_DEPTH: usize = 32;
|
pub const SAPLING_COMMITMENT_TREE_DEPTH: usize = 32;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
//! Structs for building transactions.
|
//! Structs for building transactions.
|
||||||
|
|
||||||
|
use crate::zip32::ExtendedSpendingKey;
|
||||||
use crate::{
|
use crate::{
|
||||||
jubjub::fs::Fs,
|
jubjub::fs::Fs,
|
||||||
primitives::{Diversifier, Note, PaymentAddress},
|
primitives::{Diversifier, Note, PaymentAddress},
|
||||||
@@ -7,7 +8,6 @@ use crate::{
|
|||||||
use ff::Field;
|
use ff::Field;
|
||||||
use pairing::bls12_381::{Bls12, Fr};
|
use pairing::bls12_381::{Bls12, Fr};
|
||||||
use rand::{rngs::OsRng, seq::SliceRandom, CryptoRng, RngCore};
|
use rand::{rngs::OsRng, seq::SliceRandom, CryptoRng, RngCore};
|
||||||
use zip32::ExtendedSpendingKey;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
keys::OutgoingViewingKey,
|
keys::OutgoingViewingKey,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ use ff::{PrimeField, PrimeFieldRepr};
|
|||||||
use pairing::bls12_381::{Bls12, Fr, FrRepr};
|
use pairing::bls12_381::{Bls12, Fr, FrRepr};
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
|
|
||||||
use legacy::Script;
|
use crate::legacy::Script;
|
||||||
use redjubjub::{PublicKey, Signature};
|
use crate::redjubjub::{PublicKey, Signature};
|
||||||
use JUBJUB;
|
use crate::JUBJUB;
|
||||||
|
|
||||||
pub mod amount;
|
pub mod amount;
|
||||||
pub use self::amount::Amount;
|
pub use self::amount::Amount;
|
||||||
@@ -104,7 +104,7 @@ pub struct SpendDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for SpendDescription {
|
impl std::fmt::Debug for SpendDescription {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"SpendDescription(cv = {:?}, anchor = {:?}, nullifier = {:?}, rk = {:?}, spend_auth_sig = {:?})",
|
"SpendDescription(cv = {:?}, anchor = {:?}, nullifier = {:?}, rk = {:?}, spend_auth_sig = {:?})",
|
||||||
@@ -186,7 +186,7 @@ pub struct OutputDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for OutputDescription {
|
impl std::fmt::Debug for OutputDescription {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"OutputDescription(cv = {:?}, cmu = {:?}, ephemeral_key = {:?})",
|
"OutputDescription(cv = {:?}, cmu = {:?}, ephemeral_key = {:?})",
|
||||||
@@ -253,7 +253,7 @@ enum SproutProof {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for SproutProof {
|
impl std::fmt::Debug for SproutProof {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
match self {
|
match self {
|
||||||
SproutProof::Groth(_) => write!(f, "SproutProof::Groth"),
|
SproutProof::Groth(_) => write!(f, "SproutProof::Groth"),
|
||||||
SproutProof::PHGR(_) => write!(f, "SproutProof::PHGR"),
|
SproutProof::PHGR(_) => write!(f, "SproutProof::PHGR"),
|
||||||
@@ -275,7 +275,7 @@ pub struct JSDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for JSDescription {
|
impl std::fmt::Debug for JSDescription {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"JSDescription(
|
"JSDescription(
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ mod tests {
|
|||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn add_panics_on_overflow() {
|
fn add_panics_on_overflow() {
|
||||||
let v = Amount(MAX_MONEY);
|
let v = Amount(MAX_MONEY);
|
||||||
let sum = v + Amount(1);
|
let _sum = v + Amount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -220,7 +220,7 @@ mod tests {
|
|||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn sub_panics_on_underflow() {
|
fn sub_panics_on_underflow() {
|
||||||
let v = Amount(-MAX_MONEY);
|
let v = Amount(-MAX_MONEY);
|
||||||
let diff = v - Amount(1);
|
let _diff = v - Amount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use std::fmt;
|
|||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use redjubjub::Signature;
|
use crate::redjubjub::Signature;
|
||||||
use serialize::Vector;
|
use crate::serialize::Vector;
|
||||||
|
|
||||||
pub mod builder;
|
pub mod builder;
|
||||||
pub mod components;
|
pub mod components;
|
||||||
@@ -28,7 +28,7 @@ const SAPLING_TX_VERSION: u32 = 4;
|
|||||||
pub struct TxId(pub [u8; 32]);
|
pub struct TxId(pub [u8; 32]);
|
||||||
|
|
||||||
impl fmt::Display for TxId {
|
impl fmt::Display for TxId {
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut data = self.0.clone();
|
let mut data = self.0.clone();
|
||||||
data.reverse();
|
data.reverse();
|
||||||
formatter.write_str(&hex::encode(data))
|
formatter.write_str(&hex::encode(data))
|
||||||
@@ -74,7 +74,7 @@ pub struct TransactionData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for TransactionData {
|
impl std::fmt::Debug for TransactionData {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"TransactionData(
|
"TransactionData(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use super::{
|
|||||||
Transaction, TransactionData, OVERWINTER_VERSION_GROUP_ID, SAPLING_TX_VERSION,
|
Transaction, TransactionData, OVERWINTER_VERSION_GROUP_ID, SAPLING_TX_VERSION,
|
||||||
SAPLING_VERSION_GROUP_ID,
|
SAPLING_VERSION_GROUP_ID,
|
||||||
};
|
};
|
||||||
use legacy::Script;
|
use crate::legacy::Script;
|
||||||
|
|
||||||
const ZCASH_SIGHASH_PERSONALIZATION_PREFIX: &'static [u8; 12] = b"ZcashSigHash";
|
const ZCASH_SIGHASH_PERSONALIZATION_PREFIX: &'static [u8; 12] = b"ZcashSigHash";
|
||||||
const ZCASH_PREVOUTS_HASH_PERSONALIZATION: &'static [u8; 16] = b"ZcashPrevoutHash";
|
const ZCASH_PREVOUTS_HASH_PERSONALIZATION: &'static [u8; 16] = b"ZcashPrevoutHash";
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ use rand_os::OsRng;
|
|||||||
use crate::jubjub::{fs::Fs, FixedGenerators};
|
use crate::jubjub::{fs::Fs, FixedGenerators};
|
||||||
|
|
||||||
use super::{components::Amount, sighash::signature_hash, Transaction, TransactionData};
|
use super::{components::Amount, sighash::signature_hash, Transaction, TransactionData};
|
||||||
use legacy::Script;
|
use crate::legacy::Script;
|
||||||
use redjubjub::PrivateKey;
|
use crate::redjubjub::PrivateKey;
|
||||||
use JUBJUB;
|
use crate::JUBJUB;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn tx_read_write() {
|
fn tx_read_write() {
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ impl std::cmp::PartialEq for ExtendedSpendingKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for ExtendedSpendingKey {
|
impl std::fmt::Debug for ExtendedSpendingKey {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"ExtendedSpendingKey(d = {}, tag_p = {:?}, i = {:?})",
|
"ExtendedSpendingKey(d = {}, tag_p = {:?}, i = {:?})",
|
||||||
@@ -221,7 +221,7 @@ impl std::cmp::PartialEq for ExtendedFullViewingKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for ExtendedFullViewingKey {
|
impl std::fmt::Debug for ExtendedFullViewingKey {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"ExtendedFullViewingKey(d = {}, tag_p = {:?}, i = {:?})",
|
"ExtendedFullViewingKey(d = {}, tag_p = {:?}, i = {:?})",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ version = "0.0.0"
|
|||||||
authors = [
|
authors = [
|
||||||
"Jack Grigg <jack@z.cash>",
|
"Jack Grigg <jack@z.cash>",
|
||||||
]
|
]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bellman = { path = "../bellman" }
|
bellman = { path = "../bellman" }
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
extern crate bellman;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand_core;
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
extern crate zcash_primitives;
|
|
||||||
extern crate zcash_proofs;
|
|
||||||
|
|
||||||
use bellman::groth16::*;
|
use bellman::groth16::*;
|
||||||
use ff::Field;
|
use ff::Field;
|
||||||
use pairing::bls12_381::{Bls12, Fr};
|
use pairing::bls12_381::{Bls12, Fr};
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ mod test {
|
|||||||
|
|
||||||
for length in 0..751 {
|
for length in 0..751 {
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
let mut input: Vec<bool> = (0..length).map(|_| rng.next_u32() % 2 != 0).collect();
|
let input: Vec<bool> = (0..length).map(|_| rng.next_u32() % 2 != 0).collect();
|
||||||
|
|
||||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,3 @@
|
|||||||
extern crate bellman;
|
|
||||||
extern crate blake2b_simd;
|
|
||||||
extern crate byteorder;
|
|
||||||
extern crate ff;
|
|
||||||
extern crate pairing;
|
|
||||||
extern crate rand_os;
|
|
||||||
extern crate zcash_primitives;
|
|
||||||
|
|
||||||
#[cfg(feature = "local-prover")]
|
|
||||||
extern crate directories;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand_core;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
extern crate rand_xorshift;
|
|
||||||
|
|
||||||
use bellman::groth16::{prepare_verifying_key, Parameters, PreparedVerifyingKey, VerifyingKey};
|
use bellman::groth16::{prepare_verifying_key, Parameters, PreparedVerifyingKey, VerifyingKey};
|
||||||
use pairing::bls12_381::Bls12;
|
use pairing::bls12_381::Bls12;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|||||||
Reference in New Issue
Block a user