diff --git a/.changeset/great-buckets-bow.md b/.changeset/great-buckets-bow.md new file mode 100644 index 000000000000..3f21e6481fde --- /dev/null +++ b/.changeset/great-buckets-bow.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Handle error case more explicity when creating invalid batch diff --git a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts index 3fbfed818d84..8945c3991505 100644 --- a/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts @@ -195,8 +195,12 @@ export class TransactionBatchSubmitter extends BatchSubmitter { return } - const [batchParams, wasBatchTruncated] = - await this._generateSequencerBatchParams(startBlock, endBlock) + const params = await this._generateSequencerBatchParams(startBlock, endBlock) + if (!params) { + throw new Error(`Cannot create sequencer batch with params start ${startBlock} and end ${endBlock}`) + } + + const [batchParams, wasBatchTruncated] = params const batchSizeInBytes = encodeAppendSequencerBatch(batchParams).length / 2 this.logger.debug('Sequencer batch generated', { batchSizeInBytes,