From 6038b8b40bc0f95b6f7dfc5be5200a22913e9234 Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Mon, 24 Feb 2025 17:43:07 +0100 Subject: [PATCH 1/2] fix(relayer): Correctly implement MDC fallback (#2122) --- src/relayer/Relayer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index 82c9f889e..7d91e6fc7 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -337,9 +337,9 @@ export class Relayer { return ignoreDeposit(); } - const { minConfirmations = 100_000 } = minDepositConfirmations[originChainId].find(({ usdThreshold }) => + const { minConfirmations } = minDepositConfirmations[originChainId].find(({ usdThreshold }) => usdThreshold.gte(fillAmountUsd) - ); + ) ?? { minConfirmations: 100_000 }; const { latestBlockSearched } = spokePoolClients[originChainId]; if (latestBlockSearched - blockNumber < minConfirmations) { this.logger.debug({ From 9403e3cb941eb5b821b7df814ab32c84f5da073c Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Mon, 24 Feb 2025 18:10:10 +0100 Subject: [PATCH 2/2] improve(relayer): Persistently ignore expired deposits (#2123) --- src/relayer/Relayer.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index 7d91e6fc7..a107456e5 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -337,6 +337,12 @@ export class Relayer { return ignoreDeposit(); } + // It would be preferable to use host time since it's more reliably up-to-date, but this creates issues in test. + const currentTime = spokePoolClients[destinationChainId].getCurrentTime(); + if (deposit.fillDeadline <= currentTime) { + return ignoreDeposit(); + } + const { minConfirmations } = minDepositConfirmations[originChainId].find(({ usdThreshold }) => usdThreshold.gte(fillAmountUsd) ) ?? { minConfirmations: 100_000 }; @@ -367,12 +373,6 @@ export class Relayer { return false; } - // It would be preferable to use host time since it's more reliably up-to-date, but this creates issues in test. - const currentTime = spokePoolClients[destinationChainId].getCurrentTime(); - if (deposit.fillDeadline <= currentTime) { - return false; - } - if (this.fillIsExclusive(deposit) && getAddress(deposit.exclusiveRelayer) !== this.relayerAddress) { return false; }