Commit c0d92e66 authored by pcw109550's avatar pcw109550 Committed by protolambda

Add comments for l1Blocks field of batch queue

parent c6d39019
......@@ -45,6 +45,12 @@ type BatchQueue struct {
prev NextBatchProvider
origin eth.L1BlockRef
// l1Blocks contains consecutive eth.L1BlockRef sorted by time.
// Every L1 origin of unsafe L2 blocks must be eventually included in l1Blocks.
// Batch queue's job is to ensure below two rules:
// If every L2 block corresponding to single L1 block becomes safe, it will be popped from l1Blocks.
// If new L2 block's L1 origin is not included in l1Blocks, fetch and push to l1Blocks.
// length of l1Blocks never exceeds SequencerWindowSize
l1Blocks []eth.L1BlockRef
// batches in order of when we've first seen them
......
......@@ -236,6 +236,7 @@ func checkSpanBatch(ctx context.Context, cfg *rollup.Config, log log.Logger, l1B
endEpochNum := batch.GetBlockEpochNum(batch.GetBlockCount() - 1)
originChecked := false
// l1Blocks is supplied from batch queue and its length is limited to SequencerWindowSize.
for _, l1Block := range l1Blocks {
if l1Block.Number == endEpochNum {
if !batch.CheckOriginHash(l1Block.Hash) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment