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

common: Upgrade @graphprotocol/cost-model #829

Merged
merged 7 commits into from
Jan 24, 2024
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
6 changes: 5 additions & 1 deletion .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ on:

jobs:
check:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js v20
uses: actions/[email protected]
with:
node-version: 20
- name: Build and Format
run: yarn
- name: Check Formatting
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
strategy:
matrix:
node-version: [16, 18]
node-version: [18, 19, 20]
system:
- os: ubuntu-22.04
runs-on: ${{ matrix.system.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

strategy:
fail-fast: false
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/indexer-agent-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
packages: write

Expand All @@ -34,6 +34,14 @@ jobs:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Node.js v20
uses: actions/[email protected]
with:
node-version: 20
- name: Build and push Indexer Agent image
id: docker_build
uses: docker/build-push-action@v2
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/indexer-cli-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
packages: write

Expand All @@ -34,6 +34,14 @@ jobs:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Node.js v20
uses: actions/[email protected]
with:
node-version: 20
- name: Build and push Indexer CLI image
id: docker_build
uses: docker/build-push-action@v2
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/indexer-service-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
packages: write

Expand All @@ -34,6 +34,14 @@ jobs:
registry: ghcr.io
username: ${{github.repository_owner}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up Node.js v20
uses: actions/[email protected]
with:
node-version: 20
- name: Build and push Indexer Service image
id: docker_build
uses: docker/build-push-action@v2
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/publish-native-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
# (https://github.com/bchr02/node-pre-gyp-github/issues/42)
fail-fast: false
matrix:
node_version: [16, 17, 18, 19, 20]
node_version: [18, 19, 20]
system:
- os: macos-latest
- os: macos-12
target: x86_64-apple-darwin
- os: ubuntu-20.04
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
include:
- node_version: 18
- node_version: 17
system:
os: ubuntu-22.04
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- node_version: 18
- node_version: 17
system:
os: macos-latest
os: macos-11
target: x86_64-apple-darwin
runs-on: ${{ matrix.system.os }}
steps:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.indexer-agent
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
########################################################################
# Build image

FROM node:16.15-bullseye-slim as build
FROM node:20.11-bookworm-slim as build

ENV NODE_ENV production

RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand All @@ -29,7 +29,7 @@ RUN yarn --frozen-lockfile --non-interactive --production=false
########################################################################
# Runtime image

FROM node:16.15-bullseye-slim
FROM node:20.11-bookworm-slim

ENV NODE_ENV production
# When simulating large transactions, sometimes indexer-agent runs out of memory.
Expand All @@ -38,7 +38,7 @@ ENV NODE_ENV production
ENV NODE_OPTIONS="--max-old-space-size=1536"


RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.indexer-cli
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
########################################################################
# Build image

FROM node:16.15-bullseye-slim as build
FROM node:20.11-bookworm-slim as build

ENV NODE_ENV production

RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand All @@ -30,11 +30,11 @@ RUN yarn --frozen-lockfile --non-interactive --production=false
########################################################################
# Runtime image

FROM node:16.15-bullseye-slim
FROM node:20.11-bookworm-slim

ENV NODE_ENV production

RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.indexer-service
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
########################################################################
# Build image

FROM node:16.15-bullseye-slim as build
FROM node:20.11-bookworm-slim as build

ENV NODE_ENV production

RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand All @@ -30,11 +30,11 @@ RUN yarn --frozen-lockfile --non-interactive --production=false
########################################################################
# Runtime image

FROM node:16.15-bullseye-slim
FROM node:20.11-bookworm-slim

ENV NODE_ENV production

RUN apt-get update && apt-get install -y python build-essential git curl
RUN apt-get update && apt-get install -y python3 build-essential git curl

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh && sh /tmp/rustup.sh -y
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
},
"engines": {
"node": ">=12.22.0"
},
"jest": {
"transformIgnorePatterns": [
"node_modules/([email protected])"
]
}
}
5 changes: 3 additions & 2 deletions packages/indexer-agent/src/__tests__/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const setup = async () => {
const networkSpecification = specification.NetworkSpecification.parse({
networkIdentifier: 'eip155:5',
gateway: {
url: 'http://localhost:8030/',
url: 'http://127.0.0.1:8030/',
},
networkProvider: {
url: testProviderUrl,
Expand All @@ -163,8 +163,9 @@ const setup = async () => {
url: 'http://test-indexer.xyz',
},
subgraphs: {
maxBlockDistance: 10000,
networkSubgraph: {
url: 'http://test-url.xyz',
url: 'https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-goerli',
},
epochSubgraph: {
url: 'http://test-url.xyz',
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-agent/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"target": "es2015",
"target": "es2020",
"module": "commonjs",
"declaration": true,
"sourceMap": true,
Expand Down
14 changes: 2 additions & 12 deletions packages/indexer-cli/src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,14 @@ describe('Indexer cli tests', () => {
})
cliTest(
'Indexer connect - success',
['indexer', 'connect', 'http://localhost:18000'],
'references/indexer-connect',
{
expectedExitCode: 0,
cwd: baseDir,
timeout: 10000,
},
)
// TODO: Connect should fail with helpful error message if incorrect port is provided or server isn't live
cliTest(
'Indexer connect - success with incorrect port',
['indexer', 'connect', 'http://localhost:18003'],
['indexer', 'connect', 'http://127.0.0.1:18000'],
'references/indexer-connect',
{
expectedExitCode: 0,
cwd: baseDir,
timeout: 10000,
},
)
// TODO: Test that connect should fail with helpful error message if incorrect port is provided or server isn't live
})
})
42 changes: 13 additions & 29 deletions packages/indexer-cli/src/__tests__/indexer/actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { cliTest, setup, teardown } from '../util'
import { cliTest, deleteFromAllTables, seedActions, setup, teardown } from '../util'
import path from 'path'
import { Action, ActionType, ActionStatus } from '@graphprotocol/indexer-common'

const baseDir = path.join(__dirname, '..')
describe('Indexer actions tests', () => {
describe('With indexer management server', () => {
beforeAll(setup)
afterAll(teardown)
beforeEach(seedActions)
afterEach(deleteFromAllTables)
describe('Actions help', () => {
cliTest('Indexer actions', ['indexer', 'actions'], 'references/indexer-actions', {
expectedExitCode: 255,
Expand All @@ -23,10 +24,18 @@ describe('Indexer actions tests', () => {
timeout: 10000,
},
)
cliTest(
'Indexer actions get',
['indexer', 'actions', 'get', 'all'],
'references/indexer-actions-get',
{
expectedExitCode: 0,
cwd: baseDir,
timeout: 10000,
},
)
})
describe('Actions queue', () => {
beforeAll(createTestAction)
afterAll(truncateActions)
cliTest(
'Indexer actions get',
['indexer', 'actions', 'get', 'all'],
Expand Down Expand Up @@ -78,28 +87,3 @@ describe('Indexer actions tests', () => {
})
})
})

async function createTestAction() {
await Action.create({
type: ActionType.ALLOCATE,
status: ActionStatus.SUCCESS,
deploymentID: 'QmZZtzZkfzCWMNrajxBf22q7BC9HzoT5iJUK3S8qA6zNZr',
source: 'test',
reason: 'test',
protocolNetwork: 'eip155:5',
})
await Action.create({
type: ActionType.UNALLOCATE,
status: ActionStatus.FAILED,
deploymentID: 'QmfWRZCjT8pri4Amey3e3mb2Bga75Vuh2fPYyNVnmPYL66',
source: 'test',
reason: 'test',
protocolNetwork: 'eip155:5',
})
}

async function truncateActions() {
await Action.destroy({
truncate: true,
})
}
Loading
Loading