tempo_commonware_node/dkg/manager/
mod.rs1use commonware_consensus::types::FixedEpocher;
2use commonware_cryptography::{bls12381::primitives::group::Share, ed25519::PrivateKey};
3use commonware_runtime::{BufferPooler, Clock, Metrics, Spawner, Storage};
4use eyre::WrapErr as _;
5use futures::channel::mpsc;
6use rand_core::CryptoRngCore;
7use tempo_node::TempoFullNode;
8
9mod actor;
10mod ingress;
11
12pub(crate) use actor::Actor;
13pub(crate) use ingress::Mailbox;
14
15use crate::epoch;
16
17use ingress::{Command, Message};
18
19pub(crate) async fn init<TContext>(
20 context: TContext,
21 config: Config,
22) -> eyre::Result<(Actor<TContext>, Mailbox)>
23where
24 TContext: BufferPooler + Clock + CryptoRngCore + Metrics + Spawner + Storage,
25{
26 let (tx, rx) = mpsc::unbounded();
27
28 let actor = Actor::new(config, context, rx)
29 .await
30 .wrap_err("failed initializing actor")?;
31 let mailbox = Mailbox::new(tx);
32 Ok((actor, mailbox))
33}
34
35pub(crate) struct Config {
36 pub(crate) epoch_strategy: FixedEpocher,
37
38 pub(crate) epoch_manager: epoch::manager::Mailbox,
39
40 pub(crate) namespace: Vec<u8>,
43
44 pub(crate) me: PrivateKey,
45
46 pub(crate) mailbox_size: usize,
47
48 pub(crate) marshal: crate::alias::marshal::Mailbox,
51
52 pub(crate) partition_prefix: String,
55
56 pub(crate) execution_node: TempoFullNode,
62
63 pub(crate) initial_share: Option<Share>,
65}