Skip to content

Commit 875f745

Browse files
committed
fixes after merge
1 parent 8ed53a6 commit 875f745

File tree

4 files changed

+358
-378
lines changed

4 files changed

+358
-378
lines changed

crates/database/db/src/operations.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -961,12 +961,6 @@ pub trait DatabaseReadOperations {
961961
batch_hash: B256,
962962
) -> Result<Option<BatchCommitData>, DatabaseError>;
963963

964-
/// Get a [`BatchCommitData`] from the database by its batch hash.
965-
async fn get_batch_by_hash(
966-
&self,
967-
batch_hash: B256,
968-
) -> Result<Option<BatchCommitData>, DatabaseError>;
969-
970964
/// Get the status of a batch by its hash.
971965
#[cfg(test)]
972966
async fn get_batch_status_by_hash(
@@ -1064,22 +1058,6 @@ impl<T: ReadConnectionProvider + Sync + ?Sized> DatabaseReadOperations for T {
10641058
.await
10651059
.map(|x| x.into_iter().map(Into::into).collect())?)
10661060
}
1067-
1068-
async fn get_batch_by_hash(
1069-
&self,
1070-
batch_hash: B256,
1071-
) -> Result<Option<BatchCommitData>, DatabaseError> {
1072-
Ok(models::batch_commit::Entity::find()
1073-
.filter(
1074-
models::batch_commit::Column::Index
1075-
.eq(TryInto::<i64>::try_into(batch_index).expect("index should fit in i64"))
1076-
.and(models::batch_commit::Column::RevertedBlockNumber.is_null()),
1077-
)
1078-
.one(self.get_connection())
1079-
.await
1080-
.map(|x| x.map(Into::into))?)
1081-
}
1082-
10831061
async fn get_batch_by_hash(
10841062
&self,
10851063
batch_hash: B256,

crates/derivation-pipeline/src/lib.rs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)