Skip to content

Commit

Permalink
Implement blockchain service (#318)
Browse files Browse the repository at this point in the history
* WIP implement blockchain service

* Update tests

* Fix runtime issues

* Update node core with fix

* Update changelogs and nodejs to lts
  • Loading branch information
stwiname authored Feb 27, 2025
1 parent 2469533 commit 112a0c6
Show file tree
Hide file tree
Showing 36 changed files with 1,153 additions and 1,223 deletions.
39 changes: 18 additions & 21 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ on:
workflow_dispatch:
inputs:
cpus:
description: 'docker cpus '
description: "docker cpus "
default: 2
require: true
memory:
description: 'docker memory'
default: '4g'
description: "docker memory"
default: "4g"
require: true
benchmark-time:
description: 'Benchmark time(h/m/s)'
description: "Benchmark time(h/m/s)"
default: 30m
require: true
indexerVersion:
description: 'indexer version'
default: 'latest'
description: "indexer version"
default: "latest"
require: true
deployment:
description: 'Deployment'
default: 'QmUiVCsuBKrPetipdQBDBPLZFqm87gzyRPQsYEfzzS3jzt' #Archway starter project
description: "Deployment"
default: "QmUiVCsuBKrPetipdQBDBPLZFqm87gzyRPQsYEfzzS3jzt" #Archway starter project
require: false
network-endpoint:
description: 'Network endpoint'
default: 'https://rpc.mainnet.archway.io:443'
description: "Network endpoint"
default: "https://rpc.mainnet.archway.io:443"
require: true
use-network-api-key:
description: 'Use api endpoint key'
description: "Use api endpoint key"
default: false
required: true
batch-size:
description: 'batch-size'
description: "batch-size"
default: 30
require: false
workers:
description: 'workers'
description: "workers"
default: 4
require: false
others:
description: 'Other flags'
description: "Other flags"
require: false

jobs:
Expand All @@ -48,7 +48,7 @@ jobs:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that `container-job` executes in
container: node:18
container: node:lts-alpine
services:
# Label used to access the service container
postgres:
Expand All @@ -70,7 +70,6 @@ jobs:
fetch-depth: 100
token: ${{ secrets.REPO_TOKEN }}


- name: Prepare Network Endpoint
id: prepare-network-endpoint
run: |
Expand All @@ -82,12 +81,12 @@ jobs:
echo "::set-output name=network-endpoint::${NETWORK_ENDPOINT}"
echo "::add-mask::${NETWORK_ENDPOINT}"
# Store the prepared NETWORK_ENDPOINT in an environment variable
echo "NETWORK_ENDPOINT=${NETWORK_ENDPOINT}" >> $GITHUB_ENV
echo "NETWORK_ENDPOINT=${NETWORK_ENDPOINT}" >> $GITHUB_ENV
- name: Install Docker inside the container
run: |
apt-get update
apt-get install -y docker.io
apt-get install -y docker.io
- name: Install PostgreSQL client
run: |
Expand Down Expand Up @@ -176,15 +175,14 @@ jobs:
name: benchmark-${{steps.current-time.outputs.formattedTime}}-${{steps.query_meta.outputs.indexer_version}}
path: output/benchmark/


- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# channel for sq-benchmark
channel-id: 'C05JF51F1MJ'
channel-id: "C05JF51F1MJ"
# For posting a rich message using Block Kit
payload: |
{
Expand All @@ -201,4 +199,3 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

- run: yarn install

Expand Down
90 changes: 45 additions & 45 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: PR
on:
pull_request:
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"
jobs:
code-style:
name: code-style
Expand All @@ -12,53 +12,53 @@ jobs:
SUBQL_ACCESS_TOKEN_TEST: ${{ secrets.SUBQL_ACCESS_TOKEN_TEST }}
SUBQL_ORG_TEST: ${{ secrets.SUBQL_ORG_TEST }}
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
- run: yarn
- name: build
run: yarn build
- name: code-style check
run: yarn pretty-quick --check --pattern 'packages/*/src/**/*' --branch origin/main
- name: lint
run: yarn lint
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*
- run: yarn
- name: build
run: yarn build
- name: code-style check
run: yarn pretty-quick --check --pattern 'packages/*/src/**/*' --branch origin/main
- name: lint
run: yarn lint

coverage:
name: Coverage report
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
name: Coverage report
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
steps:
- uses: actions/checkout@v3
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DB_USER: postgres
DB_PASS: postgres
DB_DATABASE: postgres
DB_HOST: postgres
DB_PORT: 5432
steps:
- uses: actions/checkout@v3

- name: Use Node 18
uses: actions/setup-node@v4
with:
node-version: 18
- name: Use Node.js environment
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Installing dependencies
run: yarn install
- name: Installing dependencies
run: yarn install

- uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: install
working-directory: ${{ matrix.path }}
test-script: yarn test-jest
annotations: none
- uses: artiomtr/jest-coverage-report-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-step: install
working-directory: ${{ matrix.path }}
test-script: yarn test-jest
annotations: none
6 changes: 3 additions & 3 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"

concurrency:
group: publish
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

- uses: marceloprado/has-changed-path@v1
id: changed-types
Expand Down Expand Up @@ -71,6 +71,6 @@ jobs:
- name: Commit changes
uses: EndBug/add-and-commit@v5
with:
message: '[SKIP CI] Prerelease'
message: "[SKIP CI] Prerelease"
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
paths-ignore:
- '.github/workflows/**'
- ".github/workflows/**"
workflow_dispatch:

concurrency:
Expand All @@ -13,7 +13,6 @@ concurrency:
cancel-in-progress: false

jobs:

# This gets the commit message because workflow dispatch doesnt set: github.event.head_commit.message
pre-ci:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -49,9 +48,9 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*

#Identify changes
#Identify changes
- uses: marceloprado/has-changed-path@v1
id: changed-types
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/*
- run: yarn

# Update deps
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@actions/core": "^1.10.0",
"@babel/preset-env": "^7.16.11",
"@octokit/request": "^5.6.3",
"@types/node": "^18.16.10",
"@types/node": "^22.13.5",
"@types/node-fetch": "2.6.2",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
Expand Down
2 changes: 2 additions & 0 deletions packages/common-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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]
### Changed
- Update `@subql/common` (#318)

## [5.2.0] - 2025-02-10
### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/common-cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@protobufs/google": "^0.0.10",
"@protobufs/ibc": "^0.1.0",
"@protobufs/tendermint": "^0.0.10",
"@subql/common": "^5.3.1",
"@subql/common": "^5.4.0",
"@subql/types-cosmos": "workspace:*",
"@subql/x-cosmology-telescope": "^1.4.14",
"fs-extra": "^11.1.1",
Expand Down
2 changes: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ 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]
### Changed
- Update `@subql/node-core` an implement BlockchainService (#318)

## [4.5.1] - 2025-02-13
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions packages/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM node:18-alpine as builder
FROM node:lts-alpine as builder
# Set working directory
WORKDIR /app

Expand All @@ -16,7 +16,7 @@ COPY ./scripts/build.sh ./scripts/build.sh
RUN ./scripts/build.sh packages/node

# Production stage
FROM node:18-alpine
FROM node:lts-alpine

# Copy .tgz file from builder
COPY --from=builder /app/packages/node/app.tgz /app.tgz
Expand Down
16 changes: 8 additions & 8 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
"@cosmjs/stargate": "npm:@subql/[email protected]",
"@cosmjs/tendermint-rpc": "npm:@subql/[email protected]",
"@kyvejs/sdk": "^1.3.2",
"@nestjs/common": "^9.4.0",
"@nestjs/core": "^9.4.0",
"@nestjs/common": "^11.0.10",
"@nestjs/core": "^11.0.10",
"@nestjs/event-emitter": "^2.0.0",
"@nestjs/platform-express": "^9.4.0",
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^5.3.1",
"@nestjs/platform-express": "^11.0.10",
"@nestjs/schedule": "^5.0.1",
"@subql/common": "^5.4.0",
"@subql/common-cosmos": "workspace:*",
"@subql/node-core": "^16.2.1",
"@subql/node-core": "^17.0.2",
"@subql/types-cosmos": "workspace:*",
"lodash": "^4.17.21",
"protobufjs": "^6.11.4",
Expand All @@ -40,8 +40,8 @@
"yargs": "^16.2.0"
},
"devDependencies": {
"@nestjs/schematics": "^9.2.0",
"@nestjs/testing": "^9.4.0",
"@nestjs/schematics": "^11.0.1",
"@nestjs/testing": "^11.0.10",
"@types/express": "^4.17.13",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.178",
Expand Down
Loading

0 comments on commit 112a0c6

Please sign in to comment.