@@ -51,7 +51,12 @@ use tracing::{debug, error, info, trace, warn};
5151
5252use crate :: block_builder:: FailOnErrorCause :: L1HandlerTransactionValidationFailed ;
5353use crate :: cende_client_types:: { StarknetClientStateDiff , StarknetClientTransactionReceipt } ;
54- use crate :: metrics:: { PROPOSER_DEFERRED_TXS , VALIDATOR_WASTED_TXS } ;
54+ use crate :: metrics:: {
55+ record_block_close_reason,
56+ BlockCloseReason ,
57+ PROPOSER_DEFERRED_TXS ,
58+ VALIDATOR_WASTED_TXS ,
59+ } ;
5560use crate :: pre_confirmed_block_writer:: { CandidateTxSender , PreconfirmedTxSender } ;
5661use crate :: transaction_executor:: TransactionExecutorTrait ;
5762use crate :: transaction_provider:: { TransactionProvider , TransactionProviderError } ;
@@ -244,14 +249,7 @@ impl BlockBuilder {
244249 if self . execution_params . is_validator {
245250 return Err ( BlockBuilderError :: FailOnError ( FailOnErrorCause :: DeadlineReached ) ) ;
246251 }
247- // TODO(Dan): extract to a function (as in record_validate_proposal_failure).
248- crate :: metrics:: BLOCK_CLOSE_REASON . increment (
249- 1 ,
250- & [ (
251- crate :: metrics:: LABEL_NAME_BLOCK_CLOSE_REASON ,
252- crate :: metrics:: BlockCloseReason :: Deadline . into ( ) ,
253- ) ] ,
254- ) ;
252+ record_block_close_reason ( BlockCloseReason :: Deadline ) ;
255253 break ;
256254 }
257255
@@ -263,14 +261,7 @@ impl BlockBuilder {
263261 started (timeout is set to {:?}), finishing block building.",
264262 time_since_start, self . execution_params. proposer_idle_detection_delay,
265263 ) ;
266- // TODO(Dan): extract to a function (as in record_validate_proposal_failure).
267- crate :: metrics:: BLOCK_CLOSE_REASON . increment (
268- 1 ,
269- & [ (
270- crate :: metrics:: LABEL_NAME_BLOCK_CLOSE_REASON ,
271- crate :: metrics:: BlockCloseReason :: IdleExecutionTimeout . into ( ) ,
272- ) ] ,
273- ) ;
264+ record_block_close_reason ( BlockCloseReason :: IdleExecutionTimeout ) ;
274265 break ;
275266 }
276267 if final_n_executed_txs. is_none ( ) {
@@ -293,14 +284,7 @@ impl BlockBuilder {
293284 // Call `handle_executed_txs()` once more to get the last results.
294285 self . handle_executed_txs ( ) . await ?;
295286 info ! ( "Block is full." ) ;
296- // TODO(Dan): extract to a function (as in record_validate_proposal_failure).
297- crate :: metrics:: BLOCK_CLOSE_REASON . increment (
298- 1 ,
299- & [ (
300- crate :: metrics:: LABEL_NAME_BLOCK_CLOSE_REASON ,
301- crate :: metrics:: BlockCloseReason :: FullBlock . into ( ) ,
302- ) ] ,
303- ) ;
287+ record_block_close_reason ( BlockCloseReason :: FullBlock ) ;
304288 break ;
305289 }
306290
0 commit comments