From 68567863c38a1c82e35438f860a74703a96a2911 Mon Sep 17 00:00:00 2001 From: harkamal Date: Tue, 9 Jan 2024 21:43:13 +0530 Subject: [PATCH] auto enable only if explicity not provided --- packages/cli/src/cmds/validator/options.ts | 4 +--- .../utils/simulation/validator_clients/lodestar.ts | 2 +- packages/validator/src/services/block.ts | 4 ++-- packages/validator/src/services/validatorStore.ts | 2 -- packages/validator/src/validator.ts | 11 ++++------- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/cmds/validator/options.ts b/packages/cli/src/cmds/validator/options.ts index 82ac897e0325..66b356d96311 100644 --- a/packages/cli/src/cmds/validator/options.ts +++ b/packages/cli/src/cmds/validator/options.ts @@ -257,9 +257,7 @@ export const validatorOptions: CliCommandOptions = { 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: { diff --git a/packages/cli/test/utils/simulation/validator_clients/lodestar.ts b/packages/cli/test/utils/simulation/validator_clients/lodestar.ts index 7c0c9e3537b1..f7a1e808a778 100644 --- a/packages/cli/test/utils/simulation/validator_clients/lodestar.ts +++ b/packages/cli/test/utils/simulation/validator_clients/lodestar.ts @@ -39,7 +39,7 @@ export const generateLodestarValidatorNode: ValidatorNodeGenerator}; type BlockProposalOpts = { - useProduceBlockV3: boolean; + useProduceBlockV3?: boolean; broadcastValidation: routes.beacon.BroadcastValidation; blindedLocal: boolean; }; @@ -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, diff --git a/packages/validator/src/services/validatorStore.ts b/packages/validator/src/services/validatorStore.ts index 809ca0c8a7c6..f8f29f8092f2 100644 --- a/packages/validator/src/services/validatorStore.ts +++ b/packages/validator/src/services/validatorStore.ts @@ -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 diff --git a/packages/validator/src/validator.ts b/packages/validator/src/validator.ts index f28a9afbaff6..deff99ee93f0 100644 --- a/packages/validator/src/validator.ts +++ b/packages/validator/src/validator.ts @@ -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, }); @@ -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,