From 285636632867994ae10aeee05295150a93388e83 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Fri, 25 Aug 2023 09:59:46 +1200 Subject: [PATCH] Update changelogs, address comments --- packages/common-substrate/CHANGELOG.md | 2 + packages/common/CHANGELOG.md | 2 + packages/node-core/CHANGELOG.md | 6 +++ .../src/configure/configure.module.ts | 40 ++++++++++--------- .../src/indexer/dictionary.service.test.ts | 6 --- packages/node/CHANGELOG.md | 5 +++ 6 files changed, 37 insertions(+), 24 deletions(-) diff --git a/packages/common-substrate/CHANGELOG.md b/packages/common-substrate/CHANGELOG.md index 96b803d6ba..199a15845f 100644 --- a/packages/common-substrate/CHANGELOG.md +++ b/packages/common-substrate/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - move block filters to common (#1969) +### Added +- Parent option to manifest (#1797) ## [2.4.0] - 2023-08-16 ### Added diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 30d1fabf89..bec6efea98 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - move block filters to common (#1969) +### Added +- Add spec for project upgrades (#1797) ## [2.6.0] - 2023-08-25 ### Changed diff --git a/packages/node-core/CHANGELOG.md b/packages/node-core/CHANGELOG.md index f3d342801d..7b9d06fa8d 100644 --- a/packages/node-core/CHANGELOG.md +++ b/packages/node-core/CHANGELOG.md @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Use test runs as unit for tests instead of entity checks (#1957) +### Changed +- Move more code from node to node-core. Including configure module, workers (#1797) + +### Added +- Project upgrades feature and many other changes to support it (#1797) + ## [4.2.3] - 2023-08-17 ### Fixed - delay getPoiBlocksByRange when fully synced, fixes the high CPU usage issue (#1952) diff --git a/packages/node-core/src/configure/configure.module.ts b/packages/node-core/src/configure/configure.module.ts index db45878a8a..8d0441b881 100644 --- a/packages/node-core/src/configure/configure.module.ts +++ b/packages/node-core/src/configure/configure.module.ts @@ -146,24 +146,28 @@ export async function registerApp

( }); const createParentProject = async (cid: string): Promise

=> { - cid = `ipfs://${cid}`; - const reader = await ReaderFactory.create(cid, { - ipfs: config.ipfs, - }); - return createProject( - cid, - await reader.getProjectSchema(), - reader, - await getCachedRoot(reader, config.root), - omitBy( - // Apply the network endpoint and dictionary from the source project to the parent projects if they are not defined in the config - { - endpoint: config.networkEndpoints ?? project.network.endpoint, - dictionary: config.networkDictionary ?? project.network.dictionary, - }, - isNil - ) - ); + try { + cid = `ipfs://${cid}`; + const reader = await ReaderFactory.create(cid, { + ipfs: config.ipfs, + }); + return createProject( + cid, + await reader.getProjectSchema(), + reader, + await getCachedRoot(reader, config.root), + omitBy( + // Apply the network endpoint and dictionary from the source project to the parent projects if they are not defined in the config + { + endpoint: config.networkEndpoints ?? project.network.endpoint, + dictionary: config.networkDictionary ?? project.network.dictionary, + }, + isNil + ) + ); + } catch (e) { + throw new Error(`Failed to load parent project with cid: ${cid}. ${e}`); + } }; const projectUpgradeService = await ProjectUpgradeSevice.create(project, createParentProject); diff --git a/packages/node-core/src/indexer/dictionary.service.test.ts b/packages/node-core/src/indexer/dictionary.service.test.ts index e224b2ea6c..1ef2197a21 100644 --- a/packages/node-core/src/indexer/dictionary.service.test.ts +++ b/packages/node-core/src/indexer/dictionary.service.test.ts @@ -350,11 +350,5 @@ describe('DictionaryService', () => { expect(results?.queryEndBlock).toEqual(499); }); - // it('sort map', () => { - // const unorderedDs = [mockDS[2], mockDS[0], mockDS[1]]; - // dictionaryService.buildDictionaryEntryMap(unorderedDs, (startBlock) => startBlock as any); - // expect([...(dictionaryService as any).mappedDictionaryQueryEntries.keys()]).toStrictEqual([100, 500, 1000]); - // }); - // TODO write a test that queries over 2 block ranges in case DS has been removed }); diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 311f8d167d..5959c6a20d 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -5,6 +5,11 @@ 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] +### Changed +- Move code to node-core (#1797) + +### Added +- Project upgrades feature which allows upgrading projects at specific heights (#1797) ## [2.12.2] - 2023-08-17 ### Fixed