@@ -92,7 +92,7 @@ use std::sync::Arc;
9292use store:: { Error as DBError , KeyValueStore } ;
9393use strum:: AsRefStr ;
9494use task_executor:: JoinHandle ;
95- use tracing:: { debug, error, info_span, instrument, span } ;
95+ use tracing:: { debug, debug_span , error, info_span, instrument} ;
9696use types:: {
9797 data_column_sidecar:: DataColumnSidecarError , BeaconBlockRef , BeaconState , BeaconStateError ,
9898 BlobsList , ChainSpec , DataColumnSidecarList , Epoch , EthSpec , ExecutionBlockHash , FullPayload ,
@@ -827,6 +827,9 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
827827 block : Arc < SignedBeaconBlock < T :: EthSpec > > ,
828828 chain : & BeaconChain < T > ,
829829 ) -> Result < Self , BlockError > {
830+ let span = debug_span ! ( "GossipVerifiedBlock::new" , block_root = "" ) ;
831+ let _guard = span. enter ( ) ;
832+
830833 // If the block is valid for gossip we don't supply it to the slasher here because
831834 // we assume it will be transformed into a fully verified block. We *do* need to supply
832835 // it to the slasher if an error occurs, because that's the end of this block's journey,
@@ -835,12 +838,16 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
835838 // The `SignedBeaconBlock` and `SignedBeaconBlockHeader` have the same canonical root,
836839 // but it's way quicker to calculate root of the header since the hash of the tree rooted
837840 // at `BeaconBlockBody` is already computed in the header.
838- Self :: new_without_slasher_checks ( block, & header, chain) . map_err ( |e| {
839- process_block_slash_info :: < _ , BlockError > (
840- chain,
841- BlockSlashInfo :: from_early_error_block ( header, e) ,
842- )
843- } )
841+ Self :: new_without_slasher_checks ( block, & header, chain)
842+ . map_err ( |e| {
843+ process_block_slash_info :: < _ , BlockError > (
844+ chain,
845+ BlockSlashInfo :: from_early_error_block ( header, e) ,
846+ )
847+ } )
848+ . inspect ( |block| {
849+ span. record ( "block_root" , block. block_root . to_string ( ) ) ;
850+ } )
844851 }
845852
846853 /// As for new, but doesn't pass the block to the slasher.
@@ -1185,6 +1192,7 @@ impl<T: BeaconChainTypes> SignatureVerifiedBlock<T> {
11851192
11861193 /// Finishes signature verification on the provided `GossipVerifedBlock`. Does not re-verify
11871194 /// the proposer signature.
1195+ #[ instrument( skip_all, fields( block_root = %from. block_root) ) ]
11881196 pub fn from_gossip_verified_block (
11891197 from : GossipVerifiedBlock < T > ,
11901198 chain : & BeaconChain < T > ,
@@ -1212,20 +1220,28 @@ impl<T: BeaconChainTypes> SignatureVerifiedBlock<T> {
12121220 signature_verifier
12131221 . include_all_signatures_except_proposal ( block. as_ref ( ) , & mut consensus_context) ?;
12141222
1215- if signature_verifier. verify ( ) . is_ok ( ) {
1216- Ok ( Self {
1217- block : MaybeAvailableBlock :: AvailabilityPending {
1223+ let sig_verify_span = info_span ! ( "signature_verify" , result = "started" ) ;
1224+ let _guard = sig_verify_span. enter ( ) ;
1225+ let result = signature_verifier. verify ( ) ;
1226+ match result {
1227+ Ok ( _) => {
1228+ sig_verify_span. record ( "result" , & "ok" ) ;
1229+ Ok ( Self {
1230+ block : MaybeAvailableBlock :: AvailabilityPending {
1231+ block_root : from. block_root ,
1232+ block,
1233+ } ,
12181234 block_root : from. block_root ,
1219- block ,
1220- } ,
1221- block_root : from . block_root ,
1222- parent : Some ( parent ) ,
1223- consensus_context ,
1224- } )
1225- } else {
1226- Err ( BlockError :: InvalidSignature (
1227- InvalidSignature :: BlockBodySignatures ,
1228- ) )
1235+ parent : Some ( parent ) ,
1236+ consensus_context ,
1237+ } )
1238+ }
1239+ Err ( _ ) => {
1240+ sig_verify_span . record ( "result" , & "fail" ) ;
1241+ Err ( BlockError :: InvalidSignature (
1242+ InvalidSignature :: BlockBodySignatures ,
1243+ ) )
1244+ }
12291245 }
12301246 }
12311247
@@ -2035,6 +2051,7 @@ impl BlockBlobError for GossipDataColumnError {
20352051/// and `Cow::Borrowed(state)` will be returned. Otherwise, the state will be cloned, cheaply
20362052/// advanced and then returned as a `Cow::Owned`. The end result is that the given `state` is never
20372053/// mutated to be invalid (in fact, it is never changed beyond a simple committee cache build).
2054+ #[ instrument( skip( state, spec) ) ]
20382055pub fn cheap_state_advance_to_obtain_committees < ' a , E : EthSpec , Err : BlockBlobError > (
20392056 state : & ' a mut BeaconState < E > ,
20402057 state_root_opt : Option < Hash256 > ,
@@ -2069,6 +2086,7 @@ pub fn cheap_state_advance_to_obtain_committees<'a, E: EthSpec, Err: BlockBlobEr
20692086}
20702087
20712088/// Obtains a read-locked `ValidatorPubkeyCache` from the `chain`.
2089+ #[ instrument( skip( chain) , level = "debug" ) ]
20722090pub fn get_validator_pubkey_cache < T : BeaconChainTypes > (
20732091 chain : & BeaconChain < T > ,
20742092) -> Result < RwLockReadGuard < ' _ , ValidatorPubkeyCache < T > > , BeaconChainError > {
0 commit comments