diff --git a/src/clients/BundleDataClient.ts b/src/clients/BundleDataClient.ts index 17af3c364..a1c38103a 100644 --- a/src/clients/BundleDataClient.ts +++ b/src/clients/BundleDataClient.ts @@ -42,7 +42,6 @@ import { ExpiredDepositsToRefundV3, LoadDataReturnValue, } from "../interfaces/BundleData"; -import { findLast } from "lodash"; type DataCache = Record>; @@ -248,7 +247,7 @@ export class BundleDataClient { // @dev Search from right to left since there can be multiple root bundles with the same relayer refund root. // The caller should take caution if they're trying to use this function to find matching refunds for older // root bundles as opposed to more recent ones. - const bundle = findLast( + const bundle = _.findLast( spokePoolClient.getRootBundleRelays(), (bundle) => bundle.relayerRefundRoot === relayerRefundRoot ); @@ -602,7 +601,7 @@ export class BundleDataClient { bundleInvalidFillsV3.push(fill); } else { assert(utils.isV3Deposit(historicalDeposit.deposit)); - const matchedDeposit: V3DepositWithBlock = historicalDeposit.deposit; + const matchedDeposit = historicalDeposit.deposit; // @dev Since queryHistoricalDepositForFill validates the fill by checking individual // object property values against the deposit's, we // sanity check it here by comparing the full relay hashes. If there's an error here then the diff --git a/src/dataworker/Dataworker.ts b/src/dataworker/Dataworker.ts index aafc6b17e..c627fa50a 100644 --- a/src/dataworker/Dataworker.ts +++ b/src/dataworker/Dataworker.ts @@ -1147,23 +1147,11 @@ export class Dataworker { !( fill.depositId === relayData.depositId && fill.originChainId === relayData.originChainId && - fill.destinationChainId === sdkUtils.getSlowFillLeafChainId(slowFill) && - fill.depositor === relayData.depositor && - fill.recipient === relayData.recipient && - fill.inputToken === relayData.inputToken && - sdkUtils.getFillOutputToken(fill) === sdkUtils.getRelayDataOutputToken(relayData) && - sdkUtils.getFillOutputAmount(fill).eq(sdkUtils.getRelayDataOutputAmount(relayData)) && - fill.message === relayData.message + sdkUtils.getV3RelayHash(fill, chainId) === sdkUtils.getV3RelayHash(relayData, chainId) ) ) { return false; } - - return ( - fill.fillDeadline === relayData.fillDeadline && - fill.exclusivityDeadline === relayData.exclusivityDeadline && - fill.exclusiveRelayer === relayData.exclusiveRelayer - ); }); return fill; @@ -1178,7 +1166,7 @@ export class Dataworker { throw new Error(`Leaf chainId does not match input chainId (${destinationChainId} != ${chainId})`); } - const outputAmount = sdkUtils.getRelayDataOutputAmount(slowFill.relayData); + const { outputAmount } = slowFill.relayData; const fill = latestFills[idx]; const amountRequired = isDefined(fill) ? bnZero : slowFill.updatedOutputAmount; @@ -1187,7 +1175,7 @@ export class Dataworker { return undefined; } - const outputToken = sdkUtils.getRelayDataOutputToken(slowFill.relayData); + const { outputToken } = slowFill.relayData; const success = await balanceAllocator.requestBalanceAllocation( destinationChainId, l2TokensToCountTowardsSpokePoolLeafExecutionCapital(outputToken, destinationChainId), @@ -1221,7 +1209,7 @@ export class Dataworker { assert(sdkUtils.getSlowFillLeafChainId(leaf) === chainId); const { relayData } = leaf; - const outputAmount = sdkUtils.getRelayDataOutputAmount(relayData); + const { outputAmount } = relayData; const mrkdwn = `rootBundleId: ${rootBundleId}\n` + `slowRelayRoot: ${slowRelayTree.getHexRoot()}\n` + diff --git a/src/dataworker/DataworkerUtils.ts b/src/dataworker/DataworkerUtils.ts index 81939c462..577a101c5 100644 --- a/src/dataworker/DataworkerUtils.ts +++ b/src/dataworker/DataworkerUtils.ts @@ -199,7 +199,6 @@ export function _buildSlowRelayRoot(bundleSlowFillsV3: BundleSlowFills): { } function buildV3SlowFillLeaf(deposit: interfaces.V3Deposit): V3SlowFillLeaf { - assert(utils.isV3Deposit(deposit)); const lpFee = deposit.inputAmount.mul(deposit.realizedLpFeePct).div(fixedPointAdjustment); return { diff --git a/src/scripts/validateRunningBalances.ts b/src/scripts/validateRunningBalances.ts index 4fd0b1e33..d2d2e3e92 100644 --- a/src/scripts/validateRunningBalances.ts +++ b/src/scripts/validateRunningBalances.ts @@ -252,9 +252,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Signer): Pr // Compute how much the slow fill will execute by checking if any fills were sent after the slow fill amount // was sent to the spoke pool. This would reduce the amount transferred when when the slow fill is executed. const slowFillsForPoolRebalanceLeaf = slowFills.filter( - (f) => - sdkUtils.getSlowFillLeafChainId(f) === leaf.chainId && - sdkUtils.getRelayDataOutputToken(f.relayData) === l2Token + (f) => f.chainId === leaf.chainId && f.relayData.outputToken === l2Token ); if (slowFillsForPoolRebalanceLeaf.length > 0) { @@ -295,9 +293,7 @@ export async function runScript(_logger: winston.Logger, baseSigner: Signer): Pr mostRecentValidatedBundle ); const slowFillsForPoolRebalanceLeaf = slowFills.filter( - (f) => - sdkUtils.getSlowFillLeafChainId(f) === leaf.chainId && - sdkUtils.getRelayDataOutputToken(f.relayData) === l2Token + (f) => f.chainId === leaf.chainId && f.relayData.outputToken === l2Token ); if (slowFillsForPoolRebalanceLeaf.length > 0) { for (const slowFillForChain of slowFillsForPoolRebalanceLeaf) {