mirror of https://github.com/vacp2p/zerokit.git
style(rln): cargo fmt
This commit is contained in:
parent
f2f3c820ff
commit
1d8408d743
|
@ -7,8 +7,8 @@ pub mod public;
|
|||
use ark_bn254::{Fr, Parameters};
|
||||
use ark_ec::bn::Bn;
|
||||
|
||||
pub mod protocol;
|
||||
pub mod circuit;
|
||||
pub mod protocol;
|
||||
|
||||
pub type Field = Fr;
|
||||
pub type Groth16Proof = ark_groth16::Proof<Bn<Parameters>>;
|
||||
|
@ -21,10 +21,10 @@ pub mod poseidon;
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::protocol::*;
|
||||
use hex_literal::hex;
|
||||
use num_bigint::BigInt;
|
||||
use semaphore::{hash::Hash, identity::Identity, poseidon_tree::PoseidonTree};
|
||||
use crate::protocol::*;
|
||||
|
||||
#[test]
|
||||
fn test_merkle_proof() {
|
||||
|
@ -66,19 +66,27 @@ mod test {
|
|||
let signal = b"xxx";
|
||||
let external_nullifier = b"appId";
|
||||
|
||||
let external_nullifier_hash = semaphore::protocol::hash_external_nullifier(external_nullifier);
|
||||
let nullifier_hash = semaphore::protocol::generate_nullifier_hash(&id, external_nullifier_hash);
|
||||
let external_nullifier_hash =
|
||||
semaphore::protocol::hash_external_nullifier(external_nullifier);
|
||||
let nullifier_hash =
|
||||
semaphore::protocol::generate_nullifier_hash(&id, external_nullifier_hash);
|
||||
|
||||
let proof = semaphore::protocol::generate_proof(&id, &merkle_proof, external_nullifier, signal).unwrap();
|
||||
let proof =
|
||||
semaphore::protocol::generate_proof(&id, &merkle_proof, external_nullifier, signal)
|
||||
.unwrap();
|
||||
|
||||
let success =
|
||||
semaphore::protocol::verify_proof(root, nullifier_hash, signal, external_nullifier, &proof).unwrap();
|
||||
let success = semaphore::protocol::verify_proof(
|
||||
root,
|
||||
nullifier_hash,
|
||||
signal,
|
||||
external_nullifier,
|
||||
&proof,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert!(success);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn test_end_to_end() {
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
/// Adapted from semaphore-rs
|
||||
use crate::circuit::{WITNESS_CALCULATOR, ZKEY};
|
||||
use semaphore::{
|
||||
identity::Identity,
|
||||
merkle_tree::{self, Branch},
|
||||
poseidon_hash,
|
||||
poseidon_tree::PoseidonHash,
|
||||
Field,
|
||||
};
|
||||
use ark_bn254::{Bn254, Parameters};
|
||||
use ark_circom::CircomReduction;
|
||||
use ark_ec::bn::Bn;
|
||||
|
@ -17,6 +10,13 @@ use ark_std::{rand::thread_rng, UniformRand};
|
|||
use color_eyre::Result;
|
||||
use ethers_core::utils::keccak256;
|
||||
use num_bigint::{BigInt, BigUint, ToBigInt};
|
||||
use semaphore::{
|
||||
identity::Identity,
|
||||
merkle_tree::{self, Branch},
|
||||
poseidon_hash,
|
||||
poseidon_tree::PoseidonHash,
|
||||
Field,
|
||||
};
|
||||
use std::time::Instant;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue