From 9c6096155da41b912f31bf63a9da0279ce321bed Mon Sep 17 00:00:00 2001 From: davyli Date: Thu, 14 Nov 2024 16:37:25 -0500 Subject: [PATCH 1/2] Add new RpcDataIngestSettings for controlling split size --- evm/evm-processor/src/ds-rpc/client.ts | 5 ++++- evm/evm-processor/src/processor.ts | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/evm/evm-processor/src/ds-rpc/client.ts b/evm/evm-processor/src/ds-rpc/client.ts index ee67a6845..8b7ed4483 100644 --- a/evm/evm-processor/src/ds-rpc/client.ts +++ b/evm/evm-processor/src/ds-rpc/client.ts @@ -45,6 +45,7 @@ export interface EvmRpcDataSourceOptions { debugTraceTimeout?: string log?: Logger validationFlags?: RpcValidationFlags + maxBlocksPerIteration?: number } export class EvmRpcDataSource implements HotDataSource { @@ -52,6 +53,7 @@ export class EvmRpcDataSource implements HotDataSource { private finalityConfirmation: number private headPollInterval: number private newHeadTimeout: number + private maxBlocksPerIteration: number private preferTraceApi?: boolean private useDebugApiForStateDiffs?: boolean private debugTraceTimeout?: string @@ -66,6 +68,7 @@ export class EvmRpcDataSource implements HotDataSource { this.preferTraceApi = options.preferTraceApi this.useDebugApiForStateDiffs = options.useDebugApiForStateDiffs this.debugTraceTimeout = options.debugTraceTimeout + this.maxBlocksPerIteration = Math.max(options.maxBlocksPerIteration || 10, 1) } async getFinalizedHeight(): Promise { @@ -85,7 +88,7 @@ export class EvmRpcDataSource implements HotDataSource { getFinalizedHeight: () => this.getFinalizedHeight(), getSplit: req => this._getColdSplit(req), requests: mapRangeRequestList(requests, req => this.toMappingRequest(req)), - splitSize: 10, + splitSize: this.maxBlocksPerIteration, concurrency: Math.min(5, this.rpc.client.getConcurrency()), stopOnHead, headPollInterval: this.headPollInterval diff --git a/evm/evm-processor/src/processor.ts b/evm/evm-processor/src/processor.ts index 4547b698d..6497f1c77 100644 --- a/evm/evm-processor/src/processor.ts +++ b/evm/evm-processor/src/processor.ts @@ -86,6 +86,11 @@ export interface RpcDataIngestionSettings { * Flags to switch off the data consistency checks */ validationFlags?: RpcValidationFlags + + /** + * The number of blocks to process at a time. + */ + maxBlocksPerIteration?: number } @@ -473,6 +478,7 @@ export class EvmBatchProcessor { headPollInterval: this.rpcIngestSettings?.headPollInterval, newHeadTimeout: this.rpcIngestSettings?.newHeadTimeout, validationFlags: this.rpcIngestSettings?.validationFlags, + maxBlocksPerIteration: this.rpcIngestSettings?.maxBlocksPerIteration, log: this.getLogger().child('rpc', {rpcUrl: this.getChainRpcClient().url}) }) } From 54350f17a246c62077f7b2cb1a3b406b65145f6f Mon Sep 17 00:00:00 2001 From: davyli Date: Thu, 14 Nov 2024 16:47:36 -0500 Subject: [PATCH 2/2] minor update to help text --- evm/evm-processor/src/processor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evm/evm-processor/src/processor.ts b/evm/evm-processor/src/processor.ts index 6497f1c77..d127c634e 100644 --- a/evm/evm-processor/src/processor.ts +++ b/evm/evm-processor/src/processor.ts @@ -88,7 +88,7 @@ export interface RpcDataIngestionSettings { validationFlags?: RpcValidationFlags /** - * The number of blocks to process at a time. + * The maximum number of blocks to process at a time */ maxBlocksPerIteration?: number }