@@ -19,7 +19,7 @@ use scroll_alloy_hardforks::ScrollHardforks;
1919use scroll_alloy_network:: Scroll ;
2020use scroll_db:: {
2121 Database , DatabaseError , DatabaseReadOperations , DatabaseTransactionProvider ,
22- DatabaseWriteOperations , L1MessageStart , UnwindResult ,
22+ DatabaseWriteOperations , L1MessageKey , UnwindResult ,
2323} ;
2424use scroll_network:: NewBlockWithPeer ;
2525use std:: {
@@ -215,9 +215,10 @@ impl<
215215 let block_info: L2BlockInfoWithL1Messages = ( & block_with_peer. block ) . into ( ) ;
216216 Self :: do_handle_block_from_peer ( ctx, block_with_peer) . await ?;
217217 Retry :: default ( )
218- . retry ( "update_l1_messages_with_l2_block " , || async {
218+ . retry ( "handle_sequenced_block " , || async {
219219 let tx = database. tx_mut ( ) . await ?;
220220 tx. update_l1_messages_with_l2_block ( block_info. clone ( ) ) . await ?;
221+ tx. set_l2_head_block_info ( block_info. block_info ) . await ?;
221222 tx. commit ( ) . await ?;
222223 Ok :: < _ , ChainOrchestratorError > ( ( ) )
223224 } )
@@ -483,9 +484,7 @@ impl<
483484 Retry :: default ( )
484485 . retry ( "insert_block" , || async {
485486 let tx = database. tx_mut ( ) . await ?;
486- for block in block_infos. clone ( ) {
487- tx. insert_block ( block, batch_info) . await ?;
488- }
487+ tx. insert_blocks ( block_infos. clone ( ) , batch_info) . await ?;
489488 tx. commit ( ) . await ?;
490489 Ok :: < _ , ChainOrchestratorError > ( ( ) )
491490 } )
@@ -537,6 +536,7 @@ impl<
537536 . retry ( "update_l1_messages_from_l2_blocks" , || async {
538537 let tx = database. tx_mut ( ) . await ?;
539538 tx. update_l1_messages_from_l2_blocks ( block_info. clone ( ) ) . await ?;
539+ tx. set_l2_head_block_info ( head. block_info ) . await ?;
540540 tx. commit ( ) . await ?;
541541 Ok :: < _ , ChainOrchestratorError > ( ( ) )
542542 } )
@@ -838,7 +838,7 @@ async fn compute_l1_message_queue_hash(
838838 } )
839839 . await ?
840840 . map ( |m| m. queue_hash )
841- . ok_or ( DatabaseError :: L1MessageNotFound ( L1MessageStart :: Index ( index) ) ) ?
841+ . ok_or ( DatabaseError :: L1MessageNotFound ( L1MessageKey :: QueueIndex ( index) ) ) ?
842842 . unwrap_or_default ( )
843843 . to_vec ( ) ;
844844 input. append ( & mut l1_message. tx_hash ( ) . to_vec ( ) ) ;
@@ -1078,7 +1078,9 @@ async fn validate_l1_messages(
10781078 let l1_message_stream = Retry :: default ( )
10791079 . retry ( "get_l1_messages" , || async {
10801080 let messages = tx
1081- . get_l1_messages ( l1_message_hashes. first ( ) . map ( |tx| L1MessageStart :: Hash ( * tx) ) )
1081+ . get_l1_messages (
1082+ l1_message_hashes. first ( ) . map ( |tx| L1MessageKey :: TransactionHash ( * tx) ) ,
1083+ )
10821084 . await ?;
10831085 Ok :: < _ , ChainOrchestratorError > ( messages)
10841086 } )
@@ -1093,7 +1095,9 @@ async fn validate_l1_messages(
10931095 . await
10941096 . map ( |m| m. map ( |msg| msg. transaction . tx_hash ( ) ) )
10951097 . transpose ( ) ?
1096- . ok_or ( ChainOrchestratorError :: L1MessageNotFound ( L1MessageStart :: Hash ( message_hash) ) ) ?;
1098+ . ok_or ( ChainOrchestratorError :: L1MessageNotFound ( L1MessageKey :: TransactionHash (
1099+ message_hash,
1100+ ) ) ) ?;
10971101
10981102 // If the received and expected L1 messages do not match return an error.
10991103 if message_hash != expected_hash {
0 commit comments