Commit 7cce55a9 authored by Annie Ke's avatar Annie Ke Committed by GitHub

fix[bs]: disambiguate generic submission errors (#1051)

* fix[bs]: disambiguate generic submission errors

* add cases for errors

* separate out errors from transaction reverts with reasons

* remove extraneous errors
parent d9fd67d2
---
'@eth-optimism/batch-submitter': patch
---
Add status to generic error log to disambiguate errors
......@@ -232,11 +232,30 @@ export abstract class BatchSubmitter {
gasRetryIncrement: this.gasRetryIncrement,
}
const receipt = await BatchSubmitter.getReceiptWithResubmission(
let receipt: TransactionReceipt
try {
receipt = await BatchSubmitter.getReceiptWithResubmission(
txFunc,
resubmissionConfig,
this.logger
)
} catch (err) {
if (err.reason) {
this.logger.error(`Transaction invalid: ${err.reason}, aborting`, {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return
}
this.logger.error('Encountered error at submission, aborting', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
return
}
this.logger.info('Received transaction receipt', { receipt })
this.logger.info(successMessage)
......
......@@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// Fix our batches if we are configured to. TODO: Remove this.
batch = await this._fixBatch(batch)
if (!(await this._validateBatch(batch))) {
this.logger.error('Batch is malformed! Cannot submit next batch!')
throw new Error('Batch is malformed! Cannot submit next batch!')
return
}
let sequencerBatchParams = await this._getSequencerBatchParams(
startBlock,
......
......@@ -441,11 +441,29 @@ export const run = async () => {
try {
await func()
} catch (err) {
logger.error('Error submitting batch', {
switch (err.code) {
case 'SERVER_ERROR':
logger.error(`Encountered server error with status ${err.status}`, {
message: err.toString(),
stack: err.stack,
code: err.code,
})
break
case 'NETWORK_ERROR':
logger.error('Could not detect network', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
break
default:
logger.error('Unhandled exception during batch submission', {
message: err.toString(),
stack: err.stack,
code: err.code,
})
break
}
logger.info('Retrying...')
}
// Sleep
......
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