@@ -450,6 +450,7 @@ mod tests {
450450
451451 use alloy_eips:: Decodable2718 ;
452452 use alloy_primitives:: { address, b256, bytes, U256 } ;
453+ use eyre:: bail;
453454 use futures:: StreamExt ;
454455 use rollup_node_primitives:: L1MessageEnvelope ;
455456 use rollup_node_providers:: { test_utils:: MockL1Provider , L1ProviderError } ;
@@ -510,7 +511,7 @@ mod tests {
510511 finalized_block_number : None ,
511512 reverted_block_number : None ,
512513 } ;
513- db. insert_batch ( batch_data) . await ?;
514+ db. insert_batch ( batch_data. clone ( ) ) . await ?;
514515
515516 // load message in db, leaving a l1 message missing.
516517 db. insert_l1_message ( L1_MESSAGE_INDEX_33 ) . await ?;
@@ -522,7 +523,7 @@ mod tests {
522523 // as long as we don't call `push_batch`, pipeline should not return attributes.
523524 pipeline
524525 . push_batch (
525- BatchInfo { index : 12 , hash : Default :: default ( ) } ,
526+ BatchInfo { index : 12 , hash : batch_data . hash } ,
526527 BatchStatus :: Consolidated ,
527528 )
528529 . await ;
@@ -541,14 +542,22 @@ mod tests {
541542
542543 // check the correctness of the last attribute.
543544 let mut attribute = ScrollPayloadAttributes :: default ( ) ;
544- if let Some ( BatchDerivationResult { attributes, .. } ) = pipeline. next ( ) . await {
545- for a in attributes {
546- if a. attributes . payload_attributes . timestamp == 1696935657 {
547- attribute = a. attributes ;
548- break ;
545+ tokio:: select! {
546+ _ = tokio:: time:: sleep( tokio:: time:: Duration :: from_secs( 5000 ) ) => {
547+ bail!( "pipeline did not yield in time" ) ;
548+ }
549+ maybe_result = pipeline. next( ) => {
550+ if let Some ( BatchDerivationResult { attributes, .. } ) = maybe_result {
551+ for a in attributes {
552+ if a. attributes. payload_attributes. timestamp == 1696935657 {
553+ attribute = a. attributes;
554+ break ;
555+ }
556+ }
549557 }
550558 }
551559 }
560+
552561 let expected = ScrollPayloadAttributes {
553562 payload_attributes : PayloadAttributes {
554563 timestamp : 1696935657 ,
@@ -582,7 +591,7 @@ mod tests {
582591 finalized_block_number : None ,
583592 reverted_block_number : None ,
584593 } ;
585- db. insert_batch ( batch_data) . await ?;
594+ db. insert_batch ( batch_data. clone ( ) ) . await ?;
586595 // load messages in db.
587596 let l1_messages = vec ! [ L1_MESSAGE_INDEX_33 , L1_MESSAGE_INDEX_34 ] ;
588597 for message in l1_messages {
@@ -595,7 +604,7 @@ mod tests {
595604
596605 // as long as we don't call `push_batch`, pipeline should not return attributes.
597606 pipeline
598- . push_batch ( BatchInfo { index : 12 , hash : Default :: default ( ) } , BatchStatus :: Committed )
607+ . push_batch ( BatchInfo { index : 12 , hash : batch_data . hash } , BatchStatus :: Committed )
599608 . await ;
600609
601610 // check the correctness of the last attribute.
0 commit comments