Skip to content

Commit

Permalink
Merge branch 'stage' into mguevara/acx-3618-update-indexer-to-start-i…
Browse files Browse the repository at this point in the history
…ndexing-events
  • Loading branch information
melisaguevara authored Jan 14, 2025
2 parents 45ff200 + 92a6399 commit 226b1fb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/indexer-api/src/services/deposits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 29 additions & 1 deletion packages/indexer/src/services/BundleIncludedEventsService.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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,
},
Expand Down

0 comments on commit 226b1fb

Please sign in to comment.