Skip to content

Commit

Permalink
Sync latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Oct 3, 2023
1 parent df5dee4 commit 54300e7
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 59 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,54 @@ jobs:
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}


node-build-push-docker-subquery:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
token: ${{ secrets.REPO_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: subquerynetwork
password: ${{ secrets.SQ_DOCKERHUB_TOKEN }}

## node
- name: Get updated node version
id: get-node-version
run: |
sh .github/workflows/scripts/nodeVersion.sh
- name: Build and push
if: github.event.inputs.isLatest == 'false'
uses: docker/build-push-action@v2
with:
push: true
platforms: arm64,amd64
file: ./packages/node/Dockerfile
tags: subquerynetwork/subql-node-near:v${{ steps.get-node-version.outputs.NODE_VERSION }},
build-args: RELEASE_VERSION=${{ steps.get-node-version.outputs.NODE_VERSION }}

- name: Build and push
if: github.event.inputs.isLatest == 'true'
uses: docker/build-push-action@v2
with:
push: true
platforms: arm64,amd64
file: ./packages/node/Dockerfile
tags: subquerynetwork/subql-node-near:v${{ steps.get-node-version.outputs.NODE_VERSION }},subquerynetwork/subql-node-near:latest
build-args: RELEASE_VERSION=${{ steps.get-node-version.outputs.NODE_VERSION }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

2 changes: 1 addition & 1 deletion packages/common-near/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"main": "dist/index.js",
"license": "GPL-3.0",
"dependencies": {
"@subql/common": "dev",
"@subql/common": "^3.1.0",
"@subql/types-core": "0.0.0-2",
"@subql/types-near": "workspace:*",
"js-yaml": "^4.1.0",
Expand Down
13 changes: 1 addition & 12 deletions packages/common-near/src/project/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
NearTransactionFilter,
NearActionHandler,
NearHandlerKind,
NearNetworkFilter,
NearRuntimeDatasource,
NearRuntimeHandler,
NearRuntimeHandlerFilter,
Expand Down Expand Up @@ -202,12 +201,6 @@ export class CustomMapping implements BaseMapping<Record<string, unknown>, NearC
file: string;
}

export class SubqlNetworkFilterImpl implements NearNetworkFilter {
@IsString()
@IsOptional()
specName?: string;
}

export class RuntimeDataSourceBase implements NearRuntimeDatasource {
@IsEnum(NearDatasourceKind, {groups: [NearDatasourceKind.Runtime]})
kind: NearDatasourceKind.Runtime;
Expand All @@ -219,10 +212,6 @@ export class RuntimeDataSourceBase implements NearRuntimeDatasource {
@IsOptional()
@IsInt()
startBlock?: number;
@IsOptional()
@ValidateNested()
@Type(() => SubqlNetworkFilterImpl)
filter?: NearNetworkFilter;
}

export class FileReferenceImpl implements FileReference {
Expand All @@ -231,7 +220,7 @@ export class FileReferenceImpl implements FileReference {
}

export class CustomDataSourceBase<K extends string, M extends CustomMapping, O = any>

Check warning on line 222 in packages/common-near/src/project/models.ts

View workflow job for this annotation

GitHub Actions / code-style

'O' is defined but never used

Check warning on line 222 in packages/common-near/src/project/models.ts

View workflow job for this annotation

GitHub Actions / code-style

Unexpected any. Specify a different type
implements NearCustomDatasource<K, M, O>
implements NearCustomDatasource<K, M>
{
@IsString()
kind: K;
Expand Down
1 change: 0 additions & 1 deletion packages/common-near/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export {
NearTransactionFilter,
NearActionFilter,
NearDatasourceProcessor,
NearNetworkFilter,
NearRuntimeHandlerFilter,
NearDatasourceKind,
RuntimeHandlerInputMap as NearRuntimeHandlerInputMap,
Expand Down
4 changes: 2 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@nestjs/event-emitter": "^2.0.0",
"@nestjs/platform-express": "^9.4.0",
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^3.0.1",
"@subql/common": "^3.1.0",
"@subql/common-near": "workspace:*",
"@subql/node-core": "^5.0.1",
"@subql/node-core": "^5.0.2",
"@subql/types-near": "workspace:*",
"cron-converter": "^1.0.2",
"eventemitter2": "^6.4.5",
Expand Down
31 changes: 31 additions & 0 deletions packages/node/src/indexer/dictionary.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: GPL-3.0

import { EventEmitter2 } from '@nestjs/event-emitter';
import { NodeConfig } from '@subql/node-core';
import { DictionaryService } from './dictionary.service';

describe('dictionary service', () => {
let dictionaryService: DictionaryService;

beforeEach(() => {
dictionaryService = new DictionaryService(
{
network: {
chainId: 'mainnet',
dictionary:
'https://api.subquery.network/sq/subquery/near-dictionary',
},
} as any,
{ dictionaryTimeout: 10000 } as NodeConfig,
new EventEmitter2(),
);
});

it('successfully validates metatada', async () => {
/* Genesis hash is unused with cosmos, chainId is used from project instead */
await expect(
dictionaryService.initValidation('mainnet'),
).resolves.toBeTruthy();
});
});
4 changes: 4 additions & 0 deletions packages/node/src/indexer/fetch.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ export class FetchService extends BaseFetchService<
);
}

protected getGenesisHash(): string {
return this.apiService.networkMeta.genesisHash;
}

protected async getFinalizedHeight(): Promise<number> {
const finalizedHeader = (await this.api.block({ finality: 'final' }))
.header;
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ initLogger(
const { setProfiler } = require('@subql/node-core');
setProfiler(argv.profiler);

if (argv._[0] === undefined) {
// Check for no subcommand
if (!argv._[0]) {
// Lazy import, to allow logger to be initialised before bootstrap()
// As bootstrap runs services that requires logger
const { bootstrap } = require('./init');
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"/dist"
],
"dependencies": {
"@subql/types-core": "dev",
"@subql/types-core": "^0.1.0",
"bn.js": "5.2.1",
"near-api-js": "^1.1.0"
},
Expand Down
73 changes: 32 additions & 41 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3098,7 +3098,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@subql/common-near@workspace:packages/common-near"
dependencies:
"@subql/common": dev
"@subql/common": ^3.1.0
"@subql/types-core": 0.0.0-2
"@subql/types-near": "workspace:*"
"@types/bn.js": 4.11.6
Expand All @@ -3112,11 +3112,11 @@ __metadata:
languageName: unknown
linkType: soft

"@subql/common@npm:3.0.1, @subql/common@npm:^3.0.1":
version: 3.0.1
resolution: "@subql/common@npm:3.0.1"
"@subql/common@npm:3.1.0, @subql/common@npm:^3.1.0":
version: 3.1.0
resolution: "@subql/common@npm:3.1.0"
dependencies:
"@subql/types-core": 0.0.1
"@subql/types-core": 0.1.0
axios: ^0.27.2
class-transformer: ^0.5.1
class-validator: ^0.14.0
Expand All @@ -3126,15 +3126,15 @@ __metadata:
reflect-metadata: ^0.1.13
semver: ^7.5.2
update-notifier: 5.1.0
checksum: 05cd5cdb0e22e7458bbe5c56adc04f5d9d57ae86be7b3efdccd0673a0630290f321d2bb742f9503ab001ccd048125553b75bbe38e82adc6af774f019e41c1e30
checksum: 43c7207acbc943cf1196c6ea0ecc6187b5a0a08a1f358861da5c2fa2db1b1a94ad6232850ef85e0c1a49274fd96d5c39204d860aa18d0e655fcad0b402df0220
languageName: node
linkType: hard

"@subql/common@npm:dev":
version: 2.7.1-3
resolution: "@subql/common@npm:2.7.1-3"
"@subql/common@npm:^3.0.1":
version: 3.0.1
resolution: "@subql/common@npm:3.0.1"
dependencies:
"@subql/types-core": 0.0.0-1
"@subql/types-core": 0.0.1
axios: ^0.27.2
class-transformer: ^0.5.1
class-validator: ^0.14.0
Expand All @@ -3144,22 +3144,22 @@ __metadata:
reflect-metadata: ^0.1.13
semver: ^7.5.2
update-notifier: 5.1.0
checksum: f05dcc0089f4e10abb438f5beb6dfc1156d2b1fb8b2053ebfbf9417e3f393df1ce5e14a50fcc57e429002704dfc2246b380649b9a3d0845bbb924165e6eb1861
checksum: 05cd5cdb0e22e7458bbe5c56adc04f5d9d57ae86be7b3efdccd0673a0630290f321d2bb742f9503ab001ccd048125553b75bbe38e82adc6af774f019e41c1e30
languageName: node
linkType: hard

"@subql/node-core@npm:^5.0.1":
version: 5.0.1
resolution: "@subql/node-core@npm:5.0.1"
"@subql/node-core@npm:^5.0.2":
version: 5.0.2
resolution: "@subql/node-core@npm:5.0.2"
dependencies:
"@apollo/client": ^3.7.16
"@nestjs/common": ^9.4.0
"@nestjs/event-emitter": ^2.0.0
"@nestjs/schedule": ^3.0.1
"@subql/apollo-links": ^1.0.2
"@subql/common": 3.0.1
"@subql/common": 3.1.0
"@subql/testing": 2.0.3-0
"@subql/types": 3.0.1
"@subql/types": 3.1.0
"@subql/utils": 2.4.4-1
"@subql/x-sequelize": 6.32.0-0.0.2
"@willsoto/nestjs-prometheus": ^5.4.0
Expand All @@ -3175,7 +3175,7 @@ __metadata:
tar: ^6.1.11
vm2: ^3.9.19
yargs: ^16.2.0
checksum: d6249dd269cdbe6d2fbf55a240e082ba444de44cd754558fbab2e0f5887155ded19c66d6212eda3a78bbf341ce28ca92960f7dbc3c7294741b82516995334424
checksum: e746752c239b4cdd9426ce664cee4330ca38e8bf8882646637404cecdb5f3e1ec846255ab5b3e19127de0c7c0d27ae22983400699b71b2a25bac473b1cb057a0
languageName: node
linkType: hard

Expand All @@ -3191,9 +3191,9 @@ __metadata:
"@nestjs/schedule": ^3.0.1
"@nestjs/schematics": ^9.2.0
"@nestjs/testing": ^9.4.0
"@subql/common": ^3.0.1
"@subql/common": ^3.1.0
"@subql/common-near": "workspace:*"
"@subql/node-core": ^5.0.1
"@subql/node-core": ^5.0.2
"@subql/types-near": "workspace:*"
"@types/express": ^4.17.13
"@types/jest": ^27.4.0
Expand Down Expand Up @@ -3230,15 +3230,6 @@ __metadata:
languageName: node
linkType: hard

"@subql/types-core@npm:0.0.0-1":
version: 0.0.0-1
resolution: "@subql/types-core@npm:0.0.0-1"
dependencies:
package-json-type: ^1.0.3
checksum: fd39376cd64622e34711dfc86c660e1cbc4fac5c72e7ee410d19b0753601024a7455b0b144fe4a1c9903f788686eb2f1c3cb50a7c9a1eb39933102b729958a42
languageName: node
linkType: hard

"@subql/types-core@npm:0.0.0-2":
version: 0.0.0-2
resolution: "@subql/types-core@npm:0.0.0-2"
Expand All @@ -3257,41 +3248,41 @@ __metadata:
languageName: node
linkType: hard

"@subql/types-core@npm:^0.0.0-1":
version: 0.0.0-0-ts-manifest
resolution: "@subql/types-core@npm:0.0.0-0-ts-manifest"
"@subql/types-core@npm:0.1.0, @subql/types-core@npm:^0.1.0":
version: 0.1.0
resolution: "@subql/types-core@npm:0.1.0"
dependencies:
package-json-type: ^1.0.3
checksum: e37e0df66471d763200baa00cf2bea526cdf0a5ee81b496473675e5404fe9553d56a6f7ebb6a6a22916981f6a2a2e2d303c538d8d3120fcd81267cc4703a88d2
checksum: fd86c2cf5148a4ad3af5c3a4fa7f0180f7a4d90fd3f6d96bc0e48eab6d73767220c859c751b21bbe08565d31eac5e8d0cee0148dee7ee7e0e273ff46182d3131
languageName: node
linkType: hard

"@subql/types-core@npm:dev":
version: 0.0.2-0
resolution: "@subql/types-core@npm:0.0.2-0"
"@subql/types-core@npm:^0.0.0-1":
version: 0.0.0-0-ts-manifest
resolution: "@subql/types-core@npm:0.0.0-0-ts-manifest"
dependencies:
package-json-type: ^1.0.3
checksum: b0461372e49d196810cf92727c9505d9b1751892d8548e1ddad1daad57ed7177556cae300f77260799ee2c8e2f33fe7774d0750033a3728f48f18aa13aea6d31
checksum: e37e0df66471d763200baa00cf2bea526cdf0a5ee81b496473675e5404fe9553d56a6f7ebb6a6a22916981f6a2a2e2d303c538d8d3120fcd81267cc4703a88d2
languageName: node
linkType: hard

"@subql/types-near@workspace:*, @subql/types-near@workspace:packages/types":
version: 0.0.0-use.local
resolution: "@subql/types-near@workspace:packages/types"
dependencies:
"@subql/types-core": dev
"@subql/types-core": ^0.1.0
"@types/app-module-path": ^2.2.0
bn.js: 5.2.1
near-api-js: ^1.1.0
languageName: unknown
linkType: soft

"@subql/types@npm:3.0.1":
version: 3.0.1
resolution: "@subql/types@npm:3.0.1"
"@subql/types@npm:3.1.0":
version: 3.1.0
resolution: "@subql/types@npm:3.1.0"
peerDependencies:
"@polkadot/api": ^10
checksum: 08bf82ecff0e6170b8962b685688aada7192019f9d7e0c309a395d8fc477d564a676e29d4f84232ae7fd8fb1feb9f0f7ca21e82ff83e4bcc11de94262fc368da
checksum: 31cd2870513e69b51c3acdd5016d2ed8fb8ce405366f912b26422b9169b236a5c5c6bb3b6a7592f7209f842d963083a08ebe3c299e81620e5752d4cc3522d552
languageName: node
linkType: hard

Expand Down

0 comments on commit 54300e7

Please sign in to comment.