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