@@ -295,12 +295,7 @@ impl<
295295 {
296296 let block_info: L2BlockInfoWithL1Messages = ( & block) . into ( ) ;
297297 self . database
298- . tx_mut ( move |tx| {
299- let block_info = block_info. clone ( ) ;
300- async move {
301- tx. update_l1_messages_from_l2_blocks ( vec ! [ block_info. clone( ) ] ) . await
302- }
303- } )
298+ . update_l1_messages_from_l2_blocks ( vec ! [ block_info. clone( ) ] )
304299 . await ?;
305300 self . signer
306301 . as_mut ( )
@@ -334,7 +329,7 @@ impl<
334329 ChainOrchestratorCommand :: Status ( tx) => {
335330 let ( l1_latest, l1_finalized, l1_processed) = self
336331 . database
337- . tx_mut ( |tx| async move {
332+ . tx ( |tx| async move {
338333 let l1_latest = tx. get_latest_l1_block_number ( ) . await ?;
339334 let l1_finalized = tx. get_finalized_l1_block_number ( ) . await ?;
340335 let l1_processed = tx. get_processed_l1_block_number ( ) . await ?;
@@ -491,12 +486,7 @@ impl<
491486
492487 // Insert the batch consolidation outcome into the database.
493488 let consolidation_outcome = batch_consolidation_outcome. clone ( ) ;
494- self . database
495- . tx_mut ( move |tx| {
496- let consolidation_outcome = consolidation_outcome. clone ( ) ;
497- async move { tx. insert_batch_consolidation_outcome ( consolidation_outcome) . await }
498- } )
499- . await ?;
489+ self . database . insert_batch_consolidation_outcome ( consolidation_outcome) . await ?;
500490
501491 Ok ( Some ( ChainOrchestratorEvent :: BatchConsolidated ( batch_consolidation_outcome) ) )
502492 }
@@ -509,11 +499,7 @@ impl<
509499 match & * notification {
510500 L1Notification :: Processed ( block_number) => {
511501 let block_number = * block_number;
512- self . database
513- . tx_mut ( move |tx| async move {
514- tx. set_processed_l1_block_number ( block_number) . await
515- } )
516- . await ?;
502+ self . database . set_processed_l1_block_number ( block_number) . await ?;
517503 Ok ( None )
518504 }
519505 L1Notification :: Reorg ( block_number) => self . handle_l1_reorg ( * block_number) . await ,
@@ -548,10 +534,7 @@ impl<
548534 & self ,
549535 block_number : u64 ,
550536 ) -> Result < Option < ChainOrchestratorEvent > , ChainOrchestratorError > {
551- self . database
552- . tx_mut ( move |tx| async move { tx. set_latest_l1_block_number ( block_number) . await } )
553- . await ?;
554-
537+ self . database . set_latest_l1_block_number ( block_number) . await ?;
555538 Ok ( Some ( ChainOrchestratorEvent :: NewL1Block ( block_number) ) )
556539 }
557540
@@ -565,9 +548,7 @@ impl<
565548 let now = Instant :: now ( ) ;
566549 let genesis_hash = self . config . chain_spec ( ) . genesis_hash ( ) ;
567550 let UnwindResult { l1_block_number, queue_index, l2_head_block_number, l2_safe_block_info } =
568- self . database
569- . tx_mut ( move |tx| async move { tx. unwind ( genesis_hash, block_number) . await } )
570- . await ?;
551+ self . database . unwind ( genesis_hash, block_number) . await ?;
571552
572553 let l2_head_block_info = if let Some ( block_number) = l2_head_block_number {
573554 // Fetch the block hash of the new L2 head block.
@@ -840,11 +821,7 @@ impl<
840821
841822 // We optimistically persist the signature upon passing consensus checks.
842823 let block_hash = block_with_peer. block . header . hash_slow ( ) ;
843- self . database
844- . tx_mut ( move |tx| async move {
845- tx. insert_signature ( block_hash, block_with_peer. signature ) . await
846- } )
847- . await ?;
824+ self . database . insert_signature ( block_hash, block_with_peer. signature ) . await ?;
848825
849826 let received_block_number = block_with_peer. block . number ;
850827 let received_block_hash = block_with_peer. block . header . hash_slow ( ) ;
@@ -867,9 +844,7 @@ impl<
867844
868845 // Purge all L1 message to L2 block mappings as they may be invalid after an
869846 // optimistic sync.
870- self . database
871- . tx_mut ( |tx| async move { tx. purge_l1_message_to_l2_block_mappings ( None ) . await } )
872- . await ?;
847+ self . database . purge_l1_message_to_l2_block_mappings ( None ) . await ?;
873848
874849 return Ok ( Some ( ChainOrchestratorEvent :: OptimisticSync ( block_info) ) ) ;
875850 }
@@ -1151,15 +1126,9 @@ impl<
11511126 self . validate_l1_messages ( & blocks_to_validate) . await ?;
11521127
11531128 self . database
1154- . tx_mut ( move |tx| {
1155- let blocks_to_validate = blocks_to_validate. clone ( ) ;
1156- async move {
1157- tx. update_l1_messages_from_l2_blocks (
1158- blocks_to_validate. into_iter ( ) . map ( |b| ( & b) . into ( ) ) . collect ( ) ,
1159- )
1160- . await
1161- }
1162- } )
1129+ . update_l1_messages_from_l2_blocks (
1130+ blocks_to_validate. into_iter ( ) . map ( |b| ( & b) . into ( ) ) . collect ( ) ,
1131+ )
11631132 . await ?;
11641133
11651134 self . notify ( ChainOrchestratorEvent :: ChainConsolidated {
@@ -1200,10 +1169,7 @@ impl<
12001169 let count = l1_message_hashes. len ( ) ;
12011170 let mut database_messages = self
12021171 . database
1203- . tx ( move |tx| async move {
1204- tx. get_n_l1_messages ( Some ( L1MessageKey :: block_number ( first_block_number) ) , count)
1205- . await
1206- } )
1172+ . get_n_l1_messages ( Some ( L1MessageKey :: block_number ( first_block_number) ) , count)
12071173 . await ?
12081174 . into_iter ( ) ;
12091175
@@ -1257,9 +1223,7 @@ async fn compute_l1_message_queue_hash(
12571223 } else if l1_message. queue_index > l1_v2_message_queue_start_index {
12581224 let index = l1_message. queue_index - 1 ;
12591225 let mut input = database
1260- . tx ( move |tx| async move {
1261- tx. get_n_l1_messages ( Some ( L1MessageKey :: from_queue_index ( index) ) , 1 ) . await
1262- } )
1226+ . get_n_l1_messages ( Some ( L1MessageKey :: from_queue_index ( index) ) , 1 )
12631227 . await ?
12641228 . first ( )
12651229 . map ( |m| m. queue_hash )
0 commit comments