Commit d093a6bb authored by Conner Fromknecht's avatar Conner Fromknecht

fix: mimic BSS timestamp bug fix from #2093

See https://github.com/ethereum-optimism/optimism/pull/2093 for more
details.
parent f3989c03
---
'@eth-optimism/batch-submitter-service': patch
---
Adds a fix for the BSS to account for the new timestamp logic in L2Geth
......@@ -91,11 +91,10 @@ func GenSequencerBatchParams(
// Iterate over the batch elements, grouping the elements according to
// the following critera:
// - All sequencer txs in the same group must have the same timestamp
// and block number.
// - All txs in the same group must have the same timestamp.
// - All sequencer txs in the same group must have the same block number.
// - If sequencer txs exist in a group, they must come before all
// queued txs.
// - A group should never split consecutive queued txs.
//
// Assuming the block and timestamp criteria for sequencer txs are
// respected within each group, the following are examples of groupings:
......@@ -110,17 +109,18 @@ func GenSequencerBatchParams(
// To enforce the above groupings, the following condition is
// used to determine when to create a new batch:
// - On the first pass, or
// - Whenever a sequecer tx is observed, and:
// - The preceding tx has a different timestamp, or
// - Whenever a sequencer tx is observed, and:
// - The preceding tx was a queued tx, or
// - The preceding sequencer tx has a different
// block number/timestamp.
// Note that a sequencer tx is required to create a new group,
// so a queued tx may ONLY exist as the first element in a group
// if it is the very first element.
// - The preceding sequencer tx has a different block number.
// Note that a sequencer tx is usually required to create a new group,
// so a queued tx may ONLY exist as the first element in a group if it
// is the very first element or it has a different timestamp from the
// preceding tx.
needsNewGroupOnSequencerTx := !lastBlockIsSequencerTx ||
el.Timestamp != lastTimestamp ||
el.BlockNumber != lastBlockNumber
if len(groupedBlocks) == 0 ||
el.Timestamp != lastTimestamp ||
(el.IsSequencerTx() && needsNewGroupOnSequencerTx) {
groupedBlocks = append(groupedBlocks, groupedBlock{})
......
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