Skip to content

Commit

Permalink
[release] 20231026 Sync @subql dependencies (#71)
Browse files Browse the repository at this point in the history
* Update @subql deps

* Apply changes from node-core, update changelogs

* [release] 20231026

* Fix test

---------

Co-authored-by: stwiname <[email protected]>
  • Loading branch information
stwiname and stwiname authored Oct 25, 2023
1 parent 72ccaa3 commit 407b672
Show file tree
Hide file tree
Showing 17 changed files with 98 additions and 137 deletions.
3 changes: 2 additions & 1 deletion .yarn/versions/a42fee2f.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
undecided:
- "@subql/common-near"
- "@subql/node-near"
- "@subql/types-near"
7 changes: 6 additions & 1 deletion packages/common-near/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.1] - 2023-10-26
### Changed
- Update @subql/common

## [3.0.0] - 2023-10-04
### Added
- Parent field to manifest for project upgrades
Expand Down Expand Up @@ -50,7 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add transaction receipts handlers and filters (#13)

## [1.0.0] - 2023-01-26
[Unreleased]: https://github.com/subquery/subql-near/compare/common-near/3.0.0...HEAD
[Unreleased]: https://github.com/subquery/subql-near/compare/common-near/3.0.1...HEAD
[3.0.1]: https://github.com/subquery/subql-near/compare/common-near/3.0.0...common-near/3.0.1
[3.0.0]: https://github.com/subquery/subql-near/compare/commonm-near/2.4.1...commonm-near/3.0.0
[2.4.1]: https://github.com/subquery/subql-near/compare/common-near/2.4.0...common-near/2.4.1
[2.4.0]: https://github.com/subquery/subql-near/compare/common-near/2.3.0...common-near/2.4.0
Expand Down
7 changes: 4 additions & 3 deletions packages/common-near/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "@subql/common-near",
"version": "3.0.0",
"version": "3.0.1",
"description": "",
"scripts": {
"build": "rm -rf dist && tsc -b",
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --write \"src/**/*.ts\""
"format": "prettier --write \"src/**/*.ts\"",
"changelog:release": "echo \"Updating changelog $npm_package_version\" && npx chan release $npm_package_version --git-url \"https://github.com/subquery/subql-near\" --release-prefix=\"common-near/\""
},
"homepage": "https://github.com/subquery/subql",
"repository": "github:subquery/subql",
"author": "Ian He",
"main": "dist/index.js",
"license": "GPL-3.0",
"dependencies": {
"@subql/common": "^3.1.1",
"@subql/common": "^3.2.0",
"@subql/types-near": "workspace:*",
"js-yaml": "^4.1.0",
"reflect-metadata": "^0.1.13"
Expand Down
7 changes: 6 additions & 1 deletion packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.0] - 2023-10-26
### Changed
- Update node-core and make according changes

## [3.0.0] - 2023-10-04
### Changed
- Update `@subql/node-core` and sync with main SDK.
Expand Down Expand Up @@ -132,7 +136,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `toJson` method to function args (#9)

## 1.18.0 - 2023-01-26
[Unreleased]: https://github.com/subquery/subql-near/compare/node-near/3.0.0...HEAD
[Unreleased]: https://github.com/subquery/subql-near/compare/node-near/3.1.0...HEAD
[3.1.0]: https://github.com/subquery/subql-near/compare/node-near/3.0.0...node-near/3.1.0
[3.0.0]: https://github.com/subquery/subql-near/compare/node-near/2.10.2...node-near/3.0.0
[2.10.2]: https://github.com/subquery/subql-near/compare/node-near/2.10.1...node-near/2.10.2
[2.10.1]: https://github.com/subquery/subql-near/compare/node-near/2.10.0...node-near/2.10.1
Expand Down
9 changes: 5 additions & 4 deletions packages/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/node-near",
"version": "3.0.0",
"version": "3.1.0",
"description": "",
"author": "Ian He",
"license": "GPL-3.0",
Expand All @@ -10,7 +10,8 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nodemon",
"start:prod": "node dist/main"
"start:prod": "node dist/main",
"changelog:release": "echo \"Updating changelog $npm_package_version\" && npx chan release $npm_package_version --git-url \"https://github.com/subquery/subql-near\" --release-prefix=\"node-near/\""
},
"homepage": "https://github.com/subquery/subql",
"repository": "github:subquery/subql",
Expand All @@ -24,9 +25,9 @@
"@nestjs/event-emitter": "^2.0.0",
"@nestjs/platform-express": "^9.4.0",
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^3.1.1",
"@subql/common": "^3.2.0",
"@subql/common-near": "workspace:*",
"@subql/node-core": "^5.0.3",
"@subql/node-core": "^6.1.1",
"@subql/types-near": "workspace:*",
"cron-converter": "^1.0.2",
"eventemitter2": "^6.4.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
BlockDispatcher,
ProcessBlockResponse,
IProjectUpgradeService,
PoiSyncService,
} from '@subql/node-core';
import {
NearProjectDs,
Expand Down Expand Up @@ -43,6 +44,7 @@ export class BlockDispatcherService
storeService: StoreService,
storeCacheService: StoreCacheService,
poiService: PoiService,
poiSyncService: PoiSyncService,
@Inject('ISubqueryProject') project: SubqueryProject,
dynamicDsService: DynamicDsService,
) {
Expand All @@ -55,6 +57,7 @@ export class BlockDispatcherService
storeService,
storeCacheService,
poiService,
poiSyncService,
project,
dynamicDsService,
async (blockNums: number[]): Promise<BlockContent[]> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
storeHostFunctions,
dynamicDsHostFunctions,
HostUnfinalizedBlocks,
PoiSyncService,
} from '@subql/node-core';
import { Store } from '@subql/types-core';
import { NearDatasource } from '@subql/types-near';
Expand Down Expand Up @@ -91,6 +92,7 @@ export class WorkerBlockDispatcherService
storeService: StoreService,
storeCacheService: StoreCacheService,
poiService: PoiService,
poiSyncService: PoiSyncService,
@Inject('ISubqueryProject') project: SubqueryProject,
dynamicDsService: DynamicDsService,
unfinalizedBlocksSevice: UnfinalizedBlocksService,
Expand All @@ -105,6 +107,7 @@ export class WorkerBlockDispatcherService
storeService,
storeCacheService,
poiService,
poiSyncService,
project,
dynamicDsService,
() =>
Expand Down
6 changes: 6 additions & 0 deletions packages/node/src/indexer/fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
StoreCacheService,
ConnectionPoolStateManager,
IProjectUpgradeService,
PoiSyncService,
} from '@subql/node-core';
import { SubqueryProject } from '../configure/SubqueryProject';
import { ApiService } from './api.service';
Expand Down Expand Up @@ -59,6 +60,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
storeService: StoreService,
storeCacheService: StoreCacheService,
poiService: PoiService,
poiSyncService: PoiSyncService,
project: SubqueryProject,
dynamicDsService: DynamicDsService,
unfinalizedBlocks: UnfinalizedBlocksService,
Expand All @@ -74,6 +76,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
storeService,
storeCacheService,
poiService,
poiSyncService,
project,
dynamicDsService,
unfinalizedBlocks,
Expand All @@ -90,6 +93,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
storeService,
storeCacheService,
poiService,
poiSyncService,
project,
dynamicDsService,
),
Expand All @@ -104,6 +108,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
StoreService,
StoreCacheService,
PoiService,
PoiSyncService,
'ISubqueryProject',
DynamicDsService,
UnfinalizedBlocksService,
Expand All @@ -119,6 +124,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
DsProcessorService,
DynamicDsService,
PoiService,
PoiSyncService,
{
useClass: ProjectService,
provide: 'IProjectService',
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/indexer/project.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('ProjectService', () => {
null,
null,
null,
{} as any,
null,
null,
null,
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/indexer/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
StoreService,
NodeConfig,
IProjectUpgradeService,
PoiSyncService,
} from '@subql/node-core';
import { Sequelize } from '@subql/x-sequelize';
import { NearProjectDs, SubqueryProject } from '../configure/SubqueryProject';
Expand All @@ -33,6 +34,8 @@ export class ProjectService extends BaseProjectService<
dsProcessorService: DsProcessorService,
apiService: ApiService,
@Inject(isMainThread ? PoiService : 'Null') poiService: PoiService,
@Inject(isMainThread ? PoiSyncService : 'Null')
poiSyncService: PoiSyncService,
@Inject(isMainThread ? Sequelize : 'Null') sequelize: Sequelize,
@Inject('ISubqueryProject') project: SubqueryProject,
@Inject('IProjectUpgradeService')
Expand All @@ -47,6 +50,7 @@ export class ProjectService extends BaseProjectService<
dsProcessorService,
apiService,
poiService,
poiSyncService,
sequelize,
project,
projectUpgradeService,
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/indexer/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const logger = getLogger(`worker #${threadId}`);
async function initWorker(startHeight: number): Promise<void> {
try {
const app = await NestFactory.create(WorkerModule, {
logger: new NestLogger(argv.debug), // TIP: If the worker is crashing comment out this line for better logging
logger: new NestLogger(!!argv.debug), // TIP: If the worker is crashing comment out this line for better logging
});

await app.init();
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function bootstrap(): Promise<void> {

try {
const app = await NestFactory.create(AppModule, {
logger: new NestLogger(debug),
logger: new NestLogger(!!debug),
});
await app.init();

Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/subcommands/testing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class TestingService extends BaseTestingService<
const testContext = await NestFactory.createApplicationContext(
TestingModule,
{
logger: new NestLogger(),
logger: new NestLogger(!!this.nodeConfig.debug),
},
);

Expand Down
87 changes: 5 additions & 82 deletions packages/node/src/yargs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const yargsOptions = yargs(hideBin(process.argv))
builder: {},
handler: (argv) => {
initLogger(
argv.debug as boolean,
argv.debug as string,
argv.outputFmt as 'json' | 'colored',
argv.logLevel as string | undefined,
);
Expand All @@ -30,7 +30,7 @@ export const yargsOptions = yargs(hideBin(process.argv))
builder: {},
handler: (argv) => {
initLogger(
argv.debug as boolean,
argv.debug as string,
argv.outputFmt as 'json' | 'colored',
argv.logLevel as string | undefined,
);
Expand All @@ -53,7 +53,7 @@ export const yargsOptions = yargs(hideBin(process.argv))
}),
handler: (argv) => {
initLogger(
argv.debug as boolean,
argv.debug as string,
argv.outputFmt as 'json' | 'colored',
argv.logLevel as string | undefined,
);
Expand All @@ -63,81 +63,6 @@ export const yargsOptions = yargs(hideBin(process.argv))
return reindexInit(argv.targetHeight);
},
})
.command({
command: 'mmr-regen',
describe:
'Re-generate mmr between Filebased/Postgres mmr and Proof of index',
builder: (yargs) =>
yargs.options({
probe: {
type: 'boolean',
description:
'Fetch latest mmr height information from file based/postgres DB and Poi table',
demandOption: false,
default: false,
},
resetOnly: {
type: 'boolean',
description:
'Only reset the mmr value in both POI and file based/postgres DB to target height',
demandOption: false,
default: false,
},
targetHeight: {
type: 'number',
description: 'Re-genrate mmr value from this block height',
demandOption: false,
},
unsafe: {
type: 'boolean',
description: 'Allow sync mmr from Poi table to file or a postgres DB',
demandOption: false,
default: false,
},
}),
handler: (argv) => {
initLogger(
argv.debug as boolean,
argv.outputFmt as 'json' | 'colored',
argv.logLevel as string | undefined,
);

// lazy import to make sure logger is instantiated before all other services
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');
return mmrRegenerateInit(
argv.probe,
argv.resetOnly,
argv.unsafe,
argv.targetHeight,
);
},
})
.command({
command: 'mmr-migrate',
describe: 'Migrate MMR data from storage file to postgres DB',
builder: (yargs) =>
yargs.options({
direction: {
type: 'string',
description: 'set direction of migration (file -> DB or DB -> file)',
demandOption: false,
choices: ['dbToFile', 'fileToDb'],
default: 'dbToFile',
},
}),
handler: (argv) => {
initLogger(
argv.debug as boolean,
argv.outputFmt as 'json' | 'colored',
argv.logLevel as string | undefined,
);
// lazy import to make sure logger is instantiated before all other services
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');
return mmrMigrateInit(argv.direction);
},
})
// Note we must have default command $0 at last to avoid override
.command({
command: '$0', //default command
Expand Down Expand Up @@ -311,10 +236,8 @@ export const yargsOptions = yargs(hideBin(process.argv))
},
debug: {
demandOption: false,
describe:
'Show debug information to console output. will forcefully set log level to debug',
type: 'boolean',
default: false,
describe: `Enable debug logging for specific scopes, this will override log-level. "*" will enable debug everywhere, or comma separated strings for specific scopes. e.g. "SQL,dictionary"`,
type: 'string',
},
ipfs: {
demandOption: false,
Expand Down
7 changes: 6 additions & 1 deletion packages/types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.0.1] - 2023-10-26
### Changed
- Update @subql/types-core

## [3.0.0] - 2023-10-04
### Changed
- Use `@subql/types-core`
Expand Down Expand Up @@ -43,7 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Args type for funciton calls (#9)

## [1.0.0] - 2023-01-26
[Unreleased]: https://github.com/subquery/subql-near/compare/types-near/3.0.0...HEAD
[Unreleased]: https://github.com/subquery/subql-near/compare/types-near/3.0.1...HEAD
[3.0.1]: https://github.com/subquery/subql-near/compare/types-near/3.0.0...types-near/3.0.1
[3.0.0]: https://github.com/subquery/subql-near/compare/types-near/2.1.3...types-near/3.0.0
[2.1.3]: https://github.com/subquery/subql-near/compare/types-near/v2.1.2...types-near/v2.1.3
[2.1.2]: https://github.com/subquery/subql-near/compare/types-near/v2.1.1...types-near/v2.1.2
Expand Down
Loading

0 comments on commit 407b672

Please sign in to comment.