Skip to content

Commit

Permalink
Add execution cli options
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Sep 27, 2021
1 parent 89895ae commit e29ce68
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/cli/src/options/beaconNodeOptions/execution.ts
Original file line number Diff line number Diff line change
@@ -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<ExecutionEngineArgs> = {
"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",
},
};
4 changes: 4 additions & 0 deletions packages/cli/src/options/beaconNodeOptions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 &
Expand All @@ -24,6 +26,7 @@ export function parseBeaconNodeArgs(args: IBeaconNodeArgs): RecursivePartial<IBe
chain: chain.parseArgs(args),
// db: {},
eth1: eth1.parseArgs(args),
executionEngine: execution.parseArgs(args),
logger: logger.parseArgs(args),
metrics: metrics.parseArgs(args),
network: network.parseArgs(args),
Expand All @@ -35,6 +38,7 @@ export const beaconNodeOptions = {
...api.options,
...chain.options,
...eth1.options,
...execution.options,
...logger.options,
...metrics.options,
...network.options,
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/test/unit/options/beaconNodeOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe("options / beaconNodeOptions", () => {
"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",

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/lodestar/src/executionEngine/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type ExecutionEngineHttpOpts = {

export const defaultExecutionEngineHttpOpts: ExecutionEngineHttpOpts = {
urls: ["http://localhost:8550"],
timeout: 12000,
};

export /**
Expand Down

0 comments on commit e29ce68

Please sign in to comment.