Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Mar 26, 2024
1 parent b82f328 commit 84202af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/dataworker/Dataworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,19 +1139,20 @@ export class Dataworker {

const sortedFills = client.getFills().filter(sdkUtils.isV3Fill<V3FillWithBlock, V2FillWithBlock>);
const latestFills = leaves.map((slowFill) => {
const { relayData } = slowFill;
const { relayData, chainId: slowFillChainId } = slowFill;

// Start with the most recent fills and search backwards.
const fill = _.findLast(sortedFills, (fill) => {
if (
!(
fill.depositId === relayData.depositId &&
fill.originChainId === relayData.originChainId &&
sdkUtils.getV3RelayHash(fill, chainId) === sdkUtils.getV3RelayHash(relayData, chainId)
sdkUtils.getV3RelayHash(fill, chainId) === sdkUtils.getV3RelayHash(relayData, slowFillChainId)
)
) {
return false;
}
return true;
});

return fill;
Expand Down
5 changes: 2 additions & 3 deletions test/Dataworker.executeSlowRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe("Dataworker: Execute slow relays", async function () {
it("Ignores V3 slow fills that were replaced by a fast fill", async function () {
await updateAllClients();

await depositV3(
const deposit = await depositV3(
spokePool_1,
destinationChainId,
depositor,
Expand All @@ -117,7 +117,6 @@ describe("Dataworker: Execute slow relays", async function () {
amountToDeposit
);
await updateAllClients();
const deposit = spokePoolClients[originChainId].getDeposits()[0];
await requestSlowFill(spokePool_2, depositor, deposit);

await updateAllClients();
Expand Down Expand Up @@ -159,7 +158,7 @@ describe("Dataworker: Execute slow relays", async function () {
expect(multiCallerClient.transactionCount()).to.equal(1);

// Replace slow fill, and check that it no longer tries to get executed by dataworker.
await fillV3(spokePool_2, relayer, deposit, deposit.realizedLpFeePct);
await fillV3(spokePool_2, relayer, deposit);
await updateAllClients();
multiCallerClient.clearTransactionQueue();
await dataworkerInstance.executeSlowRelayLeaves(spokePoolClients, new BalanceAllocator(providers));
Expand Down

0 comments on commit 84202af

Please sign in to comment.