Skip to content

Commit

Permalink
rust fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Oct 13, 2020
1 parent 33a68c8 commit ff1753e
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion benches/hash.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use bellperson::bls::{Bls12, Fr};
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use ff::PrimeField;
use generic_array::typenum;
use neptune::poseidon::{HashMode, PoseidonConstants};
use neptune::*;
use bellperson::bls::{Bls12, Fr};
use rand::rngs::OsRng;
use rand::seq::SliceRandom;
use sha2::{Digest, Sha256, Sha512};
Expand Down
2 changes: 1 addition & 1 deletion benches/synthesis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::poseidon::{Arity, PoseidonConstants};
use bellperson::bls::{Bls12, Fr};
use bellperson::gadgets::num::AllocatedNum;
use bellperson::util_cs::bench_cs::BenchCS;
use bellperson::{Circuit, ConstraintSystem, SynthesisError};
Expand All @@ -7,7 +8,6 @@ use ff::Field;
use generic_array::typenum;
use neptune::circuit::poseidon_hash;
use neptune::*;
use bellperson::bls::{Bls12, Fr};
use rand::thread_rng;
use std::marker::PhantomData;

Expand Down
2 changes: 1 addition & 1 deletion src/batch_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::cl;
use crate::error::Error;
use crate::poseidon::SimplePoseidonBatchHasher;
use crate::{Arity, BatchHasher, Strength, DEFAULT_STRENGTH};
use generic_array::GenericArray;
use bellperson::bls::Fr;
use generic_array::GenericArray;
use std::marker::PhantomData;

#[derive(Clone, Copy, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ mod tests {
use super::*;
use crate::poseidon::HashMode;
use crate::{scalar_from_u64, Poseidon, Strength};
use bellperson::bls::{Bls12, Fr};
use bellperson::util_cs::test_cs::TestConstraintSystem;
use bellperson::ConstraintSystem;
use generic_array::typenum;
use bellperson::bls::{Bls12, Fr};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;

Expand Down
4 changes: 2 additions & 2 deletions src/column_tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::error::Error;
use crate::poseidon::{Poseidon, PoseidonConstants};
use crate::tree_builder::{TreeBuilder, TreeBuilderTrait};
use crate::{Arity, BatchHasher};
use bellperson::bls::{Bls12, Fr};
use ff::Field;
use generic_array::GenericArray;
use bellperson::bls::{Bls12, Fr};

pub trait ColumnTreeBuilderTrait<ColumnArity, TreeArity>
where
Expand Down Expand Up @@ -151,10 +151,10 @@ mod tests {
use super::*;
use crate::poseidon::Poseidon;
use crate::BatchHasher;
use bellperson::bls::Fr;
use ff::Field;
use generic_array::sequence::GenericSequence;
use generic_array::typenum::{U11, U8};
use bellperson::bls::Fr;

#[test]
fn test_column_tree_builder() {
Expand Down
2 changes: 1 addition & 1 deletion src/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::cl;
use crate::error::Error;
use crate::poseidon::PoseidonConstants;
use crate::{Arity, BatchHasher, Strength, DEFAULT_STRENGTH};
use bellperson::bls::{Bls12, Fr, FrRepr};
use ff::{PrimeField, PrimeFieldDecodingError};
use generic_array::{typenum, ArrayLength, GenericArray};
use bellperson::bls::{Bls12, Fr, FrRepr};
use std::collections::HashMap;
use std::marker::PhantomData;
use std::sync::{Arc, Mutex};
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ extern crate lazy_static;

pub use crate::poseidon::{Arity, Poseidon};
use crate::round_constants::generate_constants;
pub use bellperson::bls::Fr as Scalar;
use bellperson::bls::FrRepr;
pub use error::Error;
use ff::{Field, PrimeField, ScalarEngine};
use generic_array::GenericArray;
pub use bellperson::bls::Fr as Scalar;
use bellperson::bls::FrRepr;

/// Poseidon circuit
pub mod circuit;
Expand Down
2 changes: 1 addition & 1 deletion src/mds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ fn make_v_w<E: ScalarEngine>(m: &Matrix<Scalar<E>>) -> (Vec<Scalar<E>>, Vec<Scal
mod tests {
use super::*;
use crate::*;
use matrix::left_apply_matrix;
use bellperson::bls::{Bls12, Fr};
use matrix::left_apply_matrix;
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;

Expand Down
9 changes: 3 additions & 6 deletions src/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::poseidon_alt::{hash_correct, hash_optimized_dynamic};
use crate::preprocessing::compress_round_constants;
use crate::{matrix, quintic_s_box, BatchHasher, Strength, DEFAULT_STRENGTH};
use crate::{round_constants, round_numbers, scalar_from_u64, Error};
use bellperson::bls::{Bls12, Fr};
use ff::{Field, PrimeField, ScalarEngine};
use generic_array::{sequence::GenericSequence, typenum, ArrayLength, GenericArray};
use bellperson::bls::{Fr, Bls12};
use std::marker::PhantomData;
use typenum::marker_traits::Unsigned;
use typenum::*;
Expand Down Expand Up @@ -493,10 +493,7 @@ impl<A> BatchHasher<A> for SimplePoseidonBatchHasher<A>
where
A: Arity<Fr>,
{
fn hash(
&mut self,
preimages: &[GenericArray<Fr, A>],
) -> Result<Vec<Fr>, Error> {
fn hash(&mut self, preimages: &[GenericArray<Fr, A>]) -> Result<Vec<Fr>, Error> {
Ok(preimages
.iter()
.map(|preimage| Poseidon::new_with_preimage(&preimage, &self.constants).hash())
Expand All @@ -512,9 +509,9 @@ where
mod tests {
use super::*;
use crate::*;
use bellperson::bls::{Bls12, Fr};
use ff::Field;
use generic_array::typenum;
use bellperson::bls::{Bls12, Fr};

#[test]
fn reset() {
Expand Down
2 changes: 1 addition & 1 deletion src/round_constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use crate::Error;
use ff::{PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, ScalarEngine};
pub use bellperson::bls::Fr as Scalar;
use ff::{PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, ScalarEngine};

/// From the paper ():
/// The round constants are generated using the Grain LFSR [23] in a self-shrinking
Expand Down
4 changes: 2 additions & 2 deletions src/tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::cl::GPUSelector;
use crate::error::Error;
use crate::poseidon::{Poseidon, PoseidonConstants};
use crate::{Arity, BatchHasher};
use bellperson::bls::{Bls12, Fr};
use ff::Field;
use generic_array::GenericArray;
use bellperson::bls::{Bls12, Fr};

pub trait TreeBuilderTrait<TreeArity>
where
Expand Down Expand Up @@ -250,9 +250,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use bellperson::bls::Fr;
use ff::Field;
use generic_array::typenum::U8;
use bellperson::bls::Fr;

#[test]
fn test_tree_builder() {
Expand Down

0 comments on commit ff1753e

Please sign in to comment.