@@ -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 ;
@@ -532,6 +532,9 @@ where
532532 . read_roots ( ForestDB :: InitialReadContext :: create_empty ( ) )
533533 . await
534534 . map_err ( |e| self . map_internal_error ( e) ) ?;
535+ let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
536+ let pre_global_root = HashOutput ( pre_roots. global_root ( ) . 0 ) ;
537+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( pre_global_root) ) ;
535538 let mut patricia_proofs = self
536539 . forest_storage
537540 . fetch_patricia_witnesses (
@@ -547,8 +550,13 @@ where
547550 height,
548551 message : format ! ( "pre-commit witness paths: {e:?}" ) ,
549552 } ) ?;
553+ block_measurements
554+ . attempt_to_stop_measurement (
555+ Action :: FetchPatriciaPaths ( pre_global_root) ,
556+ patricia_proofs. len ( ) ,
557+ )
558+ . ok ( ) ;
550559
551- let mut block_measurements = SingleBlockMeasurements :: default ( ) ;
552560 block_measurements. start_measurement ( Action :: EndToEnd ) ;
553561 let CommitStateDiffOutput { filled_forest, global_root, deleted_nodes } =
554562 self . commit_state_diff ( state_diff, & mut block_measurements) . await ?;
@@ -557,6 +565,8 @@ where
557565 let forest_updates = ForestDB :: serialize_forest ( & filled_forest)
558566 . map_err ( |e| self . map_internal_error ( e) ) ?;
559567
568+ let post_global_root = HashOutput ( post_roots. global_root ( ) . 0 ) ;
569+ block_measurements. start_measurement ( Action :: FetchPatriciaPaths ( post_global_root) ) ;
560570 let proof_after = self
561571 . forest_storage
562572 . fetch_patricia_witnesses (
@@ -572,15 +582,23 @@ where
572582 height,
573583 message : format ! ( "post-commit witness paths: {e:?}" ) ,
574584 } ) ?;
585+ block_measurements
586+ . attempt_to_stop_measurement (
587+ Action :: FetchPatriciaPaths ( post_global_root) ,
588+ proof_after. len ( ) ,
589+ )
590+ . ok ( ) ;
575591
576592 patricia_proofs. extend ( proof_after) ;
577593
578594 let ( metadata, next_offset) =
579595 commit_tip_metadata_bundle ( height, global_root, state_diff_commitment) ;
580596 info ! (
581- "For block number {height}, writing filled forest and witnesses to storage \
582- with metadata: {metadata:?}, delete {} nodes",
583- deleted_nodes. len( )
597+ "For block number {height}, writing filled forest and {witness_count} \
598+ witnesses to storage with metadata: {metadata:?}, delete \
599+ {deleted_nodes_count} nodes",
600+ witness_count = patricia_proofs. len( ) ,
601+ deleted_nodes_count = deleted_nodes. len( ) ,
584602 ) ;
585603 block_measurements. start_measurement ( Action :: Write ) ;
586604 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