Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
f92e9ba
fix: profile events storage relatively to insertion timestamp (#144)
amateima Jan 7, 2025
a8df10c
fix: revert redstone max block lookback (#145)
amateima Jan 8, 2025
5f92176
fix: fix building executed bundles (#146)
amateima Jan 12, 2025
92a6399
fix: rename deposit status unfilled value (#147)
amateima Jan 13, 2025
2913943
feat: add Soneium support (#148)
melisaguevara Jan 14, 2025
609f4cf
improve(perf-test): add perf markers for spoke event indexing (#150)
james-a-morris Jan 17, 2025
4398812
fix(webhook): use deposit on-chain id instead of db id (#149)
melisaguevara Jan 20, 2025
01e3ee7
fix: merge master into stage
amateima Jan 22, 2025
2f5a9c8
improve(spoke): improve running time (#151)
james-a-morris Jan 22, 2025
9108a18
fix: change depositId type for speedUps and slowFills tables (#153)
melisaguevara Jan 23, 2025
f1b35ee
fix: change depositId type for fills table (#154)
melisaguevara Jan 23, 2025
78a2423
fix: change depositId type for deposits table (#155)
melisaguevara Jan 23, 2025
a2a6e62
fix: change depositId type for RelayHashInfo table (#156)
melisaguevara Jan 23, 2025
4ed567c
fix: stringify error (#159)
melisaguevara Jan 23, 2025
7e6579a
fix: update repaymentChainId type and add new field for executedRelay…
melisaguevara Jan 23, 2025
635efe1
fix: restore mainnet max look back (#160)
melisaguevara Jan 23, 2025
d65d1f0
feat: track indexer class progress in sql (#158)
amateima Jan 24, 2025
04dac79
improve(performance): disable quote block lookup in spoke indexer (#162)
james-a-morris Jan 24, 2025
e7ef00e
fix: trigger deployment
amateima Jan 24, 2025
d2715c7
improve(spoke-processor): add perf logging (#164)
james-a-morris Jan 24, 2025
4712038
improve(spoke-indexer): optimize external association process (#165)
james-a-morris Jan 24, 2025
5829240
fix: trigger deployment
amateima Jan 24, 2025
567a659
improve(timing): reduce timing of lookback window (#167)
james-a-morris Jan 28, 2025
b4d8f66
improve(lookback): dynamically set max lookback (#168)
james-a-morris Jan 29, 2025
a867892
feat: support duplicated deposits and handle fill event matching (#163)
melisaguevara Feb 6, 2025
d416bb3
fix: update pnpm (#172)
melisaguevara Feb 6, 2025
1217e63
feat: handle unfinalised deposit events (#171)
melisaguevara Feb 6, 2025
0184bd0
feat: support doctor who (#173)
melisaguevara Feb 6, 2025
39bfb41
fix: reduce deletion time (#175)
melisaguevara Feb 6, 2025
79dba1f
feat: support bundles with duplicated relay hashes (#177)
amateima Feb 7, 2025
cb8b2ed
fix: add internal relay hash (#178)
amateima Feb 7, 2025
2aa4ebf
fix: fix fill events (#179)
amateima Feb 7, 2025
58c5da8
fix: update sdk with messageHash fix (#180)
melisaguevara Feb 7, 2025
7aade04
fix: trigger deployment
amateima Feb 7, 2025
2da22c1
fix: use internal hash for bundle events (#181)
melisaguevara Feb 8, 2025
17b649a
fix: refunded deposits webhook (#183)
melisaguevara Feb 11, 2025
d8379a8
fix: depositId type for webhooks (#184)
melisaguevara Feb 11, 2025
ab3fadb
feat(indexer): add coingecko price collection from tokens against usd…
daywiss Feb 12, 2025
511c283
fix: limit job retries (#187)
amateima Feb 12, 2025
0b1da0e
improve: change log level of some logs (#188)
daywiss Feb 12, 2025
c46b01d
fix: set internalHash as not nullable (#186)
melisaguevara Feb 12, 2025
681530d
fix(api): deposit status endpoint cache key (#192)
melisaguevara Feb 13, 2025
f23665d
fix: add support for cg api key and improve price worker (#189)
amateima Feb 13, 2025
41d6e7c
fix: price columns type (#191)
melisaguevara Feb 13, 2025
da4fdf9
fix: delete reference to deleted deposits from relay hash info (#190)
melisaguevara Feb 13, 2025
7a005e9
fix: slow fill requests indexing (#193)
melisaguevara Feb 17, 2025
188469a
fix: slow fills message field (#194)
melisaguevara Feb 17, 2025
15560ec
feat: add swap events (#169)
amateima Feb 19, 2025
3bb2a3c
fix: revert "feat: add swap events (#169)" (#195)
amateima Feb 19, 2025
7f9f64e
feat: add swap events (#196)
amateima Feb 19, 2025
637e515
fix: fix migrations order (#197)
amateima Feb 19, 2025
4a3349a
fix(migration): remove migration file due to duplicate entries (#198)
james-a-morris Feb 19, 2025
0361c80
fix: trigger deployment
amateima Feb 20, 2025
ed94475
fix: log error object
amateima Feb 24, 2025
294b96d
fix: api response for unsafe deposits (#205)
melisaguevara Feb 25, 2025
fb89e76
improve(db): load block range from postgres (#185)
james-a-morris Feb 25, 2025
087b97a
feat: add swap price worker (#174)
daywiss Feb 26, 2025
9478bf6
feat: set up test environment (#204)
melisaguevara Feb 26, 2025
725f8ee
fix: add logs for investigating null receipts (#211)
amateima Mar 4, 2025
80c5d77
feat: initial set of tests for relayHashInfo aggregations (#207)
melisaguevara Mar 10, 2025
2837732
feat: test accurate handling of duplicated deposits (#208)
melisaguevara Mar 10, 2025
6d1900f
feat: test accurate handling of deleted deposits (#209)
melisaguevara Mar 10, 2025
ec1cc12
feat: test status update for refunded deposits (#210)
melisaguevara Mar 10, 2025
b3c8022
fix: rename dr who to unichain (#214)
melisaguevara Mar 12, 2025
0cec4df
feat: refactor bundle service in hub indexer (#201)
james-a-morris Mar 12, 2025
0c059d8
fix: additional delay after indexer error handler (#215)
amateima Mar 14, 2025
17692cc
chore: update Across packages (#216)
melisaguevara Mar 17, 2025
82934f1
fix: improve error log (#220)
amateima Mar 19, 2025
2eefded
feat(svm): svm indexer data handler and solana constants (#217)
melisaguevara Mar 19, 2025
bfdcbda
feat(providersFactory): support svm providers (#221)
melisaguevara Mar 20, 2025
dc6b22a
feat(svm): initial svm indexing version (#219)
melisaguevara Mar 20, 2025
27f683b
chore: bump packages (#222)
melisaguevara Mar 20, 2025
ed3e127
fix: reduce initial update time of hubpool and config clients (#225)
amateima Mar 25, 2025
d4f077f
feat: add fill gas fee (#224)
amateima Mar 25, 2025
762435c
fix: fix redis infinity ttl (#230)
amateima Mar 26, 2025
ba6a3a4
fix: cache native token price (#232)
amateima Mar 26, 2025
e9d8774
improve(priceWorker): enable price worker with env (#229)
melisaguevara Mar 26, 2025
084f9e8
chore: bump packages to support Lens (#235)
melisaguevara Mar 26, 2025
44bc240
chore: bump sdk (#236)
melisaguevara Mar 26, 2025
cf37bfa
fix: remove column from pool rebalance save (#234)
amateima Mar 26, 2025
6d773b6
feat: support Lens (#239)
melisaguevara Mar 27, 2025
385a68b
fix: lens block time (#242)
melisaguevara Mar 27, 2025
68455a7
feat: add unfilled deposits (#244)
daywiss Mar 28, 2025
7d3a296
feat: add filled deposits endpoint (#226)
daywiss Mar 28, 2025
d435a34
feat(api): add unmatched fills endpoint (#238)
daywiss Mar 28, 2025
3a82966
fix: cap bundle end block (#248)
melisaguevara Apr 1, 2025
71a7a92
improve(api): add sorting by block time (#247)
daywiss Apr 1, 2025
5b8d664
chore: remove headers from provider set up (#249)
melisaguevara Apr 2, 2025
c47dc42
chore: add transaction hash to deposits unique constraint (#228)
melisaguevara Apr 3, 2025
fe1c19a
fix: bundle reconstruction start block (#252)
melisaguevara Apr 3, 2025
532ec68
improve(api): standardize deposit output type (#250)
daywiss Apr 4, 2025
4be66ef
feat: allow retry providers with caching disabled (#253)
amateima Apr 4, 2025
2f5f1c0
feat: add speedup array to deposits (#254)
daywiss Apr 7, 2025
08f89bf
fix(api): fix deposit queries to correct entity and props (#258)
daywiss Apr 9, 2025
c89505b
feat(svm): fetch integrator id from solana events (#255)
melisaguevara Apr 10, 2025
525fbcb
fix: add transactions table indexes (#259)
amateima Apr 10, 2025
c982dc4
improve(api): include slowFillRequested deposits in unfilled deposits…
melisaguevara Apr 16, 2025
7755c9a
feat: add api tests for deposits (#261)
daywiss Apr 17, 2025
b4f5f80
chore: add bundle events service block number env (#268)
amateima Apr 22, 2025
c4e811b
fix: improve deposits query
amateima Apr 16, 2025
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: 8 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DATABASE_HOST=postgres
DATABASE_PORT=5432
DATABASE_USER=user
DATABASE_PASSWORD=password
DATABASE_NAME=indexer-test-database

REDIS_HOST=redis
REDIS_PORT=6379
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Test
run: pnpm test
- name: Run tests using docker
run: pnpm test:e2e:docker
build:
name: Build
timeout-minutes: 15
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm turbo run check test
pnpm turbo run check
43 changes: 43 additions & 0 deletions docker-compose.e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:
# Indexer Service
indexer-scraper-e2e:
build:
context: .
container_name: indexer_service_e2e
volumes:
- .:/usr/src/app
- indexer-e2e-node-modules:/usr/src/app/node_modules
command: [sh, -c, "pnpm build && pnpm db:indexer-database:migrate:run && pnpm test"]
env_file:
- .env.test
tty: true
depends_on:
- postgres
- redis

# PostgreSQL Service
postgres:
image: postgres:13-alpine
container_name: postgres_e2e
env_file:
- .env.test
environment:
TZ: GMT
POSTGRES_DB: ${DATABASE_NAME}
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
volumes:
- indexer-e2e-pgdata:/var/lib/postgresql/data
ports:
- 5432:5432

# Redis Service
redis:
image: redis:6-alpine
container_name: redis_cache_e2e
volumes:
- indexer-e2e-redis-volume:/data
volumes:
indexer-e2e-node-modules:
indexer-e2e-pgdata:
indexer-e2e-redis-volume:
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"fix": "turbo fix",
"check": "turbo check",
"test": "turbo test",
"test:e2e:docker": "docker compose --env-file .env.test -f docker-compose.e2e.yml up --abort-on-container-exit --exit-code-from indexer-scraper-e2e",
"test:e2e:docker:prune": "docker compose --env-file .env.test -f docker-compose.e2e.yml down -v",
"start:indexer": "APP=indexer pnpm --filter @repo/node-app start",
"start:indexer:prod": "APP=indexer pnpm --filter @repo/node-app start:prod",
"start:indexer-api": "APP=indexer-api pnpm --filter @repo/node-app start",
Expand All @@ -25,7 +27,7 @@
"turbo": "^2.0.10",
"husky": "^9.1.4"
},
"packageManager": "pnpm@8.15.6",
"packageManager": "pnpm@9.15.5",
"engines": {
"node": ">=18"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/error-handling/src/utils/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { AssertError } from "../errors/AssertError";
* @returns An assertion of `value`.
* @throws {@link AssertError} if assert's validity fails
*/
export function assert(value: unknown, message: string): asserts value {
export function assert(
value: unknown,
message: string,
): asserts value is NonNullable<unknown> {
try {
return assertModule.ok(value, message);
} catch (e: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-api/.mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"spec": "**/*.test.ts",
"require": [
"ts-node/register"
"ts-node/register","dotenv/config"
],
"recursive": true
}
5 changes: 3 additions & 2 deletions packages/indexer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lint": "eslint --fix",
"lint:check": "eslint",
"check": "pnpm format:check && pnpm lint:check && pnpm build:check",
"test": "mocha",
"test": "DOTENV_CONFIG_PATH=./../../.env.test mocha",
"coverage": "nyc mocha",
"test:watch": "mocha --watch"
},
Expand All @@ -24,12 +24,13 @@
"dependencies": {
"@repo/error-handling": "workspace:*",
"@repo/indexer": "workspace:*",
"@repo/webhooks": "workspace:*",
"@repo/indexer-database": "workspace:*",
"@repo/webhooks": "workspace:*",
"@types/express": "^4.17.21",
"@types/supertest": "^6.0.2",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"ejs": "^3.1.10",
"express": "^4.19.2",
"ioredis": "^5.4.1",
Expand Down
33 changes: 32 additions & 1 deletion packages/indexer-api/src/controllers/deposits.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { Request, Response, NextFunction } from "express";
import * as s from "superstruct";
import { DepositsService } from "../services/deposits";
import { DepositsParams, DepositParams } from "../dtos/deposits.dto";
import {
DepositsParams,
DepositParams,
FilterDepositsParams,
} from "../dtos/deposits.dto";

export class DepositsController {
constructor(private service: DepositsService) {}
Expand Down Expand Up @@ -33,4 +37,31 @@ export class DepositsController {
next(err);
}
};

public getUnfilledDeposits = async (
req: Request,
res: Response,
next: NextFunction,
) => {
try {
const params = s.create(req.query, FilterDepositsParams);
const result = await this.service.getUnfilledDeposits(params);
return res.json(result);
} catch (err) {
next(err);
}
};
public getFilledDeposits = async (
req: Request,
res: Response,
next: NextFunction,
) => {
try {
const params = s.create(req.query, FilterDepositsParams);
const result = await this.service.getFilledDeposits(params);
return res.json(result);
} catch (err) {
next(err);
}
};
}
22 changes: 22 additions & 0 deletions packages/indexer-api/src/controllers/fills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Request, Response, NextFunction } from "express";
import * as s from "superstruct";
import { FillsService } from "../services/fills";
import { UnmatchedFillsParams } from "../dtos/fills.dto";

export class FillsController {
constructor(private service: FillsService) {}

public getUnmatchedFills = async (
req: Request,
res: Response,
next: NextFunction,
) => {
try {
const params = s.create(req.query, UnmatchedFillsParams);
const result = await this.service.getUnmatchedFills(params);
return res.json(result);
} catch (err) {
next(err);
}
};
}
79 changes: 77 additions & 2 deletions packages/indexer-api/src/dtos/deposits.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ export const DepositsParams = s.object({
// some kind of pagination options, skip could be the start point
skip: s.optional(stringToInt),
// pagination limit, how many to return after the start, note we convert string to number
limit: s.defaulted(stringToInt, 50),
limit: s.refine(
s.defaulted(stringToInt, 50),
"maxLimit",
(value) => value <= 1000 || "Limit must not exceed 1000",
),
});

export type DepositsParams = s.Infer<typeof DepositsParams>;

export const DepositParams = s.object({
depositId: s.optional(stringToInt),
depositId: s.optional(s.string()),
originChainId: s.optional(stringToInt),
depositTxHash: s.optional(s.string()),
relayDataHash: s.optional(s.string()),
Expand All @@ -39,3 +43,74 @@ export const DepositParams = s.object({
});

export type DepositParams = s.Infer<typeof DepositParams>;

export const FilterDepositsParams = s.object({
originChainId: s.optional(stringToInt),
destinationChainId: s.optional(stringToInt),
startTimestamp: s.optional(stringToInt),
endTimestamp: s.optional(stringToInt),
skip: s.defaulted(stringToInt, 0),
limit: s.refine(
s.defaulted(stringToInt, 50),
"maxLimit",
(value) => value <= 1000 || "Limit must not exceed 1000",
),
minSecondsToFill: s.optional(stringToInt),
});

export type FilterDepositsParams = s.Infer<typeof FilterDepositsParams>;

export type DepositReturnType = {
// Fields from V3FundsDeposited
id: number;
relayHash: string;
depositId: string;
originChainId: number;
destinationChainId: number;
depositor: string;
recipient: string;
inputToken: string;
inputAmount: string;
outputToken: string;
outputAmount: string;
message: string;
messageHash?: string;
exclusiveRelayer: string;
exclusivityDeadline?: Date;
fillDeadline: Date;
quoteTimestamp: Date;

depositTransactionHash: string;
depositBlockNumber: number;
depositBlockTimestamp?: Date;

// Fields from RelayHashInfo
status: entities.RelayStatus;
depositRefundTxHash?: string;
swapTokenPriceUsd?: string;
swapFeeUsd?: string;
bridgeFeeUsd?: string;
inputPriceUsd?: string;
outputPriceUsd?: string;
fillGasFee?: string;
fillGasFeeUsd?: string;
fillGasTokenPriceUsd?: string;

// from fill
relayer?: string;
fillBlockTimestamp?: Date;
fillTransactionHash?: string;

// from swap
swapTransactionHash?: string;
swapToken?: string;
swapTokenAmount?: string;

speedups?: {
transactionHash: string;
updatedRecipient: string;
updatedOutputAmount: string;
updatedMessage: string;
blockNumber: number;
}[];
};
25 changes: 25 additions & 0 deletions packages/indexer-api/src/dtos/fills.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as s from "superstruct";

const stringToInt = s.coerce(s.number(), s.string(), (value) => {
// Ensure the value is a valid integer string
if (!/^-?\d+$/.test(value)) {
return value;
}
return parseInt(value, 10);
});

export const UnmatchedFillsParams = s.object({
originChainId: s.optional(stringToInt),
destinationChainId: s.optional(stringToInt),
startTimestamp: s.optional(stringToInt),
endTimestamp: s.optional(stringToInt),
relayer: s.optional(s.string()),
skip: s.defaulted(stringToInt, 0),
limit: s.refine(
s.defaulted(stringToInt, 50),
"maxLimit",
(value) => value <= 1000 || "Limit must not exceed 1000",
),
});

export type UnmatchedFillsParams = s.Infer<typeof UnmatchedFillsParams>;
Loading
Loading