Skip to content

Commit

Permalink
improve: Add InvalidSlowFillRequest known reason to MultiCallerClient (
Browse files Browse the repository at this point in the history
…#1233)

This gets emitted when a slow fill request has already been sent for a relay hash.

Also adds case insensitivity to multicaller client
  • Loading branch information
nicholaspai authored Feb 23, 2024
1 parent 34ad18e commit 43bb6ca
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/clients/MultiCallerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ 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", "RelayFilled", "ClaimedMerkleLeaf"]);
export const knownRevertReasons = new Set([
"relay filled",
"Already claimed",
"RelayFilled",
"ClaimedMerkleLeaf",
"InvalidSlowFillRequest",
]);

// 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
Expand Down Expand Up @@ -445,11 +451,14 @@ export class MultiCallerClient {
// string that includes more than just the contract revert reason.
protected canIgnoreRevertReason(txn: TransactionSimulationResult): boolean {
const { transaction: _txn, reason } = txn;
const knownReason = [...knownRevertReasons].some((knownReason) => reason.includes(knownReason));
const lowerCaseReason = reason.toLowerCase();
const knownReason = [...knownRevertReasons].some((knownReason) =>
lowerCaseReason.includes(knownReason.toLowerCase())
);
return (
knownReason ||
(unknownRevertReasonMethodsToIgnore.has(_txn.method) &&
unknownRevertReasons.some((_reason) => reason.includes(_reason)))
unknownRevertReasons.some((_reason) => lowerCaseReason.includes(_reason.toLowerCase())))
);
}

Expand Down

0 comments on commit 43bb6ca

Please sign in to comment.