Skip to content

Commit

Permalink
Fix missing apiService (#275)
Browse files Browse the repository at this point in the history
* Fix missing apiService

* update generic type

* update generic type

* rollback changes
  • Loading branch information
jiqiang90 authored Apr 4, 2024
1 parent ca591de commit 516b8a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Now when `workers` set to 0, it will use block dispatcher instead of throw and exit
- Fixed workers failed to start due to missing apiService, also fix `fetchChainBlock`

## [4.0.0] - 2024-04-03
### Added
Expand Down
8 changes: 4 additions & 4 deletions packages/node/src/indexer/indexer.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
SubqlEthereumDataSource,
} from '@subql/common-ethereum';
import {
ApiService,
NodeConfig,
getLogger,
profiler,
IndexerSandbox,
ProcessBlockResponse,
Expand All @@ -33,7 +33,7 @@ import {
LightEthereumLog,
} from '@subql/types-ethereum';
import { EthereumProjectDs } from '../configure/SubqueryProject';
import { EthereumApi, EthereumApiService } from '../ethereum';
import { EthereumApi } from '../ethereum';
import {
filterBlocksProcessor,
filterLogsProcessor,
Expand All @@ -55,7 +55,7 @@ export class IndexerManager extends BaseIndexerManager<
SafeEthProvider,
EthereumApi,
BlockContent,
EthereumApiService,
ApiService,
SubqlEthereumDataSource,
SubqlEthereumCustomDataSource,
typeof FilterTypeMap,
Expand All @@ -67,7 +67,7 @@ export class IndexerManager extends BaseIndexerManager<
protected updateCustomProcessor = asSecondLayerHandlerProcessor_1_0_0;

constructor(
apiService: EthereumApiService,
apiService: ApiService,
nodeConfig: NodeConfig,
sandboxService: SandboxService,
dsProcessorService: DsProcessorService,
Expand Down
11 changes: 9 additions & 2 deletions packages/node/src/indexer/worker/worker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
IProjectUpgradeService,
IBlock,
} from '@subql/node-core';
import { EthereumBlock, LightEthereumBlock } from '@subql/types-ethereum';
import { EthereumProjectDs } from '../../configure/SubqueryProject';
import { EthereumApi } from '../../ethereum';
import SafeEthProvider from '../../ethereum/safe-api';
import { IndexerManager } from '../indexer.manager';
import { BlockContent } from '../types';

Expand All @@ -33,7 +36,11 @@ export class WorkerService extends BaseWorkerService<
{}
> {
constructor(
private apiService: ApiService<any, any, IBlock<any>[]>,
private apiService: ApiService<
EthereumApi,
SafeEthProvider,
IBlock<BlockContent>[]
>,
private indexerManager: IndexerManager,
@Inject('IProjectService')
projectService: IProjectService<EthereumProjectDs>,
Expand All @@ -49,7 +56,7 @@ export class WorkerService extends BaseWorkerService<
extra: {},
): Promise<IBlock<BlockContent>> {
const [block] = await this.apiService.fetchBlocks([heights]);
return block.block;
return block;
}

protected toBlockResponse(block: BlockContent): { parentHash: string } {
Expand Down

0 comments on commit 516b8a8

Please sign in to comment.