From 7195cbb3cfa3979a639ff93e2b44a46a96b2b25a Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:02:56 +0100 Subject: [PATCH 1/3] chore: add log msg on highest block check --- package.json | 2 +- src/reporters/block_based_reporter.ts | 13 +++++++------ 2 files changed, 8 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..05fcdb2 100644 --- a/src/reporters/block_based_reporter.ts +++ b/src/reporters/block_based_reporter.ts @@ -253,12 +253,13 @@ 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.info(`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) From 1f186b3b6a2cabb37383fb9919f4152f9b7fb99d Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:03:41 +0100 Subject: [PATCH 2/3] chore: warn --- src/reporters/block_based_reporter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reporters/block_based_reporter.ts b/src/reporters/block_based_reporter.ts index 05fcdb2..71e0777 100644 --- a/src/reporters/block_based_reporter.ts +++ b/src/reporters/block_based_reporter.ts @@ -258,7 +258,7 @@ export class BlockBasedReporter extends BaseReporter { // throw Error( // `Block number is lower than the highest previously observed block: ${blockHeader.number} <= ${this.highestObservedBlockNumber}` // ) - this.logger.info(`New Block number (${blockHeader.number}) is lower than the highest previously observed block (${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 From dc99d52056c56872ffab38739223b4ab64e6dd6e Mon Sep 17 00:00:00 2001 From: Nelson Taveras <4562733+nvtaveras@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:04:50 +0100 Subject: [PATCH 3/3] chore: pretty --- src/reporters/block_based_reporter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reporters/block_based_reporter.ts b/src/reporters/block_based_reporter.ts index 71e0777..037cc3b 100644 --- a/src/reporters/block_based_reporter.ts +++ b/src/reporters/block_based_reporter.ts @@ -258,7 +258,9 @@ export class BlockBasedReporter extends BaseReporter { // 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})`) + 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