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

feat: auto use produceBlockV3 deneb+ unless specified #6262

Merged
merged 3 commits into from
Jan 10, 2024
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
3 changes: 1 addition & 2 deletions packages/cli/src/cmds/validator/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {

useProduceBlockV3: {
type: "boolean",
description: "Enable/disable usage of produceBlockV3 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
7 changes: 4 additions & 3 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,19 +125,20 @@ export class BlockProposingService {
this.validatorStore.getBuilderSelectionParams(pubkeyHex);
const feeRecipient = this.validatorStore.getFeeRecipient(pubkeyHex);
const blindedLocal = this.opts.blindedLocal;
const useProduceBlockV3 = this.opts.useProduceBlockV3 ?? this.config.getForkSeq(slot) >= ForkSeq.deneb;

this.logger.debug("Producing block", {
...debugLogCtx,
builderSelection,
builderBoostFactor,
feeRecipient,
strictFeeRecipientCheck,
useProduceBlockV3: this.opts.useProduceBlockV3,
useProduceBlockV3,
blindedLocal,
});
this.metrics?.proposerStepCallProduceBlock.observe(this.clock.secFromSlot(slot));

const produceBlockFn = this.opts.useProduceBlockV3 ? this.produceBlockWrapper : this.produceBlockV2Wrapper;
const produceBlockFn = useProduceBlockV3 ? this.produceBlockWrapper : this.produceBlockV2Wrapper;
const produceOpts = {
feeRecipient,
strictFeeRecipientCheck,
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
Loading