Skip to content

Commit

Permalink
Merge 73b3f9b into 618895c
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech authored Nov 3, 2023
2 parents 618895c + 73b3f9b commit 7c13619
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
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

0 comments on commit 7c13619

Please sign in to comment.