From f63d315bc60a0a916f002269a78c3284e9ca7e65 Mon Sep 17 00:00:00 2001 From: Hamza Khalid Date: Thu, 2 Jan 2025 21:22:24 +0500 Subject: [PATCH] formatting --- packages/ciphernode/enclave_core/src/aggregator_start.rs | 7 ++++--- packages/ciphernode/events/src/enclave_event/mod.rs | 7 +++---- packages/ciphernode/events/src/eventbus.rs | 2 +- packages/ciphernode/logger/src/logger.rs | 6 +++--- packages/ciphernode/sortition/src/ciphernode_selector.rs | 6 +++++- .../tests/tests/test_aggregation_and_decryption.rs | 6 +++--- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/ciphernode/enclave_core/src/aggregator_start.rs b/packages/ciphernode/enclave_core/src/aggregator_start.rs index 01509aad..e5403b54 100644 --- a/packages/ciphernode/enclave_core/src/aggregator_start.rs +++ b/packages/ciphernode/enclave_core/src/aggregator_start.rs @@ -29,10 +29,11 @@ pub async fn execute( pubkey_write_path: Option<&str>, plaintext_write_path: Option<&str>, ) -> Result<(Addr>, JoinHandle>, String)> { - let bus = EventBus::::new(EventBusConfig{ + let bus = EventBus::::new(EventBusConfig { capture_history: true, - deduplicate: true - }).start(); + deduplicate: true, + }) + .start(); let rng = Arc::new(Mutex::new(ChaCha20Rng::from_rng(OsRng)?)); let store = setup_datastore(&config, &bus)?; let repositories = store.repositories(); diff --git a/packages/ciphernode/events/src/enclave_event/mod.rs b/packages/ciphernode/events/src/enclave_event/mod.rs index 5df7598e..c8018031 100644 --- a/packages/ciphernode/events/src/enclave_event/mod.rs +++ b/packages/ciphernode/events/src/enclave_event/mod.rs @@ -28,7 +28,7 @@ pub use publickey_aggregated::*; pub use shutdown::*; pub use test_event::*; -use crate::{E3id, EventId, Event, ErrorEvent}; +use crate::{E3id, ErrorEvent, Event, EventId}; use actix::Message; use serde::{Deserialize, Serialize}; use std::{ @@ -141,15 +141,14 @@ impl EnclaveEvent { } } - impl Event for EnclaveEvent { type Id = EventId; - + fn event_type(&self) -> String { let s = format!("{:?}", self); extract_enclave_event_name(&s).to_string() } - + fn event_id(&self) -> Self::Id { self.get_id() } diff --git a/packages/ciphernode/events/src/eventbus.rs b/packages/ciphernode/events/src/eventbus.rs index acf75baf..68882deb 100644 --- a/packages/ciphernode/events/src/eventbus.rs +++ b/packages/ciphernode/events/src/eventbus.rs @@ -223,4 +223,4 @@ impl BusError for Recipient { fn err(&self, err_type: E::ErrorType, err: anyhow::Error) { self.do_send(E::from_error(err_type, err)) } -} \ No newline at end of file +} diff --git a/packages/ciphernode/logger/src/logger.rs b/packages/ciphernode/logger/src/logger.rs index b873a834..09fe4bba 100644 --- a/packages/ciphernode/logger/src/logger.rs +++ b/packages/ciphernode/logger/src/logger.rs @@ -1,7 +1,7 @@ use actix::{Actor, Addr, Context, Handler}; -use events::{EnclaveEvent, EventBus, Subscribe, Event}; -use tracing::{error, info}; +use events::{EnclaveEvent, Event, EventBus, Subscribe}; use std::marker::PhantomData; +use tracing::{error, info}; pub trait EventLogging: Event { fn log(&self, logger_name: &str); @@ -34,7 +34,7 @@ impl Actor for SimpleLogger { impl Handler for SimpleLogger { type Result = (); - + fn handle(&mut self, msg: E, _: &mut Self::Context) -> Self::Result { msg.log(&self.name); } diff --git a/packages/ciphernode/sortition/src/ciphernode_selector.rs b/packages/ciphernode/sortition/src/ciphernode_selector.rs index e2e48aba..b0f2a537 100644 --- a/packages/ciphernode/sortition/src/ciphernode_selector.rs +++ b/packages/ciphernode/sortition/src/ciphernode_selector.rs @@ -16,7 +16,11 @@ impl Actor for CiphernodeSelector { } impl CiphernodeSelector { - pub fn new(bus: &Addr>, sortition: &Addr, address: &str) -> Self { + pub fn new( + bus: &Addr>, + sortition: &Addr, + address: &str, + ) -> Self { Self { bus: bus.clone(), sortition: sortition.clone(), diff --git a/packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs b/packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs index b477d670..241a0e18 100644 --- a/packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs +++ b/packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs @@ -5,9 +5,9 @@ use data::{DataStore, InMemStore}; use e3_request::E3Router; use events::{ CiphernodeAdded, CiphernodeSelected, CiphertextOutputPublished, DecryptionshareCreated, - E3RequestComplete, E3Requested, E3id, EnclaveEvent, EventBus, GetErrors, GetHistory, - KeyshareCreated, OrderedSet, PlaintextAggregated, PublicKeyAggregated, ResetHistory, Seed, - Shutdown, EventBusConfig + E3RequestComplete, E3Requested, E3id, EnclaveEvent, EventBus, EventBusConfig, GetErrors, + GetHistory, KeyshareCreated, OrderedSet, PlaintextAggregated, PublicKeyAggregated, + ResetHistory, Seed, Shutdown, }; use fhe::ext::FheExtension; use fhe::{setup_crp_params, ParamsWithCrp, SharedRng};