@subql/node-ethereum 3.0.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.d.ts +2 -2
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +6 -5
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
- package/dist/indexer/fetch.module.js +4 -2
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/sandbox.service.d.ts +3 -2
- package/dist/indexer/sandbox.service.js +6 -2
- package/dist/indexer/sandbox.service.js.map +1 -1
- package/dist/indexer/worker/worker.inMemoryCache.service.d.ts +7 -0
- package/dist/indexer/worker/worker.inMemoryCache.service.js +34 -0
- package/dist/indexer/worker/worker.inMemoryCache.service.js.map +1 -0
- package/dist/indexer/worker-fetch.module.js +5 -0
- package/dist/indexer/worker-fetch.module.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OnApplicationShutdown } from '@nestjs/common';
|
|
2
2
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
3
|
-
import { NodeConfig, SmartBatchService, StoreService, PoiService, StoreCacheService, IProjectService, WorkerBlockDispatcher, ConnectionPoolStateManager, IProjectUpgradeService, PoiSyncService } from '@subql/node-core';
|
|
3
|
+
import { NodeConfig, SmartBatchService, StoreService, PoiService, StoreCacheService, IProjectService, WorkerBlockDispatcher, ConnectionPoolStateManager, IProjectUpgradeService, PoiSyncService, InMemoryCacheService } from '@subql/node-core';
|
|
4
4
|
import { EthereumProjectDs, SubqueryProject } from '../../configure/SubqueryProject';
|
|
5
5
|
import { EthereumApiConnection } from '../../ethereum/api.connection';
|
|
6
6
|
import { DynamicDsService } from '../dynamic-ds.service';
|
|
@@ -10,7 +10,7 @@ type IndexerWorker = IIndexerWorker & {
|
|
|
10
10
|
terminate: () => Promise<number>;
|
|
11
11
|
};
|
|
12
12
|
export declare class WorkerBlockDispatcherService extends WorkerBlockDispatcher<EthereumProjectDs, IndexerWorker> implements OnApplicationShutdown {
|
|
13
|
-
constructor(nodeConfig: NodeConfig, eventEmitter: EventEmitter2, projectService: IProjectService<EthereumProjectDs>, projectUpgadeService: IProjectUpgradeService, smartBatchService: SmartBatchService, storeService: StoreService, storeCacheService: StoreCacheService, poiService: PoiService, poiSyncService: PoiSyncService, project: SubqueryProject, dynamicDsService: DynamicDsService, unfinalizedBlocksSevice: UnfinalizedBlocksService, connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>);
|
|
13
|
+
constructor(nodeConfig: NodeConfig, eventEmitter: EventEmitter2, projectService: IProjectService<EthereumProjectDs>, projectUpgadeService: IProjectUpgradeService, smartBatchService: SmartBatchService, cacheService: InMemoryCacheService, storeService: StoreService, storeCacheService: StoreCacheService, poiService: PoiService, poiSyncService: PoiSyncService, project: SubqueryProject, dynamicDsService: DynamicDsService, unfinalizedBlocksSevice: UnfinalizedBlocksService, connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>);
|
|
14
14
|
protected fetchBlock(worker: IndexerWorker, height: number): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
@@ -25,14 +25,14 @@ const node_core_1 = require("@subql/node-core");
|
|
|
25
25
|
const SubqueryProject_1 = require("../../configure/SubqueryProject");
|
|
26
26
|
const dynamic_ds_service_1 = require("../dynamic-ds.service");
|
|
27
27
|
const unfinalizedBlocks_service_1 = require("../unfinalizedBlocks.service");
|
|
28
|
-
async function createIndexerWorker(store, dynamicDsService, unfinalizedBlocksService, connectionPoolState, root, startHeight) {
|
|
29
|
-
const indexerWorker = node_core_1.Worker.create(path_1.default.resolve(__dirname, '../../../dist/indexer/worker/worker.js'), [...node_core_1.baseWorkerFunctions, 'initWorker'], Object.assign(Object.assign(Object.assign(Object.assign({}, (0, node_core_1.storeHostFunctions)(store)), (0, node_core_1.dynamicDsHostFunctions)(dynamicDsService)), { unfinalizedBlocksProcess: unfinalizedBlocksService.processUnfinalizedBlockHeader.bind(unfinalizedBlocksService) }), (0, node_core_1.connectionPoolStateHostFunctions)(connectionPoolState)), root);
|
|
28
|
+
async function createIndexerWorker(store, cache, dynamicDsService, unfinalizedBlocksService, connectionPoolState, root, startHeight) {
|
|
29
|
+
const indexerWorker = node_core_1.Worker.create(path_1.default.resolve(__dirname, '../../../dist/indexer/worker/worker.js'), [...node_core_1.baseWorkerFunctions, 'initWorker'], Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, node_core_1.cacheHostFunctions)(cache)), (0, node_core_1.storeHostFunctions)(store)), (0, node_core_1.dynamicDsHostFunctions)(dynamicDsService)), { unfinalizedBlocksProcess: unfinalizedBlocksService.processUnfinalizedBlockHeader.bind(unfinalizedBlocksService) }), (0, node_core_1.connectionPoolStateHostFunctions)(connectionPoolState)), root);
|
|
30
30
|
await indexerWorker.initWorker(startHeight);
|
|
31
31
|
return indexerWorker;
|
|
32
32
|
}
|
|
33
33
|
let WorkerBlockDispatcherService = class WorkerBlockDispatcherService extends node_core_1.WorkerBlockDispatcher {
|
|
34
|
-
constructor(nodeConfig, eventEmitter, projectService, projectUpgadeService, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocksSevice, connectionPoolState) {
|
|
35
|
-
super(nodeConfig, eventEmitter, projectService, projectUpgadeService, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, () => createIndexerWorker(storeService.getStore(), dynamicDsService, unfinalizedBlocksSevice, connectionPoolState, project.root, projectService.startHeight));
|
|
34
|
+
constructor(nodeConfig, eventEmitter, projectService, projectUpgadeService, smartBatchService, cacheService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocksSevice, connectionPoolState) {
|
|
35
|
+
super(nodeConfig, eventEmitter, projectService, projectUpgadeService, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, () => createIndexerWorker(storeService.getStore(), cacheService.getCache(), dynamicDsService, unfinalizedBlocksSevice, connectionPoolState, project.root, projectService.startHeight));
|
|
36
36
|
}
|
|
37
37
|
async fetchBlock(worker, height) {
|
|
38
38
|
const start = new Date();
|
|
@@ -54,9 +54,10 @@ WorkerBlockDispatcherService = __decorate([
|
|
|
54
54
|
(0, common_1.Injectable)(),
|
|
55
55
|
__param(2, (0, common_1.Inject)('IProjectService')),
|
|
56
56
|
__param(3, (0, common_1.Inject)('IProjectUpgradeService')),
|
|
57
|
-
__param(
|
|
57
|
+
__param(10, (0, common_1.Inject)('ISubqueryProject')),
|
|
58
58
|
__metadata("design:paramtypes", [node_core_1.NodeConfig,
|
|
59
59
|
event_emitter_1.EventEmitter2, Object, Object, node_core_1.SmartBatchService,
|
|
60
|
+
node_core_1.InMemoryCacheService,
|
|
60
61
|
node_core_1.StoreService,
|
|
61
62
|
node_core_1.StoreCacheService,
|
|
62
63
|
node_core_1.PoiService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-block-dispatcher.service.js","sourceRoot":"","sources":["../../../src/indexer/blockDispatcher/worker-block-dispatcher.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;AAEnC,gDAAwB;AACxB,2CAA2E;AAC3E,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"worker-block-dispatcher.service.js","sourceRoot":"","sources":["../../../src/indexer/blockDispatcher/worker-block-dispatcher.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;AAEnC,gDAAwB;AACxB,2CAA2E;AAC3E,yDAAsD;AACtD,gDAuB0B;AAE1B,qEAGyC;AAEzC,8DAAyD;AAEzD,4EAAwE;AAOxE,KAAK,UAAU,mBAAmB,CAChC,KAAY,EACZ,KAAY,EACZ,gBAAsD,EACtD,wBAAiE,EACjE,mBAAsE,EACtE,IAA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QACzB,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QAEvB,oDAAoD;QACpD,yBAAyB;QACzB,iBAAiB;QACjB,yEAAyE;QACzE,OAAO;QACP,+BAA+B;QAC/B,iBAAiB;QACjB,4EAA4E;QAC5E,OAAO;QACP,IAAI;IACN,CAAC;CACF,CAAA;AAlEY,4BAA4B;IADxC,IAAA,mBAAU,GAAE;IAQR,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,IAAA,eAAM,EAAC,wBAAwB,CAAC,CAAA;IAQhC,YAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAZf,sBAAU;QACR,6BAAa,kBAKR,6BAAiB;QACtB,gCAAoB;QACpB,wBAAY;QACP,6BAAiB;QACxB,sBAAU;QACN,0BAAc;QACO,iCAAe;QAClC,qCAAgB;QACT,oDAAwB;QAC5B,sCAA0B;GApBtC,4BAA4B,CAkExC;AAlEY,oEAA4B","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport path from 'path';\nimport { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n NodeConfig,\n Worker,\n SmartBatchService,\n StoreService,\n PoiService,\n StoreCacheService,\n IProjectService,\n IDynamicDsService,\n HostStore,\n HostDynamicDS,\n WorkerBlockDispatcher,\n IUnfinalizedBlocksService,\n ConnectionPoolStateManager,\n connectionPoolStateHostFunctions,\n baseWorkerFunctions,\n storeHostFunctions,\n cacheHostFunctions,\n dynamicDsHostFunctions,\n IProjectUpgradeService,\n HostUnfinalizedBlocks,\n PoiSyncService,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { Cache, Store } from '@subql/types-core';\nimport {\n EthereumProjectDs,\n SubqueryProject,\n} from '../../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../../ethereum/api.connection';\nimport { DynamicDsService } from '../dynamic-ds.service';\nimport { BlockContent } from '../types';\nimport { UnfinalizedBlocksService } from '../unfinalizedBlocks.service';\nimport { IIndexerWorker, IInitIndexerWorker } from '../worker/worker';\n\ntype IndexerWorker = IIndexerWorker & {\n terminate: () => Promise<number>;\n};\n\nasync function createIndexerWorker(\n store: Store,\n cache: Cache,\n dynamicDsService: IDynamicDsService<EthereumProjectDs>,\n unfinalizedBlocksService: IUnfinalizedBlocksService<BlockContent>,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n root: string,\n startHeight: number,\n): Promise<IndexerWorker> {\n const indexerWorker = Worker.create<\n IInitIndexerWorker,\n HostDynamicDS<EthereumProjectDs> & HostStore & HostUnfinalizedBlocks\n >(\n path.resolve(__dirname, '../../../dist/indexer/worker/worker.js'),\n [...baseWorkerFunctions, 'initWorker'],\n {\n ...cacheHostFunctions(cache),\n ...storeHostFunctions(store),\n ...dynamicDsHostFunctions(dynamicDsService),\n unfinalizedBlocksProcess:\n unfinalizedBlocksService.processUnfinalizedBlockHeader.bind(\n unfinalizedBlocksService,\n ),\n ...connectionPoolStateHostFunctions(connectionPoolState),\n },\n root,\n );\n\n await indexerWorker.initWorker(startHeight);\n\n return indexerWorker;\n}\n\n@Injectable()\nexport class WorkerBlockDispatcherService\n extends WorkerBlockDispatcher<EthereumProjectDs, IndexerWorker>\n implements OnApplicationShutdown\n{\n constructor(\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n @Inject('IProjectService')\n projectService: IProjectService<EthereumProjectDs>,\n @Inject('IProjectUpgradeService')\n projectUpgadeService: IProjectUpgradeService,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n poiSyncService: PoiSyncService,\n @Inject('ISubqueryProject') project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocksSevice: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n ) {\n super(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgadeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n () =>\n createIndexerWorker(\n storeService.getStore(),\n cacheService.getCache(),\n dynamicDsService,\n unfinalizedBlocksSevice,\n connectionPoolState,\n project.root,\n projectService.startHeight,\n ),\n );\n }\n\n protected async fetchBlock(\n worker: IndexerWorker,\n height: number,\n ): Promise<void> {\n const start = new Date();\n await worker.fetchBlock(height, null);\n const end = new Date();\n\n // const waitTime = end.getTime() - start.getTime();\n // if (waitTime > 1000) {\n // logger.info(\n // `Waiting to fetch block ${height}: ${chalk.red(`${waitTime}ms`)}`,\n // );\n // } else if (waitTime > 200) {\n // logger.info(\n // `Waiting to fetch block ${height}: ${chalk.yellow(`${waitTime}ms`)}`,\n // );\n // }\n }\n}\n"]}
|
|
@@ -27,6 +27,7 @@ let FetchModule = class FetchModule {
|
|
|
27
27
|
FetchModule = __decorate([
|
|
28
28
|
(0, common_1.Module)({
|
|
29
29
|
providers: [
|
|
30
|
+
node_core_1.InMemoryCacheService,
|
|
30
31
|
node_core_1.StoreService,
|
|
31
32
|
node_core_1.StoreCacheService,
|
|
32
33
|
{
|
|
@@ -62,8 +63,8 @@ FetchModule = __decorate([
|
|
|
62
63
|
},
|
|
63
64
|
{
|
|
64
65
|
provide: 'IBlockDispatcher',
|
|
65
|
-
useFactory: (nodeConfig, eventEmitter, projectService, projectUpgradeService, apiService, indexerManager, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState) => nodeConfig.workers !== undefined
|
|
66
|
-
? new blockDispatcher_1.WorkerBlockDispatcherService(nodeConfig, eventEmitter, projectService, projectUpgradeService, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState)
|
|
66
|
+
useFactory: (nodeConfig, eventEmitter, projectService, projectUpgradeService, apiService, indexerManager, smartBatchService, cacheService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState) => nodeConfig.workers !== undefined
|
|
67
|
+
? new blockDispatcher_1.WorkerBlockDispatcherService(nodeConfig, eventEmitter, projectService, projectUpgradeService, smartBatchService, cacheService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService, unfinalizedBlocks, connectionPoolState)
|
|
67
68
|
: new blockDispatcher_1.BlockDispatcherService(apiService, nodeConfig, indexerManager, eventEmitter, projectService, projectUpgradeService, smartBatchService, storeService, storeCacheService, poiService, poiSyncService, project, dynamicDsService),
|
|
68
69
|
inject: [
|
|
69
70
|
node_core_1.NodeConfig,
|
|
@@ -73,6 +74,7 @@ FetchModule = __decorate([
|
|
|
73
74
|
node_core_1.ApiService,
|
|
74
75
|
indexer_manager_1.IndexerManager,
|
|
75
76
|
node_core_1.SmartBatchService,
|
|
77
|
+
node_core_1.InMemoryCacheService,
|
|
76
78
|
node_core_1.StoreService,
|
|
77
79
|
node_core_1.StoreCacheService,
|
|
78
80
|
node_core_1.PoiService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,gDAc0B;AAG1B,2EAAsE;AACtE,uDAG2B;AAC3B,6DAAyD;AACzD,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAwJhE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BAAiB;aAC3B;YACD,oDAAwB;SACzB;QACD,OAAO,EAAE,CAAC,wBAAY,EAAE,6BAAiB,CAAC;KAC3C,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n PoiBenchmarkService,\n IndexingBenchmarkService,\n StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n SmartBatchService,\n StoreCacheService,\n IProjectUpgradeService,\n PoiSyncService,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport {\n BlockDispatcherService,\n WorkerBlockDispatcherService,\n} from './blockDispatcher';\nimport { DictionaryService } from './dictionary.service';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { FetchService } from './fetch.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n providers: [\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n IndexerManager,\n ConnectionPoolStateManager,\n ConnectionPoolService,\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: 'IBlockDispatcher',\n useFactory: (\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n projectService: ProjectService,\n projectUpgradeService: IProjectUpgradeService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n poiSyncService: PoiSyncService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<EthereumApiConnection>,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n cacheService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n ConnectionPoolService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n {\n provide: DictionaryService,\n useFactory: async (\n project: SubqueryProject,\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n ) => {\n const dictionaryService = await DictionaryService.create(\n project,\n nodeConfig,\n eventEmitter,\n );\n return dictionaryService;\n },\n inject: ['ISubqueryProject', NodeConfig, EventEmitter2],\n },\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n PoiSyncService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { NodeConfig, StoreService, IndexerSandbox, ISubqueryProject, ApiService } from '@subql/node-core';
|
|
1
|
+
import { NodeConfig, StoreService, IndexerSandbox, ISubqueryProject, ApiService, InMemoryCacheService } from '@subql/node-core';
|
|
2
2
|
import { BaseDataSource } from '@subql/types-core';
|
|
3
3
|
import SafeEthProvider from '../ethereum/safe-api';
|
|
4
4
|
export declare class SandboxService {
|
|
5
5
|
private readonly apiService;
|
|
6
6
|
private readonly storeService;
|
|
7
|
+
private readonly cacheService;
|
|
7
8
|
private readonly nodeConfig;
|
|
8
9
|
private readonly project;
|
|
9
10
|
private processorCache;
|
|
10
|
-
constructor(apiService: ApiService, storeService: StoreService, nodeConfig: NodeConfig, project: ISubqueryProject);
|
|
11
|
+
constructor(apiService: ApiService, storeService: StoreService, cacheService: InMemoryCacheService, nodeConfig: NodeConfig, project: ISubqueryProject);
|
|
11
12
|
getDsProcessor(ds: BaseDataSource, api: SafeEthProvider): IndexerSandbox;
|
|
12
13
|
private getDataSourceEntry;
|
|
13
14
|
}
|
|
@@ -20,9 +20,10 @@ const common_1 = require("@nestjs/common");
|
|
|
20
20
|
const node_core_1 = require("@subql/node-core");
|
|
21
21
|
/* It would be nice to move this to node core but need to find a way to inject other things into the sandbox */
|
|
22
22
|
let SandboxService = class SandboxService {
|
|
23
|
-
constructor(apiService, storeService, nodeConfig, project) {
|
|
23
|
+
constructor(apiService, storeService, cacheService, nodeConfig, project) {
|
|
24
24
|
this.apiService = apiService;
|
|
25
25
|
this.storeService = storeService;
|
|
26
|
+
this.cacheService = cacheService;
|
|
26
27
|
this.nodeConfig = nodeConfig;
|
|
27
28
|
this.project = project;
|
|
28
29
|
this.processorCache = {};
|
|
@@ -31,10 +32,12 @@ let SandboxService = class SandboxService {
|
|
|
31
32
|
const store = worker_threads_1.isMainThread
|
|
32
33
|
? this.storeService.getStore()
|
|
33
34
|
: (0, node_core_1.hostStoreToStore)(global.host); // Provided in worker.ts
|
|
35
|
+
const cache = this.cacheService.getCache();
|
|
34
36
|
const entry = this.getDataSourceEntry(ds);
|
|
35
37
|
let processor = this.processorCache[entry];
|
|
36
38
|
if (!processor) {
|
|
37
39
|
processor = new node_core_1.IndexerSandbox({
|
|
40
|
+
cache,
|
|
38
41
|
store,
|
|
39
42
|
root: this.project.root,
|
|
40
43
|
entry,
|
|
@@ -56,9 +59,10 @@ let SandboxService = class SandboxService {
|
|
|
56
59
|
SandboxService = __decorate([
|
|
57
60
|
(0, common_1.Injectable)(),
|
|
58
61
|
__param(1, (0, common_1.Inject)(worker_threads_1.isMainThread ? node_core_1.StoreService : 'Null')),
|
|
59
|
-
__param(
|
|
62
|
+
__param(4, (0, common_1.Inject)('ISubqueryProject')),
|
|
60
63
|
__metadata("design:paramtypes", [node_core_1.ApiService,
|
|
61
64
|
node_core_1.StoreService,
|
|
65
|
+
node_core_1.InMemoryCacheService,
|
|
62
66
|
node_core_1.NodeConfig, Object])
|
|
63
67
|
], SandboxService);
|
|
64
68
|
exports.SandboxService = SandboxService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.service.js","sourceRoot":"","sources":["../../src/indexer/sandbox.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,mDAA8C;AAC9C,2CAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"sandbox.service.js","sourceRoot":"","sources":["../../src/indexer/sandbox.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAA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AAM,EAAE;YAC1B,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;SACxD;QACD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,kBAAkB,CAAC,EAAkB;QAC3C,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzB,CAAC;CACF,CAAA;AA5CY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,6BAAY,CAAC,CAAC,CAAC,wBAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAI5C,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCALE,sBAAU;QAER,wBAAY;QACZ,gCAAoB;QACtB,sBAAU;GAR9B,cAAc,CA4C1B;AA5CY,wCAAc","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n NodeConfig,\n StoreService,\n IndexerSandbox,\n hostStoreToStore,\n ISubqueryProject,\n ApiService,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { BaseDataSource, Store } from '@subql/types-core';\nimport SafeEthProvider from '../ethereum/safe-api';\n\n/* It would be nice to move this to node core but need to find a way to inject other things into the sandbox */\n@Injectable()\nexport class SandboxService {\n private processorCache: Record<string, IndexerSandbox> = {};\n\n constructor(\n private readonly apiService: ApiService,\n @Inject(isMainThread ? StoreService : 'Null')\n private readonly storeService: StoreService,\n private readonly cacheService: InMemoryCacheService,\n private readonly nodeConfig: NodeConfig,\n @Inject('ISubqueryProject') private readonly project: ISubqueryProject,\n ) {}\n\n getDsProcessor(ds: BaseDataSource, api: SafeEthProvider): IndexerSandbox {\n const store: Store = isMainThread\n ? this.storeService.getStore()\n : hostStoreToStore((global as any).host); // Provided in worker.ts\n\n const cache = this.cacheService.getCache();\n const entry = this.getDataSourceEntry(ds);\n let processor = this.processorCache[entry];\n if (!processor) {\n processor = new IndexerSandbox(\n {\n cache,\n store,\n root: this.project.root,\n entry,\n chainId: this.project.network.chainId,\n },\n this.nodeConfig,\n );\n this.processorCache[entry] = processor;\n }\n processor.freeze(api, 'api');\n if (this.nodeConfig.unsafe) {\n processor.freeze(this.apiService.api.api, 'unsafeApi');\n }\n processor.freeze(this.project.network.chainId, 'chainId');\n return processor;\n }\n\n private getDataSourceEntry(ds: BaseDataSource): string {\n return ds.mapping.file;\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
4
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
5
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9
|
+
};
|
|
10
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.WorkerInMemoryCacheService = void 0;
|
|
15
|
+
const worker_threads_1 = require("worker_threads");
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const node_core_1 = require("@subql/node-core");
|
|
18
|
+
let WorkerInMemoryCacheService = class WorkerInMemoryCacheService {
|
|
19
|
+
constructor(host) {
|
|
20
|
+
this.host = host;
|
|
21
|
+
if (worker_threads_1.isMainThread) {
|
|
22
|
+
throw new Error('Expected to be worker thread');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
getCache() {
|
|
26
|
+
return (0, node_core_1.hostCacheToCache)(this.host);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
WorkerInMemoryCacheService = __decorate([
|
|
30
|
+
(0, common_1.Injectable)(),
|
|
31
|
+
__metadata("design:paramtypes", [Object])
|
|
32
|
+
], WorkerInMemoryCacheService);
|
|
33
|
+
exports.WorkerInMemoryCacheService = WorkerInMemoryCacheService;
|
|
34
|
+
//# sourceMappingURL=worker.inMemoryCache.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.inMemoryCache.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.inMemoryCache.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,mDAA8C;AAC9C,2CAA4C;AAC5C,gDAA+D;AAIxD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAAoB,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;QACjC,IAAI,6BAAY,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACjD;IACH,CAAC;IAED,QAAQ;QACN,OAAO,IAAA,4BAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AAVY,0BAA0B;IADtC,IAAA,mBAAU,GAAE;;GACA,0BAA0B,CAUtC;AAVY,gEAA0B","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Injectable } from '@nestjs/common';\nimport { HostCache, hostCacheToCache } from '@subql/node-core';\nimport { Cache } from '@subql/types-core';\n\n@Injectable()\nexport class WorkerInMemoryCacheService {\n constructor(private host: HostCache) {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n }\n\n getCache(): Cache {\n return hostCacheToCache(this.host);\n }\n}\n"]}
|
|
@@ -19,6 +19,7 @@ const indexer_manager_1 = require("./indexer.manager");
|
|
|
19
19
|
const project_service_1 = require("./project.service");
|
|
20
20
|
const sandbox_service_1 = require("./sandbox.service");
|
|
21
21
|
const unfinalizedBlocks_service_1 = require("./unfinalizedBlocks.service");
|
|
22
|
+
const worker_inMemoryCache_service_1 = require("./worker/worker.inMemoryCache.service");
|
|
22
23
|
const worker_service_1 = require("./worker/worker.service");
|
|
23
24
|
const worker_unfinalizedBlocks_service_1 = require("./worker/worker.unfinalizedBlocks.service");
|
|
24
25
|
let WorkerFetchModule = class WorkerFetchModule {
|
|
@@ -61,6 +62,10 @@ WorkerFetchModule = __decorate([
|
|
|
61
62
|
useFactory: () => new worker_unfinalizedBlocks_service_1.WorkerUnfinalizedBlocksService(global.host),
|
|
62
63
|
},
|
|
63
64
|
worker_service_1.WorkerService,
|
|
65
|
+
{
|
|
66
|
+
provide: node_core_1.InMemoryCacheService,
|
|
67
|
+
useFactory: () => new worker_inMemoryCache_service_1.WorkerInMemoryCacheService(global.host),
|
|
68
|
+
},
|
|
64
69
|
],
|
|
65
70
|
})
|
|
66
71
|
], WorkerFetchModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-fetch.module.js","sourceRoot":"","sources":["../../src/indexer/worker-fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"worker-fetch.module.js","sourceRoot":"","sources":["../../src/indexer/worker-fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,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G,EAAE,CAAC,IAAI,yDAA0B,CAAE,MAAc,CAAC,IAAI,CAAC;aACvE;SACF;KACF,CAAC;GACW,iBAAiB,CAAG;AAApB,8CAAiB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiService,\n ConnectionPoolService,\n WorkerDynamicDsService,\n WorkerConnectionPoolStateManager,\n ConnectionPoolStateManager,\n NodeConfig,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from '../ethereum';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\nimport { WorkerInMemoryCacheService } from './worker/worker.inMemoryCache.service';\nimport { WorkerService } from './worker/worker.service';\nimport { WorkerUnfinalizedBlocksService } from './worker/worker.unfinalizedBlocks.service';\n\n@Module({\n providers: [\n IndexerManager,\n {\n provide: ConnectionPoolStateManager,\n useFactory: () =>\n new WorkerConnectionPoolStateManager((global as any).host),\n },\n ConnectionPoolService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n nodeConfig,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n SandboxService,\n DsProcessorService,\n {\n provide: DynamicDsService,\n useFactory: () => new WorkerDynamicDsService((global as any).host),\n },\n {\n provide: 'IProjectService',\n useClass: ProjectService,\n },\n {\n provide: UnfinalizedBlocksService,\n useFactory: () =>\n new WorkerUnfinalizedBlocksService((global as any).host),\n },\n WorkerService,\n {\n provide: InMemoryCacheService,\n useFactory: () => new WorkerInMemoryCacheService((global as any).host),\n },\n ],\n})\nexport class WorkerFetchModule {}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-ethereum",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"@nestjs/platform-express": "^9.4.0",
|
|
27
27
|
"@nestjs/schedule": "^3.0.1",
|
|
28
28
|
"@subql/common": "3.1.3",
|
|
29
|
-
"@subql/common-ethereum": "3.0.
|
|
30
|
-
"@subql/node-core": "^6.0
|
|
29
|
+
"@subql/common-ethereum": "3.0.5",
|
|
30
|
+
"@subql/node-core": "^6.1.0",
|
|
31
31
|
"@subql/testing": "^2.0.2",
|
|
32
|
-
"@subql/types-ethereum": "3.0
|
|
32
|
+
"@subql/types-ethereum": "3.1.0",
|
|
33
33
|
"cacheable-lookup": "6",
|
|
34
34
|
"cron-converter": "^1.0.2",
|
|
35
35
|
"ethers": "^5.7.0",
|