//! Inbound communication channel for epoch transitions. use commonware_consensus::{types::Epoch, Reporter}; use commonware_cryptography::{ bls12381::primitives::{group, poly::Public, variant::Variant}, PublicKey, }; use commonware_utils::set::Ordered; use futures::{channel::mpsc, SinkExt}; /// Messages that can be sent to the orchestrator. pub enum Message { Enter(EpochTransition), Exit(Epoch), } /// A notification of an epoch transition. pub struct EpochTransition { /// The epoch to transition to. pub epoch: Epoch, /// The public polynomial for the epoch. pub poly: Option>, /// The share for the local participant for the epoch, if participating. pub share: Option, /// The dealers for the epoch. pub dealers: Ordered

, } /// Inbound communication channel for epoch transitions. #[derive(Debug, Clone)] pub struct Mailbox { sender: mpsc::Sender>, } impl Mailbox { /// Create a new [Mailbox]. pub fn new(sender: mpsc::Sender>) -> Self { Self { sender } } } impl Reporter for Mailbox { type Activity = Message; async fn report(&mut self, activity: Self::Activity) { self.sender .send(activity) .await .expect("failed to send epoch transition") } }