Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hmzakhalid committed Jan 2, 2025
1 parent 159db33 commit f63d315
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
7 changes: 4 additions & 3 deletions packages/ciphernode/enclave_core/src/aggregator_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ pub async fn execute(
pubkey_write_path: Option<&str>,
plaintext_write_path: Option<&str>,
) -> Result<(Addr<EventBus<EnclaveEvent>>, JoinHandle<Result<()>>, String)> {
let bus = EventBus::<EnclaveEvent>::new(EventBusConfig{
let bus = EventBus::<EnclaveEvent>::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();
Expand Down
7 changes: 3 additions & 4 deletions packages/ciphernode/events/src/enclave_event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ciphernode/events/src/eventbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ impl<E: ErrorEvent> BusError<E> for Recipient<E> {
fn err(&self, err_type: E::ErrorType, err: anyhow::Error) {
self.do_send(E::from_error(err_type, err))
}
}
}
6 changes: 3 additions & 3 deletions packages/ciphernode/logger/src/logger.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -34,7 +34,7 @@ impl<E: EventLogging> Actor for SimpleLogger<E> {

impl<E: EventLogging> Handler<E> for SimpleLogger<E> {
type Result = ();

fn handle(&mut self, msg: E, _: &mut Self::Context) -> Self::Result {
msg.log(&self.name);
}
Expand Down
6 changes: 5 additions & 1 deletion packages/ciphernode/sortition/src/ciphernode_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ impl Actor for CiphernodeSelector {
}

impl CiphernodeSelector {
pub fn new(bus: &Addr<EventBus<EnclaveEvent>>, sortition: &Addr<Sortition>, address: &str) -> Self {
pub fn new(
bus: &Addr<EventBus<EnclaveEvent>>,
sortition: &Addr<Sortition>,
address: &str,
) -> Self {
Self {
bus: bus.clone(),
sortition: sortition.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit f63d315

Please sign in to comment.