diff --git a/packages/common-algorand/CHANGELOG.md b/packages/common-algorand/CHANGELOG.md index e135d9f4..514d53b0 100644 --- a/packages/common-algorand/CHANGELOG.md +++ b/packages/common-algorand/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Update `@subql/common` dependency ## [4.2.5] - 2024-11-26 ### Changed diff --git a/packages/common-algorand/package.json b/packages/common-algorand/package.json index a71ba115..9d47e087 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": "^5.2.1", + "@subql/common": "^5.2.2", "@subql/types-algorand": "workspace:*" }, "peerDependencies": { diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 46e54d3c..2d441f0f 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Update `@subql/node-core` and `@subql/common` dependencies ## [3.15.1] - 2024-12-06 ### Fixed diff --git a/packages/node/package.json b/packages/node/package.json index e0f2898b..293e1a9c 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -24,9 +24,9 @@ "@nestjs/event-emitter": "^2.0.0", "@nestjs/platform-express": "^9.4.0", "@nestjs/schedule": "^3.0.1", - "@subql/common": "^5.2.1", + "@subql/common": "^5.2.2", "@subql/common-algorand": "workspace:*", - "@subql/node-core": "^15.0.3", + "@subql/node-core": "^16.1.0", "@subql/types-algorand": "workspace:*", "algosdk": "^2.8.0", "lodash": "^4.17.21", diff --git a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts index fda97a41..ffa5e65d 100644 --- a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts @@ -18,6 +18,7 @@ import { AlgorandBlock, AlgorandDataSource } from '@subql/types-algorand'; import { AlgorandApiService } from '../../algorand'; import { SubqueryProject } from '../../configure/SubqueryProject'; import { IndexerManager } from '../indexer.manager'; +import { getBlockSize } from '../types'; /** * @description Intended to behave the same as WorkerBlockDispatcherService but doesn't use worker threads or any parallel processing @@ -66,4 +67,8 @@ export class BlockDispatcherService await this.projectService.getDataSources(block.getHeader().blockHeight), ); } + + protected getBlockSize(block: IBlock): number { + return getBlockSize(block.block); + } } diff --git a/packages/node/src/indexer/types.ts b/packages/node/src/indexer/types.ts index 05cbefc1..acde32a3 100644 --- a/packages/node/src/indexer/types.ts +++ b/packages/node/src/indexer/types.ts @@ -1,6 +1,22 @@ // Copyright 2020-2024 SubQuery Pte Ltd authors & contributors // SPDX-License-Identifier: GPL-3.0 -import { AlgorandBlock } from '@subql/types-algorand'; +import { AlgorandBlock, AlgorandTransaction } from '@subql/types-algorand'; export type BlockContent = AlgorandBlock; + +export function getBlockSize(block: BlockContent): number { + return ( + block.transactions?.reduce( + (acc, tx) => acc + countInnerTransactions(tx), + 0, + ) ?? 0 + ); +} + +function countInnerTransactions(tx: AlgorandTransaction): number { + return ( + tx.innerTxns?.reduce((acc, itx) => acc + countInnerTransactions(itx), 1) ?? + 1 + ); +} diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index 78567e63..48274a35 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -14,7 +14,7 @@ import { import { AlgorandBlock, AlgorandDataSource } from '@subql/types-algorand'; import { AlgorandApiService, algorandBlockToHeader } from '../../algorand'; import { IndexerManager } from '../indexer.manager'; -import { BlockContent } from '../types'; +import { BlockContent, getBlockSize } from '../types'; export type FetchBlockResponse = Header; @@ -59,4 +59,8 @@ export class WorkerService extends BaseWorkerService< ): Promise { return this.indexerManager.indexBlock(block, dataSources); } + + protected getBlockSize(block: IBlock): number { + return getBlockSize(block.block); + } } diff --git a/yarn.lock b/yarn.lock index 40e15755..7edf591e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2709,7 +2709,7 @@ __metadata: version: 0.0.0-use.local resolution: "@subql/common-algorand@workspace:packages/common-algorand" dependencies: - "@subql/common": ^5.2.1 + "@subql/common": ^5.2.2 "@subql/types-algorand": "workspace:*" "@types/bn.js": 4.11.6 "@types/js-yaml": ^4.0.4 @@ -2723,19 +2723,20 @@ __metadata: languageName: unknown linkType: soft -"@subql/common@npm:5.2.1, @subql/common@npm:^5.2.1": - version: 5.2.1 - resolution: "@subql/common@npm:5.2.1" +"@subql/common@npm:5.2.2, @subql/common@npm:^5.2.2": + version: 5.2.2 + resolution: "@subql/common@npm:5.2.2" dependencies: "@subql/types-core": 2.0.0 axios: ^0.28.0 class-transformer: ^0.5.1 class-validator: ^0.14.1 + form-data: ^4.0.1 js-yaml: ^4.1.0 reflect-metadata: ^0.1.14 semver: ^7.6.3 update-notifier: ^5.1.0 - checksum: 362ba1409b2bd7d2bfb8aed3e2496d6a87ba4f1969a33626c323e4483329dcbb11d866186c2f6794121e2ffc9c796c977f81d3f877a53aa9c6cb88228a945f92 + checksum: 91db322edee27860ef82a6a3a16413662543ed5f951720ddf9eb1617d9a172878cf0d5c89933edad03c6d3c22eee25c31799cd054fae934a4afbf606ac5ba3bd languageName: node linkType: hard @@ -2750,9 +2751,9 @@ __metadata: "@nestjs/schedule": ^3.0.1 "@nestjs/schematics": ^9.2.0 "@nestjs/testing": ^9.4.0 - "@subql/common": ^5.2.1 + "@subql/common": ^5.2.2 "@subql/common-algorand": "workspace:*" - "@subql/node-core": ^15.0.3 + "@subql/node-core": ^16.1.0 "@subql/types-algorand": "workspace:*" "@types/express": ^4.17.13 "@types/jest": ^27.4.0 @@ -2774,18 +2775,18 @@ __metadata: languageName: unknown linkType: soft -"@subql/node-core@npm:^15.0.3": - version: 15.0.3 - resolution: "@subql/node-core@npm:15.0.3" +"@subql/node-core@npm:^16.1.0": + version: 16.1.0 + resolution: "@subql/node-core@npm:16.1.0" dependencies: "@apollo/client": ^3.11.2 "@nestjs/common": ^9.4.0 "@nestjs/event-emitter": ^2.0.0 "@nestjs/schedule": ^3.0.1 - "@subql/common": 5.2.1 + "@subql/common": 5.2.2 "@subql/testing": 2.2.2 "@subql/types": 3.11.4 - "@subql/utils": 2.16.0 + "@subql/utils": 2.17.0 "@willsoto/nestjs-prometheus": ^5.4.0 async-mutex: ^0.5.0 cron-converter: ^2.0.1 @@ -2802,7 +2803,7 @@ __metadata: toposort-class: ^1.0.1 vm2: ^3.9.19 yargs: ^16.2.0 - checksum: 22749eb41145348720df46acb9ed18c186292b357c4989e9f97870ece848431db6cc492016dfdc698b38679f077add496a63e7928570253ec785583495f29853 + checksum: 470bd98966674d7102815a4c8595f35b3e8c1351a3f52cce0e49469b3f1f49ea6d98dcc0898e491b239bf14864e50b54a79c97ba843af65f052340dc8e098a60 languageName: node linkType: hard @@ -2845,9 +2846,9 @@ __metadata: languageName: node linkType: hard -"@subql/utils@npm:2.16.0": - version: 2.16.0 - resolution: "@subql/utils@npm:2.16.0" +"@subql/utils@npm:2.17.0": + version: 2.17.0 + resolution: "@subql/utils@npm:2.17.0" dependencies: "@polkadot/util": ^13.2.3 "@polkadot/util-crypto": ^13.2.3 @@ -2860,7 +2861,7 @@ __metadata: lodash: ^4.17.21 pino: ^6.13.3 rotating-file-stream: ^3.2.3 - checksum: eac50f5dc72f07ea13eba2d34bae157f8b608eb1ca884b0890b6c57a08c1b51e49974028b27a5ec3109f707e6f2ea6656426ff4feed84596170c7bd4a40177cf + checksum: 3993ff46b8789201a64904089ddf512bf3f22a7eb126e5a36b750fef756c33a34a8dca2c751be3137024157dff2b012d49bbb79df85ef5d7eca5dec6c5118bcc languageName: node linkType: hard @@ -6014,6 +6015,17 @@ __metadata: languageName: node linkType: hard +"form-data@npm:^4.0.1": + version: 4.0.1 + resolution: "form-data@npm:4.0.1" + dependencies: + asynckit: ^0.4.0 + combined-stream: ^1.0.8 + mime-types: ^2.1.12 + checksum: ccee458cd5baf234d6b57f349fe9cc5f9a2ea8fd1af5ecda501a18fd1572a6dd3bf08a49f00568afd995b6a65af34cb8dec083cf9d582c4e621836499498dd84 + languageName: node + linkType: hard + "forwarded@npm:0.2.0": version: 0.2.0 resolution: "forwarded@npm:0.2.0"