Skip to content

Commit

Permalink
Fix filtering issue with undefined filter options
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Aug 7, 2024
1 parent 43b95ff commit 7ab85e6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions packages/node/src/algorand/utils.algorand.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,14 @@ describe('Algorand Filters', () => {
}),
).toBeTruthy();
});

it('should not filter undefined options', () => {
expect(
filterTransaction(block.transactions![4], {
sender: 'ZW3ISEHZUHPO7OZGMKLKIIMKVICOUDRCERI454I3DB2BH52HGLSO67W754',
receiver: undefined,
}),
).toBeTruthy();
});
});
});
2 changes: 1 addition & 1 deletion packages/node/src/algorand/utils.algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ export function filterTransaction(
for (const key in filterByKey) {
if (
mappingFilterTransaction[txn.txType] &&
filterByKey[key] !== undefined &&
!txComparator(
filterByKey[key],
get(txn, mappingFilterTransaction[txn.txType][key]),
)
// filterByKey[key] !== get(txn, mappingFilterTransaction[txn.txType][key])
) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class AlgorandDictionaryService extends DictionaryService<
);
}
}

this.init(dictionariesV1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { AlgorandBlockFilter, AlgorandDataSource } from '@subql/types-algorand';
import {
DictionaryQueryCondition,
DictionaryQueryEntry as DictionaryV1QueryEntry,
DsProcessor,
} from '@subql/types-core';
import { sortBy, uniqBy } from 'lodash';
import { SubqueryProject } from '../../../configure/SubqueryProject';
Expand Down Expand Up @@ -71,7 +70,6 @@ function buildDictionaryV1QueryEntries(
const baseHandlerKind = getBaseHandlerKind(ds, handler, getDsProcessor);
let filterList: AlgorandRuntimeHandlerFilter[];
if (isCustomDs(ds)) {
//const processor = plugin.handlerProcessors[handler.kind];
filterList = getBaseHandlerFilters<AlgorandRuntimeHandlerFilter>(
ds,
handler.kind,
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/indexer/indexer.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class IndexerManager extends BaseIndexerManager<
getVM: (d: AlgorandDataSource) => Promise<IndexerSandbox>,
): Promise<void> {
await this.indexBlockContent(block, dataSources, getVM);

for (const tx of block.transactions ?? []) {
await this.indexBlockTransactionContent(tx, dataSources, getVM);
}
Expand Down

0 comments on commit 7ab85e6

Please sign in to comment.