@subql/node-ethereum 6.3.2 → 6.3.3-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/dist/.tsbuildinfo +1 -1
- package/dist/indexer/unfinalizedBlocks.service.js +9 -1
- package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
- package/dist/indexer/worker/worker.service.d.ts +1 -1
- package/dist/indexer/worker/worker.service.js +1 -5
- package/dist/indexer/worker/worker.service.js.map +1 -1
- package/package.json +3 -3
|
@@ -89,7 +89,15 @@ let UnfinalizedBlocksService = class UnfinalizedBlocksService extends node_core_
|
|
|
89
89
|
if (!checkingHeader.parentHash) {
|
|
90
90
|
throw new Error('Unable to get parent hash for header');
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
const parentHeight = checkingHeader.blockHeight - 1;
|
|
93
|
+
try {
|
|
94
|
+
checkingHeader = await this.blockchainService.getHeaderForHash(checkingHeader.parentHash);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// Parent block not found on chain (orphaned), fall back to height-based check
|
|
98
|
+
logger.warn(`Failed to get block by hash, falling back to height-based check at height ${parentHeight}`);
|
|
99
|
+
checkingHeader = await this.blockchainService.getHeaderForHeight(parentHeight);
|
|
100
|
+
}
|
|
93
101
|
}
|
|
94
102
|
try {
|
|
95
103
|
const poiHeader = await this.findFinalizedUsingPOI(checkingHeader);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../src/indexer/unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,gDAS0B;AAC1B,mCAA8B;AAC9B,8DAA0D;AAC1D,wDAA6D;AAG7D,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,0BAA0B,CAAC,CAAC;AAG9C,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,S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sBAAU,UAE2B,sCAAiB;GAPzD,wBAAwB,CA2IpC","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n UnfinalizedBlocksService as BaseUnfinalizedBlocksService,\n Header,\n NodeConfig,\n getLogger,\n profiler,\n POI_NOT_ENABLED_ERROR_MESSAGE,\n IStoreModelProvider,\n IBlockchainService,\n} from '@subql/node-core';\nimport { last } from 'lodash';\nimport { BlockchainService } from '../blockchain.service';\nimport { EthereumNodeConfig } from '../configure/NodeConfig';\nimport { BlockContent } from './types';\n\nconst logger = getLogger('UnfinalizedBlocksService');\n\n@Injectable()\nexport class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService<BlockContent> {\n private supportsFinalization?: boolean;\n private startupCheck = true;\n\n constructor(\n nodeConfig: NodeConfig,\n @Inject('IStoreModelProvider') storeModelProvider: IStoreModelProvider,\n @Inject('IBlockchainService') blockchainService: BlockchainService,\n ) {\n // blockchain service cast is due to unsolvable typescript generic error, it wokrs on the main sdk but not here\n super(\n new EthereumNodeConfig(nodeConfig),\n storeModelProvider,\n blockchainService as IBlockchainService,\n );\n }\n\n /**\n * @param reindex - the function to reindex back before a fork\n * @param supportsFinalization - If the chain supports the 'finalized' block tag this should be true.\n * */\n // eslint-disable-next-line @typescript-eslint/require-await\n async init(\n reindex: (targetHeight: Header) => Promise<void>,\n supportsFinalisation?: boolean,\n ): Promise<Header | undefined> {\n this.supportsFinalization = supportsFinalisation;\n return super.init(reindex);\n }\n /**\n * Checks if a fork has happened, this doesn't find the start of the fork just where it was detected\n * @returns (Header | undefined) - The header may be the forked header but will most likely be the main header. Either way it should be used just for the block height\n * */\n @profiler()\n protected async hasForked(): Promise<Header | undefined> {\n if (this.supportsFinalization) {\n return super.hasForked();\n }\n\n // Startup check helps speed up finding a fork by checking the hash of the last unfinalized block\n if (this.startupCheck) {\n this.startupCheck = false;\n const lastUnfinalized = last(this.unfinalizedBlocks);\n if (lastUnfinalized) {\n const checkUnfinalized =\n await this.blockchainService.getHeaderForHeight(\n lastUnfinalized.blockHeight,\n );\n\n if (lastUnfinalized.blockHash !== checkUnfinalized.blockHash) {\n return checkUnfinalized;\n }\n }\n }\n\n if (this.unfinalizedBlocks.length <= 2) {\n return;\n }\n\n const i = this.unfinalizedBlocks.length - 1;\n const current = this.unfinalizedBlocks[i];\n const parent = this.unfinalizedBlocks[i - 1];\n\n if (current.parentHash !== parent.blockHash) {\n // We've found a fork now we need to find where the fork happened\n logger.warn(\n `Block fork detected at ${current.blockHeight}. Parent hash ${current.parentHash} doesn't match indexed parent ${parent.blockHash}.`,\n );\n\n return current;\n }\n\n return;\n }\n\n /**\n * Finds the height before the fork occurred based on the result of hasForked\n * @return (number | undefined) - The block height to rewind to to remove forked data\n **/\n protected async getLastCorrectFinalizedBlock(\n forkedHeader: Header,\n ): Promise<Header | undefined> {\n if (this.supportsFinalization) {\n return super.getLastCorrectFinalizedBlock(forkedHeader);\n }\n\n const bestVerifiableBlocks = this.unfinalizedBlocks.filter(\n ({ blockHeight }) => blockHeight < forkedHeader.blockHeight,\n );\n\n let checkingHeader = forkedHeader;\n\n // Work backwards through the blocks until we find a matching hash\n for (const header of bestVerifiableBlocks.reverse()) {\n if (\n header.blockHash === checkingHeader.blockHash ||\n header.blockHash === checkingHeader.parentHash\n ) {\n return header;\n }\n\n // Get the new parent\n if (!checkingHeader.parentHash) {\n throw new Error('Unable to get parent hash for header');\n }\n const parentHeight = checkingHeader.blockHeight - 1;\n try {\n checkingHeader = await this.blockchainService.getHeaderForHash(\n checkingHeader.parentHash,\n );\n } catch {\n // Parent block not found on chain (orphaned), fall back to height-based check\n logger.warn(\n `Failed to get block by hash, falling back to height-based check at height ${parentHeight}`,\n );\n checkingHeader = await this.blockchainService.getHeaderForHeight(\n parentHeight,\n );\n }\n }\n\n try {\n const poiHeader = await this.findFinalizedUsingPOI(checkingHeader);\n return poiHeader;\n } catch (e: any) {\n if (e.message === POI_NOT_ENABLED_ERROR_MESSAGE) {\n return {\n blockHeight: Math.max(\n 0,\n forkedHeader.blockHeight -\n (this.nodeConfig as EthereumNodeConfig).blockForkReindex,\n ),\n } as Header;\n }\n // TODO rewind back 1000+ blocks\n logger.info('Failed to use POI to rewind block');\n throw e;\n }\n }\n}\n"]}
|
|
@@ -17,7 +17,7 @@ export declare class WorkerService extends BaseWorkerService<BlockContent, Fetch
|
|
|
17
17
|
private indexerManager;
|
|
18
18
|
constructor(apiService: ApiService<EthereumApi, SafeEthProvider, IBlock<BlockContent>[]>, indexerManager: IndexerManager, projectService: IProjectService<EthereumProjectDs>, projectUpgradeService: IProjectUpgradeService, nodeConfig: NodeConfig);
|
|
19
19
|
protected fetchChainBlock(heights: number, extra: {}): Promise<IBlock<BlockContent>>;
|
|
20
|
-
protected toBlockResponse(block: BlockContent): Header;
|
|
20
|
+
protected toBlockResponse(block: IBlock<BlockContent>): Header;
|
|
21
21
|
protected processFetchedBlock(block: IBlock<BlockContent>, dataSources: SubqlEthereumDataSource[]): Promise<ProcessBlockResponse>;
|
|
22
22
|
getBlockSize(block: IBlock<BlockContent>): number;
|
|
23
23
|
}
|
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.WorkerService = void 0;
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
19
|
const node_core_1 = require("@subql/node-core");
|
|
20
|
-
const utils_ethereum_1 = require("../../ethereum/utils.ethereum");
|
|
21
20
|
const indexer_manager_1 = require("../indexer.manager");
|
|
22
21
|
const types_1 = require("../types");
|
|
23
22
|
let WorkerService = class WorkerService extends node_core_1.BaseWorkerService {
|
|
@@ -33,10 +32,7 @@ let WorkerService = class WorkerService extends node_core_1.BaseWorkerService {
|
|
|
33
32
|
return block;
|
|
34
33
|
}
|
|
35
34
|
toBlockResponse(block) {
|
|
36
|
-
return
|
|
37
|
-
...(0, utils_ethereum_1.ethereumBlockToHeader)(block),
|
|
38
|
-
parentHash: block.parentHash,
|
|
39
|
-
};
|
|
35
|
+
return block.getHeader();
|
|
40
36
|
}
|
|
41
37
|
async processFetchedBlock(block, dataSources) {
|
|
42
38
|
return this.indexerManager.indexBlock(block, dataSources);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AAEpD,gDAS0B;AAI1B,
|
|
1
|
+
{"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AAEpD,gDAS0B;AAI1B,wDAAoD;AACpD,oCAAsD;AAY/C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,6BAKlC;IAGW;IAKA;IAPV,YAEU,UAIP,EACO,cAA8B,EAEtC,cAAkD,EAElD,qBAA6C,EAC7C,UAAsB;QAEtB,KAAK,CAAC,cAAc,EAAE,qBAAqB,EAAE,UAAU,CAAC,CAAC;QAZjD,eAAU,GAAV,UAAU,CAIjB;QACO,mBAAc,GAAd,cAAc,CAAgB;IAQxC,CAAC;IAES,KAAK,CAAC,eAAe,CAC7B,OAAe,EACf,KAAS;QAET,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IAES,eAAe,CAAC,KAA2B;QACnD,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,KAA2B,EAC3B,WAAsC;QAEtC,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,YAAY,CAAC,KAA2B;QACtC,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACF,CAAA;AA7CY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;IAQR,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;IAOpB,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,IAAA,eAAM,EAAC,wBAAwB,CAAC,CAAA;qCARb,sBAAU;QAKN,gCAAc,kBAK1B,sBAAU;GAlBb,aAAa,CA6CzB","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { SubqlEthereumDataSource } from '@subql/common-ethereum';\nimport {\n NodeConfig,\n IProjectService,\n ProcessBlockResponse,\n ApiService,\n BaseWorkerService,\n IProjectUpgradeService,\n IBlock,\n Header,\n} from '@subql/node-core';\nimport { EthereumProjectDs } from '../../configure/SubqueryProject';\nimport { EthereumApi } from '../../ethereum';\nimport SafeEthProvider from '../../ethereum/safe-api';\nimport { IndexerManager } from '../indexer.manager';\nimport { BlockContent, getBlockSize } from '../types';\n\nexport type FetchBlockResponse = Header;\n\nexport type WorkerStatusResponse = {\n threadId: number;\n isIndexing: boolean;\n fetchedBlocks: number;\n toFetchBlocks: number;\n};\n\n@Injectable()\nexport class WorkerService extends BaseWorkerService<\n BlockContent,\n FetchBlockResponse,\n SubqlEthereumDataSource,\n {}\n> {\n constructor(\n @Inject('APIService')\n private apiService: ApiService<\n EthereumApi,\n SafeEthProvider,\n IBlock<BlockContent>[]\n >,\n private indexerManager: IndexerManager,\n @Inject('IProjectService')\n projectService: IProjectService<EthereumProjectDs>,\n @Inject('IProjectUpgradeService')\n projectUpgradeService: IProjectUpgradeService,\n nodeConfig: NodeConfig,\n ) {\n super(projectService, projectUpgradeService, nodeConfig);\n }\n\n protected async fetchChainBlock(\n heights: number,\n extra: {},\n ): Promise<IBlock<BlockContent>> {\n const [block] = await this.apiService.fetchBlocks([heights]);\n return block;\n }\n\n protected toBlockResponse(block: IBlock<BlockContent>): Header {\n return block.getHeader();\n }\n\n protected async processFetchedBlock(\n block: IBlock<BlockContent>,\n dataSources: SubqlEthereumDataSource[],\n ): Promise<ProcessBlockResponse> {\n return this.indexerManager.indexBlock(block, dataSources);\n }\n\n getBlockSize(block: IBlock<BlockContent>): number {\n return getBlockSize(block.block);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-ethereum",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3-0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@nestjs/schedule": "^5.0.1",
|
|
27
27
|
"@subql/common": "^5.8.2",
|
|
28
28
|
"@subql/common-ethereum": "4.10.1",
|
|
29
|
-
"@subql/node-core": "^
|
|
29
|
+
"@subql/node-core": "^19.1.0",
|
|
30
30
|
"@subql/testing": "^2.2.1",
|
|
31
31
|
"@subql/types-ethereum": "4.2.3",
|
|
32
32
|
"cacheable-lookup": "6",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"CHANGELOG.md",
|
|
71
71
|
"LICENSE"
|
|
72
72
|
],
|
|
73
|
-
"stableVersion": "6.3.
|
|
73
|
+
"stableVersion": "6.3.2"
|
|
74
74
|
}
|