Skip to content

Commit

Permalink
feat(relayer): Rate-limit invalid fill logs (#2063)
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl authored Feb 20, 2025
1 parent fd42f0b commit 3735439
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/relayer/Relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,19 @@ export class Relayer {
return ignoreDeposit();
}

// Skip deposits that contain invalid fills from the same relayer. This prevents potential corrupted data from
// making the same relayer fill a deposit multiple times.
if (!acceptInvalidFills && invalidFills.some((fill) => fill.relayer === this.relayerAddress)) {
this.logger.error({
at: "Relayer::filterDeposit",
message: "πŸ‘¨β€πŸ‘§β€πŸ‘¦ Skipping deposit with invalid fills from the same relayer",
deposit,
invalidFills,
destinationChainId,
});
return ignoreDeposit();
}

const { minConfirmations } = minDepositConfirmations[originChainId].find(({ usdThreshold }) =>
usdThreshold.gte(fillAmountUsd)
);
Expand Down Expand Up @@ -364,19 +377,6 @@ export class Relayer {
return false;
}

// Skip deposits that contain invalid fills from the same relayer. This prevents potential corrupted data from
// making the same relayer fill a deposit multiple times.
if (!acceptInvalidFills && invalidFills.some((fill) => fill.relayer === this.relayerAddress)) {
this.logger.error({
at: "Relayer::filterDeposit",
message: "πŸ‘¨β€πŸ‘§β€πŸ‘¦ Skipping deposit with invalid fills from the same relayer",
deposit,
invalidFills,
destinationChainId,
});
return false;
}

// We query the relayer API to get the deposit limits for different token and origin combinations.
// The relayer should *not* be filling deposits that the HubPool doesn't have liquidity for otherwise the relayer's
// refund will be stuck for potentially 7 days. Note: Filter for supported tokens first, since the relayer only
Expand Down

0 comments on commit 3735439

Please sign in to comment.