Skip to content

Commit

Permalink
Merge pull request ethereum-optimism#2093 from ethereum-optimism/sc/b…
Browse files Browse the repository at this point in the history
…ss-ts-fix

fix(bss): have BSS correctly create new contexts
  • Loading branch information
mslipper authored Jan 28, 2022
2 parents 5c5dc0c + b8b5931 commit cdc4ddd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-stingrays-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/batch-submitter': patch
---

Adds a fix for the BSS to account for new timestamp logic in L2Geth
13 changes: 11 additions & 2 deletions packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,17 +685,26 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
queued: BatchElement[]
}> = []
for (const block of blocks) {
// Create a new context in certain situations
if (
(lastBlockIsSequencerTx === false && block.isSequencerTx === true) ||
// If there are no contexts yet, create a new context.
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)
) {
groupedBlocks.push({
sequenced: [],
queued: [],
})
}

const cur = groupedBlocks.length - 1
block.isSequencerTx
? groupedBlocks[cur].sequenced.push(block)
Expand Down

0 comments on commit cdc4ddd

Please sign in to comment.