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: set default builderBoostFactor to 90 #6568

Merged
merged 10 commits into from
Apr 10, 2024
3 changes: 2 additions & 1 deletion docs/pages/validator-management/vc-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ With produceBlockV3 (enabled automatically after the Deneb hard fork), the `--bu

With Lodestar's `--builder.selection` validator options, you can select:

- `maxprofit`: Default setting for Lodestar set at `--builder.boostFactor=100`. This default setting will always choose the more profitable block. Using this option, you may customize your `--builder.boostFactor` to your preference. Examples of its usage are below.
- `default`: Default setting for Lodestar set at `--builder.boostFactor=90`. This default setting will have a local block boost of ~10%. Note that this value might change in the future depending on what we think is the most appropriate value to help improve censorship resistance of Ethereum.
- `maxprofit`: An alias of `--builder.boostFactor=100`, which will always choose the more profitable block. Using this option, you may customize your `--builder.boostFactor` to your preference. Examples of its usage are below.
- `executionalways`: An alias of `--builder.boostFactor=0`, which will select the local execution block, unless it fails to produce due to an error or a delay in the response from the execution client.
- `executiononly`: Beacon node will be requested to produce local execution block even if builder relays are configured. This option will always select the local execution block and will error if it couldn't produce one.
- `builderalways`: An alias of `--builder.boostFactor=18446744073709551615` (2\*\*64 - 1), which will select the builder block, unless the builder block fails to produce. The builder block may fail to produce if it's not available, not timely or there is an indication of censorship via `shouldOverrideBuilder` from the execution payload response.
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/beacon/routes/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {allForksBlockContentsResSerializer} from "../../utils/routes.js";
import {ExecutionOptimistic} from "./beacon/block.js";

export enum BuilderSelection {
Default = "default",
BuilderAlways = "builderalways",
ExecutionAlways = "executionalways",
MaxProfit = "maxprofit",
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/src/api/impl/validator/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function selectBlockProductionSource({
case routes.validator.BuilderSelection.ExecutionOnly:
return ProducedBlockSource.engine;

case routes.validator.BuilderSelection.Default:
case routes.validator.BuilderSelection.MaxProfit:
return builderBoostFactor !== MAX_BUILDER_BOOST_FACTOR &&
(builderBoostFactor === BigInt(0) || engineBlockValue >= (builderBlockValue * builderBoostFactor) / BigInt(100))
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cmds/validator/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export const validatorOptions: CliCommandOptions<IValidatorCliArgs> = {
"builder.selection": {
type: "string",
description:
"Builder block selection strategy `maxprofit`, `builderalways`, `builderonly`, `executionalways`, or `executiononly`",
"Builder block selection strategy `default`, `maxprofit`, `builderalways`, `builderonly`, `executionalways`, or `executiononly`",
defaultDescription: `${defaultOptions.builderSelection}`,
group: "builder",
},
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/util/proposerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export function readProposerConfigDir(filepath: string, filename: string): Propo
export function parseBuilderSelection(builderSelection?: string): routes.validator.BuilderSelection | undefined {
if (builderSelection) {
switch (builderSelection) {
case "default":
nflaig marked this conversation as resolved.
Show resolved Hide resolved
break;
case "maxprofit":
break;
case "builderalways":
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/test/sim/multi_fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const env = await SimulationEnvironment.initWithDefaults(
// return with engine full block and publish via publishBlockV2
clientOptions: {
useProduceBlockV3: true,
"builder.selection": "maxprofit",
"builder.selection": "default",
},
},
},
Expand All @@ -65,7 +65,7 @@ const env = await SimulationEnvironment.initWithDefaults(
// builder is attached to beacon, and publish via publishBlindedBlockV2
clientOptions: {
useProduceBlockV3: true,
"builder.selection": "maxprofit",
"builder.selection": "default",
blindedLocal: true,
},
},
Expand Down Expand Up @@ -100,7 +100,7 @@ const env = await SimulationEnvironment.initWithDefaults(
// of local block and subsequent publishing via publishBlindedBlock
clientOptions: {
useProduceBlockV3: false,
"builder.selection": "maxprofit",
"builder.selection": "default",
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const testValue = {
feeRecipient: "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
builder: {
gasLimit: 35000000,
selection: routes.validator.BuilderSelection.MaxProfit,
selection: routes.validator.BuilderSelection.BuilderAlways,
boostFactor: BigInt(18446744073709551616),
},
},
Expand All @@ -37,8 +37,8 @@ const testValue = {
feeRecipient: "0xcccccccccccccccccccccccccccccccccccccccc",
builder: {
gasLimit: 30000000,
selection: routes.validator.BuilderSelection.BuilderAlways,
boostFactor: BigInt(100),
selection: routes.validator.BuilderSelection.MaxProfit,
boostFactor: BigInt(50),
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ proposer_config:
builder:
gas_limit: "35000000"
selection: "maxprofit"
boost_factor: "18446744073709551616"
boost_factor: "50"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might encourage users to set it even lower :)

default_config:
graffiti: 'default graffiti'
strict_fee_recipient_check: "true"
fee_recipient: '0xcccccccccccccccccccccccccccccccccccccccc'
builder:
gas_limit: "30000000"
selection: "builderalways"
boost_factor: "100"
boost_factor: "18446744073709551616"
8 changes: 7 additions & 1 deletion packages/validator/src/services/validatorStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const defaultOptions = {
suggestedFeeRecipient: "0x0000000000000000000000000000000000000000",
defaultGasLimit: 30_000_000,
builderSelection: routes.validator.BuilderSelection.ExecutionOnly,
builderAliasSelection: routes.validator.BuilderSelection.MaxProfit,
builderAliasSelection: routes.validator.BuilderSelection.Default,
builderBoostFactor: BigInt(100),
// spec asks for gossip validation by default
broadcastValidation: routes.beacon.BroadcastValidation.gossip,
Expand Down Expand Up @@ -267,6 +267,12 @@ export class ValidatorStore {

let boostFactor;
switch (selection) {
case routes.validator.BuilderSelection.Default:
// Default value slightly favors local block to improve censorship resistance
// The people have spoken and so it shall be https://x.com/lodestar_eth/status/1772679499928191044
boostFactor = BigInt(90);
break;

case routes.validator.BuilderSelection.MaxProfit:
boostFactor =
(this.validators.get(pubkeyHex)?.builder || {}).boostFactor ?? this.defaultProposerConfig.builder.boostFactor;
Expand Down
Loading