Skip to content

Commit

Permalink
auto enable only if explicity not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Jan 9, 2024
1 parent e8b7e9c commit 6856786
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
4 changes: 1 addition & 3 deletions packages/cli/src/cmds/validator/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {

useProduceBlockV3: {
type: "boolean",
description:
"Enable/disable usage of produceBlockV3 pre deneb that might not be supported by all beacon clients yet",
defaultDescription: `${defaultOptions.useProduceBlockV3}`,
description: "Enable/disable usage of produceBlockV3 for block production, is auto enabled on deneb+ blocks",
},

broadcastValidation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const generateLodestarValidatorNode: ValidatorNodeGenerator<ValidatorClie
logFile: "none",
importKeystores: keystoresDir,
importKeystoresPassword: keystoresSecretFilePath,
useProduceBlockV3: useProduceBlockV3 ?? defaultOptions.useProduceBlockV3,
useProduceBlockV3: useProduceBlockV3 ?? false,
"builder.selection": builderSelection ?? defaultOptions.builderSelection,
blindedLocal: blindedLocal ?? defaultOptions.blindedLocal,
} as unknown as IValidatorCliArgs & GlobalArgs;
Expand Down
4 changes: 2 additions & 2 deletions packages/validator/src/services/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type FullOrBlindedBlockWithContents =

type DebugLogCtx = {debugLogCtx: Record<string, string | boolean | undefined>};
type BlockProposalOpts = {
useProduceBlockV3: boolean;
useProduceBlockV3?: boolean;
broadcastValidation: routes.beacon.BroadcastValidation;
blindedLocal: boolean;
};
Expand Down Expand Up @@ -125,7 +125,7 @@ export class BlockProposingService {
this.validatorStore.getBuilderSelectionParams(pubkeyHex);
const feeRecipient = this.validatorStore.getFeeRecipient(pubkeyHex);
const blindedLocal = this.opts.blindedLocal;
const useProduceBlockV3 = this.config.getForkSeq(slot) >= ForkSeq.deneb || this.opts.useProduceBlockV3;
const useProduceBlockV3 = this.opts.useProduceBlockV3 ?? this.config.getForkSeq(slot) >= ForkSeq.deneb;

this.logger.debug("Producing block", {
...debugLogCtx,
Expand Down
2 changes: 0 additions & 2 deletions packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ export const defaultOptions = {
builderSelection: routes.validator.BuilderSelection.ExecutionOnly,
builderAliasSelection: routes.validator.BuilderSelection.MaxProfit,
builderBoostFactor: BigInt(100),
// turn it off by default, turn it back on once other clients support v3 api
useProduceBlockV3: false,
// spec asks for gossip validation by default
broadcastValidation: routes.beacon.BroadcastValidation.gossip,
// should request fetching the locally produced block in blinded format
Expand Down
11 changes: 4 additions & 7 deletions packages/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Validator {
const chainHeaderTracker = new ChainHeaderTracker(logger, api, emitter);

const blockProposingService = new BlockProposingService(config, loggerVc, api, clock, validatorStore, metrics, {
useProduceBlockV3: opts.useProduceBlockV3 ?? defaultOptions.useProduceBlockV3,
useProduceBlockV3: opts.useProduceBlockV3,
broadcastValidation: opts.broadcastValidation ?? defaultOptions.broadcastValidation,
blindedLocal: opts.blindedLocal ?? defaultOptions.blindedLocal,
});
Expand Down Expand Up @@ -289,18 +289,15 @@ export class Validator {
await assertEqualGenesis(opts, genesis);
logger.info("Verified connected beacon node and validator have the same genesisValidatorRoot");

const {
useProduceBlockV3 = defaultOptions.useProduceBlockV3,
broadcastValidation = defaultOptions.broadcastValidation,
valProposerConfig,
} = opts;
const {useProduceBlockV3, broadcastValidation = defaultOptions.broadcastValidation, 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,
// if no explicit option is provided, useProduceBlockV3 will be auto enabled on/post deneb
useProduceBlockV3: useProduceBlockV3 === undefined ? "deneb+" : useProduceBlockV3,
broadcastValidation,
defaultBuilderSelection,
suggestedFeeRecipient,
Expand Down

0 comments on commit 6856786

Please sign in to comment.