From 4c7aa27f319f6b6c92bd71a4319add7c9af978df Mon Sep 17 00:00:00 2001 From: EmmanuelChthonic Date: Mon, 2 Oct 2023 11:49:43 +0400 Subject: [PATCH] attempted to do the rustfmt --- processor/src/db.rs | 7 +------ processor/src/key_gen.rs | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/processor/src/db.rs b/processor/src/db.rs index f906a5ced..739049770 100644 --- a/processor/src/db.rs +++ b/processor/src/db.rs @@ -8,12 +8,7 @@ pub use serai_db::*; use crate::networks::{Block, Network}; -createDb!( - MainDb { - HandledMessageDb, - PendingActivationsDb - } -); +createDb!(MainDb { HandledMessageDb, PendingActivationsDb }); #[derive(Debug)] pub struct MainDb(D, PhantomData); diff --git a/processor/src/key_gen.rs b/processor/src/key_gen.rs index 2d30727f9..63ccddbbb 100644 --- a/processor/src/key_gen.rs +++ b/processor/src/key_gen.rs @@ -27,14 +27,7 @@ pub struct KeyConfirmed { pub network_keys: ThresholdKeys, } -createDb!( - KeyGenDb { - ParamsDb, - CommitmentsDb, - GeneratedKeysDb, - KeysDb - } -); +createDb!(KeyGenDb { ParamsDb, CommitmentsDb, GeneratedKeysDb, KeysDb }); #[allow(clippy::type_complexity)] fn read_keys( @@ -56,8 +49,7 @@ fn confirm_keys( ) -> (ThresholdKeys, ThresholdKeys) { let val: &[u8] = key_pair.1.as_ref(); let (keys_vec, keys) = - read_keys::(txn, &GeneratedKeysDb::key((set, (&key_pair.0 .0, val)).encode())) - .unwrap(); + read_keys::(txn, &GeneratedKeysDb::key((set, (&key_pair.0 .0, val)).encode())).unwrap(); assert_eq!(key_pair.0 .0, keys.0.group_key().to_bytes()); assert_eq!( { @@ -87,11 +79,12 @@ impl GeneratedKeysDb { ) { let mut keys = substrate_keys.serialize(); keys.extend(network_keys.serialize().iter()); - let key = (id.set, (&substrate_keys.group_key().to_bytes(), network_keys.group_key().to_bytes().as_ref())).encode(); - txn.put( - Self::key(key), - keys, - ); + let key = ( + id.set, + (&substrate_keys.group_key().to_bytes(), network_keys.group_key().to_bytes().as_ref()), + ) + .encode(); + txn.put(Self::key(key), keys); } } @@ -170,8 +163,8 @@ impl KeyGen { info!("Generating new key. ID: {:?} Params: {:?}", id, params); // Remove old attempts - if self.active_commit.remove(&id.set).is_none() && - self.active_share.remove(&id.set).is_none() + if self.active_commit.remove(&id.set).is_none() + && self.active_share.remove(&id.set).is_none() { // If we haven't handled this set before, save the params ParamsDb::set(txn, &id.set.encode(), ¶ms); @@ -269,7 +262,8 @@ impl KeyGen { let machines = self.active_share.remove(&id.set).unwrap_or_else(|| { let machines = key_gen_machines(id, params).0; let mut rng = secret_shares_rng(id); - let commitments = CommitmentsDb::get::>>(txn, &id.encode()).unwrap(); + let commitments = + CommitmentsDb::get::>>(txn, &id.encode()).unwrap(); let mut commitments_ref: HashMap = commitments.iter().map(|(i, commitments)| (*i, commitments.as_ref())).collect();