Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ members = [
"group",
"librustzcash",
"pairing",
"sapling-crypto",
"zcash_client_backend",
"zcash_primitives",
"zcash_proofs",
Expand Down
4 changes: 4 additions & 0 deletions bellman/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "0.1.0"

[dependencies]
bit-vec = "0.4.4"
blake2s_simd = "0.5"
ff = { path = "../ff" }
futures = "0.1"
futures-cpupool = { version = "0.1", optional = true }
Expand All @@ -21,7 +22,10 @@ rand_core = "0.5"
byteorder = "1"

[dev-dependencies]
hex-literal = "0.1"
rand = "0.7"
rand_xorshift = "0.2"
sha2 = "0.8"

[features]
groth16 = ["pairing"]
Expand Down
10 changes: 2 additions & 8 deletions sapling-crypto/src/circuit/mod.rs → bellman/src/gadgets.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(test)]
pub mod test;

pub mod boolean;
Expand All @@ -7,15 +6,10 @@ pub mod uint32;
pub mod blake2s;
pub mod num;
pub mod lookup;
pub mod ecc;
pub mod pedersen_hash;
pub mod multipack;
pub mod sha256;

pub mod sapling;
pub mod sprout;

use bellman::{
use crate::{
SynthesisError
};

Expand All @@ -25,7 +19,7 @@ use bellman::{
/// This basically is just an extension to `Option`
/// which allows for a convenient mapping to an
/// error on `None`.
trait Assignment<T> {
pub trait Assignment<T> {
fn get(&self) -> Result<&T, SynthesisError>;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use pairing::{
Engine,
};

use bellman::{
use crate::{
SynthesisError,
ConstraintSystem
};
Expand Down Expand Up @@ -325,10 +325,10 @@ mod test {
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;

use ::circuit::boolean::{Boolean, AllocatedBit};
use ::circuit::test::TestConstraintSystem;
use crate::gadgets::boolean::{Boolean, AllocatedBit};
use crate::gadgets::test::TestConstraintSystem;
use super::blake2s;
use bellman::{ConstraintSystem};
use crate::{ConstraintSystem};

#[test]
fn test_blank_hash() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ff::{BitIterator, Field, PrimeField};
use pairing::Engine;

use bellman::{
use crate::{
ConstraintSystem,
SynthesisError,
LinearCombination,
Expand Down Expand Up @@ -801,10 +801,10 @@ impl From<AllocatedBit> for Boolean {

#[cfg(test)]
mod test {
use bellman::{ConstraintSystem};
use crate::{ConstraintSystem};
use ff::{Field, PrimeField};
use pairing::bls12_381::{Bls12, Fr};
use ::circuit::test::*;
use crate::gadgets::test::*;
use super::{
AllocatedBit,
Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::num::{
Num
};
use super::boolean::Boolean;
use bellman::{
use crate::{
ConstraintSystem
};

Expand Down Expand Up @@ -197,8 +197,8 @@ pub fn lookup3_xy_with_conditional_negation<E: Engine, CS>(
#[cfg(test)]
mod test {
use super::*;
use ::circuit::test::*;
use ::circuit::boolean::{Boolean, AllocatedBit};
use crate::gadgets::test::*;
use crate::gadgets::boolean::{Boolean, AllocatedBit};
use pairing::bls12_381::{Bls12, Fr};
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ff::{Field, PrimeField};
use pairing::Engine;

use bellman::{
use crate::{
SynthesisError,
ConstraintSystem,
LinearCombination,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ff::{Field, PrimeField};
use pairing::Engine;
use bellman::{ConstraintSystem, SynthesisError};
use crate::{ConstraintSystem, SynthesisError};
use super::boolean::{Boolean};
use super::num::Num;
use super::Assignment;
Expand Down Expand Up @@ -80,12 +80,12 @@ pub fn compute_multipacking<E: Engine>(

#[test]
fn test_multipacking() {
use bellman::{ConstraintSystem};
use crate::{ConstraintSystem};
use pairing::bls12_381::{Bls12};
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;

use ::circuit::test::*;
use crate::gadgets::test::*;
use super::boolean::{AllocatedBit, Boolean};

let mut rng = XorShiftRng::from_seed([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ff::{BitIterator, Field, PrimeField, PrimeFieldRepr};
use pairing::Engine;

use bellman::{
use crate::{
SynthesisError,
ConstraintSystem,
LinearCombination,
Expand Down Expand Up @@ -455,13 +455,13 @@ impl<E: Engine> Num<E> {

#[cfg(test)]
mod test {
use bellman::{ConstraintSystem};
use crate::{ConstraintSystem};
use ff::{BitIterator, Field, PrimeField};
use pairing::bls12_381::{Bls12, Fr};
use rand_core::SeedableRng;
use rand_xorshift::XorShiftRng;

use ::circuit::test::*;
use crate::gadgets::test::*;
use super::{AllocatedNum, Boolean};

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::uint32::UInt32;
use super::multieq::MultiEq;
use super::boolean::Boolean;
use bellman::{ConstraintSystem, SynthesisError};
use crate::{ConstraintSystem, SynthesisError};
use pairing::Engine;

const ROUND_CONSTANTS: [u32; 64] = [
Expand Down Expand Up @@ -305,9 +305,9 @@ fn sha256_compression_function<E, CS>(
#[cfg(test)]
mod test {
use super::*;
use circuit::boolean::AllocatedBit;
use crate::gadgets::boolean::AllocatedBit;
use pairing::bls12_381::Bls12;
use circuit::test::TestConstraintSystem;
use crate::gadgets::test::TestConstraintSystem;
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ff::{Field, PrimeField, PrimeFieldRepr};
use pairing::Engine;

use bellman::{
use crate::{
LinearCombination,
SynthesisError,
ConstraintSystem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ff::{Field, PrimeField};
use pairing::Engine;

use bellman::{
use crate::{
SynthesisError,
ConstraintSystem,
LinearCombination
Expand Down Expand Up @@ -409,13 +409,13 @@ impl UInt32 {

#[cfg(test)]
mod test {
use ::circuit::boolean::{Boolean};
use crate::gadgets::boolean::{Boolean};
use super::{UInt32};
use ff::Field;
use pairing::bls12_381::{Bls12};
use ::circuit::test::*;
use bellman::{ConstraintSystem};
use circuit::multieq::MultiEq;
use crate::gadgets::test::*;
use crate::{ConstraintSystem};
use crate::gadgets::multieq::MultiEq;
use rand_core::{RngCore, SeedableRng};
use rand_xorshift::XorShiftRng;

Expand Down
12 changes: 12 additions & 0 deletions bellman/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern crate rand_core;

extern crate futures;
extern crate bit_vec;
extern crate blake2s_simd;
extern crate byteorder;

#[cfg(feature = "multicore")]
Expand All @@ -15,9 +16,20 @@ extern crate futures_cpupool;
#[cfg(feature = "multicore")]
extern crate num_cpus;

#[cfg(test)]
#[macro_use]
extern crate hex_literal;

#[cfg(test)]
extern crate rand;

#[cfg(test)]
extern crate rand_xorshift;

#[cfg(test)]
extern crate sha2;

pub mod gadgets;
pub mod multicore;
mod multiexp;
pub mod domain;
Expand Down
1 change: 0 additions & 1 deletion librustzcash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ lazy_static = "1"
byteorder = "1"
rand_core = "0.5"
rand_os = "0.2"
sapling-crypto = { path = "../sapling-crypto" }
zcash_primitives = { path = "../zcash_primitives" }
zcash_proofs = { path = "../zcash_proofs" }
Loading