diff --git a/packages/common-near/CHANGELOG.md b/packages/common-near/CHANGELOG.md index d213c73a..2404177e 100644 --- a/packages/common-near/CHANGELOG.md +++ b/packages/common-near/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.1.5] - 2024-11-27 ### Changed diff --git a/packages/common-near/package.json b/packages/common-near/package.json index 1ccd1223..833ec39a 100644 --- a/packages/common-near/package.json +++ b/packages/common-near/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-near": "workspace:*", "js-yaml": "^4.1.0", "reflect-metadata": "^0.1.13" diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 1d9525eb..e995e50b 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 ## [4.1.1] - 2024-12-06 ### Fixed diff --git a/packages/node/package.json b/packages/node/package.json index 58ac9a89..7efeea68 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-near": "workspace:*", - "@subql/node-core": "^15.0.3", + "@subql/node-core": "^16.1.0", "@subql/types-near": "workspace:*", "lodash": "^4.17.21", "near-api-js": "^2.1.4", diff --git a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts index 7a303a61..2cbd63f5 100644 --- a/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts +++ b/packages/node/src/indexer/blockDispatcher/block-dispatcher.service.ts @@ -18,7 +18,7 @@ import { NearDatasource } from '@subql/types-near'; import { SubqueryProject } from '../../configure/SubqueryProject'; import { ApiService } from '../api.service'; import { IndexerManager } from '../indexer.manager'; -import { BlockContent } from '../types'; +import { BlockContent, getBlockSize } from '../types'; /** * @description Intended to behave the same as WorkerBlockDispatcherService but doesn't use worker threads or any parallel processing @@ -71,4 +71,8 @@ export class BlockDispatcherService await this.projectService.getDataSources(block.getHeader().blockHeight), ); } + + 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 823a718a..e9a1b510 100644 --- a/packages/node/src/indexer/types.ts +++ b/packages/node/src/indexer/types.ts @@ -17,3 +17,7 @@ export interface BlockContent { } export type BestBlocks = Record; + +export function getBlockSize(block: BlockContent): number { + return block.block.chunks.reduce((acc, c) => acc + c.encoded_length, 0); +} diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index 64f74bcc..0799c545 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -17,7 +17,7 @@ import { NearDatasource } from '@subql/types-near'; import { nearHeaderToHeader } from '../../utils/near'; import { ApiService } from '../api.service'; import { IndexerManager } from '../indexer.manager'; -import { BlockContent } from '../types'; +import { BlockContent, getBlockSize } from '../types'; export type FetchBlockResponse = Header; @@ -61,4 +61,8 @@ export class WorkerService extends BaseWorkerService< } return this.indexerManager.indexBlock(block, dataSources); } + + getBlockSize(block: IBlock): number { + return getBlockSize(block.block); + } } diff --git a/yarn.lock b/yarn.lock index 34104df0..47222cd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2637,7 +2637,7 @@ __metadata: version: 0.0.0-use.local resolution: "@subql/common-near@workspace:packages/common-near" dependencies: - "@subql/common": ^5.2.1 + "@subql/common": ^5.2.2 "@subql/types-near": "workspace:*" "@types/bn.js": 5.1.5 "@types/js-yaml": ^4.0.4 @@ -2650,34 +2650,35 @@ __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 -"@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 @@ -2694,7 +2695,7 @@ __metadata: toposort-class: ^1.0.1 vm2: ^3.9.19 yargs: ^16.2.0 - checksum: 22749eb41145348720df46acb9ed18c186292b357c4989e9f97870ece848431db6cc492016dfdc698b38679f077add496a63e7928570253ec785583495f29853 + checksum: 470bd98966674d7102815a4c8595f35b3e8c1351a3f52cce0e49469b3f1f49ea6d98dcc0898e491b239bf14864e50b54a79c97ba843af65f052340dc8e098a60 languageName: node linkType: hard @@ -2709,9 +2710,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-near": "workspace:*" - "@subql/node-core": ^15.0.3 + "@subql/node-core": ^16.1.0 "@subql/types-near": "workspace:*" "@types/express": ^4.17.13 "@types/jest": ^27.4.0 @@ -2769,9 +2770,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 @@ -2784,7 +2785,7 @@ __metadata: lodash: ^4.17.21 pino: ^6.13.3 rotating-file-stream: ^3.2.3 - checksum: eac50f5dc72f07ea13eba2d34bae157f8b608eb1ca884b0890b6c57a08c1b51e49974028b27a5ec3109f707e6f2ea6656426ff4feed84596170c7bd4a40177cf + checksum: 3993ff46b8789201a64904089ddf512bf3f22a7eb126e5a36b750fef756c33a34a8dca2c751be3137024157dff2b012d49bbb79df85ef5d7eca5dec6c5118bcc languageName: node linkType: hard @@ -5920,6 +5921,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"