Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(derive): Sequence window expiry #532

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crates/derive/src/stages/batch_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ where
// If the current epoch is too old compared to the L1 block we are at,
// i.e. if the sequence window expired, we create empty batches for the current epoch
let expiry_epoch = epoch.number + self.cfg.seq_window_size;
let force_empty_batches = (expiry_epoch == parent.l1_origin.number && empty) ||
expiry_epoch < parent.l1_origin.number;
let bq_origin = self.origin.ok_or(StageError::MissingOrigin)?;
let force_empty_batches =
(expiry_epoch == bq_origin.number && empty) || expiry_epoch < bq_origin.number;
let first_of_epoch = epoch.number == parent.l1_origin.number + 1;

// If the sequencer window did not expire,
Expand Down Expand Up @@ -235,7 +236,7 @@ where
error!(target: "batch-queue", "Cannot add batch without an origin");
panic!("Cannot add batch without an origin");
}
let origin = self.origin.ok_or_else(|| anyhow!("cannot add batch with missing origin"))?;
let origin = self.origin.ok_or(StageError::MissingOrigin)?;
let data = BatchWithInclusionBlock { inclusion_block: origin, batch };
// If we drop the batch, validation logs the drop reason with WARN level.
if data.check_batch(&self.cfg, &self.l1_blocks, parent, &mut self.fetcher).await.is_drop() {
Expand Down