Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update flag to pass builder url #6190

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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/relay/boost url>
--builder --builder.url <builder/relay/boost url>
```
2. Run lodestar validator client with these additional flags
```shell
Expand Down
6 changes: 3 additions & 3 deletions packages/beacon-node/src/execution/builder/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {IExecutionBuilder} from "./interface.js";

export type ExecutionBuilderHttpOpts = {
enabled: boolean;
urls: string[];
url: string;
timeout?: number;
faultInspectionWindow?: number;
allowedFaults?: number;
Expand All @@ -29,7 +29,7 @@ export type ExecutionBuilderHttpOpts = {

export const defaultExecutionBuilderHttpOpts: ExecutionBuilderHttpOpts = {
enabled: false,
urls: ["http://localhost:8661"],
url: "http://localhost:8661",
timeout: 12000,
};

Expand All @@ -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(
{
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/test/sim/mergemock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 14 additions & 11 deletions packages/cli/src/options/beaconNodeOptions/builder.ts
Original file line number Diff line number Diff line change
@@ -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"],
Expand All @@ -27,14 +33,11 @@ export const options: CliCommandOptions<ExecutionBuilderArgs> = {
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",
},

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/test/unit/options/beaconNodeOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -157,7 +157,7 @@ describe("options / beaconNodeOptions", () => {
},
executionBuilder: {
enabled: false,
urls: ["http://localhost:8661"],
url: "http://localhost:8661",
timeout: 12000,
faultInspectionWindow: 32,
allowedFaults: 16,
Expand Down