mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 00:44:06 +00:00
Prefetch block and txs in historical processing instead of fetching them in events processing (#460)
* Set gzip true in ethersjs provider * Add timer logs and use StaticJsonRpcProvider * Fetch block data in historical processing and cache in map * Fetch txs required for event logs in historical processing * Process events with prefetched block and txs data in realtime processing * Clear old TODOs
This commit is contained in:
@@ -18,7 +18,9 @@ import {
|
||||
ResultEvent,
|
||||
StateKind,
|
||||
EthClient,
|
||||
UpstreamConfig
|
||||
UpstreamConfig,
|
||||
EthFullTransaction,
|
||||
EthFullBlock
|
||||
} from '@cerc-io/util';
|
||||
import { GetStorageAt, getStorageValue, MappingKey, StorageLayout } from '@cerc-io/solidity-mapper';
|
||||
|
||||
@@ -117,7 +119,12 @@ export class Indexer implements IndexerInterface {
|
||||
return [];
|
||||
}
|
||||
|
||||
async fetchAndSaveFilteredEventsAndBlocks (startBlock: number, endBlock: number): Promise<{ blockProgress: BlockProgressInterface, events: DeepPartial<EventInterface>[] }[]> {
|
||||
async fetchAndSaveFilteredEventsAndBlocks (startBlock: number, endBlock: number): Promise<{
|
||||
blockProgress: BlockProgressInterface;
|
||||
events: DeepPartial<EventInterface>[];
|
||||
ethFullBlock: EthFullBlock;
|
||||
ethFullTransactions: EthFullTransaction[];
|
||||
}[]> {
|
||||
assert(startBlock);
|
||||
assert(endBlock);
|
||||
|
||||
@@ -132,8 +139,12 @@ export class Indexer implements IndexerInterface {
|
||||
return [];
|
||||
}
|
||||
|
||||
async saveBlockAndFetchEvents (block: BlockProgressInterface): Promise<[BlockProgressInterface, DeepPartial<EventInterface>[]]> {
|
||||
return [block, []];
|
||||
async saveBlockAndFetchEvents (block: BlockProgressInterface): Promise<[
|
||||
BlockProgressInterface,
|
||||
DeepPartial<EventInterface>[],
|
||||
EthFullTransaction[]
|
||||
]> {
|
||||
return [block, [], []];
|
||||
}
|
||||
|
||||
async removeUnknownEvents (block: BlockProgressInterface): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user