@@ -643,6 +643,14 @@ impl DatabaseReadOperations for Database {
643643 )
644644 }
645645
646+ async fn get_max_block_data_hint_block_number ( & self ) -> Result < u64 , DatabaseError > {
647+ metered ! (
648+ DatabaseOperation :: GetMaxBlockDataHintBlockNumber ,
649+ self ,
650+ tx( |tx| async move { tx. get_max_block_data_hint_block_number( ) . await } )
651+ )
652+ }
653+
646654 async fn get_l2_block_and_batch_info_by_hash (
647655 & self ,
648656 block_hash : B256 ,
@@ -862,7 +870,7 @@ mod test {
862870 BatchCommitData , BatchInfo , BlockInfo , L1MessageEnvelope , L2BlockInfoWithL1Messages ,
863871 } ;
864872 use scroll_alloy_consensus:: TxL1Message ;
865- use sea_orm:: { ColumnTrait , EntityTrait , QueryFilter } ;
873+ use sea_orm:: EntityTrait ;
866874
867875 #[ tokio:: test]
868876 async fn test_database_round_trip_batch_commit ( ) {
@@ -1227,11 +1235,13 @@ mod test {
12271235
12281236 #[ tokio:: test]
12291237 async fn test_delete_l1_messages_gt ( ) {
1238+ reth_tracing:: init_test_tracing ( ) ;
1239+
12301240 // Set up the test database.
12311241 let db = setup_test_db ( ) . await ;
12321242
12331243 // Generate unstructured bytes.
1234- let mut bytes = [ 0u8 ; 1024 ] ;
1244+ let mut bytes = [ 0u8 ; 10240 ] ;
12351245 rand:: rng ( ) . fill ( bytes. as_mut_slice ( ) ) ;
12361246 let mut u = Unstructured :: new ( & bytes) ;
12371247
@@ -1276,6 +1286,8 @@ mod test {
12761286
12771287 #[ tokio:: test]
12781288 async fn test_get_l2_block_info_by_number ( ) {
1289+ reth_tracing:: init_test_tracing ( ) ;
1290+
12791291 // Set up the test database.
12801292 let db = setup_test_db ( ) . await ;
12811293
@@ -1475,67 +1487,6 @@ mod test {
14751487 }
14761488 }
14771489
1478- #[ tokio:: test]
1479- async fn test_insert_block_upsert_behavior ( ) {
1480- reth_tracing:: init_test_tracing ( ) ;
1481-
1482- // Set up the test database.
1483- let db = setup_test_db ( ) . await ;
1484-
1485- // Generate unstructured bytes.
1486- let mut bytes = [ 0u8 ; 1024 ] ;
1487- rand:: rng ( ) . fill ( bytes. as_mut_slice ( ) ) ;
1488- let mut u = Unstructured :: new ( & bytes) ;
1489-
1490- // Generate batches
1491- let batch_data_1 = BatchCommitData { index : 100 , ..Arbitrary :: arbitrary ( & mut u) . unwrap ( ) } ;
1492- let batch_info_1: BatchInfo = batch_data_1. clone ( ) . into ( ) ;
1493- let batch_data_2 = BatchCommitData { index : 200 , ..Arbitrary :: arbitrary ( & mut u) . unwrap ( ) } ;
1494- let batch_info_2: BatchInfo = batch_data_2. clone ( ) . into ( ) ;
1495-
1496- db. insert_batch ( batch_data_1) . await . unwrap ( ) ;
1497- db. insert_batch ( batch_data_2) . await . unwrap ( ) ;
1498-
1499- // Insert initial block
1500- let block_info = BlockInfo { number : 600 , hash : B256 :: arbitrary ( & mut u) . unwrap ( ) } ;
1501- db. insert_blocks ( vec ! [ block_info] , batch_info_1) . await . unwrap ( ) ;
1502-
1503- // Verify initial insertion
1504- let retrieved_block = db. get_l2_block_info_by_number ( 600 ) . await . unwrap ( ) ;
1505- assert_eq ! ( retrieved_block, Some ( block_info) ) ;
1506-
1507- // Verify initial batch association using model conversion
1508- let initial_l2_block_model = models:: l2_block:: Entity :: find ( )
1509- . filter ( models:: l2_block:: Column :: BlockNumber . eq ( 600 ) )
1510- . one ( db. inner ( ) . get_connection ( ) )
1511- . await
1512- . unwrap ( )
1513- . unwrap ( ) ;
1514- let ( initial_block_info, initial_batch_info) : ( BlockInfo , BatchInfo ) =
1515- initial_l2_block_model. into ( ) ;
1516- assert_eq ! ( initial_block_info, block_info) ;
1517- assert_eq ! ( initial_batch_info, batch_info_1) ;
1518-
1519- // Update the same block with different batch info (upsert)
1520- db. insert_blocks ( vec ! [ block_info] , batch_info_2) . await . unwrap ( ) ;
1521-
1522- // Verify the block still exists and was updated
1523- let retrieved_block = db. get_l2_block_info_by_number ( 600 ) . await . unwrap ( ) . unwrap ( ) ;
1524- assert_eq ! ( retrieved_block, block_info) ;
1525-
1526- // Verify batch association was updated using model conversion
1527- let updated_l2_block_model = models:: l2_block:: Entity :: find ( )
1528- . filter ( models:: l2_block:: Column :: BlockNumber . eq ( 600 ) )
1529- . one ( db. inner ( ) . get_connection ( ) )
1530- . await
1531- . unwrap ( )
1532- . unwrap ( ) ;
1533- let ( updated_block_info, updated_batch_info) : ( BlockInfo , BatchInfo ) =
1534- updated_l2_block_model. into ( ) ;
1535- assert_eq ! ( updated_block_info, block_info) ;
1536- assert_eq ! ( updated_batch_info, batch_info_2) ;
1537- }
1538-
15391490 #[ tokio:: test]
15401491 async fn test_prepare_on_startup ( ) {
15411492 let db = setup_test_db ( ) . await ;
0 commit comments