@@ -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 ;
@@ -552,6 +552,9 @@ where
552552 . read_roots ( ForestDB :: InitialReadContext :: create_empty ( ) )
553553 . await
554554 . map_err ( |e| self . map_internal_error ( e) ) ?;
555+ let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
556+ let pre_global_root = HashOutput ( pre_roots. global_root ( ) . 0 ) ;
557+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( pre_global_root) ) ;
555558 let mut patricia_proofs = self
556559 . forest_storage
557560 . fetch_patricia_witnesses (
@@ -567,8 +570,13 @@ where
567570 height,
568571 message : format ! ( "pre-commit witness paths: {e:?}" ) ,
569572 } ) ?;
573+ block_measurements
574+ . attempt_to_stop_measurement (
575+ Action :: FetchPatriciaPaths ( pre_global_root) ,
576+ patricia_proofs. len ( ) ,
577+ )
578+ . ok ( ) ;
570579
571- let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
572580 block_measurements. start_measurement ( Action :: EndToEnd ) ;
573581 let CommitStateDiffOutput { filled_forest, global_root, deleted_nodes } =
574582 self . commit_state_diff ( state_diff, & mut block_measurements) . await ?;
@@ -577,6 +585,8 @@ where
577585 let forest_updates = ForestDB :: serialize_forest ( & filled_forest)
578586 . map_err ( |e| self . map_internal_error ( e) ) ?;
579587
588+ let post_global_root = HashOutput ( post_roots. global_root ( ) . 0 ) ;
589+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( post_global_root) ) ;
580590 let proof_after = self
581591 . forest_storage
582592 . fetch_patricia_witnesses (
@@ -592,15 +602,23 @@ where
592602 height,
593603 message : format ! ( "post-commit witness paths: {e:?}" ) ,
594604 } ) ?;
605+ block_measurements
606+ . attempt_to_stop_measurement (
607+ Action :: FetchPatriciaPaths ( post_global_root) ,
608+ proof_after. len ( ) ,
609+ )
610+ . ok ( ) ;
595611
596612 patricia_proofs. extend ( proof_after) ;
597613
598614 let ( metadata, next_offset) =
599615 commit_tip_metadata_bundle ( height, global_root, state_diff_commitment) ;
600616 info ! (
601- "For block number {height}, writing filled forest and witnesses to storage \
602- with metadata: {metadata:?}, delete {} nodes",
603- deleted_nodes. len( )
617+ "For block number {height}, writing filled forest and {witness_count} \
618+ witnesses to storage with metadata: {metadata:?}, delete \
619+ {deleted_nodes_count} nodes",
620+ witness_count = patricia_proofs. len( ) ,
621+ deleted_nodes_count = deleted_nodes. len( ) ,
604622 ) ;
605623 block_measurements. start_measurement ( Action :: Write ) ;
606624 let n_write_entries = self
@@ -638,7 +656,7 @@ impl ComponentStarter for ApolloCommitter {
638656#[ allow( clippy:: as_conversions) ]
639657fn update_metrics (
640658 height : BlockNumber ,
641- BlockMeasurement { n_reads, n_writes, durations, modifications_counts } : & BlockMeasurement ,
659+ BlockMeasurement { n_reads, n_writes, durations, modifications_counts, .. } : & BlockMeasurement ,
642660) {
643661 BLOCKS_COMMITTED . increment ( 1 ) ;
644662 TOTAL_BLOCK_DURATION . increment ( ( durations. block * 1000.0 ) as u64 ) ;
0 commit comments