diff --git a/packages/cli/src/options/beaconNodeOptions/execution.ts b/packages/cli/src/options/beaconNodeOptions/execution.ts new file mode 100644 index 000000000000..06741722bbe5 --- /dev/null +++ b/packages/cli/src/options/beaconNodeOptions/execution.ts @@ -0,0 +1,30 @@ +import {defaultOptions, IBeaconNodeOptions} from "@chainsafe/lodestar"; +import {ICliCommandOptions} from "../../util"; + +export type ExecutionEngineArgs = { + "execution.urls": string[]; + "execution.timeout": number; +}; + +export function parseArgs(args: ExecutionEngineArgs): IBeaconNodeOptions["executionEngine"] { + return { + urls: args["execution.urls"], + timeout: args["execution.timeout"], + }; +} + +export const options: ICliCommandOptions = { + "execution.urls": { + description: "Urls to execution client engine API", + type: "array", + defaultDescription: defaultOptions.executionEngine.urls.join(" "), + group: "execution", + }, + + "execution.timeout": { + description: "Timeout in miliseconds for execution engine API HTTP client", + type: "number", + defaultDescription: String(defaultOptions.executionEngine.timeout), + group: "execution", + }, +}; diff --git a/packages/cli/src/options/beaconNodeOptions/index.ts b/packages/cli/src/options/beaconNodeOptions/index.ts index 168b82facb2b..d9716d64d0de 100644 --- a/packages/cli/src/options/beaconNodeOptions/index.ts +++ b/packages/cli/src/options/beaconNodeOptions/index.ts @@ -4,6 +4,7 @@ import {removeUndefinedRecursive} from "../../util"; import * as api from "./api"; import * as chain from "./chain"; import * as eth1 from "./eth1"; +import * as execution from "./execution"; import * as logger from "./logger"; import * as metrics from "./metrics"; import * as network from "./network"; @@ -12,6 +13,7 @@ import * as sync from "./sync"; export type IBeaconNodeArgs = api.IApiArgs & chain.IChainArgs & eth1.IEth1Args & + execution.ExecutionEngineArgs & logger.ILoggerArgs & metrics.IMetricsArgs & network.INetworkArgs & @@ -24,6 +26,7 @@ export function parseBeaconNodeArgs(args: IBeaconNodeArgs): RecursivePartial { "eth1.providerUrls": ["http://my.node:8545"], "eth1.depositContractDeployBlock": 1625314, + "execution.urls": ["http://localhost:8550"], + "execution.timeout": 12000, + "logger.eth1.level": "debug", "logger.unknown.level": "debug", @@ -66,6 +69,10 @@ describe("options / beaconNodeOptions", () => { providerUrls: ["http://my.node:8545"], depositContractDeployBlock: 1625314, }, + executionEngine: { + urls: ["http://localhost:8550"], + timeout: 12000, + }, logger: { eth1: { level: LogLevel.debug, diff --git a/packages/lodestar/src/executionEngine/http.ts b/packages/lodestar/src/executionEngine/http.ts index ad616b4f3840..4b1e93a00d58 100644 --- a/packages/lodestar/src/executionEngine/http.ts +++ b/packages/lodestar/src/executionEngine/http.ts @@ -12,6 +12,7 @@ export type ExecutionEngineHttpOpts = { export const defaultExecutionEngineHttpOpts: ExecutionEngineHttpOpts = { urls: ["http://localhost:8550"], + timeout: 12000, }; export /**