diff --git a/packages/data-fetcher/src/rpcProvider/jsonRpcProviderExtended.ts b/packages/data-fetcher/src/rpcProvider/jsonRpcProviderExtended.ts index 4c1510b5b..356ff0677 100644 --- a/packages/data-fetcher/src/rpcProvider/jsonRpcProviderExtended.ts +++ b/packages/data-fetcher/src/rpcProvider/jsonRpcProviderExtended.ts @@ -1,4 +1,5 @@ import { Provider } from "zksync-ethers"; +import { FetchRequest } from "ethers"; import { ProviderState, JsonRpcProviderBase } from "./jsonRpcProviderBase"; import logger from "../logger"; @@ -18,13 +19,17 @@ export class JsonRpcProviderExtended extends Provider implements JsonRpcProvider batchMaxSizeBytes: number, batchStallTimeMs: number ) { - super(providerUrl, undefined, { + const fetchRequest = new FetchRequest(providerUrl); + fetchRequest.timeout = connectionTimeout; + + super(fetchRequest, undefined, { timeout: connectionTimeout, batchMaxSize: batchMaxSizeBytes, batchMaxCount: batchMaxCount, staticNetwork: true, batchStallTime: batchStallTimeMs, }); + this.connectionQuickTimeout = connectionQuickTimeout; } diff --git a/packages/worker/src/rpcProvider/jsonRpcProviderExtended.ts b/packages/worker/src/rpcProvider/jsonRpcProviderExtended.ts index 4c1510b5b..356ff0677 100644 --- a/packages/worker/src/rpcProvider/jsonRpcProviderExtended.ts +++ b/packages/worker/src/rpcProvider/jsonRpcProviderExtended.ts @@ -1,4 +1,5 @@ import { Provider } from "zksync-ethers"; +import { FetchRequest } from "ethers"; import { ProviderState, JsonRpcProviderBase } from "./jsonRpcProviderBase"; import logger from "../logger"; @@ -18,13 +19,17 @@ export class JsonRpcProviderExtended extends Provider implements JsonRpcProvider batchMaxSizeBytes: number, batchStallTimeMs: number ) { - super(providerUrl, undefined, { + const fetchRequest = new FetchRequest(providerUrl); + fetchRequest.timeout = connectionTimeout; + + super(fetchRequest, undefined, { timeout: connectionTimeout, batchMaxSize: batchMaxSizeBytes, batchMaxCount: batchMaxCount, staticNetwork: true, batchStallTime: batchStallTimeMs, }); + this.connectionQuickTimeout = connectionQuickTimeout; }