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

adding builder boost factor to proposer settings #13422

Closed
wants to merge 39 commits into from

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Jan 5, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

This PR adds configurations to the proposer settings for builder boost factor which is a new request option when getting a block. this would enable the validator to prioritize or deprioritize the builder's block as long as there are no errors. A previous PR #13409 enabled this option but did not allow the user to do self-configuration.

this PR also adds a new flag --builder-boost-factor and can be used providing a uint64(--builder-boost-factor=110)

note: builder boost factor will be ignored if local boost is active

related PRs ethereum/beacon-APIs#386 ethereum/beacon-APIs#398

@james-prysm james-prysm marked this pull request as ready for review January 19, 2024 15:52
@james-prysm james-prysm requested a review from a team as a code owner January 19, 2024 15:52
Copy link
Contributor

@potuz potuz left a comment

Choose a reason for hiding this comment

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

Perhaps it's a good one to hook to the tracked validators cache this entry and check if from there on the proposer path from the beacon?

@james-prysm
Copy link
Contributor Author

Perhaps it's a good one to hook to the tracked validators cache this entry and check if from there on the proposer path from the beacon?

I think it needs to be this way to follow ethereum/beacon-APIs#386
it needs to be called from the validator client, need to double check for rest-beaconapi

@james-prysm james-prysm added Builder PR or issue that supports builder related work Validator Client labels Mar 22, 2024
@@ -28,7 +28,7 @@ var (
LocalBlockValueBoost = &cli.Uint64Flag{
Name: "local-block-value-boost",
Usage: "A percentage boost for local block construction as a Uint64. This is used to prioritize local block construction over relay/builder block construction" +
"Boost is an additional percentage to multiple local block value. Use builder block if: builder_bid_value * 100 > local_block_value * (local-block-value-boost + 100)",
"Boost is an additional percentage to multiple local block value. Use builder block if: builderValueGwei*builderBoostFactor(default is 100) > local_block_value * (local-block-value-boost + 100)",
Copy link
Contributor

@nalepae nalepae Mar 25, 2024

Choose a reason for hiding this comment

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

   --local-block-value-boost value  A percentage boost for local block construction as a Uint64. This is used to prioritize local block construction over relay/builder block constructionBoost is an additional percentage to multiple local block value. Use builder block if: builderValueGwei*builderBoostFactor(default is 100) > local_block_value * (local-block-value-boost + 100) (default: 10)

Missing period and space between construction and Boost.

... builder block constructionBoost is an additional ...

In the help message, mix between xxx-yyy, xxx_yyy, xxxYyy.

Sometimes there is spaces between operands, sometimes not.

If displaying the default value of builderBoostFactor, I thinks it's better to use the real default value, and not to hardcode it in the help message in case we change it. But I guess displaying the default value here does not really help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tried to be more consistent and take out the defaults in the description

cmd/validator/flags/flags.go Outdated Show resolved Hide resolved
@@ -117,8 +129,11 @@ func (psl *settingsLoader) Load(cliCtx *cli.Context) (*proposer.Settings, error)
loadConfig := &validatorpb.ProposerSettingsPayload{}

// override settings based on other options
if psl.options.builderConfig != nil && psl.options.gasLimit != nil {
psl.options.builderConfig.GasLimit = *psl.options.gasLimit
if psl.options.builderConfig != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will panic if psl.options == nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think options can be nil but i'll add a check anyways

}
func processBuilderConfig(current *validatorpb.BuilderConfig, options *flagOptions) *validatorpb.BuilderConfig {
// If there are no options, return what was passed in
if options == nil {
return current
Copy link
Contributor

Choose a reason for hiding this comment

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

not test covered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the current setup it's not possible I guess, I can either remove this check but was just trying to be safe

current.GasLimit = reviewGasLimit(current.GasLimit)

if options.builderBoostFactor != nil {
current.BuilderBoostFactor = options.builderBoostFactor
Copy link
Contributor

Choose a reason for hiding this comment

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

Not test covered.

config/proposer/settings.go Outdated Show resolved Hide resolved
@@ -77,7 +77,7 @@ func (c *beaconApiValidatorClient) GetAttestationData(ctx context.Context, in *e

func (c *beaconApiValidatorClient) GetBeaconBlock(ctx context.Context, in *ethpb.BlockRequest) (*ethpb.GenericBeaconBlock, error) {
return wrapInMetrics[*ethpb.GenericBeaconBlock]("GetBeaconBlock", func() (*ethpb.GenericBeaconBlock, error) {
return c.getBeaconBlock(ctx, in.Slot, in.RandaoReveal, in.Graffiti)
return c.getBeaconBlock(ctx, in.Slot, in.RandaoReveal, in.Graffiti, in.BuilderBoostFactor)
Copy link
Contributor

Choose a reason for hiding this comment

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

not tested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getBeaconBlock should be tested with the builder boost factor under get_beacon_block_test.go

validator/client/propose.go Outdated Show resolved Hide resolved
}
// If there's nothing to process further, return the override or current based on what's available
if current == nil {
return override
Copy link
Contributor

Choose a reason for hiding this comment

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

This will return nil if both options.builderConfig and current are nil. Is this OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah it means there's nothing to override

@@ -225,6 +227,31 @@ func (v *validator) ProposeBlock(ctx context.Context, slot primitives.Slot, pubK
}
}

func findBuilderBoost(pubKey [fieldparams.BLSPubkeyLength]byte, proposerSettings *proposer.Settings) *wrapperspb.UInt64Value {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the name of this function :-)

@MrKoberman
Copy link

Maybe local boost could be removed and only builder boost factor can be used. If builder boost factor is less then 100 it adds 10% to the local block. This is what lighthouse integrated and to have some consistency across multiple clients it would be great if prysm could also integrate it the same way.

@james-prysm james-prysm added Blocked Blocked by research or external factors labels Jun 17, 2024
@james-prysm
Copy link
Contributor Author

lets close this... this isn't the right time to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Blocked by research or external factors Builder PR or issue that supports builder related work Validator Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants