Skip to content

Commit

Permalink
Sync @subql dependencies (#145)
Browse files Browse the repository at this point in the history
* Update @subql deps

* Add getBlockSize function

* Update changelog

---------

Co-authored-by: stwiname <[email protected]>
Co-authored-by: Scott Twiname <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 6c22172 commit 9479490
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 22 deletions.
2 changes: 2 additions & 0 deletions packages/common-algorand/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/common-algorand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,4 +67,8 @@ export class BlockDispatcherService
await this.projectService.getDataSources(block.getHeader().blockHeight),
);
}

protected getBlockSize(block: IBlock<AlgorandBlock>): number {
return getBlockSize(block.block);
}
}
18 changes: 17 additions & 1 deletion packages/node/src/indexer/types.ts
Original file line number Diff line number Diff line change
@@ -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
);
}
6 changes: 5 additions & 1 deletion packages/node/src/indexer/worker/worker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -59,4 +59,8 @@ export class WorkerService extends BaseWorkerService<
): Promise<ProcessBlockResponse> {
return this.indexerManager.indexBlock(block, dataSources);
}

protected getBlockSize(block: IBlock<AlgorandBlock>): number {
return getBlockSize(block.block);
}
}
46 changes: 29 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 9479490

Please sign in to comment.