@@ -21,7 +21,7 @@ use async_trait::async_trait;
2121use starknet_api:: block:: BlockNumber ;
2222use starknet_api:: block_hash:: state_diff_hash:: calculate_state_diff_hash;
2323use starknet_api:: core:: { GlobalRoot , StateDiffCommitment } ;
24- use starknet_api:: hash:: PoseidonHash ;
24+ use starknet_api:: hash:: { HashOutput , PoseidonHash } ;
2525use starknet_api:: state:: ThinStateDiff ;
2626use starknet_committer:: block_committer:: commit:: commit_block;
2727use starknet_committer:: block_committer:: input:: Input ;
@@ -540,6 +540,9 @@ where
540540 . read_roots ( ForestDB :: InitialReadContext :: create_empty ( ) )
541541 . await
542542 . map_err ( |e| self . map_internal_error ( e) ) ?;
543+ let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
544+ let pre_global_root = HashOutput ( pre_roots. global_root ( ) . 0 ) ;
545+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( pre_global_root) ) ;
543546 let mut patricia_proofs = self
544547 . forest_storage
545548 . fetch_patricia_witnesses (
@@ -555,8 +558,13 @@ where
555558 height,
556559 message : format ! ( "pre-commit witness paths: {e:?}" ) ,
557560 } ) ?;
561+ block_measurements
562+ . attempt_to_stop_measurement (
563+ Action :: FetchPatriciaPaths ( pre_global_root) ,
564+ patricia_proofs. len ( ) ,
565+ )
566+ . ok ( ) ;
558567
559- let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
560568 block_measurements. start_measurement ( Action :: EndToEnd ) ;
561569 let CommitStateDiffOutput { filled_forest, global_root, deleted_nodes } =
562570 self . commit_state_diff ( state_diff, & mut block_measurements) . await ?;
@@ -565,6 +573,8 @@ where
565573 let forest_updates = ForestDB :: serialize_forest ( & filled_forest)
566574 . map_err ( |e| self . map_internal_error ( e) ) ?;
567575
576+ let post_global_root = HashOutput ( post_roots. global_root ( ) . 0 ) ;
577+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( post_global_root) ) ;
568578 let proof_after = self
569579 . forest_storage
570580 . fetch_patricia_witnesses (
@@ -580,23 +590,24 @@ where
580590 height,
581591 message : format ! ( "post-commit witness paths: {e:?}" ) ,
582592 } ) ?;
593+ block_measurements
594+ . attempt_to_stop_measurement (
595+ Action :: FetchPatriciaPaths ( post_global_root) ,
596+ proof_after. len ( ) ,
597+ )
598+ . ok ( ) ;
583599
584600 patricia_proofs. extend ( proof_after) ;
585601
586602 let ( metadata, next_offset) =
587603 commit_tip_metadata_bundle ( height, global_root, state_diff_commitment) ;
588- let witness_node_count = patricia_proofs. classes_trie_proof . len ( )
589- + patricia_proofs. contracts_trie_proof . nodes . len ( )
590- + patricia_proofs. contracts_trie_proof . leaves . len ( )
591- + patricia_proofs
592- . contracts_trie_storage_proofs
593- . values ( )
594- . map ( |proof| proof. len ( ) )
595- . sum :: < usize > ( ) ;
604+
596605 info ! (
597- "For block number {height}, writing filled forest and {witness_node_count} \
598- witness nodes to storage with metadata: {metadata:?}, delete {} nodes",
599- deleted_nodes. len( )
606+ "For block number {height}, writing filled forest and {witness_count} \
607+ witnesses to storage with metadata: {metadata:?}, delete \
608+ {deleted_nodes_count} nodes",
609+ witness_count = patricia_proofs. len( ) ,
610+ deleted_nodes_count = deleted_nodes. len( ) ,
600611 ) ;
601612 block_measurements. start_measurement ( Action :: Write ) ;
602613 let n_write_entries = self
@@ -657,7 +668,7 @@ impl ComponentStarter for ApolloCommitter {
657668#[ allow( clippy:: as_conversions) ]
658669fn update_metrics (
659670 height : BlockNumber ,
660- BlockMeasurement { n_reads, n_writes, durations, modifications_counts } : & BlockMeasurement ,
671+ BlockMeasurement { n_reads, n_writes, durations, modifications_counts, .. } : & BlockMeasurement ,
661672) {
662673 BLOCKS_COMMITTED . increment ( 1 ) ;
663674 TOTAL_BLOCK_DURATION . increment ( ( durations. block * 1000.0 ) as u64 ) ;
0 commit comments