@@ -5,6 +5,7 @@ use crate::{
55 orchestrator:: { ingress:: Message , Mailbox } ,
66 BLOCKS_PER_EPOCH ,
77} ;
8+ use commonware_actor:: mailbox;
89use commonware_consensus:: {
910 marshal:: { core:: Mailbox as MarshalMailbox , standard:: Standard } ,
1011 simplex:: { self , elector:: Config as Elector , scheme, types:: Context , Plan } ,
@@ -17,7 +18,7 @@ use commonware_cryptography::{
1718use commonware_macros:: select_loop;
1819use commonware_p2p:: {
1920 utils:: mux:: { Builder , MuxHandle , Muxer } ,
20- Blocker , Receiver , Sender ,
21+ Blocker , Sender ,
2122} ;
2223use commonware_parallel:: Strategy ;
2324use commonware_runtime:: {
@@ -26,9 +27,9 @@ use commonware_runtime::{
2627 telemetry:: metrics:: { Gauge , GaugeExt , MetricsExt as _} ,
2728 BufferPooler , Clock , ContextCell , Handle , Metrics , Network , Spawner , Storage ,
2829} ;
29- use commonware_utils:: { channel :: mpsc , vec:: NonEmptyVec , NZUsize , NZU16 } ;
30+ use commonware_utils:: { vec:: NonEmptyVec , NZUsize , NZU16 } ;
3031use rand_core:: CryptoRngCore ;
31- use std:: { collections:: BTreeMap , marker:: PhantomData , time:: Duration } ;
32+ use std:: { collections:: BTreeMap , marker:: PhantomData , num :: NonZeroUsize , time:: Duration } ;
3233use tracing:: { debug, info, warn} ;
3334
3435/// Configuration for the orchestrator.
5152 pub strategy : T ,
5253
5354 pub muxer_size : usize ,
54- pub mailbox_size : usize ,
55+ pub mailbox_size : NonZeroUsize ,
5556
5657 // Partition prefix used for orchestrator metadata persistence
5758 pub partition_prefix : String ,
7475 Provider < S , C > : EpochProvider < Variant = V , PublicKey = C :: PublicKey , Scheme = S > ,
7576{
7677 context : ContextCell < E > ,
77- mailbox : mpsc :: Receiver < Message < V , C :: PublicKey > > ,
78+ mailbox : mailbox :: Receiver < Message < V , C :: PublicKey > > ,
7879 application : A ,
7980
8081 oracle : B ,
@@ -109,7 +110,7 @@ where
109110 context : E ,
110111 config : Config < B , V , C , H , A , S , L , T > ,
111112 ) -> ( Self , Mailbox < V , C :: PublicKey > ) {
112- let ( sender, mailbox) = mpsc :: channel ( config. mailbox_size ) ;
113+ let ( sender, mailbox) = mailbox :: new ( context . child ( "mailbox" ) , config. mailbox_size ) ;
113114 let page_cache_ref = CacheRef :: from_pooler ( & context, NZU16 ! ( 16_384 ) , NZUsize ! ( 10_000 ) ) ;
114115
115116 // Register latest_epoch gauge for Grafana integration
@@ -138,15 +139,15 @@ where
138139 mut self ,
139140 votes : (
140141 impl Sender < PublicKey = C :: PublicKey > ,
141- impl Receiver < PublicKey = C :: PublicKey > ,
142+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
142143 ) ,
143144 certificates : (
144145 impl Sender < PublicKey = C :: PublicKey > ,
145- impl Receiver < PublicKey = C :: PublicKey > ,
146+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
146147 ) ,
147148 resolver : (
148149 impl Sender < PublicKey = C :: PublicKey > ,
149- impl Receiver < PublicKey = C :: PublicKey > ,
150+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
150151 ) ,
151152 ) -> Handle < ( ) > {
152153 spawn_cell ! ( self . context, self . run( votes, certificates, resolver, ) )
@@ -156,15 +157,15 @@ where
156157 mut self ,
157158 ( vote_sender, vote_receiver) : (
158159 impl Sender < PublicKey = C :: PublicKey > ,
159- impl Receiver < PublicKey = C :: PublicKey > ,
160+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
160161 ) ,
161162 ( certificate_sender, certificate_receiver) : (
162163 impl Sender < PublicKey = C :: PublicKey > ,
163- impl Receiver < PublicKey = C :: PublicKey > ,
164+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
164165 ) ,
165166 ( resolver_sender, resolver_receiver) : (
166167 impl Sender < PublicKey = C :: PublicKey > ,
167- impl Receiver < PublicKey = C :: PublicKey > ,
168+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
168169 ) ,
169170 ) {
170171 // Start muxers for each physical channel used by consensus
@@ -287,15 +288,15 @@ where
287288 scheme : S ,
288289 vote_mux : & mut MuxHandle <
289290 impl Sender < PublicKey = C :: PublicKey > ,
290- impl Receiver < PublicKey = C :: PublicKey > ,
291+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
291292 > ,
292293 certificate_mux : & mut MuxHandle <
293294 impl Sender < PublicKey = C :: PublicKey > ,
294- impl Receiver < PublicKey = C :: PublicKey > ,
295+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
295296 > ,
296297 resolver_mux : & mut MuxHandle <
297298 impl Sender < PublicKey = C :: PublicKey > ,
298- impl Receiver < PublicKey = C :: PublicKey > ,
299+ impl commonware_p2p :: Receiver < PublicKey = C :: PublicKey > ,
299300 > ,
300301 ) -> Handle < ( ) > {
301302 // Start the new engine
0 commit comments