Commit 85362d44 authored by Liam Horne's avatar Liam Horne Committed by GitHub

Add more logging information to monotonicity violation logs (#1066)

* refactor: log idx of monotonicity violation from batch

* build: add changeset
parent baa3b761
---
'@eth-optimism/batch-submitter': patch
---
Log additional data in monotonicity violation
...@@ -356,13 +356,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter { ...@@ -356,13 +356,17 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
// Verify all of the batch elements are monotonic // Verify all of the batch elements are monotonic
let lastTimestamp: number let lastTimestamp: number
let lastBlockNumber: number let lastBlockNumber: number
for (const ele of batch) { for (const [idx, ele] of batch.entries()) {
if (ele.timestamp < lastTimestamp) { if (ele.timestamp < lastTimestamp) {
this.logger.error('Timestamp monotonicity violated! Element', { ele }) this.logger.error('Timestamp monotonicity violated! Element', {
idx,
ele,
})
return false return false
} }
if (ele.blockNumber < lastBlockNumber) { if (ele.blockNumber < lastBlockNumber) {
this.logger.error('Block Number monotonicity violated! Element', { this.logger.error('Block Number monotonicity violated! Element', {
idx,
ele, ele,
}) })
return false return false
......
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