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

Update node core and remove unused code #272

Merged
merged 2 commits into from
Jul 23, 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
1 change: 1 addition & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Update cosmos and subql dependencies (#270)
- Update to latest `@subql/node-core` (#272)

### Added
- Detection of Cosmos SDK version to use correct client type (#270)
Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^4.1.0",
"@subql/common-cosmos": "workspace:*",
"@subql/node-core": "^11.0.0",
"@subql/node-core": "^12.0.0",
"@subql/types-cosmos": "workspace:*",
"lodash": "^4.17.21",
"protobufjs": "^6.11.4",
Expand Down
13 changes: 0 additions & 13 deletions packages/node/src/admin/admin.module.ts

This file was deleted.

16 changes: 11 additions & 5 deletions packages/node/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@
import { Module } from '@nestjs/common';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { ScheduleModule } from '@nestjs/schedule';
import { DbModule } from '@subql/node-core';
import { AdminModule } from './admin/admin.module';
import { DbModule, CoreModule, MetaModule } from '@subql/node-core';
import { ConfigureModule } from './configure/configure.module';
import { FetchModule } from './indexer/fetch.module';
import { MetaModule } from './meta/meta.module';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version: cosmosSdkVersion } = require('@cosmjs/stargate/package.json');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version: packageVersion } = require('../package.json');

@Module({
imports: [
DbModule.forRoot(),
EventEmitterModule.forRoot(),
ConfigureModule.register(),
ScheduleModule.forRoot(),
CoreModule,
FetchModule,
MetaModule,
AdminModule,
MetaModule.forRoot({
version: packageVersion,
sdkVersion: { name: '@cosmjs/stargate', version: cosmosSdkVersion },
}),
],
controllers: [],
})
Expand Down
19 changes: 2 additions & 17 deletions packages/node/src/indexer/fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
import { Module } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import {
PoiBenchmarkService,
IndexingBenchmarkService,
CoreModule,
StoreService,
PoiService,
PoiSyncService,
NodeConfig,
ConnectionPoolService,
StoreCacheService,
ConnectionPoolStateManager,
IProjectUpgradeService,
InMemoryCacheService,
SandboxService,
MonitorService,
} from '@subql/node-core';
import { SubqueryProject } from '../configure/SubqueryProject';
Expand All @@ -34,13 +30,10 @@ import { ProjectService } from './project.service';
import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';

@Module({
imports: [CoreModule],
providers: [
InMemoryCacheService,
StoreService,
StoreCacheService,
ApiService,
IndexerManager,
ConnectionPoolStateManager,
{
provide: 'IBlockDispatcher',
useFactory: (
Expand Down Expand Up @@ -107,22 +100,14 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
],
},
FetchService,
ConnectionPoolService,
IndexingBenchmarkService,
PoiBenchmarkService,
DictionaryService,
SandboxService,
DsProcessorService,
DynamicDsService,
PoiService,
PoiSyncService,
{
useClass: ProjectService,
provide: 'IProjectService',
},
MonitorService,
UnfinalizedBlocksService,
],
exports: [StoreService, StoreCacheService, MonitorService, PoiService],
})
export class FetchModule {}
3 changes: 3 additions & 0 deletions packages/node/src/indexer/fetch.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
BaseFetchService,
getModulos,
Header,
StoreCacheService,
} from '@subql/node-core';
import { SubqueryProject } from '../configure/SubqueryProject';
import * as CosmosUtil from '../utils/cosmos';
Expand Down Expand Up @@ -45,6 +46,7 @@ export class FetchService extends BaseFetchService<
unfinalizedBlocksService: UnfinalizedBlocksService,
eventEmitter: EventEmitter2,
schedulerRegistry: SchedulerRegistry,
storeCacheService: StoreCacheService,
) {
super(
nodeConfig,
Expand All @@ -55,6 +57,7 @@ export class FetchService extends BaseFetchService<
eventEmitter,
schedulerRegistry,
unfinalizedBlocksService,
storeCacheService,
);
}

Expand Down
25 changes: 2 additions & 23 deletions packages/node/src/indexer/worker/worker-fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
import { Module } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import {
WorkerCoreModule,
ConnectionPoolService,
WorkerDynamicDsService,
ConnectionPoolStateManager,
WorkerConnectionPoolStateManager,
InMemoryCacheService,
WorkerInMemoryCacheService,
NodeConfig,
SandboxService,
WorkerUnfinalizedBlocksService,
MonitorService,
WorkerMonitorService,
} from '@subql/node-core';
import { SubqueryProject } from '../../configure/SubqueryProject';
import { ApiService } from '../api.service';
Expand All @@ -27,14 +21,9 @@ import { UnfinalizedBlocksService } from '../unfinalizedBlocks.service';
import { WorkerService } from './worker.service';

