Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(IndexedSpokePoolClient): Cast depositId correctly #2021

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Contract } from "ethers";
import { clients, utils as sdkUtils } from "@across-protocol/sdk";
import { Log } from "../interfaces";
import { CHAIN_MAX_BLOCK_LOOKBACK, RELAYER_DEFAULT_SPOKEPOOL_INDEXER } from "../common/Constants";
import { bnZero, EventSearchConfig, getNetworkName, isDefined, MakeOptional, winston } from "../utils";
import { bnZero, EventSearchConfig, getNetworkName, isDefined, MakeOptional, winston, BigNumber } from "../utils";
import { EventsAddedMessage, EventRemovedMessage } from "../utils/SuperstructUtils";

export type SpokePoolClient = clients.SpokePoolClient;
Expand Down Expand Up @@ -282,9 +282,11 @@ export class IndexedSpokePoolClient extends clients.SpokePoolClient {

// Find the latest deposit Ids, and if there are no new events, fall back to already stored values.
const fundsDeposited = eventsToQuery.indexOf("V3FundsDeposited");
const _firstDepositId = events[fundsDeposited].at(0)?.args?.depositId;
const _latestDepositId = events[fundsDeposited].at(-1)?.args?.depositId;
const [firstDepositId, latestDepositId] = [
events[fundsDeposited].at(0)?.args?.depositId ?? this.getDeposits().at(0) ?? bnZero,
events[fundsDeposited].at(-1)?.args?.depositId ?? this.getDeposits().at(-1) ?? bnZero,
_firstDepositId ? BigNumber.from(_firstDepositId) : this.getDeposits().at(0)?.depositId ?? bnZero,
bmzig marked this conversation as resolved.
Show resolved Hide resolved
_latestDepositId ? BigNumber.from(_latestDepositId) : this.getDeposits().at(-1)?.depositId ?? bnZero,
];

return {
Expand Down
2 changes: 1 addition & 1 deletion src/dataworker/Dataworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ export class Dataworker {
`slowRelayRoot: ${slowRelayTree.getHexRoot()}\n` +
`Origin chain: ${relayData.originChainId}\n` +
`Destination chain:${chainId}\n` +
`Deposit Id: ${relayData.depositId}\n` +
`Deposit Id: ${relayData.depositId.toString()}\n` +
`amount: ${outputAmount.toString()}`;

if (submitExecution) {
Expand Down
2 changes: 1 addition & 1 deletion src/relayer/Relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ export class Relayer {
this.logger.debug({
at: "Relayer::resolveRepaymentChain",
message: deposit.fromLiteChain
? `Deposit ${depositId} originated from over-allocated lite chain ${originChain}`
? `Deposit ${depositId.toString()} originated from over-allocated lite chain ${originChain}`
: `Unable to identify a preferred repayment chain for ${originChain} deposit ${depositId.toString()}.`,
txn: blockExplorerLink(transactionHash, originChainId),
});
Expand Down
Loading