diff --git a/docs/pages/beacon-management/mev-and-builder-integration.md b/docs/pages/beacon-management/mev-and-builder-integration.md index c2f2529edbe6..c2f9db9b6846 100644 --- a/docs/pages/beacon-management/mev-and-builder-integration.md +++ b/docs/pages/beacon-management/mev-and-builder-integration.md @@ -20,7 +20,7 @@ All you have to do is: 1. Provide lodestar beacon node with a Builder endpoint (which corresponds to the network you are running) via these additional flags: ```shell - --builder --builder.urls + --builder --builder.url ``` 2. Run lodestar validator client with these additional flags ```shell diff --git a/packages/beacon-node/src/execution/builder/http.ts b/packages/beacon-node/src/execution/builder/http.ts index 7b78bfbd31a1..20b7d4751c81 100644 --- a/packages/beacon-node/src/execution/builder/http.ts +++ b/packages/beacon-node/src/execution/builder/http.ts @@ -16,7 +16,7 @@ import {IExecutionBuilder} from "./interface.js"; export type ExecutionBuilderHttpOpts = { enabled: boolean; - urls: string[]; + url: string; timeout?: number; faultInspectionWindow?: number; allowedFaults?: number; @@ -29,7 +29,7 @@ export type ExecutionBuilderHttpOpts = { export const defaultExecutionBuilderHttpOpts: ExecutionBuilderHttpOpts = { enabled: false, - urls: ["http://localhost:8661"], + url: "http://localhost:8661", timeout: 12000, }; @@ -48,7 +48,7 @@ export class ExecutionBuilderHttp implements IExecutionBuilder { metrics: Metrics | null = null, logger?: Logger ) { - const baseUrl = opts.urls[0]; + const baseUrl = opts.url; if (!baseUrl) throw Error("No Url provided for executionBuilder"); this.api = getClient( { diff --git a/packages/beacon-node/test/sim/mergemock.test.ts b/packages/beacon-node/test/sim/mergemock.test.ts index 0761005714bd..d9492723599d 100644 --- a/packages/beacon-node/test/sim/mergemock.test.ts +++ b/packages/beacon-node/test/sim/mergemock.test.ts @@ -157,7 +157,7 @@ describe("executionEngine / ExecutionEngineHttp", function () { eth1: {enabled: false, providerUrls: [engineRpcUrl], jwtSecretHex}, executionEngine: {urls: [engineRpcUrl], jwtSecretHex}, executionBuilder: { - urls: [ethRpcUrl], + url: ethRpcUrl, enabled: true, issueLocalFcUWithFeeRecipient: feeRecipientMevBoost, allowedFaults: 16, diff --git a/packages/cli/src/options/beaconNodeOptions/builder.ts b/packages/cli/src/options/beaconNodeOptions/builder.ts index 7313d836a92c..96388ddfe2dd 100644 --- a/packages/cli/src/options/beaconNodeOptions/builder.ts +++ b/packages/cli/src/options/beaconNodeOptions/builder.ts @@ -1,18 +1,24 @@ import {defaultExecutionBuilderHttpOpts, IBeaconNodeOptions} from "@lodestar/beacon-node"; -import {CliCommandOptions} from "../../util/index.js"; +import {CliCommandOptions, YargsError} from "../../util/index.js"; export type ExecutionBuilderArgs = { builder: boolean; - "builder.urls"?: string[]; + "builder.url"?: string; "builder.timeout"?: number; "builder.faultInspectionWindow"?: number; "builder.allowedFaults"?: number; }; export function parseArgs(args: ExecutionBuilderArgs): IBeaconNodeOptions["executionBuilder"] { + if (Array.isArray(args["builder.url"]) || args["builder.url"]?.includes(",http")) { + throw new YargsError( + "Lodestar only supports a single builder URL. External tooling like mev-boost can be used to connect to multiple builder/relays" + ); + } + return { enabled: args["builder"], - urls: args["builder.urls"] ?? defaultExecutionBuilderHttpOpts.urls, + url: args["builder.url"] ?? defaultExecutionBuilderHttpOpts.url, timeout: args["builder.timeout"], faultInspectionWindow: args["builder.faultInspectionWindow"], allowedFaults: args["builder.allowedFaults"], @@ -27,14 +33,11 @@ export const options: CliCommandOptions = { group: "builder", }, - "builder.urls": { - description: "Urls hosting the builder API", - defaultDescription: defaultExecutionBuilderHttpOpts.urls.join(","), - type: "array", - string: true, - coerce: (urls: string[]): string[] => - // Parse ["url1,url2"] to ["url1", "url2"] - urls.map((item) => item.split(",")).flat(1), + "builder.url": { + alias: ["builder.urls"], + description: "Url hosting the builder API", + defaultDescription: defaultExecutionBuilderHttpOpts.url, + type: "string", group: "builder", }, diff --git a/packages/cli/test/unit/options/beaconNodeOptions.test.ts b/packages/cli/test/unit/options/beaconNodeOptions.test.ts index 9115ac20e6b9..bc302bbc17d6 100644 --- a/packages/cli/test/unit/options/beaconNodeOptions.test.ts +++ b/packages/cli/test/unit/options/beaconNodeOptions.test.ts @@ -53,7 +53,7 @@ describe("options / beaconNodeOptions", () => { "execution.retryAttempts": 1, builder: false, - "builder.urls": ["http://localhost:8661"], + "builder.url": "http://localhost:8661", "builder.timeout": 12000, "builder.faultInspectionWindow": 32, "builder.allowedFaults": 16, @@ -157,7 +157,7 @@ describe("options / beaconNodeOptions", () => { }, executionBuilder: { enabled: false, - urls: ["http://localhost:8661"], + url: "http://localhost:8661", timeout: 12000, faultInspectionWindow: 32, allowedFaults: 16,