Skip to content

Commit

Permalink
fmt and clippy run
Browse files Browse the repository at this point in the history
  • Loading branch information
curiecrypt committed Feb 24, 2023
1 parent da1980e commit 24804a9
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions mithril-stm/tests/test_stm_protocol.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use mithril_stm::key_reg::{KeyReg};
use mithril_stm::stm::{Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmInitializer, StmParameters, StmSig, StmSigner, StmVerificationKey};
use mithril_stm::key_reg::KeyReg;
use mithril_stm::stm::{
Stake, StmAggrSig, StmAggrVerificationKey, StmClerk, StmInitializer, StmParameters, StmSig,
StmSigner, StmVerificationKey,
};
use mithril_stm::AggregationError;

use blake2::{digest::consts::U32, Blake2b};
Expand All @@ -9,8 +12,11 @@ use rayon::prelude::*;

type H = Blake2b<U32>;

fn initialization_phase(nparties: i32, mut rng: ChaCha20Rng, params: StmParameters) -> (Vec<StmSigner<H>>, Vec<(StmVerificationKey, Stake)>) {

fn initialization_phase(
nparties: i32,
mut rng: ChaCha20Rng,
params: StmParameters,
) -> (Vec<StmSigner<H>>, Vec<(StmVerificationKey, Stake)>) {
let parties = (0..nparties)
.into_iter()
.map(|_| 1 + (rng.next_u64() % 9999))
Expand Down Expand Up @@ -39,7 +45,15 @@ fn initialization_phase(nparties: i32, mut rng: ChaCha20Rng, params: StmParamete
(signers, reg_parties)
}

fn operation_phase(params: StmParameters, signers: Vec<StmSigner<H>>, reg_parties: Vec<(StmVerificationKey, Stake)>, msg: [u8; 32]) -> (Result<StmAggrSig<H>, AggregationError>, StmAggrVerificationKey<H>) {
fn operation_phase(
params: StmParameters,
signers: Vec<StmSigner<H>>,
reg_parties: Vec<(StmVerificationKey, Stake)>,
msg: [u8; 32],
) -> (
Result<StmAggrSig<H>, AggregationError>,
StmAggrVerificationKey<H>,
) {
let sigs = signers
.par_iter()
.filter_map(|p| p.sign(&msg))
Expand Down Expand Up @@ -129,4 +143,3 @@ fn test_full_protocol_batch_verify() {
}
assert!(StmAggrSig::batch_verify(&aggr_stms, &batch_msgs, &aggr_avks, &batch_params).is_ok());
}

0 comments on commit 24804a9

Please sign in to comment.