Organize imports (#188)
* Organize imports Use rustfmt to organize imports. Resolve #162 * remove unused imports * cargo fmt
This commit is contained in:
parent
1214cdfa1b
commit
24ff82dd3d
32 changed files with 329 additions and 276 deletions
|
|
@ -1,16 +1,16 @@
|
|||
//! Module that implements the MerkleTree specified at
|
||||
//! https://0xparc.github.io/pod2/merkletree.html .
|
||||
use std::{collections::HashMap, fmt, iter::IntoIterator};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use plonky2::field::types::Field;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::iter::IntoIterator;
|
||||
|
||||
use crate::backends::counter;
|
||||
use crate::backends::plonky2::basetypes::{hash_fields, Hash, Value, EMPTY_HASH, F};
|
||||
|
||||
pub use super::merkletree_circuit::*;
|
||||
use crate::backends::{
|
||||
counter,
|
||||
plonky2::basetypes::{hash_fields, Hash, Value, EMPTY_HASH, F},
|
||||
};
|
||||
|
||||
/// Implements the MerkleTree specified at
|
||||
/// https://0xparc.github.io/pod2/merkletree.html
|
||||
|
|
@ -582,9 +582,10 @@ impl<'a> Iterator for Iter<'a> {
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use itertools::Itertools;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
//! If only proofs of existence are needed, use `MerkleProofExistenceCircuit`,
|
||||
//! which requires less amount of constraints than `MerkleProofCircuit`.
|
||||
//!
|
||||
use std::iter;
|
||||
|
||||
use anyhow::Result;
|
||||
use plonky2::{
|
||||
field::types::Field,
|
||||
|
|
@ -21,11 +23,12 @@ use plonky2::{
|
|||
},
|
||||
plonk::circuit_builder::CircuitBuilder,
|
||||
};
|
||||
use std::iter;
|
||||
|
||||
use crate::backends::plonky2::basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, HASH_SIZE};
|
||||
use crate::backends::plonky2::circuits::common::{CircuitBuilderPod, ValueTarget};
|
||||
use crate::backends::plonky2::primitives::merkletree::MerkleProof;
|
||||
use crate::backends::plonky2::{
|
||||
basetypes::{Hash, Value, D, EMPTY_HASH, EMPTY_VALUE, F, HASH_SIZE},
|
||||
circuits::common::{CircuitBuilderPod, ValueTarget},
|
||||
primitives::merkletree::MerkleProof,
|
||||
};
|
||||
|
||||
/// `MerkleProofGadget` allows to verify both proofs of existence and proofs
|
||||
/// non-existence with the same circuit.
|
||||
|
|
@ -396,13 +399,15 @@ fn kv_hash_target(
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use plonky2::plonk::{circuit_builder::CircuitBuilder, circuit_data::CircuitConfig};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use plonky2::plonk::{circuit_builder::CircuitBuilder, circuit_data::CircuitConfig};
|
||||
|
||||
use super::*;
|
||||
use crate::backends::plonky2::basetypes::hash_value;
|
||||
use crate::backends::plonky2::basetypes::C;
|
||||
use crate::backends::plonky2::primitives::merkletree::*;
|
||||
use crate::backends::plonky2::{
|
||||
basetypes::{hash_value, C},
|
||||
primitives::merkletree::*,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_keypath() -> Result<()> {
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@ use plonky2::{
|
|||
},
|
||||
};
|
||||
|
||||
use crate::backends::plonky2::basetypes::{Proof, Value, C, D, F, VALUE_SIZE};
|
||||
|
||||
pub use super::signature_circuit::*;
|
||||
use crate::backends::plonky2::basetypes::{Proof, Value, C, D, F, VALUE_SIZE};
|
||||
|
||||
lazy_static! {
|
||||
/// Signature prover parameters
|
||||
|
|
@ -201,9 +200,8 @@ impl SignatureInternalCircuit {
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::backends::plonky2::basetypes::Hash;
|
||||
|
||||
use super::*;
|
||||
use crate::backends::plonky2::basetypes::Hash;
|
||||
|
||||
#[test]
|
||||
fn test_signature() -> Result<()> {
|
||||
|
|
|
|||
|
|
@ -11,19 +11,24 @@ use plonky2::{
|
|||
target::{BoolTarget, Target},
|
||||
witness::{PartialWitness, WitnessWrite},
|
||||
},
|
||||
plonk::circuit_builder::CircuitBuilder,
|
||||
plonk::circuit_data::{
|
||||
CircuitConfig, CircuitData, ProverCircuitData, VerifierCircuitData, VerifierCircuitTarget,
|
||||
plonk::{
|
||||
circuit_builder::CircuitBuilder,
|
||||
circuit_data::{
|
||||
CircuitConfig, CircuitData, ProverCircuitData, VerifierCircuitData,
|
||||
VerifierCircuitTarget,
|
||||
},
|
||||
config::Hasher,
|
||||
proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget},
|
||||
},
|
||||
plonk::config::Hasher,
|
||||
plonk::proof::{ProofWithPublicInputs, ProofWithPublicInputsTarget},
|
||||
};
|
||||
|
||||
use super::signature::{PublicKey, SecretKey, Signature, DUMMY_PUBLIC_INPUTS, DUMMY_SIGNATURE};
|
||||
use crate::backends::plonky2::basetypes::{
|
||||
Hash, Proof, Value, C, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE,
|
||||
use crate::backends::plonky2::{
|
||||
basetypes::{Hash, Proof, Value, C, D, EMPTY_HASH, EMPTY_VALUE, F, VALUE_SIZE},
|
||||
circuits::common::{CircuitBuilderPod, ValueTarget},
|
||||
primitives::signature::{
|
||||
PublicKey, SecretKey, Signature, DUMMY_PUBLIC_INPUTS, DUMMY_SIGNATURE,
|
||||
},
|
||||
};
|
||||
use crate::backends::plonky2::circuits::common::{CircuitBuilderPod, ValueTarget};
|
||||
|
||||
lazy_static! {
|
||||
/// SignatureVerifyGadget VerifierCircuitData
|
||||
|
|
@ -164,10 +169,8 @@ impl SignatureVerifyTarget {
|
|||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use crate::backends::plonky2::basetypes::Hash;
|
||||
use crate::backends::plonky2::primitives::signature::SecretKey;
|
||||
|
||||
use super::*;
|
||||
use crate::backends::plonky2::{basetypes::Hash, primitives::signature::SecretKey};
|
||||
|
||||
#[test]
|
||||
fn test_signature_gadget() -> Result<()> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue