diff --git a/packages/rollup-core/src/app/data/consumers/canonical-chain-batch-submitter.ts b/packages/rollup-core/src/app/data/consumers/canonical-chain-batch-submitter.ts index c740af6be90da..c85289c363681 100644 --- a/packages/rollup-core/src/app/data/consumers/canonical-chain-batch-submitter.ts +++ b/packages/rollup-core/src/app/data/consumers/canonical-chain-batch-submitter.ts @@ -170,7 +170,7 @@ export class CanonicalChainBatchSubmitter extends ScheduledTask { // Returns the most recent block number with a L1 to L2 transaction protected async getBatchSubmissionBlockNumber(): Promise { const results = await Promise.all([ - this.dataService.getMaxL1BlockNumber(), + this.getMaxL1BlockNumber(), this.getMaxL1ToL2QueueBlockNumber(), this.getMaxSafetyQueueBlockNumber(), ]) @@ -183,6 +183,10 @@ export class CanonicalChainBatchSubmitter extends ScheduledTask { } } + if (min === Number.MAX_SAFE_INTEGER) { + throw new Error('Unable to fetch batch submission block number') + } + return min } @@ -491,6 +495,14 @@ export class CanonicalChainBatchSubmitter extends ScheduledTask { ) } + private async getMaxL1BlockNumber(): Promise { + try { + return await this.dataService.getMaxL1BlockNumber() + } catch (e) { + return undefined + } + } + private async catchQueueIsEmptyAndReturnUndefined( func: () => Promise ): Promise {