From 710839e980376315a0dd199ba94192a11f7a8b6d Mon Sep 17 00:00:00 2001 From: Paul <108695806+pxrl@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:52:17 +0200 Subject: [PATCH] refactor(relayer): Defer origin chain limits computation (#1793) If there are no deposits then it doesn't make sense to compute this. Defer it in order to reduce log noise. --- src/relayer/Relayer.ts | 4 ++-- test/Relayer.BasicFill.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/relayer/Relayer.ts b/src/relayer/Relayer.ts index 43e60e8da..85a09b43d 100644 --- a/src/relayer/Relayer.ts +++ b/src/relayer/Relayer.ts @@ -717,8 +717,6 @@ export class Relayer { .flat() .map(({ deposit }) => deposit); - this.fillLimits = this.computeFillLimits(); - this.logger.debug({ at: "Relayer::checkForUnfilledDepositsAndFill", message: `${allUnfilledDeposits.length} unfilled deposits found.`, @@ -727,6 +725,8 @@ export class Relayer { return txnReceipts; } + this.fillLimits = this.computeFillLimits(); + const lpFees = await this.batchComputeLpFees(allUnfilledDeposits); await sdkUtils.forEachAsync(Object.entries(unfilledDeposits), async ([chainId, _deposits]) => { if (_deposits.length === 0) { diff --git a/test/Relayer.BasicFill.ts b/test/Relayer.BasicFill.ts index a58121775..98b74eab5 100644 --- a/test/Relayer.BasicFill.ts +++ b/test/Relayer.BasicFill.ts @@ -503,7 +503,7 @@ describe("Relayer: Check for Unfilled Deposits and Fill", async function () { for (const receipts of Object.values(txnReceipts)) { expect((await receipts).length).to.equal(0); } - expect(spyLogIncludes(spy, -3, "due to insufficient deposit confirmations.")).to.be.true; + expect(spyLogIncludes(spy, -2, "due to insufficient deposit confirmations.")).to.be.true; expect(lastSpyLogIncludes(spy, "0 unfilled deposits found.")).to.be.true; });