Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollup-core: better batch submission logic #324

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<number> {
const results = await Promise.all([
this.dataService.getMaxL1BlockNumber(),
this.getMaxL1BlockNumber(),
this.getMaxL1ToL2QueueBlockNumber(),
this.getMaxSafetyQueueBlockNumber(),
])
Expand All @@ -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
}

Expand Down Expand Up @@ -491,6 +495,14 @@ export class CanonicalChainBatchSubmitter extends ScheduledTask {
)
}

private async getMaxL1BlockNumber(): Promise<number> {
try {
return await this.dataService.getMaxL1BlockNumber()
} catch (e) {
return undefined
}
}

private async catchQueueIsEmptyAndReturnUndefined(
func: () => Promise<number>
): Promise<number> {
Expand Down