@@ -126,15 +126,19 @@ where
126126 state : impl StateProvider ,
127127 ) -> Result < BlockBuilderOutcomeWithDiffLayer < BscPrimitives > , BlockExecutionError > {
128128 let finish_start = std:: time:: Instant :: now ( ) ;
129+ let executor_finish_started = std:: time:: Instant :: now ( ) ;
129130 let ( evm, result) = self . executor . finish ( ) ?;
130131 let ( db, evm_env) = evm. finish ( ) ;
132+ let executor_finish_us = executor_finish_started. elapsed ( ) . as_micros ( ) ;
131133
132134 let assembled_system_txs = {
133135 let mut inner = self . shared_ctx . inner . borrow_mut ( ) ;
134136 std:: mem:: take ( & mut inner. assembled_system_txs )
135137 } ;
136138 // merge all transitions into bundle state
139+ let merge_transitions_started = std:: time:: Instant :: now ( ) ;
137140 db. merge_transitions ( BundleRetention :: Reverts ) ;
141+ let merge_transitions_us = merge_transitions_started. elapsed ( ) . as_micros ( ) ;
138142
139143 let state_root_start = std:: time:: Instant :: now ( ) ;
140144 let hashed_state = state. hashed_post_state ( & db. bundle_state ) ;
@@ -191,8 +195,10 @@ where
191195 self . transactions . extend ( assembled_system_txs) ;
192196 let total_tx_len = self . transactions . len ( ) ;
193197
198+ let tx_into_parts_started = std:: time:: Instant :: now ( ) ;
194199 let ( transactions, senders) : ( Vec < _ > , Vec < _ > ) =
195200 self . transactions . into_iter ( ) . map ( |tx| tx. into_parts ( ) ) . unzip ( ) ;
201+ let tx_into_parts_us = tx_into_parts_started. elapsed ( ) . as_micros ( ) ;
196202
197203 // Extract sinks from ctx before it is moved into BscBlockAssemblerInput.
198204 let validator_cache_sink = self . ctx . validator_cache_sink . take ( ) ;
@@ -244,6 +250,20 @@ where
244250 assemble_duration_ms = assemble_duration. as_millis( ) ,
245251 "Assembled block body (pre-finalize)"
246252 ) ;
253+ tracing:: debug!(
254+ target: "bsc::builder::finish" ,
255+ block_number = block. header. number,
256+ user_tx_count = user_tx_len,
257+ system_tx_count = system_tx_len,
258+ total_tx_count = total_tx_len,
259+ executor_finish_us,
260+ merge_transitions_us,
261+ state_root_us = state_root_duration. as_micros( ) ,
262+ tx_into_parts_us,
263+ assemble_us = assemble_duration. as_micros( ) ,
264+ finish_total_us = finish_duration. as_micros( ) ,
265+ "finish breakdown"
266+ ) ;
247267
248268 let block = RecoveredBlock :: new_unhashed ( block, senders) ;
249269 Ok ( BlockBuilderOutcomeWithDiffLayer {
0 commit comments