diff --git a/.changeset/short-badgers-itch.md b/.changeset/short-badgers-itch.md new file mode 100644 index 000000000000..4667285782c7 --- /dev/null +++ b/.changeset/short-badgers-itch.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/batch-submitter': patch +--- + +Improved logging of batch submission timeout logs diff --git a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts index c487d86dfac9..9c82d8212b40 100644 --- a/packages/batch-submitter/src/batch-submitter/batch-submitter.ts +++ b/packages/batch-submitter/src/batch-submitter/batch-submitter.ts @@ -143,15 +143,16 @@ export abstract class BatchSubmitter { protected _shouldSubmitBatch(batchSizeInBytes: number): boolean { const currentTimestamp = Date.now() - const isTimeoutReached = - this.lastBatchSubmissionTimestamp + this.maxBatchSubmissionTime <= - currentTimestamp if (batchSizeInBytes < this.minTxSize) { - if (!isTimeoutReached) { + const timeSinceLastSubmission = + currentTimestamp - this.lastBatchSubmissionTimestamp + if (timeSinceLastSubmission < this.maxBatchSubmissionTime) { this.logger.info( 'Skipping batch submission. Batch too small & max submission timeout not reached.', { batchSizeInBytes, + timeSinceLastSubmission, + maxBatchSubmissionTime: this.maxBatchSubmissionTime, minTxSize: this.minTxSize, lastBatchSubmissionTimestamp: this.lastBatchSubmissionTimestamp, currentTimestamp, @@ -161,6 +162,8 @@ export abstract class BatchSubmitter { } this.logger.info('Timeout reached, proceeding with batch submission.', { batchSizeInBytes, + timeSinceLastSubmission, + maxBatchSubmissionTime: this.maxBatchSubmissionTime, lastBatchSubmissionTimestamp: this.lastBatchSubmissionTimestamp, currentTimestamp, })