Skip to content

Commit f4a999e

Browse files
committed
fixes after merge
1 parent 47d35e7 commit f4a999e

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

crates/chain-orchestrator/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,11 @@ impl<
551551
metered!(Task::L1Finalization, self, handle_l1_finalized(*block_info))
552552
}
553553
L1Notification::BatchCommit { block_info, data } => {
554-
metered!(Task::BatchCommit, self, handle_batch_commit(*block_info, data.clone()))
555-
match metered!(Task::BatchCommit, self, handle_batch_commit(batch.clone())) {
554+
match metered!(
555+
Task::BatchCommit,
556+
self,
557+
handle_batch_commit(*block_info, data.clone())
558+
) {
556559
Err(ChainOrchestratorError::BatchCommitGap(batch_index)) => {
557560
// Query database for the L1 block of the last known batch
558561
let reset_block =
@@ -598,11 +601,10 @@ impl<
598601
)
599602
}
600603
L1Notification::L1Message { message, block_info, block_timestamp: _ } => {
601-
metered!(Task::L1Message, self, handle_l1_message(message.clone(), *block_info))
602604
match metered!(
603605
Task::L1Message,
604606
self,
605-
handle_l1_message(message.clone(), *block_number)
607+
handle_l1_message(message.clone(), *block_info)
606608
) {
607609
Err(ChainOrchestratorError::L1MessageQueueGap(queue_index)) => {
608610
// Query database for the L1 block of the last known L1 message
@@ -825,12 +827,12 @@ impl<
825827
}
826828

827829
// Check if batch already exists in DB.
828-
if let Some(existing_batch) = tx.get_batch_by_index(batch_clone.index).await? {
829-
if existing_batch.hash == batch_clone.hash {
830+
if let Some(existing_batch) = tx.get_batch_by_index(batch.index).await? {
831+
if existing_batch.hash == batch.hash {
830832
// This means we have already processed this batch commit, we will skip
831833
// it.
832834
return Err(ChainOrchestratorError::DuplicateBatchCommit(
833-
BatchInfo::new(batch_clone.index, batch_clone.hash),
835+
BatchInfo::new(batch.index, batch.hash),
834836
));
835837
}
836838
// TODO: once batch reverts are implemented, we need to handle this

crates/watcher/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,9 @@ mod tests {
12071207

12081208
// When: Fill the channel to capacity LOG_QUERY_BLOCK_RANGE
12091209
for i in 0..LOG_QUERY_BLOCK_RANGE {
1210-
watcher.notify(L1Notification::NewBlock(i)).await?;
1210+
watcher
1211+
.notify(L1Notification::NewBlock(BlockInfo { number: i, hash: random!(B256) }))
1212+
.await?;
12111213
}
12121214

12131215
assert_eq!(watcher.current_block_number, 0, "Watcher should be set to block");
@@ -1216,7 +1218,9 @@ mod tests {
12161218
// This blocks until we send the command to reset.
12171219
let watcher_handle_task = tokio::spawn(async move {
12181220
// This would normally block, but the reset command should interrupt it
1219-
let result = watcher.notify(L1Notification::NewBlock(1000)).await;
1221+
let result = watcher
1222+
.notify(L1Notification::NewBlock(BlockInfo { number: 1000, hash: random!(B256) }))
1223+
.await;
12201224
// After reset is handled, the notify returns without sending
12211225
(watcher, result)
12221226
});

0 commit comments

Comments
 (0)