tempo_commonware_node/epoch/manager/
mod.rs1mod actor;
2pub(super) mod ingress;
3
4use std::time::Duration;
5
6pub(crate) use actor::Actor;
7use commonware_cryptography::{bls12381::primitives::variant::MinSig, ed25519::PublicKey};
8pub(crate) use ingress::Mailbox;
9
10use commonware_consensus::{marshal, simplex::signing_scheme::bls12381_threshold::Scheme};
11use commonware_p2p::Blocker;
12use commonware_runtime::{Clock, Metrics, Network, Spawner, Storage, buffer::PoolRef};
13use rand::{CryptoRng, Rng};
14
15use crate::{consensus::block::Block, epoch::scheme_provider::SchemeProvider, subblocks};
16
17pub(crate) struct Config<TBlocker> {
18 pub(crate) application: crate::consensus::application::Mailbox,
19 pub(crate) blocker: TBlocker,
20 pub(crate) buffer_pool: PoolRef,
21 pub(crate) epoch_length: u64,
22 pub(crate) time_for_peer_response: Duration,
23 pub(crate) time_to_propose: Duration,
24 pub(crate) mailbox_size: usize,
25 pub(crate) subblocks: subblocks::Mailbox,
26 pub(crate) marshal: marshal::Mailbox<Scheme<PublicKey, MinSig>, Block>,
27 pub(crate) scheme_provider: SchemeProvider,
28 pub(crate) time_to_collect_notarizations: Duration,
29 pub(crate) time_to_retry_nullify_broadcast: Duration,
30 pub(crate) partition_prefix: String,
31 pub(crate) views_to_track: u64,
32 pub(crate) views_until_leader_skip: u64,
33}
34
35pub(crate) fn init<TBlocker, TContext>(
36 config: Config<TBlocker>,
37 context: TContext,
38) -> (Actor<TBlocker, TContext>, Mailbox)
39where
40 TBlocker: Blocker<PublicKey = PublicKey>,
41 TContext:
42 Spawner + Metrics + Rng + CryptoRng + Clock + governor::clock::Clock + Storage + Network,
43{
44 let (tx, rx) = futures::channel::mpsc::unbounded();
45 let actor = Actor::new(config, context, rx);
46 let mailbox = Mailbox::new(tx);
47 (actor, mailbox)
48}