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

Fix indexing events multiple times #194

Merged
merged 2 commits into from
Oct 30, 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
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ 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]
### Fixed
- Missing dependencies for testing command (#194)
- Events getting processed multiple times (#194)

## [3.1.1] - 2023-10-26
### Fixed
Expand Down
3 changes: 2 additions & 1 deletion packages/node/src/indexer/indexer.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ export class IndexerManager extends BaseIndexerManager<
for (const msg of msgs) {
await this.indexMessage(msg, dataSources, getVM);
const events = blockContent.events.filter(
(event) => event.msg?.idx === msg.idx,
(event) => event.tx.hash === tx.hash && event.msg?.idx === msg.idx,
);

for (const evt of events) {
await this.indexEvent(evt, dataSources, getVM);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/subcommands/testing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
ConnectionPoolService,
ConnectionPoolStateManager,
DbModule,
InMemoryCacheService,
PoiService,
PoiSyncService,
StoreService,
TestRunner,
} from '@subql/node-core';
Expand All @@ -26,10 +28,12 @@ import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';

@Module({
providers: [
InMemoryCacheService,
StoreService,
StoreCacheService,
EventEmitter2,
PoiService,
PoiSyncService,
SandboxService,
DsProcessorService,
DynamicDsService,
Expand Down
2 changes: 2 additions & 0 deletions packages/types/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]
### Added
- JSDoc to field explaining definition (#194)

## [3.1.0] - 2023-10-20
### Changed
Expand Down
3 changes: 3 additions & 0 deletions packages/types/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export interface CosmosTransaction {
}

export interface CosmosMessage<T = any> {
/**
* The index of the message within the transaction
*/
idx: number;
block: CosmosBlock;
tx: CosmosTransaction;
Expand Down
Loading