From 0510cd3e766c541edc49e37a6499e2d2e5cb55ab Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Fri, 24 Nov 2023 11:04:41 +1300 Subject: [PATCH 1/6] Implement different fork detection for probabalistic finalization chains --- packages/node/src/configure/NodeConfig.ts | 5 + packages/node/src/ethereum/api.ethereum.ts | 1 - .../block-dispatcher.service.ts | 2 - .../worker-block-dispatcher.service.ts | 2 - packages/node/src/indexer/fetch.module.ts | 4 - .../src/indexer/unfinalizedBlocks.service.ts | 118 +++++++++++++++++- packages/node/src/yargs.ts | 11 +- 7 files changed, 130 insertions(+), 13 deletions(-) diff --git a/packages/node/src/configure/NodeConfig.ts b/packages/node/src/configure/NodeConfig.ts index ea9cd7050f..e259c07b89 100644 --- a/packages/node/src/configure/NodeConfig.ts +++ b/packages/node/src/configure/NodeConfig.ts @@ -6,6 +6,7 @@ import { IConfig, NodeConfig } from '@subql/node-core'; export interface IEthereumConfig extends IConfig { skipTransactions: boolean; blockConfirmations: number; + blockForkReindex: number; } export class EthereumNodeConfig extends NodeConfig { @@ -32,4 +33,8 @@ export class EthereumNodeConfig extends NodeConfig { get blockConfirmations(): number { return this._config.blockConfirmations; } + + get blockForkReindex(): number { + return this._config.blockForkReindex; + } } diff --git a/packages/node/src/ethereum/api.ethereum.ts b/packages/node/src/ethereum/api.ethereum.ts index 74bea7e727..98869d8e63 100644 --- a/packages/node/src/ethereum/api.ethereum.ts +++ b/packages/node/src/ethereum/api.ethereum.ts @@ -1,7 +1,6 @@ // Copyright 2020-2023 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 -import assert from 'assert'; import fs from 'fs'; import http from 'http'; import https from 'https'; diff --git a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts index fb8be3c18c..923d789f51 100644 --- a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts @@ -44,7 +44,6 @@ export class BlockDispatcherService smartBatchService: SmartBatchService, storeService: StoreService, storeCacheService: StoreCacheService, - poiService: PoiService, poiSyncService: PoiSyncService, @Inject('ISubqueryProject') project: SubqueryProject, dynamicDsService: DynamicDsService, @@ -57,7 +56,6 @@ export class BlockDispatcherService smartBatchService, storeService, storeCacheService, - poiService, poiSyncService, project, dynamicDsService, diff --git a/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts b/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts index 93e20577ac..f597218c34 100644 --- a/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts @@ -48,7 +48,6 @@ export class WorkerBlockDispatcherService cacheService: InMemoryCacheService, storeService: StoreService, storeCacheService: StoreCacheService, - poiService: PoiService, poiSyncService: PoiSyncService, @Inject('ISubqueryProject') project: SubqueryProject, dynamicDsService: DynamicDsService, @@ -63,7 +62,6 @@ export class WorkerBlockDispatcherService smartBatchService, storeService, storeCacheService, - poiService, poiSyncService, project, dynamicDsService, diff --git a/packages/node/src/indexer/fetch.module.ts b/packages/node/src/indexer/fetch.module.ts index d36547d754..bc6218ce08 100644 --- a/packages/node/src/indexer/fetch.module.ts +++ b/packages/node/src/indexer/fetch.module.ts @@ -93,7 +93,6 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; cacheService: InMemoryCacheService, storeService: StoreService, storeCacheService: StoreCacheService, - poiService: PoiService, poiSyncService: PoiSyncService, project: SubqueryProject, dynamicDsService: DynamicDsService, @@ -110,7 +109,6 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; cacheService, storeService, storeCacheService, - poiService, poiSyncService, project, dynamicDsService, @@ -127,7 +125,6 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; smartBatchService, storeService, storeCacheService, - poiService, poiSyncService, project, dynamicDsService, @@ -143,7 +140,6 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; InMemoryCacheService, StoreService, StoreCacheService, - PoiService, PoiSyncService, 'ISubqueryProject', DynamicDsService, diff --git a/packages/node/src/indexer/unfinalizedBlocks.service.ts b/packages/node/src/indexer/unfinalizedBlocks.service.ts index 8e3c4941b0..3853839b72 100644 --- a/packages/node/src/indexer/unfinalizedBlocks.service.ts +++ b/packages/node/src/indexer/unfinalizedBlocks.service.ts @@ -10,9 +10,17 @@ import { mainThreadOnly, NodeConfig, StoreCacheService, + getLogger, + profiler, + POI_NOT_ENABLED_ERROR_MESSAGE, } from '@subql/node-core'; +import { EthereumBlock } from '@subql/types-ethereum'; +import { last } from 'lodash'; +import { EthereumNodeConfig } from '../configure/NodeConfig'; import { BlockContent } from './types'; +const logger = getLogger('UnfinalizedBlocksService'); + export function blockToHeader(block: BlockContent | Block): Header { return { blockHeight: block.number, @@ -22,13 +30,119 @@ export function blockToHeader(block: BlockContent | Block): Header { } @Injectable() -export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { +export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { + private supportsFinalization?: boolean; + private startupCheck = true; + constructor( private readonly apiService: ApiService, nodeConfig: NodeConfig, storeCache: StoreCacheService, ) { - super(nodeConfig, storeCache); + super(new EthereumNodeConfig(nodeConfig), storeCache); + } + + /** + * @param reindex - the function to reindex back before a fork + * @param supportsFinalization - If the chain supports the 'finalized' block tag this should be true. + * */ + async init( + reindex: (targetHeight: number) => Promise, + supportsFinalisation?: boolean, + ): Promise { + this.supportsFinalization = supportsFinalisation; + return super.init(reindex); + } + + // Detect a fork by walking back through unfinalized blocks + @profiler() + protected async hasForked(): Promise
{ + if (this.supportsFinalization) { + return super.hasForked(); + } + + // Startup check helps speed up finding a fork by checking the hash of the last unfinalized block + if (this.startupCheck) { + this.startupCheck = false; + const lastUnfinalized = last(this.unfinalizedBlocks); + if (lastUnfinalized) { + const checkUnfinalized = await this.getHeaderForHeight( + lastUnfinalized.blockHeight, + ); + + if (lastUnfinalized.blockHash !== checkUnfinalized.blockHash) { + return checkUnfinalized; + } + } + } + + if (this.unfinalizedBlocks.length <= 2) { + return; + } + + const i = this.unfinalizedBlocks.length - 1; + const current = this.unfinalizedBlocks[i]; + const parent = this.unfinalizedBlocks[i - 1]; + + if (current.parentHash !== parent.blockHash) { + // We've found a fork now we need to find where the fork happened + logger.warn( + `Block fork detected at ${current.blockHeight}. Parent hash ${current.parentHash} doesn't match indexed parent ${parent.blockHash}.`, + ); + + return current; + } + + return; + } + + protected async getLastCorrectFinalizedBlock( + forkedHeader: Header, + ): Promise { + if (this.supportsFinalization) { + return super.getLastCorrectFinalizedBlock(forkedHeader); + } + + const bestVerifiableBlocks = this.unfinalizedBlocks.filter( + ({ blockHeight }) => blockHeight < forkedHeader.blockHeight, + ); + + let checkingHeader = forkedHeader; + + // Work backwards through the blocks until we find a matching hash + for (const { blockHash, blockHeight } of bestVerifiableBlocks.reverse()) { + if ( + blockHash === checkingHeader.blockHash || + blockHash === checkingHeader.parentHash + ) { + return blockHeight; + } + + // Get the new parent + checkingHeader = await this.getHeaderForHash(checkingHeader.parentHash); + } + + try { + const poiHeader = await this.findFinalizedUsingPOI(checkingHeader); + logger.info(`Using POI to rewind to ${JSON.stringify(poiHeader)}`); + return poiHeader.blockHeight; + } catch (e) { + if (e.message === POI_NOT_ENABLED_ERROR_MESSAGE) { + console.log( + 'HERE', + (this.nodeConfig as EthereumNodeConfig).blockForkReindex, + forkedHeader.blockHeight, + ); + return Math.max( + 0, + forkedHeader.blockHeight - + (this.nodeConfig as EthereumNodeConfig).blockForkReindex, + ); + } + // TODO rewind back 1000+ blocks + logger.info('Failed to use POI to rewind block'); + throw e; + } } @mainThreadOnly() diff --git a/packages/node/src/yargs.ts b/packages/node/src/yargs.ts index fdfcbba366..ad815f5bee 100644 --- a/packages/node/src/yargs.ts +++ b/packages/node/src/yargs.ts @@ -25,10 +25,17 @@ export const yargsOptions = yargsBuilder({ runOptions: { 'block-confirmations': { demandOption: false, - default: 20, + default: 200, describe: - 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum', + 'The number of blocks behind the head to be considered finalized for networks without deterministic finalisation such as Polygon POS', type: 'number', }, + 'block-fork-reindex': { + demandOption: false, + default: 1000, + type: 'number', + describe: + 'The number of blocks to reindex if a fork happens before cached unfinalized blocks and POI is not enabled.', + }, }, }); From ce010dd5de6df5f2a1404ab25e12f1df1ded6610 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Fri, 24 Nov 2023 11:27:12 +1300 Subject: [PATCH 2/6] Init unfinalized blocks service with supportsFinalization --- packages/node/src/ethereum/api.ethereum.ts | 8 +- packages/node/src/indexer/project.service.ts | 10 +- .../indexer/unfinalizedBlocks.service.spec.ts | 214 ++++++++++++++++++ 3 files changed, 229 insertions(+), 3 deletions(-) create mode 100644 packages/node/src/indexer/unfinalizedBlocks.service.spec.ts diff --git a/packages/node/src/ethereum/api.ethereum.ts b/packages/node/src/ethereum/api.ethereum.ts index 98869d8e63..7814049948 100644 --- a/packages/node/src/ethereum/api.ethereum.ts +++ b/packages/node/src/ethereum/api.ethereum.ts @@ -98,7 +98,11 @@ export class EthereumApi implements ApiWrapper { private name: string; // Ethereum POS - private supportsFinalization = true; + private _supportsFinalization = true; + + get supportsFinalization(): boolean { + return this._supportsFinalization; + } /** * @param {string} endpoint - The endpoint of the RPC provider @@ -163,7 +167,7 @@ export class EthereumApi implements ApiWrapper { ]); this.genesisBlock = genesisBlock; - this.supportsFinalization = supportsFinalization && supportsSafe; + this._supportsFinalization = supportsFinalization && supportsSafe; this.chainId = network.chainId; this.name = network.name; } catch (e) { diff --git a/packages/node/src/indexer/project.service.ts b/packages/node/src/indexer/project.service.ts index 813bce1f4e..c5facf201c 100644 --- a/packages/node/src/indexer/project.service.ts +++ b/packages/node/src/indexer/project.service.ts @@ -29,7 +29,8 @@ const { version: packageVersion } = require('../../package.json'); @Injectable() export class ProjectService extends BaseProjectService< EthereumApiService, - EthereumProjectDs + EthereumProjectDs, + UnfinalizedBlocksService > { protected packageVersion = packageVersion; @@ -75,4 +76,11 @@ export class ProjectService extends BaseProjectService< // TODO update this when implementing skipBlock feature for Eth this.apiService.updateBlockFetching(); } + + protected async initUnfinalized(): Promise { + return this.unfinalizedBlockService.init( + this.reindex.bind(this), + this.apiService.api.supportsFinalization, + ); + } } diff --git a/packages/node/src/indexer/unfinalizedBlocks.service.spec.ts b/packages/node/src/indexer/unfinalizedBlocks.service.spec.ts new file mode 100644 index 0000000000..92fa84a1de --- /dev/null +++ b/packages/node/src/indexer/unfinalizedBlocks.service.spec.ts @@ -0,0 +1,214 @@ +// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +import { hexZeroPad } from '@ethersproject/bytes'; +import { + ApiService, + CacheMetadataModel, + Header, + NodeConfig, + PoiBlock, + StoreCacheService, + METADATA_UNFINALIZED_BLOCKS_KEY, + METADATA_LAST_FINALIZED_PROCESSED_KEY, +} from '@subql/node-core'; +import { EthereumNodeConfig } from '../configure/NodeConfig'; +import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; + +// Adds 0 padding so we can convert to POI block +const hexify = (input: string) => hexZeroPad(input, 4); + +const makeHeader = (height: number, finalized?: boolean): Header => ({ + blockHeight: height, + blockHash: hexify(`0xABC${height}${finalized ? 'f' : ''}`), + parentHash: hexify(`0xABC${height - 1}${finalized ? 'f' : ''}`), +}); + +const getMockApi = (): ApiService => { + return { + api: { + getBlockByHeightOrHash: (hash: string | number) => { + const num = + typeof hash === 'number' + ? hash + : Number( + hash + .toString() + .replace('0x', '') + .replace('ABC', '') + .replace('f', ''), + ); + return Promise.resolve({ + number: num, + hash: typeof hash === 'number' ? hexify(`0xABC${hash}f`) : hash, + parentHash: hexify(`0xABC${num - 1}f`), + }); + }, + getFinalizedBlock: jest.fn(() => ({ + number: 110, + hash: '0xABC110f', + parentHash: '0xABC109f', + })), + }, + } as any; +}; + +function getMockMetadata(): any { + const data: Record = {}; + return { + upsert: ({ key, value }: any) => (data[key] = value), + findOne: ({ where: { key } }: any) => ({ value: data[key] }), + findByPk: (key: string) => data[key], + find: (key: string) => data[key], + } as any; +} + +function mockStoreCache(): StoreCacheService { + return { + metadata: new CacheMetadataModel(getMockMetadata()), + poi: { + getPoiBlocksBefore: jest.fn(() => [ + PoiBlock.create(99, hexify('0xABC99f'), new Uint8Array(), ''), + ]), + }, + } as any as StoreCacheService; +} + +describe('UnfinalizedBlockService', () => { + let unfinalizedBlocks: UnfinalizedBlocksService; + let storeCache: StoreCacheService; + + beforeEach(() => { + storeCache = mockStoreCache(); + + unfinalizedBlocks = new UnfinalizedBlocksService( + getMockApi(), + new NodeConfig({ + unfinalizedBlocks: true, + blockForkReindex: 1000, + } as any) as EthereumNodeConfig, + storeCache, + ); + }); + + it('handles a block fork', async () => { + await unfinalizedBlocks.init(jest.fn()); + + (unfinalizedBlocks as any)._unfinalizedBlocks = [ + makeHeader(100), + makeHeader(101), + makeHeader(102), + makeHeader(103, true), // Where the fork started + makeHeader(104), + makeHeader(105), + makeHeader(106), + makeHeader(107), + makeHeader(108), + makeHeader(109), + makeHeader(110), + ]; + + const rewind = await unfinalizedBlocks.processUnfinalizedBlockHeader( + makeHeader(111, true), + ); + + expect(rewind).toEqual(103); + }); + + it('uses POI blocks if there are not enough cached unfinalized blocks', async () => { + await unfinalizedBlocks.init(jest.fn()); + + (unfinalizedBlocks as any)._unfinalizedBlocks = [ + makeHeader(100), + makeHeader(101), + makeHeader(102), + makeHeader(103), + makeHeader(104), + makeHeader(105), + makeHeader(106), + makeHeader(107), + makeHeader(108), + makeHeader(109), + makeHeader(110), + ]; + + const spy = jest.spyOn(storeCache.poi as any, 'getPoiBlocksBefore'); + + const rewind = await unfinalizedBlocks.processUnfinalizedBlockHeader( + makeHeader(111, true), + ); + + expect(rewind).toEqual(99); + expect(spy).toHaveBeenCalled(); + }); + + // The finalized block is after the cached unfinalized blocks, they should be rechecked + it('startup, correctly checks for forks after cached unfinalized blocks', async () => { + storeCache.metadata.set( + METADATA_UNFINALIZED_BLOCKS_KEY, + JSON.stringify([ + makeHeader(99, true), + makeHeader(100), + makeHeader(101), + ]), + ); + + storeCache.metadata.set(METADATA_LAST_FINALIZED_PROCESSED_KEY, 99); + + const rewind = jest.fn(); + + await unfinalizedBlocks.init(rewind); + + // It should fall back to poi in this case + expect(rewind).toHaveBeenCalledWith(99); + }); + + it('startup, correctly checks for forks within cached unfinalized blocks', async () => { + storeCache.metadata.set( + METADATA_UNFINALIZED_BLOCKS_KEY, + JSON.stringify([ + makeHeader(110), + makeHeader(111), + makeHeader(112), + ]), + ); + + storeCache.metadata.set(METADATA_LAST_FINALIZED_PROCESSED_KEY, 109); + + const rewind = jest.fn(); + + await unfinalizedBlocks.init(rewind); + + // It should fall back to poi in this case + expect(rewind).toHaveBeenCalledWith(99); + }); + + it('doesnt throw if there are no unfinalized blocks on startup', async () => { + storeCache.metadata.set(METADATA_LAST_FINALIZED_PROCESSED_KEY, 109); + + await expect(unfinalizedBlocks.init(jest.fn())).resolves.not.toThrow(); + }); + + it('rewinds using blockForkReindex value if poi is not enabled', async () => { + // Do this to "disable" poi + (storeCache as any).poi = null; + + storeCache.metadata.set( + METADATA_UNFINALIZED_BLOCKS_KEY, + JSON.stringify([ + makeHeader(110), + makeHeader(111), + makeHeader(112), + ]), + ); + + storeCache.metadata.set(METADATA_LAST_FINALIZED_PROCESSED_KEY, 109); + + const rewind = jest.fn(); + + await unfinalizedBlocks.init(rewind); + + // It should fall back to poi in this case + expect(rewind).toHaveBeenCalledWith(0); + }); +}); From 711ba1cd9bc3ebbbea758879e1e0a358611fec4e Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Fri, 24 Nov 2023 11:51:48 +1300 Subject: [PATCH 3/6] Update changelog --- packages/node/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 369e3e6aff..2a4f9d13d7 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Different method for detecting block forks for chains with probabalistic finalization (#217) ## [3.3.6] - 2023-11-23 ### Fixed @@ -20,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.3.3] - 2023-11-13 ### Changed -- Updates to match changes in `@subql/node-core` (#210) +- Updates to match changes in - Dictionary service to use dictionary registry - Use yargs from node core From c9c6ab0c654d6e9579388b036ec63efd0553ac63 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Mon, 27 Nov 2023 10:29:01 +1300 Subject: [PATCH 4/6] Update node core, improve Celo tests --- packages/node/package.json | 2 +- .../celo/celo-json-rpc-batch-provider.spec.ts | 2 +- .../ethers/celo/celo-json-rpc-provider.spec.ts | 2 +- .../ethers/celo/celo-ws-provider.spec.ts | 2 +- yarn.lock | 16 ++++++++-------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/node/package.json b/packages/node/package.json index 74654522ab..259d1f738c 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -27,7 +27,7 @@ "@nestjs/schedule": "^3.0.1", "@subql/common": "^3.3.0", "@subql/common-ethereum": "workspace:*", - "@subql/node-core": "^6.4.2", + "@subql/node-core": "6.4.3-0", "@subql/testing": "^2.0.2", "@subql/types-ethereum": "workspace:*", "cacheable-lookup": "6", diff --git a/packages/node/src/ethereum/ethers/celo/celo-json-rpc-batch-provider.spec.ts b/packages/node/src/ethereum/ethers/celo/celo-json-rpc-batch-provider.spec.ts index 124fd310f7..2d5ced9ee2 100644 --- a/packages/node/src/ethereum/ethers/celo/celo-json-rpc-batch-provider.spec.ts +++ b/packages/node/src/ethereum/ethers/celo/celo-json-rpc-batch-provider.spec.ts @@ -30,6 +30,6 @@ describe('CeloJsonRpcProvider', () => { const block = formatBlock( await provider.send('eth_getBlockByNumber', ['latest', true]), ); - expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800)); + expect(BigNumber.from(block.gasLimit).gte(constants.Zero)).toBeTruthy(); }); }); diff --git a/packages/node/src/ethereum/ethers/celo/celo-json-rpc-provider.spec.ts b/packages/node/src/ethereum/ethers/celo/celo-json-rpc-provider.spec.ts index 13405ba4f2..61d5b1c8fb 100644 --- a/packages/node/src/ethereum/ethers/celo/celo-json-rpc-provider.spec.ts +++ b/packages/node/src/ethereum/ethers/celo/celo-json-rpc-provider.spec.ts @@ -28,6 +28,6 @@ describe('CeloJsonRpcProvider', () => { const block = formatBlock( await provider.send('eth_getBlockByNumber', ['latest', true]), ); - expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800)); + expect(BigNumber.from(block.gasLimit).gte(constants.Zero)).toBeTruthy(); }); }); diff --git a/packages/node/src/ethereum/ethers/celo/celo-ws-provider.spec.ts b/packages/node/src/ethereum/ethers/celo/celo-ws-provider.spec.ts index 3737d9af36..5fa4291b12 100644 --- a/packages/node/src/ethereum/ethers/celo/celo-ws-provider.spec.ts +++ b/packages/node/src/ethereum/ethers/celo/celo-ws-provider.spec.ts @@ -28,6 +28,6 @@ describe('CeloJsonRpcProvider', () => { const block = formatBlock( await provider.send('eth_getBlockByNumber', ['latest', true]), ); - expect(BigNumber.from(block.gasLimit)).toEqual(BigNumber.from(0x01e84800)); + expect(BigNumber.from(block.gasLimit).gte(constants.Zero)).toBeTruthy(); }); }); diff --git a/yarn.lock b/yarn.lock index 93a3547ff7..c34e6da6fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3243,9 +3243,9 @@ __metadata: languageName: node linkType: hard -"@subql/node-core@npm:^6.4.2": - version: 6.4.2 - resolution: "@subql/node-core@npm:6.4.2" +"@subql/node-core@npm:6.4.3-0": + version: 6.4.3-0 + resolution: "@subql/node-core@npm:6.4.3-0" dependencies: "@apollo/client": ^3.7.16 "@nestjs/common": ^9.4.0 @@ -3270,7 +3270,7 @@ __metadata: tar: ^6.1.11 vm2: ^3.9.19 yargs: ^16.2.0 - checksum: 93f7e2c1e1f855645496d92d4a5ad5970eee092dee7f2274687285b15bae87139ffdd61e979a33fe7470cd8abc4b660786e2148cfa003ad2566c9f5a4c1676a2 + checksum: 709e007db1ccb3b1e965ed09cddd5188131144de1ac4c5119b272908692ba8c0563bbaec961234a2b209c10839551851f51bb6d298b51d704966d15c6cc16afb languageName: node linkType: hard @@ -3288,7 +3288,7 @@ __metadata: "@nestjs/testing": ^9.4.0 "@subql/common": ^3.3.0 "@subql/common-ethereum": "workspace:*" - "@subql/node-core": ^6.4.2 + "@subql/node-core": 6.4.3-0 "@subql/testing": ^2.0.2 "@subql/types-ethereum": "workspace:*" "@types/express": ^4.17.13 @@ -4689,13 +4689,13 @@ __metadata: linkType: hard "axios@npm:^1.6.0": - version: 1.6.1 - resolution: "axios@npm:1.6.1" + version: 1.6.2 + resolution: "axios@npm:1.6.2" dependencies: follow-redirects: ^1.15.0 form-data: ^4.0.0 proxy-from-env: ^1.1.0 - checksum: 573f03f59b7487d54551b16f5e155d1d130ad4864ed32d1da93d522b78a57123b34e3bde37f822a65ee297e79f1db840f9ad6514addff50d3cbf5caeed39e8dc + checksum: 4a7429e2b784be0f2902ca2680964391eae7236faa3967715f30ea45464b98ae3f1c6f631303b13dfe721b17126b01f486c7644b9ef276bfc63112db9fd379f8 languageName: node linkType: hard From f63c0821b71e840d182caddb890a2395dee9dba3 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Mon, 27 Nov 2023 13:14:27 +1300 Subject: [PATCH 5/6] Tidy up, document hasForked function --- .../src/indexer/unfinalizedBlocks.service.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/node/src/indexer/unfinalizedBlocks.service.ts b/packages/node/src/indexer/unfinalizedBlocks.service.ts index 3853839b72..4555176ae3 100644 --- a/packages/node/src/indexer/unfinalizedBlocks.service.ts +++ b/packages/node/src/indexer/unfinalizedBlocks.service.ts @@ -53,8 +53,10 @@ export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { if (this.supportsFinalization) { @@ -96,6 +98,10 @@ export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { @@ -124,15 +130,9 @@ export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService Date: Mon, 27 Nov 2023 14:42:35 +1300 Subject: [PATCH 6/6] Update node-core --- packages/node/CHANGELOG.md | 2 +- packages/node/package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 2a4f9d13d7..2891cd28fe 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -22,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [3.3.3] - 2023-11-13 ### Changed -- Updates to match changes in +- Updates to match changes in `@subql/node-core` (#210) - Dictionary service to use dictionary registry - Use yargs from node core diff --git a/packages/node/package.json b/packages/node/package.json index 259d1f738c..32b286ca80 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -27,7 +27,7 @@ "@nestjs/schedule": "^3.0.1", "@subql/common": "^3.3.0", "@subql/common-ethereum": "workspace:*", - "@subql/node-core": "6.4.3-0", + "@subql/node-core": "^7.0.0", "@subql/testing": "^2.0.2", "@subql/types-ethereum": "workspace:*", "cacheable-lookup": "6", diff --git a/yarn.lock b/yarn.lock index c34e6da6fc..622053fb68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3243,9 +3243,9 @@ __metadata: languageName: node linkType: hard -"@subql/node-core@npm:6.4.3-0": - version: 6.4.3-0 - resolution: "@subql/node-core@npm:6.4.3-0" +"@subql/node-core@npm:^7.0.0": + version: 7.0.0 + resolution: "@subql/node-core@npm:7.0.0" dependencies: "@apollo/client": ^3.7.16 "@nestjs/common": ^9.4.0 @@ -3270,7 +3270,7 @@ __metadata: tar: ^6.1.11 vm2: ^3.9.19 yargs: ^16.2.0 - checksum: 709e007db1ccb3b1e965ed09cddd5188131144de1ac4c5119b272908692ba8c0563bbaec961234a2b209c10839551851f51bb6d298b51d704966d15c6cc16afb + checksum: 0c83ef7d7540c6ae667faaec69c7ad542880c481c763199bccaa22bb4110ee9a516cc29a4dc74e99be48157b1ccc0668cad24f8fb3910977146e2293ff3f5a91 languageName: node linkType: hard @@ -3288,7 +3288,7 @@ __metadata: "@nestjs/testing": ^9.4.0 "@subql/common": ^3.3.0 "@subql/common-ethereum": "workspace:*" - "@subql/node-core": 6.4.3-0 + "@subql/node-core": ^7.0.0 "@subql/testing": ^2.0.2 "@subql/types-ethereum": "workspace:*" "@types/express": ^4.17.13