@Module({
imports: [WorkerCoreModule],
providers: [
IndexerManager,
{
provide: ConnectionPoolStateManager,
useFactory: () =>
new WorkerConnectionPoolStateManager((global as any).host),
},
ConnectionPoolService,
{
provide: ApiService,
useFactory: async (
Expand All @@ -59,7 +48,6 @@ import { WorkerService } from './worker.service';
NodeConfig,
],
},
SandboxService,
DsProcessorService,
{
provide: DynamicDsService,
Expand All @@ -75,15 +63,6 @@ import { WorkerService } from './worker.service';
useFactory: () =>
new WorkerUnfinalizedBlocksService((global as any).host),
},
{
provide: InMemoryCacheService,
useFactory: () => new WorkerInMemoryCacheService((global as any).host),
},
{
provide: MonitorService,
useFactory: () => new WorkerMonitorService((global as any).host),
},
],
exports: [],
})
export class WorkerFetchModule {}
3 changes: 2 additions & 1 deletion packages/node/src/indexer/worker/worker.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { Module } from '@nestjs/common';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { ScheduleModule } from '@nestjs/schedule';
import { DbModule } from '@subql/node-core';
import { DbModule, WorkerCoreModule } from '@subql/node-core';
import { ConfigureModule } from '../../configure/configure.module';
import { WorkerFetchModule } from './worker-fetch.module';

Expand All @@ -14,6 +14,7 @@ import { WorkerFetchModule } from './worker-fetch.module';
EventEmitterModule.forRoot(),
ConfigureModule.register(),
ScheduleModule.forRoot(),
WorkerCoreModule,
WorkerFetchModule,
],
controllers: [],
Expand Down
15 changes: 0 additions & 15 deletions packages/node/src/meta/meta.controller.ts

This file was deleted.

16 changes: 0 additions & 16 deletions packages/node/src/meta/meta.module.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/node/src/meta/meta.service.ts

This file was deleted.

20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6402,9 +6402,9 @@ __metadata:
languageName: node
linkType: hard

"@subql/node-core@npm:^11.0.0":
version: 11.0.0
resolution: "@subql/node-core@npm:11.0.0"
"@subql/node-core@npm:^12.0.0":
version: 12.0.0
resolution: "@subql/node-core@npm:12.0.0"
dependencies:
"@apollo/client": ^3.8.8
"@nestjs/common": ^9.4.0
Expand All @@ -6413,7 +6413,7 @@ __metadata:
"@subql/common": 4.1.0
"@subql/testing": 2.2.1
"@subql/types": 3.9.0
"@subql/utils": 2.12.1
"@subql/utils": 2.13.0
"@willsoto/nestjs-prometheus": ^5.4.0
async-lock: ^1.4.0
async-mutex: ^0.4.0
Expand All @@ -6431,7 +6431,7 @@ __metadata:
toposort-class: ^1.0.1
vm2: ^3.9.19
yargs: ^16.2.0
checksum: b41ec97d614ceafc006e66cf5f6419fba027d5831cd56ed335d431d63b176f902ab1039db5764ba01d5cadbfba695cbd4c06f67e5b7b4f9941877ea482e8e066
checksum: a37ab972f75dee4ecda070aafb125194a03952bcc8c6f2dacbae4c8c4f97cb5228b53ab09614d24658ad576f8f9de7a5d07c491f288ea1f449a2f80040235731
languageName: node
linkType: hard

Expand All @@ -6453,7 +6453,7 @@ __metadata:
"@nestjs/testing": ^9.4.0
"@subql/common": ^4.1.0
"@subql/common-cosmos": "workspace:*"
"@subql/node-core": ^11.0.0
"@subql/node-core": ^12.0.0
"@subql/types-cosmos": "workspace:*"
"@types/express": ^4.17.13
"@types/jest": ^27.4.0
Expand Down Expand Up @@ -6524,9 +6524,9 @@ __metadata:
languageName: node
linkType: hard

"@subql/utils@npm:2.12.1":
version: 2.12.1
resolution: "@subql/utils@npm:2.12.1"
"@subql/utils@npm:2.13.0":
version: 2.13.0
resolution: "@subql/utils@npm:2.13.0"
dependencies:
"@polkadot/util": ^12.6.2
"@polkadot/util-crypto": ^12.6.2
Expand All @@ -6542,7 +6542,7 @@ __metadata:
rotating-file-stream: ^3.0.2
semver: ^7.5.2
tar: ^6.2.1
checksum: 8ee95bfde1e1672a85cade26d51af57ee2023587ab7977379430e5d957422d80deff505fba377b51fb008b80e2f6c23ccbc266e717f74ee3f5f5e4092bba0ed9
checksum: e2c43c0c2865f5e014572da3ec0a41691e5c534f90b0f008f12770ab9871783bba348cb929f5d51e36527d11344107718c3f86ef1b227dbc344ee03233c48031
languageName: node
linkType: hard

Expand Down
Loading