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

refactor: repurpose --builder flag to alias maxprofit builder.selection and turn builder off by default #6081

Merged
merged 3 commits into from
Nov 3, 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
12 changes: 10 additions & 2 deletions packages/cli/src/cmds/validator/handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import path from "node:path";
import {setMaxListeners} from "node:events";
import {LevelDbController} from "@lodestar/db";
import {ProcessShutdownCallback, SlashingProtection, Validator, ValidatorProposerConfig} from "@lodestar/validator";
import {
ProcessShutdownCallback,
SlashingProtection,
Validator,
ValidatorProposerConfig,
defaultOptions,
} from "@lodestar/validator";
import {routes} from "@lodestar/api";
import {getMetrics, MetricsRegister} from "@lodestar/validator";
import {
Expand Down Expand Up @@ -216,7 +222,9 @@ function getProposerConfigFromArgs(
feeRecipient: args.suggestedFeeRecipient ? parseFeeRecipient(args.suggestedFeeRecipient) : undefined,
builder: {
gasLimit: args.defaultGasLimit,
selection: parseBuilderSelection(args["builder.selection"]),
selection: parseBuilderSelection(
args["builder.selection"] ?? (args["builder"] ? defaultOptions.builderAliasSelection : undefined)
),
},
};

Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/cmds/validator/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,13 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {

builder: {
type: "boolean",
description: "Enable execution payload production via a builder for better rewards",
description: `An alias for \`--builder.selection ${defaultOptions.builderAliasSelection}\` for the builder flow, ignored if \`--builder.selection\` is explicitly provided`,
group: "builder",
deprecated: "enabling or disabling builder flow is now solely managed by `builder.selection` flag",
},

"builder.selection": {
type: "string",
description: "Default builder block selection strategy: `maxprofit`, `builderalways`, or `builderonly`",
description: "Builder block selection strategy `maxprofit`, `builderalways`, `builderonly` or `executiononly`",
defaultDescription: `\`${defaultOptions.builderSelection}\``,
group: "builder",
},
Expand Down
3 changes: 2 additions & 1 deletion packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ type ValidatorData = ProposerConfig & {
export const defaultOptions = {
suggestedFeeRecipient: "0x0000000000000000000000000000000000000000",
defaultGasLimit: 30_000_000,
builderSelection: routes.validator.BuilderSelection.MaxProfit,
builderSelection: routes.validator.BuilderSelection.ExecutionOnly,
builderAliasSelection: routes.validator.BuilderSelection.MaxProfit,
// turn it off by default, turn it back on once other clients support v3 api
useProduceBlockV3: false,
};
Expand Down
12 changes: 12 additions & 0 deletions packages/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,18 @@ export class Validator {
await assertEqualGenesis(opts, genesis);
logger.info("Verified connected beacon node and validator have the same genesisValidatorRoot");

const {useProduceBlockV3, valProposerConfig} = opts;
const defaultBuilderSelection =
valProposerConfig?.defaultConfig.builder?.selection ?? defaultOptions.builderSelection;
const strictFeeRecipientCheck = valProposerConfig?.defaultConfig.strictFeeRecipientCheck ?? false;
const suggestedFeeRecipient = valProposerConfig?.defaultConfig.feeRecipient ?? defaultOptions.suggestedFeeRecipient;
logger.info("Initializing validator", {
useProduceBlockV3,
defaultBuilderSelection,
suggestedFeeRecipient,
strictFeeRecipientCheck,
});

return Validator.init(opts, genesis, metrics);
}

Expand Down