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 { ...@@ -232,11 +232,30 @@ export abstract class BatchSubmitter {
gasRetryIncrement: this.gasRetryIncrement, gasRetryIncrement: this.gasRetryIncrement,
} }
const receipt = await BatchSubmitter.getReceiptWithResubmission( let receipt: TransactionReceipt
txFunc, try {
resubmissionConfig, receipt = await BatchSubmitter.getReceiptWithResubmission(
this.logger 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('Received transaction receipt', { receipt })
this.logger.info(successMessage) this.logger.info(successMessage)
......
...@@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -301,8 +301,7 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// Fix our batches if we are configured to. TODO: Remove this. // Fix our batches if we are configured to. TODO: Remove this.
batch = await this._fixBatch(batch) batch = await this._fixBatch(batch)
if (!(await this._validateBatch(batch))) { if (!(await this._validateBatch(batch))) {
this.logger.error('Batch is malformed! Cannot submit next batch!') return
throw new Error('Batch is malformed! Cannot submit next batch!')
} }
let sequencerBatchParams = await this._getSequencerBatchParams( let sequencerBatchParams = await this._getSequencerBatchParams(
startBlock, startBlock,
......
...@@ -441,11 +441,29 @@ export const run = async () => { ...@@ -441,11 +441,29 @@ export const run = async () => {
try { try {
await func() await func()
} catch (err) { } catch (err) {
logger.error('Error submitting batch', { switch (err.code) {
message: err.toString(), case 'SERVER_ERROR':
stack: err.stack, logger.error(`Encountered server error with status ${err.status}`, {
code: err.code, 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...') logger.info('Retrying...')
} }
// Sleep // 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