Commit cdc4ddd8 authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

Merge pull request #2093 from ethereum-optimism/sc/bss-ts-fix

fix(bss): have BSS correctly create new contexts
parents 5c5dc0c9 b8b59319
---
'@eth-optimism/batch-submitter': patch
---
Adds a fix for the BSS to account for new timestamp logic in L2Geth
...@@ -685,10 +685,18 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -685,10 +685,18 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
queued: BatchElement[] queued: BatchElement[]
}> = [] }> = []
for (const block of blocks) { for (const block of blocks) {
// Create a new context in certain situations
if ( if (
(lastBlockIsSequencerTx === false && block.isSequencerTx === true) || // If there are no contexts yet, create a new context.
groupedBlocks.length === 0 || groupedBlocks.length === 0 ||
(block.timestamp !== lastTimestamp && block.isSequencerTx === true) || // If the last block was an L1 to L2 transaction, but the next block is a Sequencer
// transaction, create a new context.
(lastBlockIsSequencerTx === false && block.isSequencerTx === true) ||
// If the timestamp of the last block differs from the timestamp of the current block,
// create a new context. Applies to both L1 to L2 transactions and Sequencer transactions.
block.timestamp !== lastTimestamp ||
// If the block number of the last block differs from the block number of the current block,
// create a new context. ONLY applies to Sequencer transactions.
(block.blockNumber !== lastBlockNumber && block.isSequencerTx === true) (block.blockNumber !== lastBlockNumber && block.isSequencerTx === true)
) { ) {
groupedBlocks.push({ groupedBlocks.push({
...@@ -696,6 +704,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -696,6 +704,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
queued: [], queued: [],
}) })
} }
const cur = groupedBlocks.length - 1 const cur = groupedBlocks.length - 1
block.isSequencerTx block.isSequencerTx
? groupedBlocks[cur].sequenced.push(block) ? groupedBlocks[cur].sequenced.push(block)
......
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