From 5634000b05cb0015939531a44c1e49605bc0c6da Mon Sep 17 00:00:00 2001 From: bennett Date: Mon, 7 Apr 2025 12:10:11 -0500 Subject: [PATCH 1/3] improve: only warn on invalid/unrepayable fills on mainnet Signed-off-by: bennett --- src/clients/SpokePoolClient/SpokePoolClient.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clients/SpokePoolClient/SpokePoolClient.ts b/src/clients/SpokePoolClient/SpokePoolClient.ts index 1a316bd4a..9c0fc7201 100644 --- a/src/clients/SpokePoolClient/SpokePoolClient.ts +++ b/src/clients/SpokePoolClient/SpokePoolClient.ts @@ -24,7 +24,7 @@ import { spreadEvent, spreadEventWithBlockNumber, } from "../../utils/EventUtils"; -import { ZERO_ADDRESS } from "../../constants"; +import { ZERO_ADDRESS, CHAIN_IDs } from "../../constants"; import { Deposit, DepositWithBlock, @@ -405,8 +405,10 @@ export abstract class SpokePoolClient extends BaseAbstractClient { } return newInvalidFill; }); + // Log invalid and unrepayable fills as warns iff the hub pool client is defined for mainnet. + const logLevel = this.hubPoolClient?.chainId === CHAIN_IDs.MAINNET ? "warn" : "debug"; if (invalidFillsForDeposit.length > 0) { - this.logger.warn({ + this.logger[logLevel]({ at: "SpokePoolClient", chainId: this.chainId, message: "Invalid fills found matching deposit ID", @@ -417,7 +419,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient { } const unrepayableFillsForDeposit = unrepayableFills.filter((x) => x.depositId.eq(deposit.depositId)); if (unrepayableFillsForDeposit.length > 0) { - this.logger.warn({ + this.logger[logLevel]({ at: "SpokePoolClient", chainId: this.chainId, message: "Unrepayable fills found where we need to switch repayment address and or chain", From 924016d4d84d488282a2eb5e09b494ad7a33dd52 Mon Sep 17 00:00:00 2001 From: bennett Date: Mon, 7 Apr 2025 12:12:42 -0500 Subject: [PATCH 2/3] comment Signed-off-by: bennett --- src/clients/SpokePoolClient/SpokePoolClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clients/SpokePoolClient/SpokePoolClient.ts b/src/clients/SpokePoolClient/SpokePoolClient.ts index 9c0fc7201..10044ef68 100644 --- a/src/clients/SpokePoolClient/SpokePoolClient.ts +++ b/src/clients/SpokePoolClient/SpokePoolClient.ts @@ -405,7 +405,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient { } return newInvalidFill; }); - // Log invalid and unrepayable fills as warns iff the hub pool client is defined for mainnet. + // Log invalid and unrepayable fills as warns iff the hub pool client is defined and the hub chain is mainnet. const logLevel = this.hubPoolClient?.chainId === CHAIN_IDs.MAINNET ? "warn" : "debug"; if (invalidFillsForDeposit.length > 0) { this.logger[logLevel]({ From 78d5d63b1a7d2cd9e9171221addbf9b6f1df7a82 Mon Sep 17 00:00:00 2001 From: bennett Date: Tue, 13 May 2025 15:54:07 -0500 Subject: [PATCH 3/3] use chainIsProd Signed-off-by: bennett --- src/clients/SpokePoolClient/SpokePoolClient.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/clients/SpokePoolClient/SpokePoolClient.ts b/src/clients/SpokePoolClient/SpokePoolClient.ts index 7c7d6ae0d..11f51eb74 100644 --- a/src/clients/SpokePoolClient/SpokePoolClient.ts +++ b/src/clients/SpokePoolClient/SpokePoolClient.ts @@ -18,6 +18,7 @@ import { toAddress, validateFillForDeposit, chainIsEvm, + chainIsProd, } from "../../utils"; import { duplicateEvent, @@ -25,7 +26,7 @@ import { spreadEvent, spreadEventWithBlockNumber, } from "../../utils/EventUtils"; -import { ZERO_ADDRESS, CHAIN_IDs } from "../../constants"; +import { ZERO_ADDRESS } from "../../constants"; import { Deposit, DepositWithBlock, @@ -353,7 +354,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient { fillCount: number; invalidFills: FillWithBlock[]; } { - const { outputAmount } = deposit; + const { outputAmount, originChainId } = deposit; const fillsForDeposit = this.depositHashesToFills[this.getDepositHash(deposit)]; // If no fills then the full amount is remaining. if (fillsForDeposit === undefined || fillsForDeposit.length === 0) { @@ -409,8 +410,8 @@ export abstract class SpokePoolClient extends BaseAbstractClient { } return newInvalidFill; }); - // Log invalid and unrepayable fills as warns iff the hub pool client is defined and the hub chain is mainnet. - const logLevel = this.hubPoolClient?.chainId === CHAIN_IDs.MAINNET ? "warn" : "debug"; + // Log invalid and unrepayable fills as warns if we are on a production network. + const logLevel = chainIsProd(originChainId) ? "warn" : "debug"; if (invalidFillsForDeposit.length > 0) { this.logger[logLevel]({ at: "SpokePoolClient",