Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommitteeManager -> CiphernodeSupervisor #47

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct Die;
struct CommitteeMeta {
nodecount: usize,
}
pub struct CommitteeManager {
pub struct CiphernodeSupervisor {
bus: Addr<EventBus>,
fhe: Addr<Fhe>,

Expand All @@ -27,11 +27,11 @@ pub struct CommitteeManager {
meta: HashMap<E3id, CommitteeMeta>,
}

impl Actor for CommitteeManager {
impl Actor for CiphernodeSupervisor {
type Context = Context<Self>;
}

impl CommitteeManager {
impl CiphernodeSupervisor {
pub fn new(bus: Addr<EventBus>, fhe: Addr<Fhe>) -> Self {
Self {
bus,
Expand All @@ -43,7 +43,7 @@ impl CommitteeManager {
}

pub fn attach(bus: Addr<EventBus>, fhe: Addr<Fhe>) -> Addr<Self> {
let addr = CommitteeManager::new(bus.clone(), fhe).start();
let addr = CiphernodeSupervisor::new(bus.clone(), fhe).start();
bus.do_send(Subscribe::new(
"CommitteeRequested",
addr.clone().recipient(),
Expand All @@ -65,7 +65,7 @@ impl CommitteeManager {
}
}

impl Handler<EnclaveEvent> for CommitteeManager {
impl Handler<EnclaveEvent> for CiphernodeSupervisor {
type Result = ();

fn handle(&mut self, event: EnclaveEvent, _ctx: &mut Self::Context) -> Self::Result {
Expand Down
10 changes: 5 additions & 5 deletions packages/ciphernode/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// #![warn(missing_docs, unused_imports)]

mod ciphernode;
mod committee;
mod ciphernode_supervisor;
mod publickey_aggregator;
mod data;
mod plaintext_aggregator;
Expand All @@ -19,7 +19,7 @@ mod serializers;
// TODO: this is too permissive
pub use actix::prelude::*;
pub use ciphernode::*;
pub use committee::*;
pub use ciphernode_supervisor::*;
pub use publickey_aggregator::*;
pub use data::*;
pub use eventbus::*;
Expand All @@ -30,7 +30,7 @@ pub use p2p::*;

pub use actix::prelude::*;
pub use ciphernode::*;
pub use committee::*;
pub use ciphernode_supervisor::*;
pub use publickey_aggregator::*;
pub use data::*;
pub use eventbus::*;
Expand Down Expand Up @@ -60,7 +60,7 @@ pub use p2p::*;
mod tests {
use crate::{
ciphernode::Ciphernode,
committee::CommitteeManager,
ciphernode_supervisor::CiphernodeSupervisor,
data::Data,
eventbus::{EventBus, GetHistory},
events::{CommitteeRequested, E3id, EnclaveEvent, KeyshareCreated, PublicKeyAggregated},
Expand Down Expand Up @@ -98,7 +98,7 @@ mod tests {
let node = Ciphernode::attach(bus.clone(), fhe.clone(), data.clone()).await;

// setup the committee manager to generate the comittee public keys
CommitteeManager::attach(bus.clone(), fhe.clone());
CiphernodeSupervisor::attach(bus.clone(), fhe.clone());
(node, data)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/enclave_node/src/bin/aggregator.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use enclave_core::Actor;
use enclave_core::CommitteeManager;
use enclave_core::CiphernodeSupervisor;
use enclave_core::EventBus;
use enclave_core::Fhe;
use enclave_core::P2p;
Expand All @@ -11,7 +11,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let fhe = Fhe::try_default()?.start();
let bus = EventBus::new(true).start();
SimpleLogger::attach(bus.clone());
CommitteeManager::attach(bus.clone(), fhe.clone());
CiphernodeSupervisor::attach(bus.clone(), fhe.clone());
let (_, h) = P2p::spawn_libp2p(bus.clone())?;
println!("Aggregator");
let _ = tokio::join!(h);
Expand Down
4 changes: 2 additions & 2 deletions packages/ciphernode/enclave_node/src/bin/ciphernode.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use enclave_core::Actor;
use enclave_core::Ciphernode;
use enclave_core::CommitteeManager;
use enclave_core::CiphernodeSupervisor;
use enclave_core::Data;
use enclave_core::EventBus;
use enclave_core::Fhe;
Expand All @@ -15,7 +15,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let data = Data::new(true).start(); // TODO: Use a sled backed Data Actor
SimpleLogger::attach(bus.clone());
Ciphernode::attach(bus.clone(), fhe.clone(), data.clone());
CommitteeManager::attach(bus.clone(), fhe.clone());
CiphernodeSupervisor::attach(bus.clone(), fhe.clone());
let (_, h) = P2p::spawn_libp2p(bus.clone())?;
println!("Ciphernode");
let _ = tokio::join!(h);
Expand Down
Loading