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

L2 support for Indexer Agent #668

Merged
merged 16 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: "Check Formatting"
on:
push:
branches: [main]
pull_request:
branches: [main]
pull_request: {}

jobs:
check:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
pull_request: {}

jobs:
build:
strategy:
matrix:
node-version: [14, 16, 17]
node-version: [16, 18]
system:
- os: ubuntu-20.04
include:
- node_version: 18
system:
os: ubuntu-22.04
- os: ubuntu-22.04
runs-on: ${{ matrix.system.os }}
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-native-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# (https://github.com/bchr02/node-pre-gyp-github/issues/42)
fail-fast: false
matrix:
node_version: [14, 16, 17]
node_version: [16, 17, 18, 19, 20]
system:
- os: macos-latest
target: x86_64-apple-darwin
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
},
"resolutions": {
"ethers": "5.7.0",
"sequelize": "6.19.0",
"sequelize": "6.31.1",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@urql/core": "2.4.4",
"@urql/exchange-execute": "1.2.2"
},
"overrides": {
"ethers": "5.7.0",
"sequelize": "6.19.0",
"sequelize": "6.31.1",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@urql/core": "2.4.4",
Expand Down
25 changes: 25 additions & 0 deletions packages/indexer-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- A new migration to add the `protocolNetwork` column as a composite primary key to the following tables:
- Actions
- IndexingRules
- POIDisputes
- allocation_receipts
- vouchers
- transfer_receipts
- transfers
- allocation_summaries

- The Agent can now be configured for multiple protocol networks.
To enable this feature, start the agent with the environment variable `INDEXER_AGENT_MULTINETWORK_MODE` set to
`true` and specify a directory containing YAML network specification files, one per network.

- The Agent can be configured to automatically support subgraph transfers from L1 to L2. To enable
this feature, set the `enable-auto-migration-support` startup option to `true`.

### Changed

- The Agent GraphQL API was updated to accept (and in some cases require) a `protocolNetwork`
parameter to determine which network should be used for queries or mutations.

- The `/network` endpoint exposed by the Agent now requires an additional path segment to disambiguate
which protocol network it should target, like `/network/mainnet` or `/network/arbitrum-one`.

## [0.20.17] - 2023-06-19
### Changed
Expand Down
7 changes: 5 additions & 2 deletions packages/indexer-agent/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
const bail = (s) => {
const bail = s => {
throw new Error(s)
}

module.exports = {
collectCoverage: true,
forceExit: true,
preset: 'ts-jest',
testEnvironment: 'node',
testPathIgnorePatterns: ['/node_modules/', '/dist/', '.yalc'],
globals: {
__DATABASE__: {
host: process.env.POSTGRES_TEST_HOST || bail('POSTGRES_TEST_HOST is not defined'),
host:
process.env.POSTGRES_TEST_HOST ||
bail('POSTGRES_TEST_HOST is not defined'),
port: parseInt(process.env.POSTGRES_TEST_PORT || '5432'),
username:
process.env.POSTGRES_TEST_USERNAME ||
Expand Down
17 changes: 13 additions & 4 deletions packages/indexer-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"scripts": {
"format": "prettier --write 'src/**/*.ts'",
"lint": "eslint . --ext .ts,.tsx --fix",
"compile": "tsc",
"compile": "tsc --build",
"prepare": "yarn format && yarn lint && yarn compile",
"start": "node ./dist/index.js start",
"test": "jest --colors --verbose",
"test": "jest --colors --verbose --detectOpenHandles",
"test:ci": "jest --verbose --ci",
"clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo",
"migrator:pending": "node src/db/cli/migrator pending",
Expand All @@ -43,6 +43,9 @@
"graphql-tag": "2.12.6",
"isomorphic-fetch": "3.0.0",
"jayson": "3.6.6",
"lodash.isequal": "^4.5.0",
"lodash.mapvalues": "^4.6.0",
"lodash.zip": "^4.2.0",
"ngeohash": "0.6.3",
"p-filter": "2.1.0",
"p-map": "4.0.0",
Expand All @@ -51,12 +54,18 @@
"p-retry": "4.6.1",
"umzug": "3.0.0",
"yaml": "^2.0.0-10",
"yargs": "17.4.1"
"yargs": "17.4.1",
"zod": "^3.21.4",
"zod-validation-error": "^1.3.0"
},
"devDependencies": {
"@types/bs58": "4.0.1",
"@types/isomorphic-fetch": "0.0.36",
"@types/jest": "27.4.1",
"@types/lodash.countby": "^4.6.7",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.mapvalues": "^4.6.7",
"@types/lodash.zip": "^4.2.7",
"@types/ngeohash": "0.6.4",
"@types/node": "17.0.23",
"@types/yargs": "17.0.10",
Expand All @@ -73,7 +82,7 @@
},
"resolutions": {
"ethers": "5.7.0",
"sequelize": "6.19.0",
"sequelize": "6.31.1",
"@ethersproject/bignumber": "5.7.0",
"@ethersproject/providers": "5.7.0"
},
Expand Down
Loading
Loading