Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release] 20231020 #191

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/common-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.0] - 2023-10-20
### Changed
- Version bump with `common` 3.1.3

## [3.0.3] - 2023-10-17
### Changed
- Update type names to be consistent with main SDK (#189)
Expand Down Expand Up @@ -95,7 +99,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix chainTypes not being in deployments

## [0.0.5] - 2022-06-15
[Unreleased]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.0.3...HEAD
[Unreleased]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.1.0...HEAD
[3.1.0]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.0.3...common-cosmos/3.1.0
[3.0.3]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.0.2...common-cosmos/3.0.3
[3.0.2]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.0.1...common-cosmos/3.0.2
[3.0.1]: https://github.com/subquery/subql-cosmos/compare/common-cosmos/3.0.0...common-cosmos/3.0.1
Expand Down
4 changes: 2 additions & 2 deletions packages/common-cosmos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/common-cosmos",
"version": "3.0.3",
"version": "3.1.0",
"description": "",
"scripts": {
"build": "rm -rf dist && tsc -b",
Expand All @@ -23,7 +23,7 @@
"@protobufs/google": "^0.0.10",
"@protobufs/ibc": "^0.1.0",
"@protobufs/tendermint": "^0.0.10",
"@subql/common": "^3.1.2",
"@subql/common": "^3.1.3",
"@subql/types-cosmos": "workspace:*",
"fs-extra": "^11.1.1",
"js-yaml": "^4.1.0",
Expand Down
10 changes: 9 additions & 1 deletion packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.0] - 2023-10-20
### Added
- Inject in-memory cache to sandbox

### Fixed
- Bump with `@subq/node-core` 3.1.0 , fixed poi migration init check, and improve logging

## [3.0.3] - 2023-10-17
### Changed
- Update type names to be consistent with main SDK (#189)
Expand Down Expand Up @@ -284,7 +291,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Init release

[Unreleased]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.0.3...HEAD
[Unreleased]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.1.0...HEAD
[3.1.0]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.0.3...node-cosmos/3.1.0
[3.0.3]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.0.2...node-cosmos/3.0.3
[3.0.2]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.0.1...node-cosmos/3.0.2
[3.0.1]: https://github.com/subquery/subql-cosmos/compare/node-cosmos/3.0.0...node-cosmos/3.0.1
Expand Down
6 changes: 3 additions & 3 deletions packages/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/node-cosmos",
"version": "3.0.3",
"version": "3.1.0",
"description": "",
"author": "SubQuery Pte Ltd",
"license": "GPL-3.0",
Expand Down Expand Up @@ -28,9 +28,9 @@
"@nestjs/event-emitter": "^2.0.0",
"@nestjs/platform-express": "^9.4.0",
"@nestjs/schedule": "^3.0.1",
"@subql/common": "^3.1.2",
"@subql/common": "^3.1.3",
"@subql/common-cosmos": "workspace:*",
"@subql/node-core": "^6.0.2",
"@subql/node-core": "^6.1.0",
"@subql/types-cosmos": "workspace:*",
"cosmjs-types": "^0.7.0",
"cron-converter": "^1.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import {
HostUnfinalizedBlocks,
baseWorkerFunctions,
storeHostFunctions,
cacheHostFunctions,
dynamicDsHostFunctions,
IProjectUpgradeService,
InMemoryCacheService,
} from '@subql/node-core';
import { Store } from '@subql/types-core';
import { Cache, Store } from '@subql/types-core';
import {
CosmosProjectDs,
SubqueryProject,
Expand All @@ -44,6 +46,7 @@ type IndexerWorker = IIndexerWorker & {

async function createIndexerWorker(
store: Store,
cache: Cache,
dynamicDsService: IDynamicDsService<CosmosProjectDs>,
unfinalizedBlocksService: IUnfinalizedBlocksService<BlockContent>,
connectionPoolState: ConnectionPoolStateManager<CosmosClientConnection>,
Expand All @@ -60,6 +63,7 @@ async function createIndexerWorker(
path.resolve(__dirname, '../../../dist/indexer/worker/worker.js'),
[...baseWorkerFunctions, 'initWorker'],
{
...cacheHostFunctions(cache),
...storeHostFunctions(store),
...dynamicDsHostFunctions(dynamicDsService),
unfinalizedBlocksProcess:
Expand Down Expand Up @@ -88,6 +92,7 @@ export class WorkerBlockDispatcherService
@Inject('IProjectUpgradeService')
projectUpgadeService: IProjectUpgradeService,
smartBatchService: SmartBatchService,
cacheService: InMemoryCacheService,
storeService: StoreService,
storeCacheService: StoreCacheService,
poiService: PoiService,
Expand All @@ -112,6 +117,7 @@ export class WorkerBlockDispatcherService
() =>
createIndexerWorker(
storeService.getStore(),
cacheService.getCache(),
dynamicDsService,
unfinalizedBlocksSevice,
connectionPoolState,
Expand Down
5 changes: 5 additions & 0 deletions packages/node/src/indexer/fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
StoreCacheService,
ConnectionPoolStateManager,
IProjectUpgradeService,
InMemoryCacheService,
} from '@subql/node-core';
import { SubqueryProject } from '../configure/SubqueryProject';
import { ApiService } from './api.service';
Expand All @@ -34,6 +35,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';

@Module({
providers: [
InMemoryCacheService,
StoreService,
StoreCacheService,
ApiService,
Expand All @@ -56,6 +58,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
apiService: ApiService,
indexerManager: IndexerManager,
smartBatchService: SmartBatchService,
cacheService: InMemoryCacheService,
storeService: StoreService,
storeCacheService: StoreCacheService,
poiService: PoiService,
Expand All @@ -72,6 +75,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
projectService,
projectUpgradeService,
smartBatchService,
cacheService,
storeService,
storeCacheService,
poiService,
Expand Down Expand Up @@ -104,6 +108,7 @@ import { UnfinalizedBlocksService } from './unfinalizedBlocks.service';
ApiService,
IndexerManager,
SmartBatchService,
InMemoryCacheService,
StoreService,
StoreCacheService,
PoiService,
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/indexer/sandbox.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
IndexerSandbox,
hostStoreToStore,
ISubqueryProject,
InMemoryCacheService,
} from '@subql/node-core';
import { Store, BaseDataSource } from '@subql/types-core';
import { ApiService, CosmosSafeClient } from './api.service';
Expand All @@ -22,6 +23,7 @@ export class SandboxService<Api extends CosmosSafeClient> {
private readonly apiService: ApiService,
@Inject(isMainThread ? StoreService : 'Null')
private readonly storeService: StoreService,
private readonly cacheService: InMemoryCacheService,
private readonly nodeConfig: NodeConfig,
@Inject('ISubqueryProject') private readonly project: ISubqueryProject,
) {}
Expand All @@ -31,11 +33,13 @@ export class SandboxService<Api extends CosmosSafeClient> {
? this.storeService.getStore()
: hostStoreToStore((global as any).host); // Provided in worker.ts

const cache = this.cacheService.getCache();
const entry = this.getDataSourceEntry(ds);
let processor = this.processorCache[entry];
if (!processor) {
processor = new IndexerSandbox(
{
cache,
store,
root: this.project.root,
entry,
Expand Down
6 changes: 6 additions & 0 deletions packages/node/src/indexer/worker/worker-fetch.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
WorkerDynamicDsService,
ConnectionPoolStateManager,
WorkerConnectionPoolStateManager,
InMemoryCacheService,
} from '@subql/node-core';
import { SubqueryProject } from '../../configure/SubqueryProject';
import { ApiService } from '../api.service';
Expand All @@ -18,6 +19,7 @@ import { IndexerManager } from '../indexer.manager';
import { ProjectService } from '../project.service';
import { SandboxService } from '../sandbox.service';
import { UnfinalizedBlocksService } from '../unfinalizedBlocks.service';
import { WorkerInMemoryCacheService } from './worker.inMemoryCache.service';
import { WorkerService } from './worker.service';
import { WorkerUnfinalizedBlocksService } from './worker.unfinalizedBlocks.service';

Expand Down Expand Up @@ -63,6 +65,10 @@ import { WorkerUnfinalizedBlocksService } from './worker.unfinalizedBlocks.servi
useFactory: () =>
new WorkerUnfinalizedBlocksService((global as any).host),
},
{
provide: InMemoryCacheService,
useFactory: () => new WorkerInMemoryCacheService((global as any).host),
},
],
exports: [],
})
Expand Down
20 changes: 20 additions & 0 deletions packages/node/src/indexer/worker/worker.inMemoryCache.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: GPL-3.0

import { isMainThread } from 'worker_threads';
import { Injectable } from '@nestjs/common';
import { HostCache, hostCacheToCache } from '@subql/node-core';
import { Cache } from '@subql/types-core';

@Injectable()
export class WorkerInMemoryCacheService {
constructor(private host: HostCache) {
if (isMainThread) {
throw new Error('Expected to be worker thread');
}
}

getCache(): Cache {
return hostCacheToCache(this.host);
}
}
7 changes: 6 additions & 1 deletion packages/types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.1.0] - 2023-10-20
### Changed
- Version bump with `types-core` 0.2.0

## [3.0.3] - 2023-10-17
### Changed
- Update type names to be consistent with main SDK (#189)
Expand Down Expand Up @@ -81,7 +85,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix chainTypes not being in deployments

## [0.0.5] - 2022-06-15
[Unreleased]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.0.3...HEAD
[Unreleased]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.1.0...HEAD
[3.1.0]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.0.3...types-cosmos/3.1.0
[3.0.3]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.0.2...types-cosmos/3.0.3
[3.0.2]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.0.1...types-cosmos/3.0.2
[3.0.1]: https://github.com/subquery/subql-cosmos/compare/types-cosmos/3.0.0...types-cosmos/3.0.1
Expand Down
4 changes: 2 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/types-cosmos",
"version": "3.0.3",
"version": "3.1.0",
"description": "",
"homepage": "https://github.com/subquery/subql-cosmos",
"repository": "github:subquery/subql-cosmos",
Expand All @@ -19,6 +19,6 @@
"@cosmjs/cosmwasm-stargate": "^0.30.1",
"@cosmjs/proto-signing": "^0.30.1",
"@cosmjs/stargate": "^0.30.1",
"@subql/types-core": "^0.1.1"
"@subql/types-core": "^0.2.0"
}
}
Loading
Loading