diff --git a/packages/indexer-api/src/services/deposits.ts b/packages/indexer-api/src/services/deposits.ts index d36de052..0ce5ed78 100644 --- a/packages/indexer-api/src/services/deposits.ts +++ b/packages/indexer-api/src/services/deposits.ts @@ -156,7 +156,10 @@ export class DepositsService { } const result = { - status: relay.status, + status: + relay.status === entities.RelayStatus.Unfilled + ? "pending" + : relay.status, originChainId: relay.originChainId, depositId: relay.depositId, depositTxHash: relay.depositTxHash, diff --git a/packages/indexer/src/services/BundleIncludedEventsService.ts b/packages/indexer/src/services/BundleIncludedEventsService.ts index 849254ec..95041057 100644 --- a/packages/indexer/src/services/BundleIncludedEventsService.ts +++ b/packages/indexer/src/services/BundleIncludedEventsService.ts @@ -1,7 +1,10 @@ import * as across from "@across-protocol/sdk"; +import { getDeployedBlockNumber } from "@across-protocol/contracts"; import Redis from "ioredis"; import winston from "winston"; + import { DataSource, entities } from "@repo/indexer-database"; + import { BaseIndexer } from "../generics"; import { BundleRepository } from "../database/BundleRepository"; import * as utils from "../utils"; @@ -191,12 +194,37 @@ export class BundleIncludedEventsService extends BaseIndexer { const blockTime = getBlockTime(chainId); const endBlockTimeBuffer = 60 * 15; const blockBuffer = Math.round(endBlockTimeBuffer / blockTime); + const endBlockWithBuffer = endBlock + blockBuffer; + const deployedBlockNumber = getDeployedBlockNumber( + "SpokePool", + chainId, + ); + this.logger.debug({ + at: "Indexer#BundleIncludedEventsService#getSpokeClientsForLookbackBlockRange", + message: `Instantiate SpokePool client for chain ${chainId}`, + deployedBlockNumber, + startBlock, + endBlockWithBuffer, + }); + // A chain can be included in the bundle even if the SpokePool is not deployed yet + // In this case, the SpokePool client will not be instantiated and updated + if (deployedBlockNumber > endBlock) { + this.logger.debug({ + at: "Indexer#BundleIncludedEventsService#getSpokeClientsForLookbackBlockRange", + message: `SpokePool client not instantiated as it is not deployed yet for chain ${chainId}`, + deployedBlockNumber, + startBlock, + endBlockWithBuffer, + }); + return acc; + } + return { ...acc, [chainId]: spokePoolClientFactory.get( chainId, startBlock, - endBlock + blockBuffer, + endBlockWithBuffer, { hubPoolClient: this.hubPoolClient, },