From 44a0a19d5be92a48cf9cadac83e7cadf15f1e1f0 Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:09:39 +0100 Subject: [PATCH] chore: add log msg on highest block check (#281) --- package.json | 2 +- src/reporters/block_based_reporter.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 3a94215..1bab8fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "celo-oracle", - "version": "2.0.16-beta", + "version": "2.0.17-beta", "description": "Oracle application to aggregate and report exchange rates to the Celo network", "author": "Celo", "license": "Apache-2.0", diff --git a/src/reporters/block_based_reporter.ts b/src/reporters/block_based_reporter.ts index 25225a7..037cc3b 100644 --- a/src/reporters/block_based_reporter.ts +++ b/src/reporters/block_based_reporter.ts @@ -253,12 +253,15 @@ export class BlockBasedReporter extends BaseReporter { performBlockHeaderChecks(blockHeader: BlockHeader) { // Ensure this is the highest block number we've seen - // Temporary disable this check as it seems to cause issues after the L2 upgrade, likely because of the faster block times - // if (this.highestObservedBlockNumber && blockHeader.number <= this.highestObservedBlockNumber) { - // throw Error( - // `Block number is lower than the highest previously observed block: ${blockHeader.number} <= ${this.highestObservedBlockNumber}` - // ) - // } + if (this.highestObservedBlockNumber && blockHeader.number <= this.highestObservedBlockNumber) { + // Temporary disable this throw as it seems to cause issues after the L2 upgrade, likely because of the faster block times + // throw Error( + // `Block number is lower than the highest previously observed block: ${blockHeader.number} <= ${this.highestObservedBlockNumber}` + // ) + this.logger.warn( + `New Block number (${blockHeader.number}) is lower than the highest previously observed block (${this.highestObservedBlockNumber})` + ) + } const now = Date.now() // now is in ms, and blockHeader.timestamp is in seconds, so we convert it to ms const blockTimestampMs = secondsToMs(blockHeader.timestamp as number)