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