From 136fa84dc8e7da8eca73cbd9316b18f64a0d0b32 Mon Sep 17 00:00:00 2001 From: Jay Ji Date: Tue, 9 Apr 2024 17:01:13 +1200 Subject: [PATCH] Sync main 20240408 (#110) * sync with main * update headers * changelog * fixes * Fix workers * Fix test * update ci * Update test * Update .github/actions/create-release/gh-release-script.js Co-authored-by: Scott Twiname --------- Co-authored-by: Scott Twiname --- .eslintrc.js | 2 +- .github/actions/create-release/action.yml | 8 +- .../create-release/gh-release-script.js | 107 ++-- .github/workflows/node-docker.yml | 27 +- .github/workflows/prerelease.yml | 4 + .github/workflows/release.yml | 29 +- packages/common-algorand/CHANGELOG.md | 3 + packages/common-algorand/package.json | 2 +- packages/common-algorand/src/index.ts | 2 +- packages/common-algorand/src/project/index.ts | 2 +- packages/common-algorand/src/project/load.ts | 2 +- .../common-algorand/src/project/models.ts | 2 +- packages/common-algorand/src/project/types.ts | 2 +- packages/common-algorand/src/project/utils.ts | 2 +- .../is-string-or-object.validation.ts | 2 +- .../versioned/ProjectManifestVersioned.ts | 2 +- .../src/project/versioned/index.ts | 2 +- .../src/project/versioned/v1_0_0/index.ts | 2 +- .../src/project/versioned/v1_0_0/model.ts | 2 +- packages/node/CHANGELOG.md | 7 + packages/node/package.json | 4 +- packages/node/src/algorand/algorand.spec.ts | 2 +- packages/node/src/algorand/api.algorand.ts | 14 +- packages/node/src/algorand/api.connection.ts | 12 +- .../node/src/algorand/api.service.algorand.ts | 16 +- packages/node/src/algorand/index.ts | 2 +- .../node/src/algorand/utils.algorand.spec.ts | 2 +- packages/node/src/algorand/utils.algorand.ts | 21 +- packages/node/src/app.module.ts | 2 +- .../node/src/configure/SubqueryProject.ts | 2 +- .../node/src/configure/configure.module.ts | 2 +- packages/node/src/indexer/api.service.spec.ts | 8 +- .../algorand-block-dispatcher.ts | 6 +- .../block-dispatcher.service.ts | 11 +- .../node/src/indexer/blockDispatcher/index.ts | 2 +- .../worker-block-dispatcher.service.ts | 17 +- .../src/indexer/dictionary.service.spec.ts | 33 -- .../node/src/indexer/dictionary.service.ts | 50 -- .../dictionary/algorandDictionary.service.ts | 75 +++ packages/node/src/indexer/dictionary/index.ts | 4 + .../v1/algorandDictionaryV1.spec.ts | 75 +++ .../dictionary/v1/algorandDictionaryV1.ts | 163 ++++++ .../node/src/indexer/dictionary/v1/index.ts | 4 + .../node/src/indexer/ds-processor.service.ts | 2 +- .../node/src/indexer/dynamic-ds.service.ts | 10 +- packages/node/src/indexer/fetch.module.ts | 23 +- packages/node/src/indexer/fetch.service.ts | 133 +---- packages/node/src/indexer/indexer.manager.ts | 14 +- packages/node/src/indexer/project.service.ts | 2 +- packages/node/src/indexer/sandbox.service.ts | 2 +- packages/node/src/indexer/types.ts | 2 +- .../src/indexer/unfinalizedBlocks.service.ts | 19 +- .../src/indexer/worker/worker-fetch.module.ts | 2 +- .../node/src/indexer/worker/worker.module.ts | 2 +- .../node/src/indexer/worker/worker.service.ts | 16 +- packages/node/src/indexer/worker/worker.ts | 2 +- .../worker.unfinalizedBlocks.service.ts | 13 +- packages/node/src/init.ts | 2 +- packages/node/src/main.ts | 2 +- packages/node/src/meta/meta.controller.ts | 2 +- packages/node/src/meta/meta.module.ts | 2 +- packages/node/src/meta/meta.service.ts | 2 +- .../node/src/subcommands/forceClean.init.ts | 2 +- .../node/src/subcommands/forceClean.module.ts | 2 +- .../src/subcommands/forceClean.service.ts | 2 +- packages/node/src/subcommands/reindex.init.ts | 2 +- .../node/src/subcommands/reindex.module.ts | 2 +- packages/node/src/subcommands/testing.init.ts | 2 +- .../node/src/subcommands/testing.module.ts | 2 +- .../node/src/subcommands/testing.service.ts | 5 +- packages/node/src/utils/project.ts | 2 +- packages/node/src/yargs.ts | 2 +- packages/node/test/jsonfy.js | 2 +- packages/types/CHANGELOG.md | 3 + packages/types/package.json | 2 +- packages/types/src/global.ts | 2 +- packages/types/src/index.ts | 2 +- packages/types/src/interfaces.ts | 2 +- packages/types/src/project.ts | 7 +- yarn.lock | 490 ++---------------- 80 files changed, 624 insertions(+), 899 deletions(-) delete mode 100644 packages/node/src/indexer/dictionary.service.spec.ts delete mode 100644 packages/node/src/indexer/dictionary.service.ts create mode 100644 packages/node/src/indexer/dictionary/algorandDictionary.service.ts create mode 100644 packages/node/src/indexer/dictionary/index.ts create mode 100644 packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.spec.ts create mode 100644 packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.ts create mode 100644 packages/node/src/indexer/dictionary/v1/index.ts diff --git a/.eslintrc.js b/.eslintrc.js index 3385fe9c..4b0550bd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -85,7 +85,7 @@ module.exports = { 2, 'line', [ - //Copyright 2020-2023 SubQuery Pte Ltd authors & contributors + //Copyright 2020-2024 SubQuery Pte Ltd authors & contributors {pattern: ' Copyright \\d{4}(-\\d{4})? SubQuery Pte Ltd authors & contributors'}, ' SPDX-License-Identifier: GPL-3.0', ], diff --git a/.github/actions/create-release/action.yml b/.github/actions/create-release/action.yml index bacd1904..e67ba30d 100644 --- a/.github/actions/create-release/action.yml +++ b/.github/actions/create-release/action.yml @@ -12,18 +12,18 @@ inputs: npm-token: description: 'token to push to npm registry' required: true - + runs: using: "composite" steps: - working-directory: ${{ inputs.package-path }} - run: echo "Changes exist in ${{ inputs.package-path }}" && yarn npm publish --access public + run: echo "Changes exist in ${{ inputs.package-path }}" && yarn npm publish --access public env: NPM_TOKEN: ${{ inputs.npm-token }} shell: bash - working-directory: ${{ github.workspace }} - run: node ${{ github.action_path }}/gh-release-script.js ${{ github.workspace }}/${{ inputs.package-path }} - env: + run: node ${{ github.action_path }}/gh-release-script.js ${{ github.workspace }}/${{ inputs.package-path }} ${{ github.sha }} + env: REPO_TOKEN: ${{ inputs.repo-token }} shell: bash diff --git a/.github/actions/create-release/gh-release-script.js b/.github/actions/create-release/gh-release-script.js index 196134d7..76bb3097 100644 --- a/.github/actions/create-release/gh-release-script.js +++ b/.github/actions/create-release/gh-release-script.js @@ -8,76 +8,77 @@ const myArgs = process.argv.slice(2); const pJson = require(`${myArgs[0]}/package.json`) const version = pJson.version; -const repoName = pJson.name; +const repoName = pJson.name; const packageName = repoName.split('/'); function checkForBetaVersion(version) { - if (version.includes('-')){ - exit(0); //skip this package but continue trying to release others - } + if (version.includes('-')){ + exit(0); //skip this package but continue trying to release others + } } function gatherReleaseInfo(logPath) { - const changeLogs = fs.readFileSync(logPath, 'utf8'); - const regex = /## \[([0-9]+(\.[0-9]+)+)] - [0-9]{4}-[0-9]{2}-[0-9]{2}/i; - - let lines = changeLogs.split(/\n/); - let foundChangelog = false; - let releaseInfo = ''; - let i = 0; + const changeLogs = fs.readFileSync(logPath, 'utf8'); + const regex = /## \[([0-9]+(\.[0-9]+)+)] - [0-9]{4}-[0-9]{2}-[0-9]{2}/i; - for(let j = 0; j < lines.length; j++){ - if(lines[j].includes(`[${version}]`)){ - i = j; - j = lines.length; - foundChangelog = true; - } - } + let lines = changeLogs.split(/\n/); + let foundChangelog = false; + let releaseInfo = ''; + let i = 0; - lines = lines.slice(i); - - if(foundChangelog){ - for(let j = 0; j < lines.length; j++){ - if(j == 0){ - releaseInfo += `${lines[j]}`+ '\n'; - continue; - } - - if(!regex.test(lines[j])){ - releaseInfo += `${lines[j]}`+ '\n'; - } else { - j = lines.length; - } - } + for(let j = 0; j < lines.length; j++){ + if(lines[j].includes(`[${version}]`)){ + i = j; + j = lines.length; + foundChangelog = true; } - - if(releaseInfo === ''){ - core.setFailed("No release info found, either missing in changelog or changelog is formatted incorrectly") + } + + lines = lines.slice(i); + + if(foundChangelog){ + for(let j = 0; j < lines.length; j++){ + if(j == 0){ + releaseInfo += `${lines[j]}`+ '\n'; + continue; + } + + if(!regex.test(lines[j])){ + releaseInfo += `${lines[j]}`+ '\n'; + } else { + j = lines.length; + } } + } + + if(releaseInfo === ''){ + core.setFailed("No release info found, either missing in changelog or changelog is formatted incorrectly") + } - console.log("Gathered release info...") - return releaseInfo; + console.log("Gathered release info...") + return releaseInfo; } async function publishRelease(releaseInfo) { - await request('POST /repos/{owner}/{repo}/releases', { - headers: { - authorization: `token ${process.env.REPO_TOKEN}`, - }, - owner: 'subquery', - name: `[${version}] ${repoName}`, - repo: 'subql-algorand', - tag_name: `${packageName[1]}/${version}`, - body: releaseInfo - }).catch( err => { - core.setFailed(err) - }) - - console.log("Release Created...") + await request('POST /repos/{owner}/{repo}/releases', { + headers: { + authorization: `token ${process.env.REPO_TOKEN}`, + }, + owner: 'subquery', + name: `[${version}] ${repoName}`, + repo: 'subql-algorand', + tag_name: `${packageName[1]}/${version}`, + target_commitish: `${myArgs[1]}`, + body: releaseInfo + }).catch( err => { + core.setFailed(err) + }) + + console.log("Release Created...") } - + checkForBetaVersion(version); const releaseInfo = gatherReleaseInfo(`${myArgs[0]}/CHANGELOG.md`); diff --git a/.github/workflows/node-docker.yml b/.github/workflows/node-docker.yml index 263f658d..f94a2a6c 100644 --- a/.github/workflows/node-docker.yml +++ b/.github/workflows/node-docker.yml @@ -27,12 +27,12 @@ jobs: COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s") if [[ $COMMIT_MESSAGE == "[release]"* ]] && git diff --name-only HEAD~1 HEAD -- './packages/node/package.json' then - echo "::set-output name=changes_found::true" + echo "::set-output name=changes_found::true" >> "$GITHUB_OUTPUT" else - echo "::set-output name=changes_found::false" + echo "::set-output name=changes_found::false" >> "$GITHUB_OUTPUT" fi else - echo "::set-output name=changes_found::true" + echo "::set-output name=changes_found::true" >> "$GITHUB_OUTPUT" fi node-build-push-docker: @@ -46,13 +46,13 @@ jobs: token: ${{ secrets.REPO_TOKEN }} - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: onfinality password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -69,7 +69,7 @@ jobs: - name: Build and push if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true @@ -80,7 +80,7 @@ jobs: - name: Build and push if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'true') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true @@ -104,13 +104,13 @@ jobs: token: ${{ secrets.REPO_TOKEN }} - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: subquerynetwork password: ${{ secrets.SQ_DOCKERHUB_TOKEN }} @@ -127,7 +127,7 @@ jobs: - name: Build and push if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true @@ -138,7 +138,7 @@ jobs: - name: Build and push if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'true') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: context: . push: true @@ -149,4 +149,3 @@ jobs: - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} - diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 0c3e89cd..0800dd92 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -6,6 +6,10 @@ on: paths-ignore: - '.github/workflows/**' +concurrency: + group: publish + cancel-in-progress: false + jobs: pre-ci: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index deb4e74e..d70742c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,22 +7,37 @@ on: - '.github/workflows/**' workflow_dispatch: +concurrency: + # Same group as prerelease + group: publish + cancel-in-progress: false + jobs: + # This gets the commit message because workflow dispatch doesnt set: github.event.head_commit.message pre-ci: runs-on: ubuntu-latest timeout-minutes: 1 + outputs: + commit-message: ${{ steps.step1.outputs.commit-message }} steps: - - name: 'Block Concurrent Executions' - uses: softprops/turnstyle@v1 + - uses: actions/checkout@v4 with: - poll-interval-seconds: 10 - env: - GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} + fetch-depth: 100 + + # Get the commit message, workflow_dispatch doesn't contain it so we need to get it through git cli + - id: step1 + run: | + if [ -n "${{ github.event.head_commit.message }}" ] + then + echo "commit-message=${{ github.event.head_commit.message }}" >> "$GITHUB_OUTPUT" + else + echo "commit-message=$(git log -1 --pretty=%B)" >> "$GITHUB_OUTPUT" + fi Build-Publish: name: Build-Publish needs: pre-ci - if: "!startsWith(github.event.head_commit.message, '[SKIP CI]') && startsWith(github.event.head_commit.message, '[release]') && github.repository == 'subquery/subql-algorand'" + if: "!startsWith(needs.pre-ci.outputs.commit-message, '[SKIP CI]') && startsWith(needs.pre-ci.outputs.commit-message, '[release]') && github.repository == 'subquery/subql-algorand'" runs-on: ubuntu-latest steps: #Check out @@ -35,7 +50,7 @@ jobs: with: node-version: 18 - #Identify changes + #Identify changes - uses: marceloprado/has-changed-path@v1 id: changed-types with: diff --git a/packages/common-algorand/CHANGELOG.md b/packages/common-algorand/CHANGELOG.md index 8f0efa10..6d207081 100644 --- a/packages/common-algorand/CHANGELOG.md +++ b/packages/common-algorand/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- version bump with `@subql/common` + ## [3.2.2] - 2024-02-23 ### Changed - version bump with `@subql/common` diff --git a/packages/common-algorand/package.json b/packages/common-algorand/package.json index 7529ccd9..9ae2b502 100644 --- a/packages/common-algorand/package.json +++ b/packages/common-algorand/package.json @@ -14,7 +14,7 @@ "main": "dist/index.js", "license": "GPL-3.0", "dependencies": { - "@subql/common": "^3.4.1", + "@subql/common": "^3.5.0", "@subql/types-algorand": "workspace:*", "class-transformer": "^0.5.1", "class-validator": "^0.13.2", diff --git a/packages/common-algorand/src/index.ts b/packages/common-algorand/src/index.ts index 97f0d4d0..aa8374ef 100644 --- a/packages/common-algorand/src/index.ts +++ b/packages/common-algorand/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './project'; diff --git a/packages/common-algorand/src/project/index.ts b/packages/common-algorand/src/project/index.ts index 09bb892f..2eaa386f 100644 --- a/packages/common-algorand/src/project/index.ts +++ b/packages/common-algorand/src/project/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './load'; diff --git a/packages/common-algorand/src/project/load.ts b/packages/common-algorand/src/project/load.ts index 6b04f5b3..2dbe546b 100644 --- a/packages/common-algorand/src/project/load.ts +++ b/packages/common-algorand/src/project/load.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {AlgorandProjectManifestVersioned, VersionedProjectManifest} from './versioned'; diff --git a/packages/common-algorand/src/project/models.ts b/packages/common-algorand/src/project/models.ts index ff73b008..32a32d81 100644 --- a/packages/common-algorand/src/project/models.ts +++ b/packages/common-algorand/src/project/models.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {BaseDataSource, ProcessorImpl} from '@subql/common'; diff --git a/packages/common-algorand/src/project/types.ts b/packages/common-algorand/src/project/types.ts index 7295aac2..77a21a99 100644 --- a/packages/common-algorand/src/project/types.ts +++ b/packages/common-algorand/src/project/types.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {AlgorandDataSource} from '@subql/types-algorand'; diff --git a/packages/common-algorand/src/project/utils.ts b/packages/common-algorand/src/project/utils.ts index b182f523..d575129e 100644 --- a/packages/common-algorand/src/project/utils.ts +++ b/packages/common-algorand/src/project/utils.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { diff --git a/packages/common-algorand/src/project/validation/is-string-or-object.validation.ts b/packages/common-algorand/src/project/validation/is-string-or-object.validation.ts index 7538988a..7dd8e9a6 100644 --- a/packages/common-algorand/src/project/validation/is-string-or-object.validation.ts +++ b/packages/common-algorand/src/project/validation/is-string-or-object.validation.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {registerDecorator, ValidationOptions} from 'class-validator'; diff --git a/packages/common-algorand/src/project/versioned/ProjectManifestVersioned.ts b/packages/common-algorand/src/project/versioned/ProjectManifestVersioned.ts index 8b76168f..f8392e04 100644 --- a/packages/common-algorand/src/project/versioned/ProjectManifestVersioned.ts +++ b/packages/common-algorand/src/project/versioned/ProjectManifestVersioned.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {AlgorandDataSource} from '@subql/types-algorand'; diff --git a/packages/common-algorand/src/project/versioned/index.ts b/packages/common-algorand/src/project/versioned/index.ts index 621343db..e73a2d4a 100644 --- a/packages/common-algorand/src/project/versioned/index.ts +++ b/packages/common-algorand/src/project/versioned/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './ProjectManifestVersioned'; diff --git a/packages/common-algorand/src/project/versioned/v1_0_0/index.ts b/packages/common-algorand/src/project/versioned/v1_0_0/index.ts index 26eab2f7..37369651 100644 --- a/packages/common-algorand/src/project/versioned/v1_0_0/index.ts +++ b/packages/common-algorand/src/project/versioned/v1_0_0/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './model'; diff --git a/packages/common-algorand/src/project/versioned/v1_0_0/model.ts b/packages/common-algorand/src/project/versioned/v1_0_0/model.ts index 13899456..64667185 100644 --- a/packages/common-algorand/src/project/versioned/v1_0_0/model.ts +++ b/packages/common-algorand/src/project/versioned/v1_0_0/model.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index cea9c211..a3b8e449 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Updated with node-core.Now dictionary support multiple dictionary endpoints, indexer will fetch and switch dictionaries base on available blocks +### Fixed +- Updated with node-core ,also fixed: + - Fix modulo block didn't apply correctly with multiple dataSources + - Now when `workers` set to 0, it will use block dispatcher instead of throw and exit + ## [3.9.1] - 2024-03-14 ### Changed - Update `@subql/node-core` to 4.7.2 with graphql comments escaping fix diff --git a/packages/node/package.json b/packages/node/package.json index c7983896..81ca6202 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -25,9 +25,9 @@ "@nestjs/event-emitter": "^2.0.0", "@nestjs/platform-express": "^9.4.0", "@nestjs/schedule": "^3.0.1", - "@subql/common": "^3.4.1", + "@subql/common": "^3.5.0", "@subql/common-algorand": "workspace:*", - "@subql/node-core": "^7.4.2", + "@subql/node-core": "^8.0.1", "@subql/types-algorand": "workspace:*", "algosdk": "^2.2.0", "axios": "^1.3.4", diff --git a/packages/node/src/algorand/algorand.spec.ts b/packages/node/src/algorand/algorand.spec.ts index b113535d..af58e5d8 100644 --- a/packages/node/src/algorand/algorand.spec.ts +++ b/packages/node/src/algorand/algorand.spec.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { INestApplication } from '@nestjs/common'; diff --git a/packages/node/src/algorand/api.algorand.ts b/packages/node/src/algorand/api.algorand.ts index 95c35a30..3e5a44c4 100644 --- a/packages/node/src/algorand/api.algorand.ts +++ b/packages/node/src/algorand/api.algorand.ts @@ -1,8 +1,8 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { TokenHeader } from '@subql/common-algorand'; -import { delay, getLogger } from '@subql/node-core'; +import { delay, getLogger, IBlock } from '@subql/node-core'; import { AlgorandBlock, AlgorandTransaction, @@ -11,7 +11,7 @@ import { import algosdk, { Indexer } from 'algosdk'; import axios from 'axios'; import { omit } from 'lodash'; -import { camelCaseObjectKey } from './utils.algorand'; +import { camelCaseObjectKey, formatBlockUtil } from './utils.algorand'; const logger = getLogger('api.algorand'); @@ -170,7 +170,7 @@ export class AlgorandApi { getSafeApi(height: number): SafeAPIService { return new SafeAPIService(this, height, this.endpoint); } - async fetchBlocks(blockNums: number[]): Promise { + async fetchBlocks(blockNums: number[]): Promise[]> { let blocks: AlgorandBlock[] = []; for (let i = 0; i < blockNums.length; i++) { @@ -185,14 +185,14 @@ export class AlgorandApi { blocks = [...blocks, ...fetchedBlocks]; - blocks = await Promise.all( + const formattedBlocks = await Promise.all( blocks.map(async (block) => { block.hash = await this.getBlockHash(block.round, blocks); - return block; + return formatBlockUtil(block); }), ); - return blocks; + return formattedBlocks; } private blockInCache(number: number): AlgorandBlock { diff --git a/packages/node/src/algorand/api.connection.ts b/packages/node/src/algorand/api.connection.ts index eeee8442..6b5c3f30 100644 --- a/packages/node/src/algorand/api.connection.ts +++ b/packages/node/src/algorand/api.connection.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { @@ -7,17 +7,21 @@ import { IApiConnectionSpecific, NetworkMetadataPayload, getLogger, + IBlock, } from '@subql/node-core'; import { BlockContent } from '../indexer/types'; import { AlgorandApi, SafeAPIService } from './api.algorand'; const logger = getLogger('AlgorandApiConnection'); -type FetchFunc = (api: AlgorandApi, batch: number[]) => Promise; +type FetchFunc = ( + api: AlgorandApi, + batch: number[], +) => Promise[]>; export class AlgorandApiConnection implements - IApiConnectionSpecific + IApiConnectionSpecific[]> { readonly networkMeta: NetworkMetadataPayload; @@ -56,7 +60,7 @@ export class AlgorandApiConnection logger.debug('apiDisconnect is not implemented'); } - async fetchBlocks(heights: number[]): Promise { + async fetchBlocks(heights: number[]): Promise[]> { const blocks = await this.fetchBlocksBatches(this.unsafeApi, heights); return blocks; } diff --git a/packages/node/src/algorand/api.service.algorand.ts b/packages/node/src/algorand/api.service.algorand.ts index 26b8662c..b87707b0 100644 --- a/packages/node/src/algorand/api.service.algorand.ts +++ b/packages/node/src/algorand/api.service.algorand.ts @@ -1,9 +1,14 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; import { EventEmitter2 } from '@nestjs/event-emitter'; -import { ApiService, ConnectionPoolService, getLogger } from '@subql/node-core'; +import { + ApiService, + ConnectionPoolService, + getLogger, + IBlock, +} from '@subql/node-core'; import { SubqueryProject } from '../configure/SubqueryProject'; import { BlockContent } from '../indexer/types'; import { AlgorandApi, SafeAPIService } from './api.algorand'; @@ -15,7 +20,7 @@ const logger = getLogger('api'); export class AlgorandApiService extends ApiService< AlgorandApi, SafeAPIService, - BlockContent[] + IBlock[] > { constructor( @Inject('ISubqueryProject') private project: SubqueryProject, @@ -41,8 +46,7 @@ export class AlgorandApiService extends ApiService< AlgorandApiConnection.create(endpoint, this.fetchBlockBatches), //eslint-disable-next-line @typescript-eslint/require-await async (connection: AlgorandApiConnection) => { - const api = connection.unsafeApi; - return api.getGenesisHash(); + return connection.unsafeApi.getGenesisHash(); }, ); @@ -56,7 +60,7 @@ export class AlgorandApiService extends ApiService< async fetchBlockBatches( api: AlgorandApi, blocks: number[], - ): Promise { + ): Promise[]> { return api.fetchBlocks(blocks); } } diff --git a/packages/node/src/algorand/index.ts b/packages/node/src/algorand/index.ts index 57cc61a7..215045ee 100644 --- a/packages/node/src/algorand/index.ts +++ b/packages/node/src/algorand/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './api.algorand'; diff --git a/packages/node/src/algorand/utils.algorand.spec.ts b/packages/node/src/algorand/utils.algorand.spec.ts index 7b7312c0..38fe0852 100644 --- a/packages/node/src/algorand/utils.algorand.spec.ts +++ b/packages/node/src/algorand/utils.algorand.spec.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { INestApplication } from '@nestjs/common'; diff --git a/packages/node/src/algorand/utils.algorand.ts b/packages/node/src/algorand/utils.algorand.ts index d5222627..0ccf1834 100644 --- a/packages/node/src/algorand/utils.algorand.ts +++ b/packages/node/src/algorand/utils.algorand.ts @@ -1,6 +1,7 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 +import { Header, IBlock } from '@subql/node-core'; import { AlgorandBlock, AlgorandBlockFilter, @@ -9,6 +10,24 @@ import { } from '@subql/types-algorand'; import { Indexer, TransactionType } from 'algosdk'; import { camelCase, get } from 'lodash'; +import { BlockContent } from '../indexer/types'; + +export function algorandBlockToHeader(block: BlockContent): Header { + return { + blockHeight: block.round, + blockHash: block.round.toString(), + parentHash: block.previousBlockHash, + }; +} + +export function formatBlockUtil( + block: B, +): IBlock { + return { + block, + getHeader: () => algorandBlockToHeader(block), + }; +} export function camelCaseObjectKey(object: object) { if (Array.isArray(object)) { diff --git a/packages/node/src/app.module.ts b/packages/node/src/app.module.ts index bf09efe3..db086c35 100644 --- a/packages/node/src/app.module.ts +++ b/packages/node/src/app.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/configure/SubqueryProject.ts b/packages/node/src/configure/SubqueryProject.ts index 2594c8a7..32af4c5b 100644 --- a/packages/node/src/configure/SubqueryProject.ts +++ b/packages/node/src/configure/SubqueryProject.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import assert from 'assert'; diff --git a/packages/node/src/configure/configure.module.ts b/packages/node/src/configure/configure.module.ts index 8361b7ad..de172d9b 100644 --- a/packages/node/src/configure/configure.module.ts +++ b/packages/node/src/configure/configure.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { DynamicModule, Global, Module } from '@nestjs/common'; diff --git a/packages/node/src/indexer/api.service.spec.ts b/packages/node/src/indexer/api.service.spec.ts index 1b26c904..9b1144a1 100644 --- a/packages/node/src/indexer/api.service.spec.ts +++ b/packages/node/src/indexer/api.service.spec.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { INestApplication } from '@nestjs/common'; @@ -67,7 +67,9 @@ describe('ApiService', () => { const block = (await apiService.api.fetchBlocks([50000]))[0]; - expect(block.hash).toEqual('Gss169f22yVUBJzbNT9qXtQukjh0tgecvapaQY5NIRg='); + expect(block.block.hash).toEqual( + 'Gss169f22yVUBJzbNT9qXtQukjh0tgecvapaQY5NIRg=', + ); }); it('waits on pending block to fetch hash', async () => { @@ -83,6 +85,6 @@ describe('ApiService', () => { expect(fetchLatestBlock).not.toThrow(); const block = await fetchLatestBlock(); - expect(block.hash).toBeDefined(); + expect(block.block.hash).toBeDefined(); }); }); diff --git a/packages/node/src/indexer/blockDispatcher/algorand-block-dispatcher.ts b/packages/node/src/indexer/blockDispatcher/algorand-block-dispatcher.ts index 22bfe054..f663b79a 100644 --- a/packages/node/src/indexer/blockDispatcher/algorand-block-dispatcher.ts +++ b/packages/node/src/indexer/blockDispatcher/algorand-block-dispatcher.ts @@ -1,8 +1,10 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { IBlockDispatcher } from '@subql/node-core'; +import { AlgorandBlock } from '@subql/types-algorand'; -export interface IAlgorandBlockDispatcher extends IBlockDispatcher { +export interface IAlgorandBlockDispatcher + extends IBlockDispatcher { init(onDynamicDsCreated: (height: number) => Promise): Promise; } diff --git a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts index 204d5356..c3bc5104 100644 --- a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; @@ -13,6 +13,7 @@ import { BlockDispatcher, ProcessBlockResponse, IProjectUpgradeService, + IBlock, } from '@subql/node-core'; import { AlgorandBlock } from '@subql/types-algorand'; import { AlgorandApiService } from '../../algorand'; @@ -58,9 +59,7 @@ export class BlockDispatcherService poiSyncService, project, dynamicDsService, - async (blockNums: number[]): Promise => { - return this.apiService.fetchBlocks(blockNums); - }, + apiService.fetchBlocks.bind(apiService), ); } @@ -69,11 +68,11 @@ export class BlockDispatcherService } protected async indexBlock( - block: AlgorandBlock, + block: IBlock, ): Promise { return this.indexerManager.indexBlock( block, - await this.projectService.getDataSources(this.getBlockHeight(block)), + await this.projectService.getDataSources(block.getHeader().blockHeight), ); } } diff --git a/packages/node/src/indexer/blockDispatcher/index.ts b/packages/node/src/indexer/blockDispatcher/index.ts index f21bb041..aa62cd36 100644 --- a/packages/node/src/indexer/blockDispatcher/index.ts +++ b/packages/node/src/indexer/blockDispatcher/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { IAlgorandBlockDispatcher } from './algorand-block-dispatcher'; 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 ede0a04d..a660a7d1 100644 --- a/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/worker-block-dispatcher.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import path from 'path'; @@ -17,6 +17,7 @@ import { InMemoryCacheService, createIndexerWorker, } from '@subql/node-core'; +import { AlgorandBlock } from '@subql/types-algorand'; import { AlgorandApiConnection } from '../../algorand'; import { AlgorandProjectDs, @@ -33,7 +34,7 @@ type IndexerWorker = IIndexerWorker & { @Injectable() export class WorkerBlockDispatcherService - extends WorkerBlockDispatcher + extends WorkerBlockDispatcher implements OnApplicationShutdown { constructor( @@ -90,17 +91,5 @@ export class WorkerBlockDispatcherService ): Promise { // const start = new Date(); await worker.fetchBlock(height, null); - // const end = new Date(); - - // const waitTime = end.getTime() - start.getTime(); - // if (waitTime > 1000) { - // logger.info( - // `Waiting to fetch block ${height}: ${chalk.red(`${waitTime}ms`)}`, - // ); - // } else if (waitTime > 200) { - // logger.info( - // `Waiting to fetch block ${height}: ${chalk.yellow(`${waitTime}ms`)}`, - // ); - // } } } diff --git a/packages/node/src/indexer/dictionary.service.spec.ts b/packages/node/src/indexer/dictionary.service.spec.ts deleted file mode 100644 index 07093199..00000000 --- a/packages/node/src/indexer/dictionary.service.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors -// SPDX-License-Identifier: GPL-3.0 - -import { EventEmitter2 } from '@nestjs/event-emitter'; -import { NodeConfig } from '@subql/node-core'; -import { DictionaryService } from './dictionary.service'; - -describe('dictionary service', () => { - let dictionaryService: DictionaryService; - - beforeEach(async () => { - dictionaryService = await DictionaryService.create( - { - network: { - chainId: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', - dictionary: - 'https://api.subquery.network/sq/subquery/Algorand-Dictionary', - }, - } as any, - { dictionaryTimeout: 10000 } as NodeConfig, - new EventEmitter2(), - ); - }); - - it('successfully validates metatada', async () => { - /* Genesis hash is unused with cosmos, chainId is used from project instead */ - await expect( - dictionaryService.initValidation( - 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', - ), - ).resolves.toBeTruthy(); - }); -}); diff --git a/packages/node/src/indexer/dictionary.service.ts b/packages/node/src/indexer/dictionary.service.ts deleted file mode 100644 index 66c8b627..00000000 --- a/packages/node/src/indexer/dictionary.service.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors -// SPDX-License-Identifier: GPL-3.0 - -import { Inject, Injectable } from '@nestjs/common'; -import { EventEmitter2 } from '@nestjs/event-emitter'; -import { NETWORK_FAMILY } from '@subql/common'; -import { - NodeConfig, - DictionaryService as CoreDictionaryService, -} from '@subql/node-core'; -import { MetaData } from '@subql/utils'; -import { SubqueryProject } from '../configure/SubqueryProject'; - -@Injectable() -export class DictionaryService extends CoreDictionaryService { - private constructor( - @Inject('ISubqueryProject') protected project: SubqueryProject, - nodeConfig: NodeConfig, - eventEmitter: EventEmitter2, - dictionaryUrl?: string, - ) { - super( - dictionaryUrl ?? project.network.dictionary, - project.network.chainId, - nodeConfig, - eventEmitter, - ); - } - - protected validateChainMeta(metaData: MetaData): boolean { - // Chain id is used as genesis hash - return this.project.network.chainId === metaData.genesisHash; - } - - static async create( - project: SubqueryProject, - nodeConfig: NodeConfig, - eventEmitter: EventEmitter2, - ): Promise { - const url = - project.network.dictionary ?? - (await CoreDictionaryService.resolveDictionary( - NETWORK_FAMILY.algorand, - project.network.chainId, - nodeConfig.dictionaryRegistry, - )); - - return new DictionaryService(project, nodeConfig, eventEmitter, url); - } -} diff --git a/packages/node/src/indexer/dictionary/algorandDictionary.service.ts b/packages/node/src/indexer/dictionary/algorandDictionary.service.ts new file mode 100644 index 00000000..422bb036 --- /dev/null +++ b/packages/node/src/indexer/dictionary/algorandDictionary.service.ts @@ -0,0 +1,75 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +import { Inject, Injectable } from '@nestjs/common'; +import { EventEmitter2 } from '@nestjs/event-emitter'; +import { NETWORK_FAMILY } from '@subql/common'; +import { NodeConfig, DictionaryService, getLogger } from '@subql/node-core'; +import { AlgorandBlock, AlgorandDataSource } from '@subql/types-algorand'; +import { SubqueryProject } from '../../configure/SubqueryProject'; +import { DsProcessorService } from '../ds-processor.service'; +import { AlgorandDictionaryV1 } from './v1'; + +const logger = getLogger('AlograndDictionary'); + +@Injectable() +export class AlgorandDictionaryService extends DictionaryService< + AlgorandDataSource, + AlgorandBlock +> { + async initDictionaries(): Promise { + const dictionariesV1: AlgorandDictionaryV1[] = []; + + if (!this.project) { + throw new Error(`Project in Dictionary service not initialized `); + } + const registryDictionaries = await this.resolveDictionary( + NETWORK_FAMILY.algorand, + this.project.network.chainId, + this.nodeConfig.dictionaryRegistry, + ); + + logger.debug(`Dictionary registry endpoints: ${registryDictionaries}`); + + const dictionaryEndpoints: string[] = ( + !Array.isArray(this.project.network.dictionary) + ? !this.project.network.dictionary + ? [] + : [this.project.network.dictionary] + : this.project.network.dictionary + ).concat(registryDictionaries); + + for (const endpoint of dictionaryEndpoints) { + try { + const dictionaryV1 = await AlgorandDictionaryV1.create( + this.project, + this.nodeConfig, + this.dsProcessorService.getDsProcessor.bind(this), + endpoint, + ); + dictionariesV1.push(dictionaryV1); + } catch (e) { + logger.warn( + `Dictionary endpoint "${endpoint}" is not a valid dictionary`, + ); + } + } + this.init(dictionariesV1); + } + + constructor( + @Inject('ISubqueryProject') protected project: SubqueryProject, + nodeConfig: NodeConfig, + eventEmitter: EventEmitter2, + protected dsProcessorService: DsProcessorService, + ) { + super(project.network.chainId, nodeConfig, eventEmitter); + } + + private getV1Dictionary(): AlgorandDictionaryV1 | undefined { + // TODO this needs to be removed once Algorand supports V2 dictionaries + return this._dictionaries[ + this._currentDictionaryIndex + ] as AlgorandDictionaryV1; + } +} diff --git a/packages/node/src/indexer/dictionary/index.ts b/packages/node/src/indexer/dictionary/index.ts new file mode 100644 index 00000000..f10bbd31 --- /dev/null +++ b/packages/node/src/indexer/dictionary/index.ts @@ -0,0 +1,4 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +export * from './algorandDictionary.service'; diff --git a/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.spec.ts b/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.spec.ts new file mode 100644 index 00000000..bd7aa589 --- /dev/null +++ b/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.spec.ts @@ -0,0 +1,75 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +import { EventEmitter2 } from '@nestjs/event-emitter'; +import { NETWORK_FAMILY } from '@subql/common'; +import { DictionaryService, NodeConfig } from '@subql/node-core'; +import { MetaData } from '@subql/utils'; +import { AlgorandDictionaryV1 } from './algorandDictionaryV1'; + +const nodeConfig = { + dictionaryTimeout: 10000, + dictionaryRegistry: + 'https://github.com/subquery/templates/raw/main/dist/dictionary.json', +} as NodeConfig; +const project = { + network: { + chainId: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', + }, +} as any; + +class TestDictionaryService extends DictionaryService { + async initDictionaries(): Promise { + return Promise.resolve(undefined); + } + async getRegistryDictionaries(chainId: string): Promise { + return this.resolveDictionary( + NETWORK_FAMILY.algorand, + chainId, + this.nodeConfig.dictionaryRegistry, + ); + } +} +describe('dictionary v1', () => { + let dictionary: AlgorandDictionaryV1; + beforeEach(async () => { + const testDictionaryService = new TestDictionaryService( + project.network.chainId, + nodeConfig, + new EventEmitter2(), + ); + const dictionaryEndpoints = + await testDictionaryService.getRegistryDictionaries( + project.network.chainId, + ); + dictionary = await AlgorandDictionaryV1.create( + { + network: { + chainId: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', + dictionary: dictionaryEndpoints[1], + }, + } as any, + { dictionaryTimeout: 10000 } as NodeConfig, + jest.fn(), + dictionaryEndpoints[1], // use endpoint from network + ); + }); + + it('successfully validates metatada', () => { + // start height from metadata + expect(dictionary.startHeight).toBe(1); + // further validation + expect( + (dictionary as any).dictionaryValidation( + { + lastProcessedHeight: 10000, + targetHeight: 10000, + chain: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', + genesisHash: 'wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=', + startHeight: 1, + } as MetaData, + 1, + ), + ).toBeTruthy(); + }); +}); diff --git a/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.ts b/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.ts new file mode 100644 index 00000000..6af83e02 --- /dev/null +++ b/packages/node/src/indexer/dictionary/v1/algorandDictionaryV1.ts @@ -0,0 +1,163 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +import { + isCustomDs, + AlgorandHandlerKind, + AlgorandRuntimeHandlerFilter, + AlgorandHandler, + isRuntimeDs, +} from '@subql/common-algorand'; +import { NodeConfig, DictionaryV1 } from '@subql/node-core'; +import { AlgorandBlockFilter, AlgorandDataSource } from '@subql/types-algorand'; +import { + DictionaryQueryCondition, + DictionaryQueryEntry as DictionaryV1QueryEntry, + DsProcessor, +} from '@subql/types-core'; +import { sortBy, uniqBy } from 'lodash'; +import { SubqueryProject } from '../../../configure/SubqueryProject'; +import { isBaseHandler, isCustomHandler } from '../../../utils/project'; + +function getBaseHandlerKind< + P extends DsProcessor = DsProcessor, +>( + ds: AlgorandDataSource, + handler: AlgorandHandler, + getDsProcessor: (ds: AlgorandDataSource) => P, +): AlgorandHandlerKind { + if (isRuntimeDs(ds) && isBaseHandler(handler)) { + return handler.kind; + } else if (isCustomDs(ds) && isCustomHandler(handler)) { + const plugin = getDsProcessor(ds); + const baseHandler = plugin.handlerProcessors[handler.kind]?.baseHandlerKind; + if (!baseHandler) { + throw new Error( + `handler type ${handler.kind} not found in processor for ${ds.kind}`, + ); + } + return baseHandler; + } else { + throw new Error('unknown base handler kind'); + } +} + +function getBaseHandlerFilters< + T extends AlgorandRuntimeHandlerFilter, + P extends DsProcessor = DsProcessor, +>( + ds: AlgorandDataSource, + handlerKind: string, + getDsProcessor: (ds: AlgorandDataSource) => P, +): T[] { + if (isCustomDs(ds)) { + const plugin = getDsProcessor(ds); + const processor = plugin.handlerProcessors[handlerKind]; + return processor.baseFilter instanceof Array + ? (processor.baseFilter as T[]) + : ([processor.baseFilter] as T[]); + } else { + throw new Error(`Expected a custom datasource here`); + } +} + +// eslint-disable-next-line complexity +function buildDictionaryV1QueryEntries< + P extends DsProcessor = DsProcessor, +>( + dataSources: AlgorandDataSource[], + getDsProcessor: (ds: AlgorandDataSource) => P, +): DictionaryV1QueryEntry[] { + const queryEntries: DictionaryV1QueryEntry[] = []; + + for (const ds of dataSources) { + for (const handler of ds.mapping.handlers) { + const baseHandlerKind = getBaseHandlerKind(ds, handler, getDsProcessor); + let filterList: AlgorandRuntimeHandlerFilter[]; + if (isCustomDs(ds)) { + //const processor = plugin.handlerProcessors[handler.kind]; + filterList = getBaseHandlerFilters( + ds, + handler.kind, + getDsProcessor, + ); + } else { + filterList = [handler.filter]; + } + // Filter out any undefined + filterList = filterList.filter(Boolean); + if (!filterList.length) return []; + switch (baseHandlerKind) { + case AlgorandHandlerKind.Block: + for (const filter of filterList as AlgorandBlockFilter[]) { + if (filter.modulo === undefined) { + return []; + } + } + break; + case AlgorandHandlerKind.Transaction: + filterList.forEach((f) => { + const conditions: DictionaryQueryCondition[] = Object.entries(f) + .filter(([field]) => field !== 'applicationArgs') // Dictionary doesn't support applciation args + .map(([field, value]) => ({ + field, + value, + matcher: 'equalTo', + })); + queryEntries.push({ + entity: 'transactions', + conditions, + }); + }); + break; + default: + } + } + } + + return uniqBy( + queryEntries, + (item) => + `${item.entity}|${JSON.stringify( + sortBy(item.conditions, (c) => c.field), + )}`, + ); +} + +export class AlgorandDictionaryV1 extends DictionaryV1 { + constructor( + project: SubqueryProject, + nodeConfig: NodeConfig, + protected getDsProcessor: ( + ds: AlgorandDataSource, + ) => DsProcessor, + dictionaryUrl?: string, + chainId?: string, + ) { + super(dictionaryUrl, chainId ?? project.network.chainId, nodeConfig); + } + + static async create( + project: SubqueryProject, + nodeConfig: NodeConfig, + getDsProcessor: (ds: AlgorandDataSource) => DsProcessor, + dictionaryUrl?: string, + chainId?: string, + ): Promise { + const dictionary = new AlgorandDictionaryV1( + project, + nodeConfig, + getDsProcessor, + dictionaryUrl, + chainId, + ); + await dictionary.init(); + return dictionary; + } + + buildDictionaryQueryEntries( + dataSources: AlgorandDataSource[], + ): DictionaryV1QueryEntry[] { + return buildDictionaryV1QueryEntries(dataSources, this.getDsProcessor); + } +} diff --git a/packages/node/src/indexer/dictionary/v1/index.ts b/packages/node/src/indexer/dictionary/v1/index.ts new file mode 100644 index 00000000..37b99eb5 --- /dev/null +++ b/packages/node/src/indexer/dictionary/v1/index.ts @@ -0,0 +1,4 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +export * from './algorandDictionaryV1'; diff --git a/packages/node/src/indexer/ds-processor.service.ts b/packages/node/src/indexer/ds-processor.service.ts index fc4dcafa..281d4036 100644 --- a/packages/node/src/indexer/ds-processor.service.ts +++ b/packages/node/src/indexer/ds-processor.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; diff --git a/packages/node/src/indexer/dynamic-ds.service.ts b/packages/node/src/indexer/dynamic-ds.service.ts index f9841706..c8fb38ec 100644 --- a/packages/node/src/indexer/dynamic-ds.service.ts +++ b/packages/node/src/indexer/dynamic-ds.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; @@ -27,15 +27,15 @@ export class DynamicDsService extends BaseDynamicDsService { protected async getDatasource( params: DatasourceParams, ): Promise { - const { name, ...template } = cloneDeep( - this.project.templates.find((t) => t.name === params.templateName), + const t = this.project.templates.find( + (t) => t.name === params.templateName, ); - - if (!template) { + if (!t) { throw new Error( `Unable to find matching template in project for name: "${params.templateName}"`, ); } + const { name, ...template } = cloneDeep(t); const dsObj = { ...template, diff --git a/packages/node/src/indexer/fetch.module.ts b/packages/node/src/indexer/fetch.module.ts index 0c1b3f4a..2f47989b 100644 --- a/packages/node/src/indexer/fetch.module.ts +++ b/packages/node/src/indexer/fetch.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; @@ -23,7 +23,7 @@ import { BlockDispatcherService, WorkerBlockDispatcherService, } from './blockDispatcher'; -import { DictionaryService } from './dictionary.service'; +import { AlgorandDictionaryService } from './dictionary'; import { DsProcessorService } from './ds-processor.service'; import { DynamicDsService } from './dynamic-ds.service'; import { FetchService } from './fetch.service'; @@ -84,7 +84,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; unfinalizedBlocksService: UnfinalizedBlocksService, connectionPoolState: ConnectionPoolStateManager, ) => - nodeConfig.workers !== undefined + nodeConfig.workers ? new WorkerBlockDispatcherService( nodeConfig, eventEmitter, @@ -136,22 +136,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; ConnectionPoolService, IndexingBenchmarkService, PoiBenchmarkService, - { - provide: DictionaryService, - useFactory: async ( - project: SubqueryProject, - nodeConfig: NodeConfig, - eventEmitter: EventEmitter2, - ) => { - const dictionaryService = await DictionaryService.create( - project, - nodeConfig, - eventEmitter, - ); - return dictionaryService; - }, - inject: ['ISubqueryProject', NodeConfig, EventEmitter2], - }, + AlgorandDictionaryService, SandboxService, DsProcessorService, DynamicDsService, diff --git a/packages/node/src/indexer/fetch.service.ts b/packages/node/src/indexer/fetch.service.ts index 65f46011..05718043 100644 --- a/packages/node/src/indexer/fetch.service.ts +++ b/packages/node/src/indexer/fetch.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; @@ -6,32 +6,18 @@ import { EventEmitter2 } from '@nestjs/event-emitter'; import { SchedulerRegistry } from '@nestjs/schedule'; import { isCustomDs, - isRuntimeDs, AlgorandHandlerKind, - AlgorandHandler, AlgorandDataSource, - AlgorandRuntimeHandlerFilter, } from '@subql/common-algorand'; import { NodeConfig, BaseFetchService, getModulos } from '@subql/node-core'; -import { AlgorandBlockFilter } from '@subql/types-algorand'; -import { - DictionaryQueryCondition, - DictionaryQueryEntry, -} from '@subql/types-core'; -import { sortBy, uniqBy } from 'lodash'; +import { AlgorandBlock } from '@subql/types-algorand'; import { AlgorandApi, AlgorandApiService, calcInterval } from '../algorand'; import { SubqueryProject } from '../configure/SubqueryProject'; -import { isBaseHandler, isCustomHandler } from '../utils/project'; import { IAlgorandBlockDispatcher } from './blockDispatcher'; -import { DictionaryService } from './dictionary.service'; -import { DsProcessorService } from './ds-processor.service'; -import { DynamicDsService } from './dynamic-ds.service'; +import { AlgorandDictionaryService } from './dictionary'; import { ProjectService } from './project.service'; const BLOCK_TIME_VARIANCE = 5000; //ms -const DICTIONARY_MAX_QUERY_SIZE = 10000; -const CHECK_MEMORY_INTERVAL = 60000; -const MINIMUM_BATCH_SIZE = 5; const INTERVAL_PERCENT = 0.9; @@ -39,7 +25,7 @@ const INTERVAL_PERCENT = 0.9; export class FetchService extends BaseFetchService< AlgorandDataSource, IAlgorandBlockDispatcher, - DictionaryService + AlgorandBlock > { constructor( private apiService: AlgorandApiService, @@ -48,9 +34,7 @@ export class FetchService extends BaseFetchService< @Inject('ISubqueryProject') project: SubqueryProject, @Inject('IBlockDispatcher') blockDispatcher: IAlgorandBlockDispatcher, - dictionaryService: DictionaryService, - private dsProcessorService: DsProcessorService, - dynamicDsService: DynamicDsService, + dictionaryService: AlgorandDictionaryService, eventEmitter: EventEmitter2, schedulerRegistry: SchedulerRegistry, ) { @@ -60,7 +44,6 @@ export class FetchService extends BaseFetchService< project.network, blockDispatcher, dictionaryService, - dynamicDsService, eventEmitter, schedulerRegistry, ); @@ -70,67 +53,6 @@ export class FetchService extends BaseFetchService< return this.apiService.unsafeApi; } - buildDictionaryQueryEntries( - dataSources: AlgorandDataSource[], - ): DictionaryQueryEntry[] { - const queryEntries: DictionaryQueryEntry[] = []; - - for (const ds of dataSources) { - const plugin = isCustomDs(ds) - ? this.dsProcessorService.getDsProcessor(ds) - : undefined; - for (const handler of ds.mapping.handlers) { - const baseHandlerKind = this.getBaseHandlerKind(ds, handler); - let filterList: AlgorandRuntimeHandlerFilter[]; - if (isCustomDs(ds)) { - //const processor = plugin.handlerProcessors[handler.kind]; - filterList = this.getBaseHandlerFilters( - ds, - handler.kind, - ); - } else { - filterList = [handler.filter]; - } - // Filter out any undefined - filterList = filterList.filter(Boolean); - if (!filterList.length) return []; - switch (baseHandlerKind) { - case AlgorandHandlerKind.Block: - for (const filter of filterList as AlgorandBlockFilter[]) { - if (filter.modulo === undefined) { - return []; - } - } - break; - case AlgorandHandlerKind.Transaction: - filterList.forEach((f) => { - const conditions: DictionaryQueryCondition[] = Object.entries(f) - .filter(([field]) => field !== 'applicationArgs') // Dictionary doesn't support applciation args - .map(([field, value]) => ({ - field, - value, - matcher: 'equalTo', - })); - queryEntries.push({ - entity: 'transactions', - conditions, - }); - }); - break; - default: - } - } - } - - return uniqBy( - queryEntries, - (item) => - `${item.entity}|${JSON.stringify( - sortBy(item.conditions, (c) => c.field), - )}`, - ); - } - protected getGenesisHash(): string { return this.apiService.networkMeta.genesisHash; } @@ -158,52 +80,11 @@ export class FetchService extends BaseFetchService< return Math.min(BLOCK_TIME_VARIANCE, chainInterval); } - getModulos(): number[] { - return getModulos( - this.projectService.getAllDataSources(), - isCustomDs, - AlgorandHandlerKind.Block, - ); - } - - private getBaseHandlerKind( - ds: AlgorandDataSource, - handler: AlgorandHandler, - ): AlgorandHandlerKind { - if (isRuntimeDs(ds) && isBaseHandler(handler)) { - return handler.kind; - } else if (isCustomDs(ds) && isCustomHandler(handler)) { - const plugin = this.dsProcessorService.getDsProcessor(ds); - const baseHandler = - plugin.handlerProcessors[handler.kind]?.baseHandlerKind; - if (!baseHandler) { - throw new Error( - `handler type ${handler.kind} not found in processor for ${ds.kind}`, - ); - } - return baseHandler; - } else { - throw new Error('unknown base handler kind'); - } + protected getModulos(dataSources: AlgorandDataSource[]): number[] { + return getModulos(dataSources, isCustomDs, AlgorandHandlerKind.Block); } - protected async preLoopHook(): Promise { // Algorand doesn't need to do anything here return Promise.resolve(); } - - private getBaseHandlerFilters( - ds: AlgorandDataSource, - handlerKind: string, - ): T[] { - if (isCustomDs(ds)) { - const plugin = this.dsProcessorService.getDsProcessor(ds); - const processor = plugin.handlerProcessors[handlerKind]; - return processor.baseFilter instanceof Array - ? (processor.baseFilter as T[]) - : ([processor.baseFilter] as T[]); - } else { - throw new Error(`Expected a custom datasource here`); - } - } } diff --git a/packages/node/src/indexer/indexer.manager.ts b/packages/node/src/indexer/indexer.manager.ts index 1d0c2426..f5fbc227 100644 --- a/packages/node/src/indexer/indexer.manager.ts +++ b/packages/node/src/indexer/indexer.manager.ts @@ -1,7 +1,7 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { isRuntimeDs, AlgorandHandlerKind, @@ -12,11 +12,11 @@ import { } from '@subql/common-algorand'; import { NodeConfig, - getLogger, profiler, IndexerSandbox, ProcessBlockResponse, BaseIndexerManager, + IBlock, } from '@subql/node-core'; import { AlgorandBlock, @@ -42,8 +42,6 @@ import { SandboxService } from './sandbox.service'; import { BlockContent } from './types'; import { UnfinalizedBlocksService } from './unfinalizedBlocks.service'; -const logger = getLogger('indexer'); - @Injectable() export class IndexerManager extends BaseIndexerManager< SafeAPIService, @@ -82,11 +80,11 @@ export class IndexerManager extends BaseIndexerManager< @profiler() async indexBlock( - block: BlockContent, + block: IBlock, dataSources: AlgorandDataSource[], ): Promise { return super.internalIndexBlock(block, dataSources, () => - this.getApi(block), + this.getApi(block.block), ); } @@ -139,7 +137,7 @@ export class IndexerManager extends BaseIndexerManager< kind: AlgorandHandlerKind, data: T, ): Promise { - // Substrate doesn't need to do anything here + // Algorand doesn't need to do anything here return Promise.resolve(data); } diff --git a/packages/node/src/indexer/project.service.ts b/packages/node/src/indexer/project.service.ts index efc69058..04ada511 100644 --- a/packages/node/src/indexer/project.service.ts +++ b/packages/node/src/indexer/project.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { isMainThread } from 'worker_threads'; diff --git a/packages/node/src/indexer/sandbox.service.ts b/packages/node/src/indexer/sandbox.service.ts index cc79cf37..47296736 100644 --- a/packages/node/src/indexer/sandbox.service.ts +++ b/packages/node/src/indexer/sandbox.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { isMainThread } from 'worker_threads'; diff --git a/packages/node/src/indexer/types.ts b/packages/node/src/indexer/types.ts index d0670ab3..05cbefc1 100644 --- a/packages/node/src/indexer/types.ts +++ b/packages/node/src/indexer/types.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { AlgorandBlock } from '@subql/types-algorand'; diff --git a/packages/node/src/indexer/unfinalizedBlocks.service.ts b/packages/node/src/indexer/unfinalizedBlocks.service.ts index 1cb5926c..64dc3e5e 100644 --- a/packages/node/src/indexer/unfinalizedBlocks.service.ts +++ b/packages/node/src/indexer/unfinalizedBlocks.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Injectable } from '@nestjs/common'; @@ -9,17 +9,9 @@ import { StoreCacheService, mainThreadOnly, } from '@subql/node-core'; -import { AlgorandApiService } from '../algorand'; +import { AlgorandApiService, algorandBlockToHeader } from '../algorand'; import { BlockContent } from './types'; -export function algorandBlockToHeader(block: BlockContent): Header { - return { - blockHeight: block.round, - blockHash: block.round.toString(), - parentHash: block.previousBlockHash, - }; -} - @Injectable() export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { constructor( @@ -30,11 +22,6 @@ export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { const checkHealth = await this.apiService.api.api.makeHealthCheck().do(); @@ -50,7 +37,7 @@ export class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService { return algorandBlockToHeader( - await this.apiService.api.getBlockByHeight(height), + await this.apiService.api.getHeaderOnly(height), ); } } diff --git a/packages/node/src/indexer/worker/worker-fetch.module.ts b/packages/node/src/indexer/worker/worker-fetch.module.ts index a11bbada..290d5e73 100644 --- a/packages/node/src/indexer/worker/worker-fetch.module.ts +++ b/packages/node/src/indexer/worker/worker-fetch.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/indexer/worker/worker.module.ts b/packages/node/src/indexer/worker/worker.module.ts index 1c12324a..fe6dfd91 100644 --- a/packages/node/src/indexer/worker/worker.module.ts +++ b/packages/node/src/indexer/worker/worker.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index e402bd7c..3f78be29 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; @@ -7,9 +7,15 @@ import { IProjectService, BaseWorkerService, IProjectUpgradeService, + ApiService, + IBlock, } from '@subql/node-core'; import { AlgorandBlock, AlgorandDataSource } from '@subql/types-algorand'; -import { AlgorandApiService } from '../../algorand'; +import { + AlgorandApi, + AlgorandApiService, + SafeAPIService, +} from '../../algorand'; import { AlgorandProjectDs } from '../../configure/SubqueryProject'; import { IndexerManager } from '../indexer.manager'; import { BlockContent } from '../types'; @@ -48,7 +54,9 @@ export class WorkerService extends BaseWorkerService< super(projectService, projectUpgradeService, nodeConfig); } - protected async fetchChainBlock(heights: number): Promise { + protected async fetchChainBlock( + heights: number, + ): Promise> { const [block] = await this.apiService.fetchBlocks([heights]); return block; } @@ -58,7 +66,7 @@ export class WorkerService extends BaseWorkerService< }; } protected async processFetchedBlock( - block: AlgorandBlock, + block: IBlock, dataSources: AlgorandDataSource[], ): Promise { return this.indexerManager.indexBlock(block, dataSources); diff --git a/packages/node/src/indexer/worker/worker.ts b/packages/node/src/indexer/worker/worker.ts index b72da24b..7830aa7e 100644 --- a/packages/node/src/indexer/worker/worker.ts +++ b/packages/node/src/indexer/worker/worker.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 // initlogger and yargs must be imported before all other imports diff --git a/packages/node/src/indexer/worker/worker.unfinalizedBlocks.service.ts b/packages/node/src/indexer/worker/worker.unfinalizedBlocks.service.ts index 340bcc3e..3c130c1a 100644 --- a/packages/node/src/indexer/worker/worker.unfinalizedBlocks.service.ts +++ b/packages/node/src/indexer/worker/worker.unfinalizedBlocks.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { isMainThread } from 'worker_threads'; @@ -7,9 +7,10 @@ import { IUnfinalizedBlocksService, Header, HostUnfinalizedBlocks, + IBlock, } from '@subql/node-core'; +import { algorandBlockToHeader } from '../../algorand'; import { BlockContent } from '../types'; -import { algorandBlockToHeader } from '../unfinalizedBlocks.service'; @Injectable() export class WorkerUnfinalizedBlocksService @@ -21,8 +22,12 @@ export class WorkerUnfinalizedBlocksService } } - async processUnfinalizedBlocks(block: BlockContent): Promise { - return this.processUnfinalizedBlockHeader(algorandBlockToHeader(block)); + async processUnfinalizedBlocks( + block: IBlock, + ): Promise { + return this.processUnfinalizedBlockHeader( + algorandBlockToHeader(block.block), + ); } async processUnfinalizedBlockHeader(header: Header): Promise { diff --git a/packages/node/src/init.ts b/packages/node/src/init.ts index 8c457038..71243e0e 100644 --- a/packages/node/src/init.ts +++ b/packages/node/src/init.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { NestFactory } from '@nestjs/core'; diff --git a/packages/node/src/main.ts b/packages/node/src/main.ts index 8d4742d8..d9b6c534 100644 --- a/packages/node/src/main.ts +++ b/packages/node/src/main.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { initLogger } from '@subql/node-core/logger'; diff --git a/packages/node/src/meta/meta.controller.ts b/packages/node/src/meta/meta.controller.ts index 07a9035a..fa7b0618 100644 --- a/packages/node/src/meta/meta.controller.ts +++ b/packages/node/src/meta/meta.controller.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Controller, Get } from '@nestjs/common'; diff --git a/packages/node/src/meta/meta.module.ts b/packages/node/src/meta/meta.module.ts index b8426aab..cc474236 100644 --- a/packages/node/src/meta/meta.module.ts +++ b/packages/node/src/meta/meta.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/meta/meta.service.ts b/packages/node/src/meta/meta.service.ts index a38b0870..0d833359 100644 --- a/packages/node/src/meta/meta.service.ts +++ b/packages/node/src/meta/meta.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Injectable } from '@nestjs/common'; diff --git a/packages/node/src/subcommands/forceClean.init.ts b/packages/node/src/subcommands/forceClean.init.ts index 59d3d165..d4b2d7d3 100644 --- a/packages/node/src/subcommands/forceClean.init.ts +++ b/packages/node/src/subcommands/forceClean.init.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { NestFactory } from '@nestjs/core'; diff --git a/packages/node/src/subcommands/forceClean.module.ts b/packages/node/src/subcommands/forceClean.module.ts index 20fe7517..faa9cbe2 100644 --- a/packages/node/src/subcommands/forceClean.module.ts +++ b/packages/node/src/subcommands/forceClean.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/subcommands/forceClean.service.ts b/packages/node/src/subcommands/forceClean.service.ts index b068895b..01264be0 100644 --- a/packages/node/src/subcommands/forceClean.service.ts +++ b/packages/node/src/subcommands/forceClean.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import fs from 'fs'; diff --git a/packages/node/src/subcommands/reindex.init.ts b/packages/node/src/subcommands/reindex.init.ts index 5d1e9e15..99fbb1ad 100644 --- a/packages/node/src/subcommands/reindex.init.ts +++ b/packages/node/src/subcommands/reindex.init.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { NestFactory } from '@nestjs/core'; diff --git a/packages/node/src/subcommands/reindex.module.ts b/packages/node/src/subcommands/reindex.module.ts index 0194aaf1..7b36c0c0 100644 --- a/packages/node/src/subcommands/reindex.module.ts +++ b/packages/node/src/subcommands/reindex.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/subcommands/testing.init.ts b/packages/node/src/subcommands/testing.init.ts index 2471b069..ea7ce39b 100644 --- a/packages/node/src/subcommands/testing.init.ts +++ b/packages/node/src/subcommands/testing.init.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { getLogger } from '@subql/node-core'; diff --git a/packages/node/src/subcommands/testing.module.ts b/packages/node/src/subcommands/testing.module.ts index 1395c517..6198b8d3 100644 --- a/packages/node/src/subcommands/testing.module.ts +++ b/packages/node/src/subcommands/testing.module.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Module } from '@nestjs/common'; diff --git a/packages/node/src/subcommands/testing.service.ts b/packages/node/src/subcommands/testing.service.ts index 18222a21..8dc847a4 100644 --- a/packages/node/src/subcommands/testing.service.ts +++ b/packages/node/src/subcommands/testing.service.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { Inject, Injectable } from '@nestjs/common'; @@ -8,6 +8,7 @@ import { TestingService as BaseTestingService, NestLogger, TestRunner, + IBlock, } from '@subql/node-core'; import { AlgorandApi, AlgorandApiService, SafeAPIService } from '../algorand'; import { @@ -64,7 +65,7 @@ export class TestingService extends BaseTestingService< } async indexBlock( - block: BlockContent, + block: IBlock, handler: string, indexerManager: IndexerManager, ): Promise { diff --git a/packages/node/src/utils/project.ts b/packages/node/src/utils/project.ts index 937bed4a..2dcfb065 100644 --- a/packages/node/src/utils/project.ts +++ b/packages/node/src/utils/project.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { diff --git a/packages/node/src/yargs.ts b/packages/node/src/yargs.ts index 978a67db..857d19a7 100644 --- a/packages/node/src/yargs.ts +++ b/packages/node/src/yargs.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { yargsBuilder } from '@subql/node-core/yargs'; diff --git a/packages/node/test/jsonfy.js b/packages/node/test/jsonfy.js index df561f78..4cb58a04 100644 --- a/packages/node/test/jsonfy.js +++ b/packages/node/test/jsonfy.js @@ -1,5 +1,5 @@ 'use strict'; -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 Object.defineProperty(exports, '__esModule', { value: true }); exports.JsonfyDatasourcePlugin = void 0; diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 302d58e9..63383fd7 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Update `@subql/types-core` + ## [3.1.2] - 2024-02-07 ### Changed - Update `@subql/types-core` diff --git a/packages/types/package.json b/packages/types/package.json index d26edab1..8b45f03a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -24,6 +24,6 @@ "algosdk": "^2.2.0" }, "dependencies": { - "@subql/types-core": "^0.5.0" + "@subql/types-core": "^0.6.0" } } diff --git a/packages/types/src/global.ts b/packages/types/src/global.ts index 9e8f4ff5..6dff07ff 100644 --- a/packages/types/src/global.ts +++ b/packages/types/src/global.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import {SafeAPI} from './interfaces'; diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index b946343b..8d163673 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 export * from './interfaces'; diff --git a/packages/types/src/interfaces.ts b/packages/types/src/interfaces.ts index 588f2dc2..de9c8cba 100644 --- a/packages/types/src/interfaces.ts +++ b/packages/types/src/interfaces.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import type {TransactionType, Indexer} from 'algosdk'; diff --git a/packages/types/src/project.ts b/packages/types/src/project.ts index 354f376c..3f0430c3 100644 --- a/packages/types/src/project.ts +++ b/packages/types/src/project.ts @@ -1,4 +1,4 @@ -// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 import { @@ -7,7 +7,6 @@ import { CommonSubqueryProject, DictionaryQueryEntry, FileReference, - Processor, ProjectManifestV1_0_0, BlockFilter, BaseHandler, @@ -223,7 +222,7 @@ export interface HandlerInputTransformer_0_0_0< E, DS extends AlgorandCustomDataSource = AlgorandCustomDataSource > { - (input: RuntimeHandlerInputMap[T], ds: DS, api: Indexer, assets?: Record): Promise; // | SubstrateBuiltinDataSource + (input: RuntimeHandlerInputMap[T], ds: DS, api: Indexer, assets?: Record): Promise; // | AlgorandBuiltinDataSource } export interface HandlerInputTransformer_1_0_0< @@ -238,7 +237,7 @@ export interface HandlerInputTransformer_1_0_0< filter?: F; api: Indexer; assets?: Record; - }): Promise; // | SubstrateBuiltinDataSource + }): Promise; // | AlgorandBuiltinDataSource } type SecondLayerHandlerProcessorArray< diff --git a/yarn.lock b/yarn.lock index 449d41ec..77207a6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1698,48 +1698,6 @@ __metadata: languageName: node linkType: hard -"@ethereumjs/common@npm:^3.2.0": - version: 3.2.0 - resolution: "@ethereumjs/common@npm:3.2.0" - dependencies: - "@ethereumjs/util": ^8.1.0 - crc-32: ^1.2.0 - checksum: cb9cc11f5c868cb577ba611cebf55046e509218bbb89b47ccce010776dafe8256d70f8f43fab238aec74cf71f62601cd5842bc03a83261200802de365732a14b - languageName: node - linkType: hard - -"@ethereumjs/rlp@npm:^4.0.1": - version: 4.0.1 - resolution: "@ethereumjs/rlp@npm:4.0.1" - bin: - rlp: bin/rlp - checksum: 30db19c78faa2b6ff27275ab767646929207bb207f903f09eb3e4c273ce2738b45f3c82169ddacd67468b4f063d8d96035f2bf36f02b6b7e4d928eefe2e3ecbc - languageName: node - linkType: hard - -"@ethereumjs/tx@npm:^4.2.0": - version: 4.2.0 - resolution: "@ethereumjs/tx@npm:4.2.0" - dependencies: - "@ethereumjs/common": ^3.2.0 - "@ethereumjs/rlp": ^4.0.1 - "@ethereumjs/util": ^8.1.0 - ethereum-cryptography: ^2.0.0 - checksum: 87a3f5f2452cfbf6712f8847525a80c213210ed453c211c793c5df801fe35ecef28bae17fadd222fcbdd94277478a47e52d2b916a90a6b30cda21f1e0cdaee42 - languageName: node - linkType: hard - -"@ethereumjs/util@npm:^8.0.6, @ethereumjs/util@npm:^8.1.0": - version: 8.1.0 - resolution: "@ethereumjs/util@npm:8.1.0" - dependencies: - "@ethereumjs/rlp": ^4.0.1 - ethereum-cryptography: ^2.0.0 - micro-ftch: ^0.3.1 - checksum: 9ae5dee8f12b0faf81cd83f06a41560e79b0ba96a48262771d897a510ecae605eb6d84f687da001ab8ccffd50f612ae50f988ef76e6312c752897f462f3ac08d - languageName: node - linkType: hard - "@gar/promisify@npm:^1.1.3": version: 1.1.3 resolution: "@gar/promisify@npm:1.1.3" @@ -2245,60 +2203,6 @@ __metadata: languageName: node linkType: hard -"@metamask/abi-utils@npm:^2.0.2": - version: 2.0.2 - resolution: "@metamask/abi-utils@npm:2.0.2" - dependencies: - "@metamask/utils": ^8.0.0 - superstruct: ^1.0.3 - checksum: 5ec153e7691a4e1dc8738a0ba1a99a354ddb13851fa88a40a19f002f6308310e71c2cee28c3a25d9f7f67e839c7dffe4760e93e308dd17fa725b08d0dc73a3d4 - languageName: node - linkType: hard - -"@metamask/eth-sig-util@npm:5.1.0": - version: 5.1.0 - resolution: "@metamask/eth-sig-util@npm:5.1.0" - dependencies: - "@ethereumjs/util": ^8.0.6 - bn.js: ^4.12.0 - ethereum-cryptography: ^2.0.0 - ethjs-util: ^0.1.6 - tweetnacl: ^1.0.3 - tweetnacl-util: ^0.15.1 - checksum: c639e3bf91625faeb0230a6314f0b2d05e8f5e2989542d3e0eed1d21b7b286e1860f68629870fd7e568c1a599b3993c4210403fb4c84a625fb1e75ef676eab4f - languageName: node - linkType: hard - -"@metamask/eth-sig-util@npm:^7.0.0": - version: 7.0.1 - resolution: "@metamask/eth-sig-util@npm:7.0.1" - dependencies: - "@ethereumjs/util": ^8.1.0 - "@metamask/abi-utils": ^2.0.2 - "@metamask/utils": ^8.1.0 - ethereum-cryptography: ^2.1.2 - tweetnacl: ^1.0.3 - tweetnacl-util: ^0.15.1 - checksum: 98d056bd83aeb2d29ec3de09cd18e67d97ea295a59d405a9ce3fe274badd2d4f18da1fe530a266b4c777650855ed75ecd3577decd607a561e938dd7a808c5839 - languageName: node - linkType: hard - -"@metamask/utils@npm:^8.0.0, @metamask/utils@npm:^8.1.0": - version: 8.3.0 - resolution: "@metamask/utils@npm:8.3.0" - dependencies: - "@ethereumjs/tx": ^4.2.0 - "@noble/hashes": ^1.3.1 - "@scure/base": ^1.1.3 - "@types/debug": ^4.1.7 - debug: ^4.3.4 - pony-cause: ^2.1.10 - semver: ^7.5.4 - superstruct: ^1.0.3 - checksum: cd60c49b4c0397fb31e6b38937a0d9346cbb8337cb8add59db8db0e0e2156fb063ff4df93a26410157f0cc02aa9a9b785fc1b53cfc4ab73204462893ed11cacb - languageName: node - linkType: hard - "@nestjs/common@npm:^9.4.0": version: 9.4.3 resolution: "@nestjs/common@npm:9.4.3" @@ -2427,24 +2331,6 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:1.0.0, @noble/curves@npm:~1.0.0": - version: 1.0.0 - resolution: "@noble/curves@npm:1.0.0" - dependencies: - "@noble/hashes": 1.3.0 - checksum: 6bcef44d626c640dc8961819d68dd67dffb907e3b973b7c27efe0ecdd9a5c6ce62c7b9e3dfc930c66605dced7f1ec0514d191c09a2ce98d6d52b66e3315ffa79 - languageName: node - linkType: hard - -"@noble/curves@npm:1.3.0, @noble/curves@npm:~1.3.0": - version: 1.3.0 - resolution: "@noble/curves@npm:1.3.0" - dependencies: - "@noble/hashes": 1.3.3 - checksum: b65342ee66c4a440eee2978524412eabba9a9efdd16d6370e15218c6a7d80bddf35e66bb57ed52c0dfd32cb9a717b439ab3a72db618f1a0066dfebe3fd12a421 - languageName: node - linkType: hard - "@noble/curves@npm:^1.2.0": version: 1.2.0 resolution: "@noble/curves@npm:1.2.0" @@ -2454,13 +2340,6 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.0": - version: 1.3.0 - resolution: "@noble/hashes@npm:1.3.0" - checksum: d7ddb6d7c60f1ce1f87facbbef5b724cdea536fc9e7f59ae96e0fc9de96c8f1a2ae2bdedbce10f7dcc621338dfef8533daa73c873f2b5c87fa1a4e05a95c2e2e - languageName: node - linkType: hard - "@noble/hashes@npm:1.3.2, @noble/hashes@npm:^1.3.2": version: 1.3.2 resolution: "@noble/hashes@npm:1.3.2" @@ -2468,20 +2347,6 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1.3.1, @noble/hashes@npm:~1.3.2": - version: 1.3.3 - resolution: "@noble/hashes@npm:1.3.3" - checksum: 8a6496d1c0c64797339bc694ad06cdfaa0f9e56cd0c3f68ae3666cfb153a791a55deb0af9c653c7ed2db64d537aa3e3054629740d2f2338bb1dcb7ab60cd205b - languageName: node - linkType: hard - -"@noble/hashes@npm:~1.3.0": - version: 1.3.1 - resolution: "@noble/hashes@npm:1.3.1" - checksum: 7fdefc0f7a0c1ec27acc6ff88841793e3f93ec4ce6b8a6a12bfc0dd70ae6b7c4c82fe305fdfeda1735d5ad4a9eebe761e6693b3d355689c559e91242f4bc95b1 - languageName: node - linkType: hard - "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -2910,62 +2775,6 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:~1.1.0": - version: 1.1.1 - resolution: "@scure/base@npm:1.1.1" - checksum: b4fc810b492693e7e8d0107313ac74c3646970c198bbe26d7332820886fa4f09441991023ec9aa3a2a51246b74409ab5ebae2e8ef148bbc253da79ac49130309 - languageName: node - linkType: hard - -"@scure/base@npm:~1.1.4": - version: 1.1.5 - resolution: "@scure/base@npm:1.1.5" - checksum: 9e9ee6088cb3aa0fb91f5a48497d26682c7829df3019b1251d088d166d7a8c0f941c68aaa8e7b96bbad20c71eb210397cb1099062cde3e29d4bad6b975c18519 - languageName: node - linkType: hard - -"@scure/bip32@npm:1.3.0": - version: 1.3.0 - resolution: "@scure/bip32@npm:1.3.0" - dependencies: - "@noble/curves": ~1.0.0 - "@noble/hashes": ~1.3.0 - "@scure/base": ~1.1.0 - checksum: 6eae997f9bdf41fe848134898960ac48e645fa10e63d579be965ca331afd0b7c1b8ebac170770d237ab4099dafc35e5a82995384510025ccf2abe669f85e8918 - languageName: node - linkType: hard - -"@scure/bip32@npm:1.3.3": - version: 1.3.3 - resolution: "@scure/bip32@npm:1.3.3" - dependencies: - "@noble/curves": ~1.3.0 - "@noble/hashes": ~1.3.2 - "@scure/base": ~1.1.4 - checksum: f939ca733972622fcc1e61d4fdf170a0ad294b24ddb7ed7cdd4c467e1ef283b970154cb101cf5f1a7b64cf5337e917ad31135911dfc36b1d76625320167df2fa - languageName: node - linkType: hard - -"@scure/bip39@npm:1.2.0": - version: 1.2.0 - resolution: "@scure/bip39@npm:1.2.0" - dependencies: - "@noble/hashes": ~1.3.0 - "@scure/base": ~1.1.0 - checksum: 980d761f53e63de04a9e4db840eb13bfb1bd1b664ecb04a71824c12c190f4972fd84146f3ed89b2a8e4c6bd2c17c15f8b592b7ac029e903323b0f9e2dae6916b - languageName: node - linkType: hard - -"@scure/bip39@npm:1.2.2": - version: 1.2.2 - resolution: "@scure/bip39@npm:1.2.2" - dependencies: - "@noble/hashes": ~1.3.2 - "@scure/base": ~1.1.4 - checksum: cb99505e6d2deef8e55e81df8c563ce8dbfdf1595596dc912bceadcf366c91b05a98130e928ecb090df74efdb20150b64acc4be55bc42768cab4d39a2833d234 - languageName: node - linkType: hard - "@sinclair/typebox@npm:^0.27.8": version: 0.27.8 resolution: "@sinclair/typebox@npm:0.27.8" @@ -2998,30 +2807,11 @@ __metadata: languageName: node linkType: hard -"@subql/apollo-links@npm:1.3.2": - version: 1.3.2 - resolution: "@subql/apollo-links@npm:1.3.2" - dependencies: - "@apollo/client": ^3.8.8 - "@metamask/eth-sig-util": 5.1.0 - "@subql/network-support": 0.2.0 - apollo-link-error: ^1.1.13 - buffer: ^6.0.3 - cross-fetch: ^4.0.0 - js-base64: ^3.7.5 - jwt-decode: ^3.1.2 - lru-cache: ^10.0.1 - peerDependencies: - graphql: "*" - checksum: 6eb9047062984744f2071db3dfc9f4aae56fb351e21961cf3743a97298a36bd227802a453d41ecf705732ace7ad85c3fa3d05c6c3ea2b38784d4fdc1072fc3b1 - languageName: node - linkType: hard - "@subql/common-algorand@workspace:*, @subql/common-algorand@workspace:packages/common-algorand": version: 0.0.0-use.local resolution: "@subql/common-algorand@workspace:packages/common-algorand" dependencies: - "@subql/common": ^3.4.1 + "@subql/common": ^3.5.0 "@subql/types-algorand": "workspace:*" "@types/bn.js": 4.11.6 "@types/js-yaml": ^4.0.4 @@ -3040,11 +2830,11 @@ __metadata: languageName: unknown linkType: soft -"@subql/common@npm:3.4.1, @subql/common@npm:^3.4.1": - version: 3.4.1 - resolution: "@subql/common@npm:3.4.1" +"@subql/common@npm:3.5.0, @subql/common@npm:^3.5.0": + version: 3.5.0 + resolution: "@subql/common@npm:3.5.0" dependencies: - "@subql/types-core": 0.5.0 + "@subql/types-core": 0.6.0 axios: ^0.28.0 class-transformer: ^0.5.1 class-validator: ^0.14.0 @@ -3054,20 +2844,7 @@ __metadata: reflect-metadata: ^0.1.13 semver: ^7.5.2 update-notifier: 5.1.0 - checksum: 334d1c4f937d16bd50106ffd14425cfc7f1ae6ea8046da8dadb6c6ce685a3de7acb81243f05de986a61fa918802730e5d4f788b5a20d86052841a12d7cbbc380 - languageName: node - linkType: hard - -"@subql/network-support@npm:0.2.0": - version: 0.2.0 - resolution: "@subql/network-support@npm:0.2.0" - dependencies: - "@metamask/eth-sig-util": ^7.0.0 - cross-fetch: ^4.0.0 - js-base64: ^3.7.5 - jwt-decode: ^3.1.2 - lru-cache: ^10.0.1 - checksum: 097d82687654a05f228bdbec227bc18b7bd3d577092123add7e6834274ba8a12401d4c24cb2301cd3bd07fe5755ffe3bd6a39414c95cf355d10c17586e2d69a0 + checksum: 63c374b82de90f2db5c76d8f3808e37100d3616707736806d3f43249ea0ca63f0c115104815cb842becb0d350e16e893a8d3942c0e865d62890e43362a455799 languageName: node linkType: hard @@ -3083,9 +2860,9 @@ __metadata: "@nestjs/schedule": ^3.0.1 "@nestjs/schematics": ^9.2.0 "@nestjs/testing": ^9.4.0 - "@subql/common": ^3.4.1 + "@subql/common": ^3.5.0 "@subql/common-algorand": "workspace:*" - "@subql/node-core": ^7.4.2 + "@subql/node-core": ^8.0.1 "@subql/types-algorand": "workspace:*" "@types/express": ^4.17.13 "@types/jest": ^27.4.0 @@ -3114,19 +2891,18 @@ __metadata: languageName: unknown linkType: soft -"@subql/node-core@npm:^7.4.2": - version: 7.4.2 - resolution: "@subql/node-core@npm:7.4.2" +"@subql/node-core@npm:^8.0.1": + version: 8.0.1 + resolution: "@subql/node-core@npm:8.0.1" dependencies: "@apollo/client": ^3.8.8 "@nestjs/common": ^9.4.0 "@nestjs/event-emitter": ^2.0.0 "@nestjs/schedule": ^3.0.1 - "@subql/apollo-links": 1.3.2 - "@subql/common": 3.4.1 + "@subql/common": 3.5.0 "@subql/testing": 2.1.1-0 - "@subql/types": 3.3.1 - "@subql/utils": 2.8.0 + "@subql/types": 3.4.0 + "@subql/utils": 2.9.0 "@willsoto/nestjs-prometheus": ^5.4.0 async-lock: ^1.4.0 async-mutex: ^0.4.0 @@ -3142,7 +2918,7 @@ __metadata: toposort-class: ^1.0.1 vm2: ^3.9.19 yargs: ^16.2.0 - checksum: d5115fd8981280821cad28779562282e6f2dd6fa7b7e8d0079142e56320e5748e1149a8db8ccd0e1f9e7d088a0c6ea0c4a2c5738cf5d4209641a66ad67e3781e + checksum: ead9feeef201b2ed9db1726e70d375d6a3ca5d44f7576dd14aa2949308d11a6a34abcc1013cd4d84eb8e57fd236609cdb93e359c0b85ff5b225257c99261635d languageName: node linkType: hard @@ -3159,7 +2935,7 @@ __metadata: version: 0.0.0-use.local resolution: "@subql/types-algorand@workspace:packages/types" dependencies: - "@subql/types-core": ^0.5.0 + "@subql/types-core": ^0.6.0 "@types/app-module-path": ^2.2.0 algosdk: ^2.2.0 peerDependencies: @@ -3167,12 +2943,12 @@ __metadata: languageName: unknown linkType: soft -"@subql/types-core@npm:0.5.0, @subql/types-core@npm:^0.5.0": - version: 0.5.0 - resolution: "@subql/types-core@npm:0.5.0" +"@subql/types-core@npm:0.6.0, @subql/types-core@npm:^0.6.0": + version: 0.6.0 + resolution: "@subql/types-core@npm:0.6.0" dependencies: package-json-type: ^1.0.3 - checksum: bc348655ead081a6e15c669e5b44dbb78a3673d2497d173a1d4a6e21c328702b3582ee0d8e71042b3e25d6e1d41fbc5a3cf4724a07e2062bd01b87cf5956f6d6 + checksum: 0688f1973f830d1d2ab34864b00fc7efb105228b0328ac485c69950957da3a67a92d9477bc94945e57e3cccbf1b732bdea097c1a452a907e23704e9cbeff31fc languageName: node linkType: hard @@ -3185,20 +2961,20 @@ __metadata: languageName: node linkType: hard -"@subql/types@npm:3.3.1": - version: 3.3.1 - resolution: "@subql/types@npm:3.3.1" +"@subql/types@npm:3.4.0": + version: 3.4.0 + resolution: "@subql/types@npm:3.4.0" dependencies: - "@subql/types-core": 0.5.0 + "@subql/types-core": 0.6.0 peerDependencies: "@polkadot/api": ^10 - checksum: 4e949446d169ec6cfcc9ad32b8b5d14a6d82b8c69ac1f6513494f454d339014adfb554f5d7b95389f3faf507ddfde809592559aed8a098a63e748d08804895eb + checksum: a13e02ebdf35abc05104615f3884faf9f2d9037eece58ac05ba6cc4e07812ef40479645578327147ac82872e9466b5e2995a22076a7fdbc27fd6dd28f1cb669d languageName: node linkType: hard -"@subql/utils@npm:2.8.0": - version: 2.8.0 - resolution: "@subql/utils@npm:2.8.0" +"@subql/utils@npm:2.9.0": + version: 2.9.0 + resolution: "@subql/utils@npm:2.9.0" dependencies: "@polkadot/util": ^12.5.1 "@polkadot/util-crypto": ^12.5.1 @@ -3214,7 +2990,7 @@ __metadata: rotating-file-stream: ^3.0.2 semver: ^7.5.2 tar: ^6.1.11 - checksum: fa311fd7095f9e1ccc22f78113cccf744296722b921c1b1b405e9121f492baadd996eb68f5e21ef947295b767ab7172e7318b2a44e8a7c7f2ff577209a30eb11 + checksum: 2536add6833f9a1487ea17eccf0288e48f7a89bb67dfedbc46034902e350d4474be7f38cef06e938ee49ba25274c2271e2b5b6b46e04c965cdba5105f9af4599 languageName: node linkType: hard @@ -3946,15 +3722,6 @@ __metadata: languageName: node linkType: hard -"@wry/equality@npm:^0.1.2": - version: 0.1.11 - resolution: "@wry/equality@npm:0.1.11" - dependencies: - tslib: ^1.9.3 - checksum: 1a26a0fd11e3e3a6a197d9a54a5bec523caf693daa24ad2709f496e43dd3cd12290a0d17df81f8a783437795f6c64a1ca2717cdac6e79022bde4450c11e705c9 - languageName: node - linkType: hard - "@wry/equality@npm:^0.5.0": version: 0.5.5 resolution: "@wry/equality@npm:0.5.5" @@ -4242,58 +4009,6 @@ __metadata: languageName: node linkType: hard -"apollo-link-error@npm:^1.1.13": - version: 1.1.13 - resolution: "apollo-link-error@npm:1.1.13" - dependencies: - apollo-link: ^1.2.14 - apollo-link-http-common: ^0.2.16 - tslib: ^1.9.3 - checksum: b417b77acbf464d8246eb79312c6d755f9d398c6c9f560c9e2270260519df639c3f0a8b9454ccc55c7f54eb57490706275ede120ecd7f475ec4627012feaf4b2 - languageName: node - linkType: hard - -"apollo-link-http-common@npm:^0.2.16": - version: 0.2.16 - resolution: "apollo-link-http-common@npm:0.2.16" - dependencies: - apollo-link: ^1.2.14 - ts-invariant: ^0.4.0 - tslib: ^1.9.3 - peerDependencies: - graphql: ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 - checksum: 46672f2b10a01f495ed91d32b9d21ed0747bf23c8c23a2041ca41dd92a05e0e18d7842d29c958f6ddfaee03bd89202788f593cdcb96d4167191aff125f109c67 - languageName: node - linkType: hard - -"apollo-link@npm:^1.2.14": - version: 1.2.14 - resolution: "apollo-link@npm:1.2.14" - dependencies: - apollo-utilities: ^1.3.0 - ts-invariant: ^0.4.0 - tslib: ^1.9.3 - zen-observable-ts: ^0.8.21 - peerDependencies: - graphql: ^0.11.3 || ^0.12.3 || ^0.13.0 || ^14.0.0 || ^15.0.0 - checksum: ad8d051ffceb270cdbbcc71d499bce2fda437a65fac6edc859a9e2dc0dbcb10b6a3f4da41789e786270aa358719c8b71315f383a698a74957df0d7aeea042918 - languageName: node - linkType: hard - -"apollo-utilities@npm:^1.3.0": - version: 1.3.4 - resolution: "apollo-utilities@npm:1.3.4" - dependencies: - "@wry/equality": ^0.1.2 - fast-json-stable-stringify: ^2.0.0 - ts-invariant: ^0.4.0 - tslib: ^1.10.0 - peerDependencies: - graphql: ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 - checksum: 6e0192a3420782909c930f5230808d7fbbdbcdfccddd960120e19bab251b77a16e590b05dbb4a7da2c27c59077fbfd53e56819a9fae694debe7f898e8b0ec1e9 - languageName: node - linkType: hard - "append-field@npm:^1.0.0": version: 1.0.0 resolution: "append-field@npm:1.0.0" @@ -4663,13 +4378,6 @@ __metadata: languageName: node linkType: hard -"bn.js@npm:^4.12.0": - version: 4.12.0 - resolution: "bn.js@npm:4.12.0" - checksum: 39afb4f15f4ea537b55eaf1446c896af28ac948fdcf47171961475724d1bb65118cca49fa6e3d67706e4790955ec0e74de584e45c8f1ef89f46c812bee5b5a12 - languageName: node - linkType: hard - "bn.js@npm:^5.2.1": version: 5.2.1 resolution: "bn.js@npm:5.2.1" @@ -5392,15 +5100,6 @@ __metadata: languageName: node linkType: hard -"crc-32@npm:^1.2.0": - version: 1.2.2 - resolution: "crc-32@npm:1.2.2" - bin: - crc32: bin/crc32.njs - checksum: ad2d0ad0cbd465b75dcaeeff0600f8195b686816ab5f3ba4c6e052a07f728c3e70df2e3ca9fd3d4484dc4ba70586e161ca5a2334ec8bf5a41bf022a6103ff243 - languageName: node - linkType: hard - "create-jest@npm:^29.7.0": version: 29.7.0 resolution: "create-jest@npm:29.7.0" @@ -5453,15 +5152,6 @@ __metadata: languageName: node linkType: hard -"cross-fetch@npm:^4.0.0": - version: 4.0.0 - resolution: "cross-fetch@npm:4.0.0" - dependencies: - node-fetch: ^2.6.12 - checksum: ecca4f37ffa0e8283e7a8a590926b66713a7ef7892757aa36c2d20ffa27b0ac5c60dcf453119c809abe5923fc0bae3702a4d896bfb406ef1077b0d0018213e24 - languageName: node - linkType: hard - "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -6268,40 +5958,6 @@ __metadata: languageName: node linkType: hard -"ethereum-cryptography@npm:^2.0.0": - version: 2.0.0 - resolution: "ethereum-cryptography@npm:2.0.0" - dependencies: - "@noble/curves": 1.0.0 - "@noble/hashes": 1.3.0 - "@scure/bip32": 1.3.0 - "@scure/bip39": 1.2.0 - checksum: 958f8aab2d1b32aa759fb27a27877b3647410e8bb9aca7d65d1d477db4864cf7fc46b918eb52a1e246c25e98ee0a35a632c88b496aeaefa13469ee767a76c8db - languageName: node - linkType: hard - -"ethereum-cryptography@npm:^2.1.2": - version: 2.1.3 - resolution: "ethereum-cryptography@npm:2.1.3" - dependencies: - "@noble/curves": 1.3.0 - "@noble/hashes": 1.3.3 - "@scure/bip32": 1.3.3 - "@scure/bip39": 1.2.2 - checksum: 7f9c14f868a588641179cace3eb86c332c4743290865db699870710253cabc4dc74bd4bce5e7bc6db667482e032e94d6f79521219eb6be5dc422059d279a27b7 - languageName: node - linkType: hard - -"ethjs-util@npm:^0.1.6": - version: 0.1.6 - resolution: "ethjs-util@npm:0.1.6" - dependencies: - is-hex-prefixed: 1.0.0 - strip-hex-prefix: 1.0.0 - checksum: 1f42959e78ec6f49889c49c8a98639e06f52a15966387dd39faf2930db48663d026efb7db2702dcffe7f2a99c4a0144b7ce784efdbf733f4077aae95de76d65f - languageName: node - linkType: hard - "event-target-shim@npm:^5.0.0": version: 5.0.1 resolution: "event-target-shim@npm:5.0.1" @@ -7725,13 +7381,6 @@ __metadata: languageName: node linkType: hard -"is-hex-prefixed@npm:1.0.0": - version: 1.0.0 - resolution: "is-hex-prefixed@npm:1.0.0" - checksum: 5ac58e6e528fb029cc43140f6eeb380fad23d0041cc23154b87f7c9a1b728bcf05909974e47248fd0b7fcc11ba33cf7e58d64804883056fabd23e2b898be41de - languageName: node - linkType: hard - "is-hexadecimal@npm:^1.0.0": version: 1.0.4 resolution: "is-hexadecimal@npm:1.0.4" @@ -8588,13 +8237,6 @@ __metadata: languageName: node linkType: hard -"js-base64@npm:^3.7.5": - version: 3.7.5 - resolution: "js-base64@npm:3.7.5" - checksum: 67a78c8b1c47b73f1c6fba1957e9fe6fd9dc78ac93ac46cc2e43472dcb9cf150d126fb0e593192e88e0497354fa634d17d255add7cc6ee3c7b4d29870faa8e18 - languageName: node - linkType: hard - "js-sdsl@npm:^4.1.4": version: 4.4.0 resolution: "js-sdsl@npm:4.4.0" @@ -8762,13 +8404,6 @@ __metadata: languageName: node linkType: hard -"jwt-decode@npm:^3.1.2": - version: 3.1.2 - resolution: "jwt-decode@npm:3.1.2" - checksum: 20a4b072d44ce3479f42d0d2c8d3dabeb353081ba4982e40b83a779f2459a70be26441be6c160bfc8c3c6eadf9f6380a036fbb06ac5406b5674e35d8c4205eeb - languageName: node - linkType: hard - "keyv@npm:^3.0.0": version: 3.1.0 resolution: "keyv@npm:3.1.0" @@ -9013,13 +8648,6 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^10.0.1": - version: 10.0.1 - resolution: "lru-cache@npm:10.0.1" - checksum: 06f8d0e1ceabd76bb6f644a26dbb0b4c471b79c7b514c13c6856113879b3bf369eb7b497dad4ff2b7e2636db202412394865b33c332100876d838ad1372f0181 - languageName: node - linkType: hard - "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -9197,13 +8825,6 @@ __metadata: languageName: node linkType: hard -"micro-ftch@npm:^0.3.1": - version: 0.3.1 - resolution: "micro-ftch@npm:0.3.1" - checksum: 0e496547253a36e98a83fb00c628c53c3fb540fa5aaeaf718438873785afd193244988c09d219bb1802984ff227d04938d9571ef90fe82b48bd282262586aaff - languageName: node - linkType: hard - "micromark@npm:~2.11.0": version: 2.11.4 resolution: "micromark@npm:2.11.4" @@ -10259,13 +9880,6 @@ __metadata: languageName: node linkType: hard -"pony-cause@npm:^2.1.10": - version: 2.1.10 - resolution: "pony-cause@npm:2.1.10" - checksum: 8b61378f213e61056312dc274a1c79980154e9d864f6ad86e0c8b91a50d3ce900d430995ee24147c9f3caa440dfe7d51c274b488d7f033b65b206522536d7217 - languageName: node - linkType: hard - "postgres-array@npm:~2.0.0": version: 2.0.0 resolution: "postgres-array@npm:2.0.0" @@ -11528,15 +11142,6 @@ __metadata: languageName: node linkType: hard -"strip-hex-prefix@npm:1.0.0": - version: 1.0.0 - resolution: "strip-hex-prefix@npm:1.0.0" - dependencies: - is-hex-prefixed: 1.0.0 - checksum: 4cafe7caee1d281d3694d14920fd5d3c11adf09371cef7e2ccedd5b83efd9e9bd2219b5d6ce6e809df6e0f437dc9d30db1192116580875698aad164a6d6b285b - languageName: node - linkType: hard - "strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" @@ -11587,13 +11192,6 @@ __metadata: languageName: unknown linkType: soft -"superstruct@npm:^1.0.3": - version: 1.0.3 - resolution: "superstruct@npm:1.0.3" - checksum: 761790bb111e6e21ddd608299c252f3be35df543263a7ebbc004e840d01fcf8046794c274bcb351bdf3eae4600f79d317d085cdbb19ca05803a4361840cc9bb1 - languageName: node - linkType: hard - "supports-color@npm:^5.3.0, supports-color@npm:^5.5.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" @@ -11821,15 +11419,6 @@ __metadata: languageName: node linkType: hard -"ts-invariant@npm:^0.4.0": - version: 0.4.4 - resolution: "ts-invariant@npm:0.4.4" - dependencies: - tslib: ^1.9.3 - checksum: 58b32fb6b7c479e602e55b9eb63bb99a203c5db09367d3aa7c3cbe000ba62f919eea7f031f55172df9b6d362a6f1a87e906df84b04b8c74c88e507ac58f7a554 - languageName: node - linkType: hard - "ts-invariant@npm:^0.9.4": version: 0.9.4 resolution: "ts-invariant@npm:0.9.4" @@ -11944,7 +11533,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^1.10.0, tslib@npm:^1.8.1, tslib@npm:^1.9.3": +"tslib@npm:^1.8.1": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd @@ -11983,13 +11572,6 @@ __metadata: languageName: node linkType: hard -"tweetnacl-util@npm:^0.15.1": - version: 0.15.1 - resolution: "tweetnacl-util@npm:0.15.1" - checksum: ae6aa8a52cdd21a95103a4cc10657d6a2040b36c7a6da7b9d3ab811c6750a2d5db77e8c36969e75fdee11f511aa2b91c552496c6e8e989b6e490e54aca2864fc - languageName: node - linkType: hard - "tweetnacl@npm:^1.0.3": version: 1.0.3 resolution: "tweetnacl@npm:1.0.3" @@ -12772,16 +12354,6 @@ __metadata: languageName: node linkType: hard -"zen-observable-ts@npm:^0.8.21": - version: 0.8.21 - resolution: "zen-observable-ts@npm:0.8.21" - dependencies: - tslib: ^1.9.3 - zen-observable: ^0.8.0 - checksum: 2931628598937effcc77acf88ac8d3468c0584bbc4488726ae2c94f6a02615ff80e9d6dc0943b71bc874466ab371837737ce8245eed3bfea38daa466a2fdc6ce - languageName: node - linkType: hard - "zen-observable-ts@npm:^1.2.0, zen-observable-ts@npm:^1.2.5": version: 1.2.5 resolution: "zen-observable-ts@npm:1.2.5" @@ -12791,7 +12363,7 @@ __metadata: languageName: node linkType: hard -"zen-observable@npm:0.8.15, zen-observable@npm:^0.8.0": +"zen-observable@npm:0.8.15": version: 0.8.15 resolution: "zen-observable@npm:0.8.15" checksum: b7289084bc1fc74a559b7259faa23d3214b14b538a8843d2b001a35e27147833f4107590b1b44bf5bc7f6dfe6f488660d3a3725f268e09b3925b3476153b7821