Commit 71f8de9c authored by Mark Tyneway's avatar Mark Tyneway Committed by Kelvin Fichter

batch-submitter: handle error case explicitly

It was possible to return from a function directly
into destructuring an array when the return value
was polymorphic in either being an array or undefined.
The undefined case is handled explicitly now and an
error is thrown with a useful error message instead of
something that would require looking at the source code
and knowing nodejs error types to find out what the
problem was.
parent a5807cde
---
'@eth-optimism/batch-submitter': patch
---
Handle error case more explicity when creating invalid batch
......@@ -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,
......
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