From a894e3714c7d94d08bff9c806088601893d45d67 Mon Sep 17 00:00:00 2001 From: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:48:38 -0500 Subject: [PATCH] fix: MulticallerClient should ignore expected reverts for V3 fills (#1217) * fix: MulticallerClient should ignore expected reverts for V3 fills This will filter out the barrage of duplicate fill issues * Update MultiCallerClient.ts * Update MultiCallerClient.ts * add call static * Revert "add call static" This reverts commit ea994f451afd25c6faa0624a2744f2d449f564fc. * Update MultiCallerClient.ts --- package.json | 2 +- src/clients/MultiCallerClient.ts | 20 ++++++++++++++++---- src/utils/TransactionUtils.ts | 21 +++++++++++++++++++-- test/MultiCallerClient.ts | 19 +++++++++++-------- yarn.lock | 28 ++++------------------------ 5 files changed, 51 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 6ea770273..b6ec35048 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "@across-protocol/constants-v2": "1.0.8", "@across-protocol/contracts-v2": "2.5.0-beta.7", - "@across-protocol/sdk-v2": "0.22.2", + "@across-protocol/sdk-v2": "0.22.4", "@arbitrum/sdk": "^3.1.3", "@defi-wonderland/smock": "^2.3.5", "@eth-optimism/sdk": "^3.1.0", diff --git a/src/clients/MultiCallerClient.ts b/src/clients/MultiCallerClient.ts index 6954ce57a..5ec2e52f4 100644 --- a/src/clients/MultiCallerClient.ts +++ b/src/clients/MultiCallerClient.ts @@ -24,18 +24,26 @@ import lodash from "lodash"; // .includes() to partially match reason string in order to not ignore errors thrown by non-contract reverts. // For example, a NodeJS error might result in a reason string that includes more than just the contract r // evert reason. -export const knownRevertReasons = new Set(["relay filled", "Already claimed"]); +export const knownRevertReasons = new Set(["relay filled", "Already claimed", "RelayFilled", "ClaimedMerkleLeaf"]); // The following reason potentially includes false positives of reverts that we should be alerted on, however // there is something likely broken in how the provider is interpreting contract reverts. Currently, there are // a lot of duplicate transaction sends that are reverting with this reason, for example, sending a transaction // to execute a relayer refund leaf takes a while to execute and ends up reverting because a duplicate transaction // mines before it. This situation leads to this revert reason which is spamming the Logger currently. -export const unknownRevertReason = - "missing revert data in call exception; Transaction reverted without a reason string"; +export const unknownRevertReasons = [ + "missing revert data in call exception; Transaction reverted without a reason string", + // execution reverted is the error reason when a require statement with a custom error is thrown. + "execution reverted", +]; export const unknownRevertReasonMethodsToIgnore = new Set([ + "multicall", "fillRelay", "fillRelayWithUpdatedFee", + "fillV3Relay", + "fillV3RelayWithUpdatedDeposit", + "requestV3SlowFill", + "executeV3SlowRelayLeaf", "executeSlowRelayLeaf", "executeRelayerRefundLeaf", "executeRootBundle", @@ -438,7 +446,11 @@ export class MultiCallerClient { protected canIgnoreRevertReason(txn: TransactionSimulationResult): boolean { const { transaction: _txn, reason } = txn; const knownReason = [...knownRevertReasons].some((knownReason) => reason.includes(knownReason)); - return knownReason || (unknownRevertReasonMethodsToIgnore.has(_txn.method) && reason.includes(unknownRevertReason)); + return ( + knownReason || + (unknownRevertReasonMethodsToIgnore.has(_txn.method) && + unknownRevertReasons.some((_reason) => reason.includes(_reason))) + ); } // Filter out transactions that revert for non-critical, expected reasons. For example, the "relay filled" error may diff --git a/src/utils/TransactionUtils.ts b/src/utils/TransactionUtils.ts index 8750b98b0..dd87cadee 100644 --- a/src/utils/TransactionUtils.ts +++ b/src/utils/TransactionUtils.ts @@ -169,9 +169,26 @@ export async function willSucceed(transaction: AugmentedTransaction): Promise