@@ -49,7 +49,7 @@ use crate::{
4949} ;
5050
5151/// The state of the chain worker.
52- pub struct ChainWorkerState < StorageClient >
52+ pub ( crate ) struct ChainWorkerState < StorageClient >
5353where
5454 StorageClient : Storage + Clone + Send + Sync + ' static ,
5555{
7171{
7272 /// Creates a new [`ChainWorkerState`] using the provided `storage` client.
7373 #[ expect( clippy:: too_many_arguments) ]
74- pub async fn load (
74+ pub ( super ) async fn load (
7575 config : ChainWorkerConfig ,
7676 storage : StorageClient ,
7777 block_values : Arc < ValueCache < CryptoHash , Hashed < Block > > > ,
@@ -98,13 +98,16 @@ where
9898 }
9999
100100 /// Returns the [`ChainId`] of the chain handled by this worker.
101- pub fn chain_id ( & self ) -> ChainId {
101+ fn chain_id ( & self ) -> ChainId {
102102 self . chain . chain_id ( )
103103 }
104104
105105 /// Handles a request and applies it to the chain state.
106106 #[ instrument( skip_all) ]
107- pub async fn handle_request ( & mut self , request : ChainWorkerRequest < StorageClient :: Context > ) {
107+ pub ( super ) async fn handle_request (
108+ & mut self ,
109+ request : ChainWorkerRequest < StorageClient :: Context > ,
110+ ) {
108111 tracing:: trace!( "Handling chain worker request: {request:?}" ) ;
109112 // TODO(#2237): Spawn concurrent tasks for read-only operations
110113 let responded = match request {
@@ -211,7 +214,7 @@ where
211214 ///
212215 /// The returned view holds a lock on the chain state, which prevents the worker from changing
213216 /// it.
214- pub ( super ) async fn chain_state_view (
217+ async fn chain_state_view (
215218 & mut self ,
216219 ) -> Result < OwnedRwLockReadGuard < ChainStateView < StorageClient :: Context > > , WorkerError > {
217220 if self . shared_chain_view . is_none ( ) {
@@ -242,7 +245,7 @@ where
242245
243246 /// Handles a [`ChainInfoQuery`], potentially voting on the next block.
244247 #[ tracing:: instrument( level = "debug" , skip( self ) ) ]
245- pub ( super ) async fn handle_chain_info_query (
248+ async fn handle_chain_info_query (
246249 & mut self ,
247250 query : ChainInfoQuery ,
248251 ) -> Result < ( ChainInfoResponse , NetworkActions ) , WorkerError > {
@@ -264,7 +267,7 @@ where
264267 }
265268
266269 /// Returns the requested blob, if it belongs to the current locking block or pending proposal.
267- pub ( super ) async fn download_pending_blob ( & self , blob_id : BlobId ) -> Result < Blob , WorkerError > {
270+ async fn download_pending_blob ( & self , blob_id : BlobId ) -> Result < Blob , WorkerError > {
268271 if let Some ( blob) = self . chain . manager . pending_blob ( & blob_id) . await ? {
269272 return Ok ( blob) ;
270273 }
@@ -470,7 +473,7 @@ where
470473
471474 /// Returns true if there are no more outgoing messages in flight up to the given
472475 /// block height.
473- pub async fn all_messages_to_tracked_chains_delivered_up_to (
476+ async fn all_messages_to_tracked_chains_delivered_up_to (
474477 & self ,
475478 height : BlockHeight ,
476479 ) -> Result < bool , WorkerError > {
@@ -496,7 +499,7 @@ where
496499 }
497500
498501 /// Processes a leader timeout issued for this multi-owner chain.
499- pub ( super ) async fn process_timeout (
502+ async fn process_timeout (
500503 & mut self ,
501504 certificate : TimeoutCertificate ,
502505 ) -> Result < ( ChainInfoResponse , NetworkActions ) , WorkerError > {
@@ -534,7 +537,7 @@ where
534537 ///
535538 /// If they cannot be found, it creates an entry in `pending_proposed_blobs` so they can be
536539 /// submitted one by one.
537- pub ( super ) async fn load_proposal_blobs (
540+ async fn load_proposal_blobs (
538541 & mut self ,
539542 proposal : & BlockProposal ,
540543 ) -> Result < Vec < Blob > , WorkerError > {
@@ -578,7 +581,7 @@ where
578581 }
579582
580583 /// Processes a validated block issued for this multi-owner chain.
581- pub ( super ) async fn process_validated_block (
584+ async fn process_validated_block (
582585 & mut self ,
583586 certificate : ValidatedBlockCertificate ,
584587 ) -> Result < ( ChainInfoResponse , NetworkActions , bool ) , WorkerError > {
@@ -635,7 +638,7 @@ where
635638 }
636639
637640 /// Processes a confirmed block (aka a commit).
638- pub ( super ) async fn process_confirmed_block (
641+ async fn process_confirmed_block (
639642 & mut self ,
640643 certificate : ConfirmedBlockCertificate ,
641644 notify_when_messages_are_delivered : Option < oneshot:: Sender < ( ) > > ,
@@ -874,7 +877,7 @@ where
874877
875878 /// Updates the chain's inboxes, receiving messages from a cross-chain update.
876879 #[ instrument( level = "trace" , skip( self , bundles) ) ]
877- pub ( super ) async fn process_cross_chain_update (
880+ async fn process_cross_chain_update (
878881 & mut self ,
879882 origin : ChainId ,
880883 bundles : Vec < ( Epoch , MessageBundle ) > ,
@@ -922,7 +925,7 @@ where
922925 }
923926
924927 /// Handles the cross-chain request confirming that the recipient was updated.
925- pub ( super ) async fn confirm_updated_recipient (
928+ async fn confirm_updated_recipient (
926929 & mut self ,
927930 recipient : ChainId ,
928931 latest_height : BlockHeight ,
@@ -944,7 +947,7 @@ where
944947 Ok ( ( ) )
945948 }
946949
947- pub async fn update_received_certificate_trackers (
950+ async fn update_received_certificate_trackers (
948951 & mut self ,
949952 new_trackers : BTreeMap < ValidatorPublicKey , u64 > ,
950953 ) -> Result < ( ) , WorkerError > {
@@ -955,7 +958,7 @@ where
955958 }
956959
957960 /// Attempts to vote for a leader timeout, if possible.
958- pub ( super ) async fn vote_for_leader_timeout (
961+ async fn vote_for_leader_timeout (
959962 & mut self ,
960963 height : BlockHeight ,
961964 round : Round ,
@@ -982,7 +985,7 @@ where
982985 }
983986
984987 /// Votes for falling back to a public chain.
985- pub ( super ) async fn vote_for_fallback ( & mut self ) -> Result < ( ) , WorkerError > {
988+ async fn vote_for_fallback ( & mut self ) -> Result < ( ) , WorkerError > {
986989 let chain = & mut self . chain ;
987990 if let ( epoch, Some ( entry) ) = (
988991 chain. execution_state . system . epoch . get ( ) ,
@@ -1004,10 +1007,7 @@ where
10041007 Ok ( ( ) )
10051008 }
10061009
1007- pub ( super ) async fn handle_pending_blob (
1008- & mut self ,
1009- blob : Blob ,
1010- ) -> Result < ChainInfoResponse , WorkerError > {
1010+ async fn handle_pending_blob ( & mut self , blob : Blob ) -> Result < ChainInfoResponse , WorkerError > {
10111011 let mut was_expected = self
10121012 . chain
10131013 . pending_validated_blobs
@@ -1040,7 +1040,7 @@ where
10401040
10411041 /// Returns a stored [`Certificate`] for the chain's block at the requested [`BlockHeight`].
10421042 #[ cfg( with_testing) ]
1043- pub ( super ) async fn read_certificate (
1043+ async fn read_certificate (
10441044 & mut self ,
10451045 height : BlockHeight ,
10461046 ) -> Result < Option < ConfirmedBlockCertificate > , WorkerError > {
@@ -1058,10 +1058,7 @@ where
10581058 }
10591059
10601060 /// Queries an application's state on the chain.
1061- pub ( super ) async fn query_application (
1062- & mut self ,
1063- query : Query ,
1064- ) -> Result < QueryOutcome , WorkerError > {
1061+ async fn query_application ( & mut self , query : Query ) -> Result < QueryOutcome , WorkerError > {
10651062 self . ensure_is_active ( ) . await ?;
10661063 let local_time = self . storage . clock ( ) . current_time ( ) ;
10671064 let outcome = self
@@ -1072,7 +1069,7 @@ where
10721069 }
10731070
10741071 /// Returns an application's description.
1075- pub ( super ) async fn describe_application (
1072+ async fn describe_application (
10761073 & mut self ,
10771074 application_id : ApplicationId ,
10781075 ) -> Result < ApplicationDescription , WorkerError > {
@@ -1082,7 +1079,7 @@ where
10821079 }
10831080
10841081 /// Executes a block without persisting any changes to the state.
1085- pub ( super ) async fn stage_block_execution (
1082+ async fn stage_block_execution (
10861083 & mut self ,
10871084 block : ProposedBlock ,
10881085 round : Option < u32 > ,
@@ -1114,7 +1111,7 @@ where
11141111 }
11151112
11161113 /// Validates and executes a block proposed to extend this chain.
1117- pub ( super ) async fn handle_block_proposal (
1114+ async fn handle_block_proposal (
11181115 & mut self ,
11191116 proposal : BlockProposal ,
11201117 ) -> Result < ( ChainInfoResponse , NetworkActions ) , WorkerError > {
@@ -1257,7 +1254,7 @@ where
12571254 }
12581255
12591256 /// Prepares a [`ChainInfoResponse`] for a [`ChainInfoQuery`].
1260- pub ( super ) async fn prepare_chain_info_response (
1257+ async fn prepare_chain_info_response (
12611258 & mut self ,
12621259 query : ChainInfoQuery ,
12631260 ) -> Result < ChainInfoResponse , WorkerError > {
@@ -1398,14 +1395,14 @@ fn check_block_epoch(
13981395
13991396/// Helper type for handling cross-chain updates.
14001397pub ( crate ) struct CrossChainUpdateHelper < ' a > {
1401- pub allow_messages_from_deprecated_epochs : bool ,
1402- pub current_epoch : Epoch ,
1403- pub committees : & ' a BTreeMap < Epoch , Committee > ,
1398+ pub ( crate ) allow_messages_from_deprecated_epochs : bool ,
1399+ pub ( crate ) current_epoch : Epoch ,
1400+ pub ( crate ) committees : & ' a BTreeMap < Epoch , Committee > ,
14041401}
14051402
14061403impl < ' a > CrossChainUpdateHelper < ' a > {
14071404 /// Creates a new [`CrossChainUpdateHelper`].
1408- pub fn new < C > ( config : & ChainWorkerConfig , chain : & ' a ChainStateView < C > ) -> Self
1405+ fn new < C > ( config : & ChainWorkerConfig , chain : & ' a ChainStateView < C > ) -> Self
14091406 where
14101407 C : Context + Clone + Send + Sync + ' static ,
14111408 {
@@ -1425,7 +1422,7 @@ impl<'a> CrossChainUpdateHelper<'a> {
14251422 /// * Basic invariants are checked for good measure. We still crucially trust
14261423 /// the worker of the sending chain to have verified and executed the blocks
14271424 /// correctly.
1428- pub fn select_message_bundles (
1425+ pub ( crate ) fn select_message_bundles (
14291426 & self ,
14301427 origin : & ' a ChainId ,
14311428 recipient : ChainId ,
0 commit comments