@@ -35,6 +35,7 @@ use linera_views::{
3535    views:: { ClonableView ,  CryptoHashView ,  RootView ,  View } , 
3636} ; 
3737use  serde:: { Deserialize ,  Serialize } ; 
38+ use  tracing:: instrument; 
3839
3940use  crate :: { 
4041    block:: { Block ,  ConfirmedBlock } , 
@@ -309,6 +310,7 @@ pub struct ChainTipState {
309310impl  ChainTipState  { 
310311    /// Checks that the proposed block is suitable, i.e. at the expected height and with the 
311312/// expected parent. 
313+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
312314    pub  fn  verify_block_chaining ( & self ,  new_block :  & ProposedBlock )  -> Result < ( ) ,  ChainError >  { 
313315        ensure ! ( 
314316            new_block. height == self . next_block_height, 
@@ -326,6 +328,7 @@ impl ChainTipState {
326328
327329    /// Returns `true` if the validated block's height is below the tip height. Returns an error if 
328330/// it is higher than the tip. 
331+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
329332    pub  fn  already_validated_block ( & self ,  height :  BlockHeight )  -> Result < bool ,  ChainError >  { 
330333        ensure ! ( 
331334            self . next_block_height >= height, 
@@ -337,6 +340,7 @@ impl ChainTipState {
337340    } 
338341
339342    /// Checks if the measurement counters would be valid. 
343+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
340344    pub  fn  update_counters ( 
341345        & mut  self , 
342346        transactions :  & [ Transaction ] , 
@@ -391,6 +395,7 @@ where
391395        self . context ( ) . extra ( ) . chain_id ( ) 
392396    } 
393397
398+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
394399    pub  async  fn  query_application ( 
395400        & mut  self , 
396401        local_time :  Timestamp , 
@@ -408,6 +413,7 @@ where
408413            . with_execution_context ( ChainExecutionContext :: Query ) 
409414    } 
410415
416+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
411417    pub  async  fn  describe_application ( 
412418        & mut  self , 
413419        application_id :  ApplicationId , 
@@ -419,6 +425,7 @@ where
419425            . with_execution_context ( ChainExecutionContext :: DescribeApplication ) 
420426    } 
421427
428+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
422429    pub  async  fn  mark_messages_as_received ( 
423430        & mut  self , 
424431        target :  & ChainId , 
@@ -459,6 +466,7 @@ where
459466
460467    /// Returns true if there are no more outgoing messages in flight up to the given 
461468/// block height. 
469+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
462470    pub  fn  all_messages_delivered_up_to ( & self ,  height :  BlockHeight )  -> bool  { 
463471        tracing:: debug!( 
464472            "Messages left in {:.8}'s outbox: {:?}" , 
@@ -478,6 +486,7 @@ where
478486    } 
479487
480488    /// Invariant for the states of active chains. 
489+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
481490    pub  async  fn  ensure_is_active ( & mut  self ,  local_time :  Timestamp )  -> Result < ( ) ,  ChainError >  { 
482491        // Initialize ourselves. 
483492        if  self 
@@ -506,6 +515,7 @@ where
506515
507516    /// Verifies that this chain is up-to-date and all the messages executed ahead of time 
508517/// have been properly received by now. 
518+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
509519    pub  async  fn  validate_incoming_bundles ( & self )  -> Result < ( ) ,  ChainError >  { 
510520        let  chain_id = self . chain_id ( ) ; 
511521        let  pairs = self . inboxes . try_load_all_entries ( ) . await ?; 
@@ -526,6 +536,7 @@ where
526536        Ok ( ( ) ) 
527537    } 
528538
539+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
529540    pub  async  fn  next_block_height_to_receive ( 
530541        & self , 
531542        origin :  & ChainId , 
@@ -540,13 +551,15 @@ where
540551    /// Returns the height of the highest block we have, plus one. Includes preprocessed blocks. 
541552/// 
542553/// The "+ 1" is so that it can be used in the same places as `next_block_height`. 
554+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
543555    pub  async  fn  next_height_to_preprocess ( & self )  -> Result < BlockHeight ,  ChainError >  { 
544556        if  let  Some ( height)  = self . preprocessed_blocks . indices ( ) . await ?. last ( )  { 
545557            return  Ok ( height. saturating_add ( BlockHeight ( 1 ) ) ) ; 
546558        } 
547559        Ok ( self . tip_state . get ( ) . next_block_height ) 
548560    } 
549561
562+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
550563    pub  async  fn  last_anticipated_block_height ( 
551564        & self , 
552565        origin :  & ChainId , 
@@ -567,6 +580,7 @@ where
567580/// round timeouts. 
568581/// 
569582/// Returns `true` if incoming `Subscribe` messages created new outbox entries. 
583+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
570584    pub  async  fn  receive_message_bundle ( 
571585        & mut  self , 
572586        origin :  & ChainId , 
@@ -630,6 +644,7 @@ where
630644    } 
631645
632646    /// Updates the `received_log` trackers. 
647+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
633648    pub  fn  update_received_certificate_trackers ( 
634649        & mut  self , 
635650        new_trackers :  BTreeMap < ValidatorPublicKey ,  u64 > , 
@@ -649,6 +664,7 @@ where
649664        } 
650665    } 
651666
667+     #[ instrument( target = "telemetry_only" ,  skip_all) ]  
652668    pub  fn  current_committee ( & self )  -> Result < ( Epoch ,  & Committee ) ,  ChainError >  { 
653669        self . execution_state 
654670            . system 
@@ -661,6 +677,7 @@ where
661677    } 
662678
663679    /// Removes the incoming message bundles in the block from the inboxes. 
680+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
664681    pub  async  fn  remove_bundles_from_inboxes ( 
665682        & mut  self , 
666683        timestamp :  Timestamp , 
@@ -739,6 +756,7 @@ where
739756    } 
740757
741758    /// Returns the outboxes for the given targets, or an error if any of them are missing. 
759+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
742760    pub  async  fn  load_outboxes ( 
743761        & self , 
744762        targets :  & [ ChainId ] , 
@@ -750,6 +768,7 @@ where
750768
751769    /// Executes a block: first the incoming messages, then the main operation. 
752770/// Does not update chain state other than the execution state. 
771+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
753772    #[ expect( clippy:: too_many_arguments) ]  
754773    async  fn  execute_block_inner ( 
755774        chain :  & mut  ExecutionStateView < C > , 
@@ -859,6 +878,7 @@ where
859878
860879    /// Executes a block: first the incoming messages, then the main operation. 
861880/// Does not update chain state other than the execution state. 
881+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
862882    pub  async  fn  execute_block ( 
863883        & mut  self , 
864884        block :  & ProposedBlock , 
@@ -919,6 +939,7 @@ where
919939    /// Applies an execution outcome to the chain, updating the outboxes, state hash and chain 
920940/// manager. This does not touch the execution state itself, which must be updated separately. 
921941/// Returns the set of event streams that were updated as a result of applying the block. 
942+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
922943    pub  async  fn  apply_confirmed_block ( 
923944        & mut  self , 
924945        block :  & ConfirmedBlock , 
@@ -953,6 +974,7 @@ where
953974
954975    /// Adds a block to `preprocessed_blocks`, and updates the outboxes where possible. 
955976/// Returns the set of streams that were updated as a result of preprocessing the block. 
977+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
956978    pub  async  fn  preprocess_block ( 
957979        & mut  self , 
958980        block :  & ConfirmedBlock , 
@@ -979,6 +1001,7 @@ where
9791001    } 
9801002
9811003    /// Verifies that the block is valid according to the chain's application permission settings. 
1004+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
9821005    fn  check_app_permissions ( 
9831006        app_permissions :  & ApplicationPermissions , 
9841007        block :  & ProposedBlock , 
@@ -1021,6 +1044,7 @@ where
10211044    } 
10221045
10231046    /// Returns the hashes of all blocks we have in the given range. 
1047+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
10241048    pub  async  fn  block_hashes ( 
10251049        & self , 
10261050        range :  impl  RangeBounds < BlockHeight > , 
@@ -1066,6 +1090,7 @@ where
10661090    /// Updates the outboxes with the messages sent in the block. 
10671091/// 
10681092/// Returns the set of all recipients. 
1093+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
10691094    async  fn  process_outgoing_messages ( 
10701095        & mut  self , 
10711096        block :  & Block , 
@@ -1157,6 +1182,7 @@ where
11571182    /// Updates the event streams with events emitted by the block if they form a contiguous 
11581183/// sequence (might not be the case when preprocessing a block). 
11591184/// Returns the set of updated event streams. 
1185+ #[ instrument( target = "telemetry_only" ,  skip_all) ]  
11601186    async  fn  process_emitted_events ( 
11611187        & mut  self , 
11621188        block :  & Block , 
0 commit comments