From 8ce7287bcab91c19ae6b9ad0bd729c64ed4a4dbe Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 5 Jan 2024 09:16:28 -0600 Subject: [PATCH 01/19] wip --- .../v1alpha1/validator-client/BUILD.bazel | 3 ++ .../validator-client/keymanager.pb.go | 46 +++++++++++++------ .../validator-client/keymanager.proto | 2 + 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/proto/prysm/v1alpha1/validator-client/BUILD.bazel b/proto/prysm/v1alpha1/validator-client/BUILD.bazel index 89c008fa8e1b..abf3bc4eeba0 100644 --- a/proto/prysm/v1alpha1/validator-client/BUILD.bazel +++ b/proto/prysm/v1alpha1/validator-client/BUILD.bazel @@ -29,6 +29,7 @@ proto_library( "@com_google_protobuf//:any_proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:wrappers_proto", "@com_google_protobuf//:timestamp_proto", "@googleapis//google/api:annotations_proto", ], @@ -53,6 +54,7 @@ go_proto_library( "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", "@org_golang_google_protobuf//runtime/protoimpl:go_default_library", @@ -78,6 +80,7 @@ go_proto_library( "@googleapis//google/api:annotations_go_proto", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", ], ) diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go index 5f1605c0fd37..b7fd4824124f 100755 --- a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go +++ b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go @@ -16,6 +16,7 @@ import ( v1alpha1 "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -515,9 +516,10 @@ type BuilderConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - GasLimit github_com_prysmaticlabs_prysm_v4_consensus_types_validator.Uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/validator.Uint64"` - Relays []string `protobuf:"bytes,3,rep,name=relays,proto3" json:"relays,omitempty"` + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + GasLimit github_com_prysmaticlabs_prysm_v4_consensus_types_validator.Uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/validator.Uint64"` + Relays []string `protobuf:"bytes,3,rep,name=relays,proto3" json:"relays,omitempty"` + BuilderBoostFactor *wrapperspb.UInt64Value `protobuf:"bytes,4,opt,name=builder_boost_factor,json=builderBoostFactor,proto3" json:"builder_boost_factor,omitempty"` } func (x *BuilderConfig) Reset() { @@ -573,6 +575,13 @@ func (x *BuilderConfig) GetRelays() []string { return nil } +func (x *BuilderConfig) GetBuilderBoostFactor() *wrapperspb.UInt64Value { + if x != nil { + return x.BuilderBoostFactor + } + return nil +} + type ProposerSettingsPayload struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -648,7 +657,9 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x63, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x0d, 0x0a, 0x0b, 0x53, + 0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, + 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x0d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, @@ -779,7 +790,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0xa6, 0x01, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0xf6, 0x01, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x63, 0x0a, 0x09, 0x67, 0x61, 0x73, @@ -790,7 +801,12 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x70, 0x65, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x4e, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, + 0x72, 0x5f, 0x62, 0x6f, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x73, 0x74, + 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x65, 0x74, @@ -865,6 +881,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_goTypes = []inte (*v1alpha1.BlindedBeaconBlockCapella)(nil), // 18: ethereum.eth.v1alpha1.BlindedBeaconBlockCapella (*v1alpha1.BeaconBlockDeneb)(nil), // 19: ethereum.eth.v1alpha1.BeaconBlockDeneb (*v1alpha1.BlindedBeaconBlockDeneb)(nil), // 20: ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb + (*wrapperspb.UInt64Value)(nil), // 21: google.protobuf.UInt64Value } var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int32{ 7, // 0: ethereum.validator.accounts.v2.SignRequest.block:type_name -> ethereum.eth.v1alpha1.BeaconBlock @@ -883,14 +900,15 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int3 20, // 13: ethereum.validator.accounts.v2.SignRequest.blinded_block_deneb:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb 0, // 14: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status 4, // 15: ethereum.validator.accounts.v2.ProposerOptionPayload.builder:type_name -> ethereum.validator.accounts.v2.BuilderConfig - 6, // 16: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry - 3, // 17: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload - 3, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name + 21, // 16: ethereum.validator.accounts.v2.BuilderConfig.builder_boost_factor:type_name -> google.protobuf.UInt64Value + 6, // 17: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry + 3, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload + 3, // 19: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload + 20, // [20:20] is the sub-list for method output_type + 20, // [20:20] is the sub-list for method input_type + 20, // [20:20] is the sub-list for extension type_name + 20, // [20:20] is the sub-list for extension extendee + 0, // [0:20] is the sub-list for field type_name } func init() { file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() } diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.proto b/proto/prysm/v1alpha1/validator-client/keymanager.proto index 42ced4ccdf68..eed1a33c8746 100644 --- a/proto/prysm/v1alpha1/validator-client/keymanager.proto +++ b/proto/prysm/v1alpha1/validator-client/keymanager.proto @@ -6,6 +6,7 @@ import "proto/prysm/v1alpha1/attestation.proto"; import "proto/prysm/v1alpha1/beacon_block.proto"; import "proto/prysm/v1alpha1/beacon_state.proto"; import "proto/prysm/v1alpha1/sync_committee.proto"; +import "google/protobuf/wrappers.proto"; option csharp_namespace = "Ethereum.Validator.Accounts.V2"; option go_package = "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1/validator-client;validatorpb"; @@ -94,6 +95,7 @@ message BuilderConfig { bool enabled = 1; uint64 gas_limit = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v4/consensus-types/validator.Uint64"]; repeated string relays = 3; + google.protobuf.UInt64Value builder_boost_factor = 4; } // ProposerSettingsPayload is used to unmarshal files sent from the validator flag as well as safe to bolt db bucket From ba73f17a7688b37105585308ce3201d584d0122d Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 8 Jan 2024 13:17:56 -0600 Subject: [PATCH 02/19] proposer settings wip --- config/validator/service/proposer_settings.go | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/config/validator/service/proposer_settings.go b/config/validator/service/proposer_settings.go index ad937b957bf7..4144d8f70701 100644 --- a/config/validator/service/proposer_settings.go +++ b/config/validator/service/proposer_settings.go @@ -10,6 +10,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/consensus-types/validator" "github.com/prysmaticlabs/prysm/v4/encoding/bytesutil" validatorpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1/validator-client" + "google.golang.org/protobuf/types/known/wrapperspb" ) // ToSettings converts struct to ProposerSettings @@ -54,9 +55,10 @@ func ToSettings(ps *validatorpb.ProposerSettingsPayload) (*ProposerSettings, err // BuilderConfig is the struct representation of the JSON config file set in the validator through the CLI. // GasLimit is a number set to help the network decide on the maximum gas in each block. type BuilderConfig struct { - Enabled bool `json:"enabled" yaml:"enabled"` - GasLimit validator.Uint64 `json:"gas_limit,omitempty" yaml:"gas_limit,omitempty"` - Relays []string `json:"relays,omitempty" yaml:"relays,omitempty"` + Enabled bool `json:"enabled" yaml:"enabled"` + GasLimit validator.Uint64 `json:"gas_limit,omitempty" yaml:"gas_limit,omitempty"` + Relays []string `json:"relays,omitempty" yaml:"relays,omitempty"` + BuilderBoostFactor *uint64 `json:"builder_boost_factor,omitempty" yaml:"builder_boost_factor,omitempty"` } // ToBuilderConfig converts protobuf to a builder config used in inmemory storage @@ -64,9 +66,14 @@ func ToBuilderConfig(from *validatorpb.BuilderConfig) *BuilderConfig { if from == nil { return nil } + var bbf *uint64 + if from.BuilderBoostFactor != nil { + bbf = &from.BuilderBoostFactor.Value + } config := &BuilderConfig{ - Enabled: from.Enabled, - GasLimit: from.GasLimit, + Enabled: from.Enabled, + GasLimit: from.GasLimit, + BuilderBoostFactor: bbf, } if from.Relays != nil { relays := make([]string, len(from.Relays)) @@ -173,6 +180,7 @@ func (bc *BuilderConfig) Clone() *BuilderConfig { config := &BuilderConfig{} config.Enabled = bc.Enabled config.GasLimit = bc.GasLimit + config.BuilderBoostFactor = bc.BuilderBoostFactor var relays []string if bc.Relays != nil { relays = make([]string, len(bc.Relays)) @@ -196,6 +204,10 @@ func (bc *BuilderConfig) ToPayload() *validatorpb.BuilderConfig { config.Relays = relays } config.GasLimit = bc.GasLimit + if bc.BuilderBoostFactor != nil { + config.BuilderBoostFactor = &wrapperspb.UInt64Value{Value: *bc.BuilderBoostFactor} + } + return config } From 5d50550a27f916450b39904ede782ff2cb890dc2 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Thu, 18 Jan 2024 16:38:04 -0600 Subject: [PATCH 03/19] adding builder boost factor to builder settings --- validator/client/propose.go | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/validator/client/propose.go b/validator/client/propose.go index 0b865e2c097e..47b619121c77 100644 --- a/validator/client/propose.go +++ b/validator/client/propose.go @@ -12,6 +12,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/signing" fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" "github.com/prysmaticlabs/prysm/v4/config/params" + validatorserviceconfig "github.com/prysmaticlabs/prysm/v4/config/validator/service" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" @@ -26,6 +27,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/validator/client/iface" "github.com/sirupsen/logrus" "go.opencensus.io/trace" + "google.golang.org/protobuf/types/known/wrapperspb" ) const domainDataErr = "could not get domain data" @@ -74,9 +76,10 @@ func (v *validator) ProposeBlock(ctx context.Context, slot primitives.Slot, pubK // Request block from beacon node b, err := v.validatorClient.GetBeaconBlock(ctx, ðpb.BlockRequest{ - Slot: slot, - RandaoReveal: randaoReveal, - Graffiti: g, + Slot: slot, + RandaoReveal: randaoReveal, + Graffiti: g, + BuilderBoostFactor: findBuilderBoost(pubKey, v.proposerSettings), }) if err != nil { log.WithField("blockSlot", slot).WithError(err).Error("Failed to request block from beacon node") @@ -220,6 +223,27 @@ func (v *validator) ProposeBlock(ctx context.Context, slot primitives.Slot, pubK } } +func findBuilderBoost(pubKey [fieldparams.BLSPubkeyLength]byte, proposerSettings *validatorserviceconfig.ProposerSettings) *wrapperspb.UInt64Value { + if proposerSettings != nil { + if proposerSettings.ProposeConfig != nil { + option, ok := proposerSettings.ProposeConfig[pubKey] + if ok && option.BuilderConfig != nil && option.BuilderConfig.BuilderBoostFactor != nil { + return &wrapperspb.UInt64Value{ + Value: *option.BuilderConfig.BuilderBoostFactor, + } + } + } + if proposerSettings.DefaultConfig != nil && + proposerSettings.DefaultConfig.BuilderConfig != nil && + proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor != nil { + return &wrapperspb.UInt64Value{ + Value: *proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor, + } + } + } + return nil +} + // ProposeExit performs a voluntary exit on a validator. // The exit is signed by the validator before being sent to the beacon node for broadcasting. func ProposeExit( From 86bc39dee0ab02cff51cd3153c3e9d994dddf656 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 19 Jan 2024 09:22:11 -0600 Subject: [PATCH 04/19] adding tests for builder boost --- validator/client/propose_test.go | 135 +++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/validator/client/propose_test.go b/validator/client/propose_test.go index 4c863767d937..e162f835d7a6 100644 --- a/validator/client/propose_test.go +++ b/validator/client/propose_test.go @@ -4,14 +4,17 @@ import ( "context" "encoding/hex" "errors" + "reflect" "strings" "testing" + "github.com/ethereum/go-ethereum/common" "github.com/golang/mock/gomock" "github.com/prysmaticlabs/prysm/v4/beacon-chain/core/signing" lruwrpr "github.com/prysmaticlabs/prysm/v4/cache/lru" fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams" "github.com/prysmaticlabs/prysm/v4/config/params" + validatorserviceconfig "github.com/prysmaticlabs/prysm/v4/config/validator/service" "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks" blocktest "github.com/prysmaticlabs/prysm/v4/consensus-types/blocks/testing" "github.com/prysmaticlabs/prysm/v4/consensus-types/interfaces" @@ -28,6 +31,7 @@ import ( testing2 "github.com/prysmaticlabs/prysm/v4/validator/db/testing" "github.com/prysmaticlabs/prysm/v4/validator/graffiti" logTest "github.com/sirupsen/logrus/hooks/test" + "google.golang.org/protobuf/types/known/wrapperspb" ) type mocks struct { @@ -980,3 +984,134 @@ func TestGetGraffitiOrdered_Ok(t *testing.T) { require.DeepEqual(t, want, got) } } + +func Test_findBuilderBoost(t *testing.T) { + pubKey := [fieldparams.BLSPubkeyLength]byte{'a'} + + type args struct { + proposerSettings *validatorserviceconfig.ProposerSettings + } + tests := []struct { + name string + args args + want *wrapperspb.UInt64Value + }{ + { + name: "no proposer settings", + args: args{ + proposerSettings: nil, + }, + want: nil, + }, + { + name: "Proposer settings without builder settings", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + config[pubKey] = &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + } + return config + }(), + }, + }, + want: nil, + }, + { + name: "Proposer settings with builder settings but without builder boost factor", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + config[pubKey] = &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + BuilderConfig: &validatorserviceconfig.BuilderConfig{ + Enabled: true, + }, + } + return config + }(), + }, + }, + want: nil, + }, + { + name: "Proposer settings with builder settings and specific propose config", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + bb := uint64(123) + config[pubKey] = &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + BuilderConfig: &validatorserviceconfig.BuilderConfig{ + Enabled: true, + BuilderBoostFactor: &bb, + }, + } + return config + }(), + }, + }, + want: &wrapperspb.UInt64Value{ + Value: 123, + }, + }, + { + name: "Proposer settings with builder settings and default config", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + DefaultConfig: func() *validatorserviceconfig.ProposerOption { + bb := uint64(123) + return &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + BuilderConfig: &validatorserviceconfig.BuilderConfig{ + Enabled: true, + BuilderBoostFactor: &bb, + }, + } + }(), + }, + }, + want: &wrapperspb.UInt64Value{ + Value: 123, + }, + }, + { + name: "Proposer settings with nil boost settings", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + DefaultConfig: func() *validatorserviceconfig.ProposerOption { + var bb *uint64 + return &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + BuilderConfig: &validatorserviceconfig.BuilderConfig{ + Enabled: true, + BuilderBoostFactor: bb, + }, + } + }(), + }, + }, + want: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := findBuilderBoost(pubKey, tt.args.proposerSettings); !reflect.DeepEqual(got, tt.want) { + t.Errorf("findBuilderBoost() = %v, want %v", got, tt.want) + } + }) + } +} From c880301139333aea0498effcf72f8e86df19c97e Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 19 Jan 2024 09:52:18 -0600 Subject: [PATCH 05/19] adding another unit test and gaz --- config/validator/service/BUILD.bazel | 1 + validator/client/BUILD.bazel | 2 ++ validator/client/propose_test.go | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/config/validator/service/BUILD.bazel b/config/validator/service/BUILD.bazel index 198de3a1a1a1..f2ce86814244 100644 --- a/config/validator/service/BUILD.bazel +++ b/config/validator/service/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/validator/client/BUILD.bazel b/validator/client/BUILD.bazel index 268d0afd603c..26afc0c46478 100644 --- a/validator/client/BUILD.bazel +++ b/validator/client/BUILD.bazel @@ -93,6 +93,7 @@ go_library( "@org_golang_google_grpc//status:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) @@ -176,5 +177,6 @@ go_test( "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/validator/client/propose_test.go b/validator/client/propose_test.go index e162f835d7a6..b8e27d969887 100644 --- a/validator/client/propose_test.go +++ b/validator/client/propose_test.go @@ -1064,6 +1064,28 @@ func Test_findBuilderBoost(t *testing.T) { Value: 123, }, }, + { + name: "Proposer settings with builder settings and specific propose config but wrong pubkey", + args: args{ + proposerSettings: &validatorserviceconfig.ProposerSettings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + bb := uint64(123) + config[[fieldparams.BLSPubkeyLength]byte{'z'}] = &validatorserviceconfig.ProposerOption{ + FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("a"), + }, + BuilderConfig: &validatorserviceconfig.BuilderConfig{ + Enabled: true, + BuilderBoostFactor: &bb, + }, + } + return config + }(), + }, + }, + want: nil, + }, { name: "Proposer settings with builder settings and default config", args: args{ From e9b6193fb79bc3d0caf2a02576448361187943dd Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 22 Jan 2024 11:48:42 -0600 Subject: [PATCH 06/19] fixing getBeaconBlock rest API --- validator/client/beacon-api/BUILD.bazel | 2 ++ .../beacon-api/beacon_api_validator_client.go | 2 +- .../client/beacon-api/get_beacon_block.go | 16 +++++++--- .../beacon-api/get_beacon_block_test.go | 31 ++++++++++--------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/validator/client/beacon-api/BUILD.bazel b/validator/client/beacon-api/BUILD.bazel index fad6d0ea3bb0..d20ebef092a6 100644 --- a/validator/client/beacon-api/BUILD.bazel +++ b/validator/client/beacon-api/BUILD.bazel @@ -66,6 +66,7 @@ go_library( "@com_github_sirupsen_logrus//:go_default_library", "@org_golang_google_grpc//:go_default_library", "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) @@ -145,5 +146,6 @@ go_test( "@com_github_sirupsen_logrus//hooks/test:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/validator/client/beacon-api/beacon_api_validator_client.go b/validator/client/beacon-api/beacon_api_validator_client.go index df7fc6a06333..cd341be7cb95 100644 --- a/validator/client/beacon-api/beacon_api_validator_client.go +++ b/validator/client/beacon-api/beacon_api_validator_client.go @@ -75,7 +75,7 @@ func (c *beaconApiValidatorClient) GetAttestationData(ctx context.Context, in *e } func (c *beaconApiValidatorClient) GetBeaconBlock(ctx context.Context, in *ethpb.BlockRequest) (*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) } func (c *beaconApiValidatorClient) GetFeeRecipientByPubKey(_ context.Context, _ *ethpb.FeeRecipientByPubKeyRequest) (*ethpb.FeeRecipientByPubKeyResponse, error) { diff --git a/validator/client/beacon-api/get_beacon_block.go b/validator/client/beacon-api/get_beacon_block.go index 5726894fbd3d..7e15d9b60117 100644 --- a/validator/client/beacon-api/get_beacon_block.go +++ b/validator/client/beacon-api/get_beacon_block.go @@ -16,6 +16,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/network/httputil" ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" "github.com/prysmaticlabs/prysm/v4/runtime/version" + "google.golang.org/protobuf/types/known/wrapperspb" ) type abstractProduceBlockResponseJson struct { @@ -23,12 +24,19 @@ type abstractProduceBlockResponseJson struct { Data json.RawMessage `json:"data"` } -func (c beaconApiValidatorClient) getBeaconBlock(ctx context.Context, slot primitives.Slot, randaoReveal []byte, graffiti []byte) (*ethpb.GenericBeaconBlock, error) { +func buildGetBeaconBlockUrlValues(randaoReveal []byte, graffiti []byte, builderBoostFactor *wrapperspb.UInt64Value) neturl.Values { queryParams := neturl.Values{} + if builderBoostFactor != nil { + queryParams.Add("builder_boost_factor", fmt.Sprint(builderBoostFactor.Value)) + } queryParams.Add("randao_reveal", hexutil.Encode(randaoReveal)) if len(graffiti) > 0 { queryParams.Add("graffiti", hexutil.Encode(graffiti)) } + return queryParams +} + +func (c beaconApiValidatorClient) getBeaconBlock(ctx context.Context, slot primitives.Slot, randaoReveal []byte, graffiti []byte, builderBoostFactor *wrapperspb.UInt64Value) (*ethpb.GenericBeaconBlock, error) { var ver string var blinded bool @@ -36,7 +44,7 @@ func (c beaconApiValidatorClient) getBeaconBlock(ctx context.Context, slot primi // Try v3 endpoint first. If it's not supported, then we fall back to older endpoints. // We try the blinded block endpoint first. If it fails, we assume that we got a full block and try the full block endpoint. - queryUrl := buildURL(fmt.Sprintf("/eth/v3/validator/blocks/%d", slot), queryParams) + queryUrl := buildURL(fmt.Sprintf("/eth/v3/validator/blocks/%d", slot), buildGetBeaconBlockUrlValues(randaoReveal, graffiti, builderBoostFactor)) produceBlockV3ResponseJson := validator.ProduceBlockV3Response{} err := c.jsonRestHandler.Get(ctx, queryUrl, &produceBlockV3ResponseJson) errJson := &httputil.DefaultJsonError{} @@ -48,14 +56,14 @@ func (c beaconApiValidatorClient) getBeaconBlock(ctx context.Context, slot primi return nil, errJson } log.Debug("Endpoint /eth/v3/validator/blocks is not supported, falling back to older endpoints for block proposal.") - fallbackResp, err := c.fallBackToBlinded(ctx, slot, queryParams) + fallbackResp, err := c.fallBackToBlinded(ctx, slot, buildGetBeaconBlockUrlValues(randaoReveal, graffiti, nil)) errJson = &httputil.DefaultJsonError{} if err != nil { if !errors.As(err, &errJson) { return nil, err } log.Debug("Endpoint /eth/v1/validator/blinded_blocks failed to produce a blinded block, trying /eth/v2/validator/blocks.") - fallbackResp, err = c.fallBackToFull(ctx, slot, queryParams) + fallbackResp, err = c.fallBackToFull(ctx, slot, buildGetBeaconBlockUrlValues(randaoReveal, graffiti, nil)) if err != nil { return nil, err } diff --git a/validator/client/beacon-api/get_beacon_block_test.go b/validator/client/beacon-api/get_beacon_block_test.go index 79e2a1e1e3f3..b21ee6d70bc4 100644 --- a/validator/client/beacon-api/get_beacon_block_test.go +++ b/validator/client/beacon-api/get_beacon_block_test.go @@ -18,6 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/v4/testing/require" "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api/mock" test_helpers "github.com/prysmaticlabs/prysm/v4/validator/client/beacon-api/test-helpers" + "google.golang.org/protobuf/types/known/wrapperspb" ) func TestGetBeaconBlock_RequestFailed(t *testing.T) { @@ -36,7 +37,7 @@ func TestGetBeaconBlock_RequestFailed(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - _, err := validatorClient.getBeaconBlock(ctx, 1, []byte{1}, []byte{2}) + _, err := validatorClient.getBeaconBlock(ctx, 1, []byte{1}, []byte{2}, nil) assert.ErrorContains(t, "foo error", err) } @@ -139,7 +140,7 @@ func TestGetBeaconBlock_Error(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - _, err := validatorClient.getBeaconBlock(ctx, 1, []byte{1}, []byte{2}) + _, err := validatorClient.getBeaconBlock(ctx, 1, []byte{1}, []byte{2}, nil) assert.ErrorContains(t, testCase.expectedErrorMessage, err) }) } @@ -175,7 +176,7 @@ func TestGetBeaconBlock_Phase0Valid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -218,7 +219,7 @@ func TestGetBeaconBlock_AltairValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -262,7 +263,7 @@ func TestGetBeaconBlock_BellatrixValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -307,7 +308,7 @@ func TestGetBeaconBlock_BlindedBellatrixValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -352,7 +353,7 @@ func TestGetBeaconBlock_CapellaValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -397,7 +398,7 @@ func TestGetBeaconBlock_BlindedCapellaValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -442,7 +443,7 @@ func TestGetBeaconBlock_DenebValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, nil) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -473,7 +474,7 @@ func TestGetBeaconBlock_BlindedDenebValid(t *testing.T) { jsonRestHandler := mock.NewMockJsonRestHandler(ctrl) jsonRestHandler.EXPECT().Get( ctx, - fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), + fmt.Sprintf("/eth/v3/validator/blocks/%d?builder_boost_factor=%s&graffiti=%s&randao_reveal=%s", slot, "100", hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), &validator.ProduceBlockV3Response{}, ).SetArg( 2, @@ -487,7 +488,7 @@ func TestGetBeaconBlock_BlindedDenebValid(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, &wrapperspb.UInt64Value{Value: 100}) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -518,7 +519,7 @@ func TestGetBeaconBlock_FallbackToBlindedBlock(t *testing.T) { jsonRestHandler := mock.NewMockJsonRestHandler(ctrl) jsonRestHandler.EXPECT().Get( ctx, - fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), + fmt.Sprintf("/eth/v3/validator/blocks/%d?builder_boost_factor=%s&graffiti=%s&randao_reveal=%s", slot, "100", hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), &validator.ProduceBlockV3Response{}, ).Return( &httputil.DefaultJsonError{Code: http.StatusNotFound}, @@ -538,7 +539,7 @@ func TestGetBeaconBlock_FallbackToBlindedBlock(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, &wrapperspb.UInt64Value{Value: 100}) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ @@ -569,7 +570,7 @@ func TestGetBeaconBlock_FallbackToFullBlock(t *testing.T) { jsonRestHandler := mock.NewMockJsonRestHandler(ctrl) jsonRestHandler.EXPECT().Get( ctx, - fmt.Sprintf("/eth/v3/validator/blocks/%d?graffiti=%s&randao_reveal=%s", slot, hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), + fmt.Sprintf("/eth/v3/validator/blocks/%d?builder_boost_factor=%s&graffiti=%s&randao_reveal=%s", slot, "100", hexutil.Encode(graffiti), hexutil.Encode(randaoReveal)), &validator.ProduceBlockV3Response{}, ).Return( &httputil.DefaultJsonError{Code: http.StatusNotFound}, @@ -596,7 +597,7 @@ func TestGetBeaconBlock_FallbackToFullBlock(t *testing.T) { ).Times(1) validatorClient := &beaconApiValidatorClient{jsonRestHandler: jsonRestHandler} - beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti) + beaconBlock, err := validatorClient.getBeaconBlock(ctx, slot, randaoReveal, graffiti, &wrapperspb.UInt64Value{Value: 100}) require.NoError(t, err) expectedBeaconBlock := ðpb.GenericBeaconBlock{ From 8749e543b1c6f2e07f016418843c83de411c30f7 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 22 Jan 2024 12:00:57 -0600 Subject: [PATCH 07/19] fixing linting --- validator/client/beacon-api/get_beacon_block.go | 1 - 1 file changed, 1 deletion(-) diff --git a/validator/client/beacon-api/get_beacon_block.go b/validator/client/beacon-api/get_beacon_block.go index 7e15d9b60117..bab6d3e1fe39 100644 --- a/validator/client/beacon-api/get_beacon_block.go +++ b/validator/client/beacon-api/get_beacon_block.go @@ -37,7 +37,6 @@ func buildGetBeaconBlockUrlValues(randaoReveal []byte, graffiti []byte, builderB } func (c beaconApiValidatorClient) getBeaconBlock(ctx context.Context, slot primitives.Slot, randaoReveal []byte, graffiti []byte, builderBoostFactor *wrapperspb.UInt64Value) (*ethpb.GenericBeaconBlock, error) { - var ver string var blinded bool var decoder *json.Decoder From ad942a8fd3d84ce92ee7cb635e5ab2cf3fb4218e Mon Sep 17 00:00:00 2001 From: james-prysm Date: Thu, 21 Mar 2024 16:16:36 -0500 Subject: [PATCH 08/19] fixing branch --- config/proposer/settings.go | 21 ++- .../validator-client/keymanager.pb.go | 160 ++++++++++-------- .../validator-client/keymanager.proto | 1 - .../beacon-api/beacon_api_validator_client.go | 2 +- validator/client/propose.go | 2 +- validator/client/propose_test.go | 70 ++++---- 6 files changed, 140 insertions(+), 116 deletions(-) diff --git a/config/proposer/settings.go b/config/proposer/settings.go index 88338eca7dbe..88a2c7d7edf2 100644 --- a/config/proposer/settings.go +++ b/config/proposer/settings.go @@ -11,6 +11,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/validator" "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" validatorpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/validator-client" + "google.golang.org/protobuf/types/known/wrapperspb" ) // SettingFromConsensus converts struct to Settings while verifying the fields @@ -79,9 +80,10 @@ func verifyOption(key string, option *validatorpb.ProposerOptionPayload) error { // BuilderConfig is the struct representation of the JSON config file set in the validator through the CLI. // GasLimit is a number set to help the network decide on the maximum gas in each block. type BuilderConfig struct { - Enabled bool `json:"enabled" yaml:"enabled"` - GasLimit validator.Uint64 `json:"gas_limit,omitempty" yaml:"gas_limit,omitempty"` - Relays []string `json:"relays,omitempty" yaml:"relays,omitempty"` + Enabled bool `json:"enabled" yaml:"enabled"` + GasLimit validator.Uint64 `json:"gas_limit,omitempty" yaml:"gas_limit,omitempty"` + Relays []string `json:"relays,omitempty" yaml:"relays,omitempty"` + BuilderBoostFactor *uint64 `json:"builder_boost_factor,omitempty" yaml:"builder_boost_factor,omitempty"` } // BuilderConfigFromConsensus converts protobuf to a builder config used in in-memory storage @@ -89,9 +91,14 @@ func BuilderConfigFromConsensus(from *validatorpb.BuilderConfig) *BuilderConfig if from == nil { return nil } + var bbf *uint64 + if from.BuilderBoostFactor != nil { + bbf = &from.BuilderBoostFactor.Value + } c := &BuilderConfig{ - Enabled: from.Enabled, - GasLimit: from.GasLimit, + Enabled: from.Enabled, + GasLimit: from.GasLimit, + BuilderBoostFactor: bbf, } if from.Relays != nil { relays := make([]string, len(from.Relays)) @@ -224,6 +231,7 @@ func (bc *BuilderConfig) Clone() *BuilderConfig { c := &BuilderConfig{} c.Enabled = bc.Enabled c.GasLimit = bc.GasLimit + c.BuilderBoostFactor = bc.BuilderBoostFactor var relays []string if bc.Relays != nil { relays = make([]string, len(bc.Relays)) @@ -255,5 +263,8 @@ func (bc *BuilderConfig) ToConsensus() *validatorpb.BuilderConfig { c.Relays = relays } c.GasLimit = bc.GasLimit + if bc.BuilderBoostFactor != nil { + c.BuilderBoostFactor = &wrapperspb.UInt64Value{Value: *bc.BuilderBoostFactor} + } return c } diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go index b7fd4824124f..5a8414defcaf 100755 --- a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go +++ b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.3 +// protoc v4.25.1 // source: proto/prysm/v1alpha1/validator-client/keymanager.proto package validatorpb @@ -10,10 +10,10 @@ import ( reflect "reflect" sync "sync" - github_com_prysmaticlabs_prysm_v4_consensus_types_primitives "github.com/prysmaticlabs/prysm/v4/consensus-types/primitives" - github_com_prysmaticlabs_prysm_v4_consensus_types_validator "github.com/prysmaticlabs/prysm/v4/consensus-types/validator" - _ "github.com/prysmaticlabs/prysm/v4/proto/eth/ext" - v1alpha1 "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1" + github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives" + github_com_prysmaticlabs_prysm_v5_consensus_types_validator "github.com/prysmaticlabs/prysm/v5/consensus-types/validator" + _ "github.com/prysmaticlabs/prysm/v5/proto/eth/ext" + v1alpha1 "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" @@ -106,7 +106,7 @@ type SignRequest struct { // *SignRequest_BlockDeneb // *SignRequest_BlindedBlockDeneb Object isSignRequest_Object `protobuf_oneof:"object"` - SigningSlot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,6,opt,name=signing_slot,json=signingSlot,proto3" json:"signing_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` + SigningSlot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,6,opt,name=signing_slot,json=signingSlot,proto3" json:"signing_slot,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` } func (x *SignRequest) Reset() { @@ -197,18 +197,18 @@ func (x *SignRequest) GetExit() *v1alpha1.VoluntaryExit { return nil } -func (x *SignRequest) GetSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { +func (x *SignRequest) GetSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot { if x, ok := x.GetObject().(*SignRequest_Slot); ok { return x.Slot } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0) + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(0) } -func (x *SignRequest) GetEpoch() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch { +func (x *SignRequest) GetEpoch() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch { if x, ok := x.GetObject().(*SignRequest_Epoch); ok { return x.Epoch } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch(0) + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch(0) } func (x *SignRequest) GetBlockAltair() *v1alpha1.BeaconBlockAltair { @@ -288,11 +288,11 @@ func (x *SignRequest) GetBlindedBlockDeneb() *v1alpha1.BlindedBeaconBlockDeneb { return nil } -func (x *SignRequest) GetSigningSlot() github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot { +func (x *SignRequest) GetSigningSlot() github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot { if x != nil { return x.SigningSlot } - return github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot(0) + return github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(0) } type isSignRequest_Object interface { @@ -316,11 +316,11 @@ type SignRequest_Exit struct { } type SignRequest_Slot struct { - Slot github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Slot `protobuf:"varint,105,opt,name=slot,proto3,oneof" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Slot"` + Slot github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot `protobuf:"varint,105,opt,name=slot,proto3,oneof" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Slot"` } type SignRequest_Epoch struct { - Epoch github_com_prysmaticlabs_prysm_v4_consensus_types_primitives.Epoch `protobuf:"varint,106,opt,name=epoch,proto3,oneof" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives.Epoch"` + Epoch github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Epoch `protobuf:"varint,106,opt,name=epoch,proto3,oneof" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives.Epoch"` } type SignRequest_BlockAltair struct { @@ -463,6 +463,7 @@ type ProposerOptionPayload struct { FeeRecipient string `protobuf:"bytes,1,opt,name=fee_recipient,json=feeRecipient,proto3" json:"fee_recipient,omitempty"` Builder *BuilderConfig `protobuf:"bytes,2,opt,name=builder,proto3" json:"builder,omitempty"` + Graffiti *string `protobuf:"bytes,3,opt,name=graffiti,proto3,oneof" json:"graffiti,omitempty"` } func (x *ProposerOptionPayload) Reset() { @@ -511,13 +512,20 @@ func (x *ProposerOptionPayload) GetBuilder() *BuilderConfig { return nil } +func (x *ProposerOptionPayload) GetGraffiti() string { + if x != nil && x.Graffiti != nil { + return *x.Graffiti + } + return "" +} + type BuilderConfig struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - GasLimit github_com_prysmaticlabs_prysm_v4_consensus_types_validator.Uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v4/consensus-types/validator.Uint64"` + GasLimit github_com_prysmaticlabs_prysm_v5_consensus_types_validator.Uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/validator.Uint64"` Relays []string `protobuf:"bytes,3,rep,name=relays,proto3" json:"relays,omitempty"` BuilderBoostFactor *wrapperspb.UInt64Value `protobuf:"bytes,4,opt,name=builder_boost_factor,json=builderBoostFactor,proto3" json:"builder_boost_factor,omitempty"` } @@ -561,11 +569,11 @@ func (x *BuilderConfig) GetEnabled() bool { return false } -func (x *BuilderConfig) GetGasLimit() github_com_prysmaticlabs_prysm_v4_consensus_types_validator.Uint64 { +func (x *BuilderConfig) GetGasLimit() github_com_prysmaticlabs_prysm_v5_consensus_types_validator.Uint64 { if x != nil { return x.GasLimit } - return github_com_prysmaticlabs_prysm_v4_consensus_types_validator.Uint64(0) + return github_com_prysmaticlabs_prysm_v5_consensus_types_validator.Uint64(0) } func (x *BuilderConfig) GetRelays() []string { @@ -645,7 +653,9 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x1a, 0x1b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, + 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x65, 0x78, 0x74, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x61, 0x74, 0x74, 0x65, @@ -657,9 +667,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x63, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x29, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, - 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x0d, 0x0a, 0x0b, 0x53, + 0x74, 0x74, 0x65, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x0d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, @@ -691,13 +699,13 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x69, 0x74, 0x12, 0x5b, 0x0a, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x69, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, - 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, + 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x48, 0x00, 0x52, 0x04, 0x73, 0x6c, 0x6f, 0x74, 0x12, 0x5e, 0x0a, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x6a, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, - 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, + 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x48, 0x00, 0x52, 0x05, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x12, 0x4d, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x61, 0x6c, 0x74, 0x61, 0x69, 0x72, 0x18, @@ -766,7 +774,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x42, 0x45, 0x82, 0xb5, 0x18, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, - 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, + 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x70, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x73, 0x2e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x42, 0x08, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4a, @@ -782,7 +790,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x55, 0x43, 0x43, 0x45, 0x45, 0x44, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4e, 0x49, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, - 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0x85, 0x01, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, + 0x4c, 0x45, 0x44, 0x10, 0x03, 0x22, 0xb3, 0x01, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x66, 0x65, 0x65, 0x52, 0x65, 0x63, 0x69, 0x70, @@ -790,59 +798,62 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0xf6, 0x01, - 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x63, 0x0a, 0x09, 0x67, 0x61, 0x73, - 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, - 0x18, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, - 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, - 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x12, 0x4e, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, - 0x72, 0x5f, 0x62, 0x6f, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x73, 0x74, - 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, + 0x08, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x08, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x88, 0x01, 0x01, 0x42, 0x0b, + 0x0a, 0x09, 0x5f, 0x67, 0x72, 0x61, 0x66, 0x66, 0x69, 0x74, 0x69, 0x22, 0xf6, 0x01, 0x0a, 0x0d, + 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, + 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x63, 0x0a, 0x09, 0x67, 0x61, 0x73, 0x5f, 0x6c, + 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x42, 0x46, 0x82, 0xb5, 0x18, 0x42, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, + 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, + 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x73, 0x75, 0x73, 0x2d, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, 0x6e, 0x74, + 0x36, 0x34, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x6c, 0x61, 0x79, 0x73, 0x12, 0x4e, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, + 0x62, 0x6f, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x73, 0x74, 0x46, 0x61, + 0x63, 0x74, 0x6f, 0x72, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, + 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x65, 0x74, - 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, - 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, - 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x78, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x4b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, + 0x61, 0x64, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x5c, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x42, 0xce, 0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, - 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x34, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x31, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, - 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, - 0xca, 0x02, 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, - 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x78, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x4b, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, + 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x72, + 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0xce, + 0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x73, 0x2e, 0x76, 0x32, 0x42, 0x0f, 0x4b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, + 0x62, 0x73, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x3b, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x70, 0x62, 0xaa, 0x02, 0x1e, + 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x6f, 0x72, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x56, 0x32, 0xca, 0x02, + 0x1e, 0x45, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x5c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, + 0x74, 0x6f, 0x72, 0x5c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5c, 0x56, 0x32, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -997,6 +1008,7 @@ func file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() { (*SignRequest_BlockDeneb)(nil), (*SignRequest_BlindedBlockDeneb)(nil), } + file_proto_prysm_v1alpha1_validator_client_keymanager_proto_msgTypes[2].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.proto b/proto/prysm/v1alpha1/validator-client/keymanager.proto index 4e71dc074013..ad6d97f37eac 100644 --- a/proto/prysm/v1alpha1/validator-client/keymanager.proto +++ b/proto/prysm/v1alpha1/validator-client/keymanager.proto @@ -7,7 +7,6 @@ import "proto/prysm/v1alpha1/attestation.proto"; import "proto/prysm/v1alpha1/beacon_block.proto"; import "proto/prysm/v1alpha1/beacon_state.proto"; import "proto/prysm/v1alpha1/sync_committee.proto"; -import "google/protobuf/wrappers.proto"; option csharp_namespace = "Ethereum.Validator.Accounts.V2"; option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/validator-client;validatorpb"; diff --git a/validator/client/beacon-api/beacon_api_validator_client.go b/validator/client/beacon-api/beacon_api_validator_client.go index 115053c5623d..13505385ec69 100644 --- a/validator/client/beacon-api/beacon_api_validator_client.go +++ b/validator/client/beacon-api/beacon_api_validator_client.go @@ -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) }) } diff --git a/validator/client/propose.go b/validator/client/propose.go index b36e4dda9593..d3b559e2901b 100644 --- a/validator/client/propose.go +++ b/validator/client/propose.go @@ -227,7 +227,7 @@ func (v *validator) ProposeBlock(ctx context.Context, slot primitives.Slot, pubK } } -func findBuilderBoost(pubKey [fieldparams.BLSPubkeyLength]byte, proposerSettings *validatorserviceconfig.ProposerSettings) *wrapperspb.UInt64Value { +func findBuilderBoost(pubKey [fieldparams.BLSPubkeyLength]byte, proposerSettings *proposer.Settings) *wrapperspb.UInt64Value { if proposerSettings != nil { if proposerSettings.ProposeConfig != nil { option, ok := proposerSettings.ProposeConfig[pubKey] diff --git a/validator/client/propose_test.go b/validator/client/propose_test.go index 4a1423d05a37..8449be89da06 100644 --- a/validator/client/propose_test.go +++ b/validator/client/propose_test.go @@ -9,6 +9,7 @@ import ( "strings" "testing" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/signing" lruwrpr "github.com/prysmaticlabs/prysm/v5/cache/lru" @@ -31,6 +32,7 @@ import ( testing2 "github.com/prysmaticlabs/prysm/v5/validator/db/testing" "github.com/prysmaticlabs/prysm/v5/validator/graffiti" logTest "github.com/sirupsen/logrus/hooks/test" + "go.uber.org/mock/gomock" "google.golang.org/protobuf/types/known/wrapperspb" ) @@ -1266,7 +1268,7 @@ func Test_findBuilderBoost(t *testing.T) { pubKey := [fieldparams.BLSPubkeyLength]byte{'a'} type args struct { - proposerSettings *validatorserviceconfig.ProposerSettings + proposerSettings *proposer.Settings } tests := []struct { name string @@ -1283,11 +1285,11 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings without builder settings", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { - config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) - config[pubKey] = &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + proposerSettings: &proposer.Settings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option) + config[pubKey] = &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, } @@ -1300,14 +1302,14 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings with builder settings but without builder boost factor", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { - config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) - config[pubKey] = &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + proposerSettings: &proposer.Settings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option) + config[pubKey] = &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, - BuilderConfig: &validatorserviceconfig.BuilderConfig{ + BuilderConfig: &proposer.BuilderConfig{ Enabled: true, }, } @@ -1320,15 +1322,15 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings with builder settings and specific propose config", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { - config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + proposerSettings: &proposer.Settings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option) bb := uint64(123) - config[pubKey] = &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + config[pubKey] = &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, - BuilderConfig: &validatorserviceconfig.BuilderConfig{ + BuilderConfig: &proposer.BuilderConfig{ Enabled: true, BuilderBoostFactor: &bb, }, @@ -1344,15 +1346,15 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings with builder settings and specific propose config but wrong pubkey", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption { - config := make(map[[fieldparams.BLSPubkeyLength]byte]*validatorserviceconfig.ProposerOption) + proposerSettings: &proposer.Settings{ + ProposeConfig: func() map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option { + config := make(map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option) bb := uint64(123) - config[[fieldparams.BLSPubkeyLength]byte{'z'}] = &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + config[[fieldparams.BLSPubkeyLength]byte{'z'}] = &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, - BuilderConfig: &validatorserviceconfig.BuilderConfig{ + BuilderConfig: &proposer.BuilderConfig{ Enabled: true, BuilderBoostFactor: &bb, }, @@ -1366,14 +1368,14 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings with builder settings and default config", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - DefaultConfig: func() *validatorserviceconfig.ProposerOption { + proposerSettings: &proposer.Settings{ + DefaultConfig: func() *proposer.Option { bb := uint64(123) - return &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + return &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, - BuilderConfig: &validatorserviceconfig.BuilderConfig{ + BuilderConfig: &proposer.BuilderConfig{ Enabled: true, BuilderBoostFactor: &bb, }, @@ -1388,14 +1390,14 @@ func Test_findBuilderBoost(t *testing.T) { { name: "Proposer settings with nil boost settings", args: args{ - proposerSettings: &validatorserviceconfig.ProposerSettings{ - DefaultConfig: func() *validatorserviceconfig.ProposerOption { + proposerSettings: &proposer.Settings{ + DefaultConfig: func() *proposer.Option { var bb *uint64 - return &validatorserviceconfig.ProposerOption{ - FeeRecipientConfig: &validatorserviceconfig.FeeRecipientConfig{ + return &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ FeeRecipient: common.HexToAddress("a"), }, - BuilderConfig: &validatorserviceconfig.BuilderConfig{ + BuilderConfig: &proposer.BuilderConfig{ Enabled: true, BuilderBoostFactor: bb, }, From 75038e4d71e1d1d3463e179586433556e1a015b8 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Thu, 21 Mar 2024 17:19:52 -0500 Subject: [PATCH 09/19] fixing linting, and wip adding a builder boost factor flag --- cmd/beacon-chain/flags/base.go | 2 +- cmd/validator/flags/flags.go | 8 +++++++ cmd/validator/main.go | 1 + cmd/validator/usage.go | 1 + config/proposer/loader/BUILD.bazel | 1 + config/proposer/loader/loader.go | 30 ++++++++++++++++++++----- config/proposer/loader/loader_test.go | 13 +++++++---- validator/client/BUILD.bazel | 4 +--- validator/client/beacon-api/BUILD.bazel | 2 +- validator/node/node.go | 1 + 10 files changed, 49 insertions(+), 14 deletions(-) diff --git a/cmd/beacon-chain/flags/base.go b/cmd/beacon-chain/flags/base.go index 38e7069cc266..1f973b064de3 100644 --- a/cmd/beacon-chain/flags/base.go +++ b/cmd/beacon-chain/flags/base.go @@ -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)", } // ExecutionEngineEndpoint provides an HTTP access endpoint to connect to an execution client on the execution layer ExecutionEngineEndpoint = &cli.StringFlag{ diff --git a/cmd/validator/flags/flags.go b/cmd/validator/flags/flags.go index 94e84b9635f1..cf71b8e79769 100644 --- a/cmd/validator/flags/flags.go +++ b/cmd/validator/flags/flags.go @@ -366,6 +366,14 @@ var ( Value: fmt.Sprint(params.BeaconConfig().DefaultBuilderGasLimit), } + // BuilderBoostFactorFlag sets a multiplier for builder block construction as a Uint64. + BuilderBoostFactorFlag = &cli.Uint64Flag{ + Name: "builder-boost-factor", + Usage: "A multiplier for builder block construction as a Uint64 with a default of 100. This is used to prioritize local block construction over relay/builder block construction" + + "Boost factor is a multiplier against the builder value. Use builder block if: builderValueGwei*builderBoostFactor(default is 100) > local_block_value * (local-block-value-boost + 100)", + Value: 100, + } + // ValidatorsRegistrationBatchSizeFlag sets the maximum size for one batch of validator registrations. Use a non-positive value to disable batching. ValidatorsRegistrationBatchSizeFlag = &cli.IntFlag{ Name: "validators-registration-batch-size", diff --git a/cmd/validator/main.go b/cmd/validator/main.go index 5692f9ec64f5..1fedb1bf299c 100644 --- a/cmd/validator/main.go +++ b/cmd/validator/main.go @@ -83,6 +83,7 @@ var appFlags = []cli.Flag{ flags.ProposerSettingsFlag, flags.EnableBuilderFlag, flags.BuilderGasLimitFlag, + flags.BuilderBoostFactorFlag, flags.ValidatorsRegistrationBatchSizeFlag, //////////////////// cmd.DisableMonitoringFlag, diff --git a/cmd/validator/usage.go b/cmd/validator/usage.go index ccc76d2617b9..399aa696d50f 100644 --- a/cmd/validator/usage.go +++ b/cmd/validator/usage.go @@ -121,6 +121,7 @@ var appHelpFlagGroups = []flagGroup{ flags.SuggestedFeeRecipientFlag, flags.EnableBuilderFlag, flags.BuilderGasLimitFlag, + flags.BuilderBoostFactorFlag, flags.ValidatorsRegistrationBatchSizeFlag, flags.EnableDistributed, }, diff --git a/config/proposer/loader/BUILD.bazel b/config/proposer/loader/BUILD.bazel index 650e090d04db..dcb0d398785b 100644 --- a/config/proposer/loader/BUILD.bazel +++ b/config/proposer/loader/BUILD.bazel @@ -41,5 +41,6 @@ go_library( "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", + "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/config/proposer/loader/loader.go b/config/proposer/loader/loader.go index 9831a9e06b3b..e3890f109c85 100644 --- a/config/proposer/loader/loader.go +++ b/config/proposer/loader/loader.go @@ -15,6 +15,7 @@ import ( "github.com/prysmaticlabs/prysm/v5/validator/db/iface" log "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" + "google.golang.org/protobuf/types/known/wrapperspb" ) type settingsType int @@ -35,8 +36,9 @@ type settingsLoader struct { } type flagOptions struct { - builderConfig *proposer.BuilderConfig - gasLimit *validator.Uint64 + builderConfig *proposer.BuilderConfig + gasLimit *validator.Uint64 + builderBoostFactor *wrapperspb.UInt64Value } // SettingsLoaderOption sets additional options that affect the proposer settings @@ -74,6 +76,17 @@ func WithGasLimit() SettingsLoaderOption { } } +// WithBuilderBoostFactor applies the --builder-boost-factor flag to proposer settings +func WithBuilderBoostFactor() SettingsLoaderOption { + return func(cliCtx *cli.Context, psl *settingsLoader) error { + if cliCtx.IsSet(flags.BuilderBoostFactorFlag.Name) { + bbf := cliCtx.Uint64(flags.BuilderBoostFactorFlag.Name) + psl.options.builderBoostFactor = &wrapperspb.UInt64Value{Value: bbf} + } + return nil + } +} + // NewProposerSettingsLoader returns a new proposer settings loader that can process the proposer settings based on flag options func NewProposerSettingsLoader(cliCtx *cli.Context, db iface.ValidatorDB, opts ...SettingsLoaderOption) (*settingsLoader, error) { if cliCtx.IsSet(flags.ProposerSettingsFlag.Name) && cliCtx.IsSet(flags.ProposerSettingsURLFlag.Name) { @@ -207,6 +220,7 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v var builderConfig *validatorpb.BuilderConfig var gasLimitOnly *validator.Uint64 + var builderBoostFactor *wrapperspb.UInt64Value if psl.options != nil { if psl.options.builderConfig != nil { @@ -215,6 +229,9 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v if psl.options.gasLimit != nil { gasLimitOnly = psl.options.gasLimit } + if psl.options.builderBoostFactor != nil { + builderBoostFactor = psl.options.builderBoostFactor + } } if dbSettings != nil && dbSettings.DefaultConfig != nil { @@ -229,7 +246,7 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v // process any builder overrides on defaults if newSettings.DefaultConfig != nil { - newSettings.DefaultConfig.Builder = processBuilderConfig(newSettings.DefaultConfig.Builder, builderConfig, gasLimitOnly) + newSettings.DefaultConfig.Builder = processBuilderConfig(newSettings.DefaultConfig.Builder, builderConfig, gasLimitOnly, builderBoostFactor) } if dbSettings != nil && len(dbSettings.ProposerConfig) != 0 { @@ -247,7 +264,7 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v // process any overrides for proposer config for _, option := range newSettings.ProposerConfig { if option != nil { - option.Builder = processBuilderConfig(option.Builder, builderConfig, gasLimitOnly) + option.Builder = processBuilderConfig(option.Builder, builderConfig, gasLimitOnly, builderBoostFactor) } } @@ -259,7 +276,7 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v return newSettings } -func processBuilderConfig(current *validatorpb.BuilderConfig, override *validatorpb.BuilderConfig, gasLimitOnly *validator.Uint64) *validatorpb.BuilderConfig { +func processBuilderConfig(current *validatorpb.BuilderConfig, override *validatorpb.BuilderConfig, gasLimitOnly *validator.Uint64, builderBoostFactor *wrapperspb.UInt64Value) *validatorpb.BuilderConfig { if current != nil { current.GasLimit = reviewGasLimit(current.GasLimit) if override != nil { @@ -268,6 +285,9 @@ func processBuilderConfig(current *validatorpb.BuilderConfig, override *validato if gasLimitOnly != nil { current.GasLimit = *gasLimitOnly } + if builderBoostFactor != nil { + current.BuilderBoostFactor = builderBoostFactor + } return current } return override diff --git a/config/proposer/loader/loader_test.go b/config/proposer/loader/loader_test.go index aaa0592f15b1..211791e9c933 100644 --- a/config/proposer/loader/loader_test.go +++ b/config/proposer/loader/loader_test.go @@ -28,10 +28,11 @@ import ( func TestProposerSettingsLoader(t *testing.T) { hook := logtest.NewGlobal() type proposerSettingsFlag struct { - dir string - url string - defaultfee string - defaultgas string + dir string + url string + defaultfee string + defaultgas string + builderBoostFactor *uint64 } type args struct { @@ -926,6 +927,9 @@ func TestProposerSettingsLoader(t *testing.T) { set.String(flags.BuilderGasLimitFlag.Name, tt.args.proposerSettingsFlagValues.defaultgas, "") require.NoError(t, set.Set(flags.BuilderGasLimitFlag.Name, tt.args.proposerSettingsFlagValues.defaultgas)) } + if tt.args.proposerSettingsFlagValues.builderBoostFactor != nil { + set.Uint64(flags.BuilderBoostFactorFlag.Name, *tt.args.proposerSettingsFlagValues.builderBoostFactor, "") + } if tt.validatorRegistrationEnabled { set.Bool(flags.EnableBuilderFlag.Name, true, "") } @@ -940,6 +944,7 @@ func TestProposerSettingsLoader(t *testing.T) { validatorDB, WithBuilderConfig(), WithGasLimit(), + WithBuilderBoostFactor(), ) if tt.wantInitErr != "" { require.ErrorContains(t, tt.wantInitErr, err) diff --git a/validator/client/BUILD.bazel b/validator/client/BUILD.bazel index c242b8c13d33..87e40dd15394 100644 --- a/validator/client/BUILD.bazel +++ b/validator/client/BUILD.bazel @@ -5,13 +5,11 @@ go_library( srcs = [ "aggregate.go", "attest.go", - "attest_protect.go", "key_reload.go", "log.go", "metrics.go", "multiple_endpoints_grpc_resolver.go", "propose.go", - "propose_protect.go", "registration.go", "runner.go", "service.go", @@ -179,7 +177,7 @@ go_test( "@org_golang_google_grpc//metadata:go_default_library", "@org_golang_google_grpc//status:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", - "@org_uber_go_mock//gomock:go_default_library", "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", + "@org_uber_go_mock//gomock:go_default_library", ], ) diff --git a/validator/client/beacon-api/BUILD.bazel b/validator/client/beacon-api/BUILD.bazel index b79561939e8f..db772f856bc5 100644 --- a/validator/client/beacon-api/BUILD.bazel +++ b/validator/client/beacon-api/BUILD.bazel @@ -140,7 +140,7 @@ go_test( "@com_github_pkg_errors//:go_default_library", "@org_golang_google_protobuf//types/known/emptypb:go_default_library", "@org_golang_google_protobuf//types/known/timestamppb:go_default_library", - "@org_uber_go_mock//gomock:go_default_library", "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", + "@org_uber_go_mock//gomock:go_default_library", ], ) diff --git a/validator/node/node.go b/validator/node/node.go index 67d92e32bf63..bfa9f3647e76 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -613,6 +613,7 @@ func proposerSettings(cliCtx *cli.Context, db iface.ValidatorDB) (*proposer.Sett db, loader.WithBuilderConfig(), loader.WithGasLimit(), + loader.WithBuilderBoostFactor(), ) if err != nil { return nil, err From bea46206d0277ca92490238321532baf154a42f6 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 22 Mar 2024 14:41:59 -0500 Subject: [PATCH 10/19] fixing logic and adding tests --- config/proposer/BUILD.bazel | 1 - config/proposer/loader/BUILD.bazel | 1 - config/proposer/loader/loader.go | 79 ++++++----- config/proposer/loader/loader_test.go | 130 +++++++++++++++++- ...on-proposer-with-builder-boost-config.yaml | 13 ++ config/proposer/settings.go | 12 +- .../validator-client/keymanager.pb.go | 42 +++--- .../validator-client/keymanager.proto | 3 +- 8 files changed, 206 insertions(+), 75 deletions(-) create mode 100644 config/proposer/loader/testdata/good-prepare-beacon-proposer-with-builder-boost-config.yaml diff --git a/config/proposer/BUILD.bazel b/config/proposer/BUILD.bazel index 937119fdc420..6a7004d7aa0d 100644 --- a/config/proposer/BUILD.bazel +++ b/config/proposer/BUILD.bazel @@ -14,7 +14,6 @@ go_library( "@com_github_ethereum_go_ethereum//common:go_default_library", "@com_github_ethereum_go_ethereum//common/hexutil:go_default_library", "@com_github_pkg_errors//:go_default_library", - "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/config/proposer/loader/BUILD.bazel b/config/proposer/loader/BUILD.bazel index dcb0d398785b..650e090d04db 100644 --- a/config/proposer/loader/BUILD.bazel +++ b/config/proposer/loader/BUILD.bazel @@ -41,6 +41,5 @@ go_library( "@com_github_pkg_errors//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", "@com_github_urfave_cli_v2//:go_default_library", - "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library", ], ) diff --git a/config/proposer/loader/loader.go b/config/proposer/loader/loader.go index e3890f109c85..1153a5dd49c4 100644 --- a/config/proposer/loader/loader.go +++ b/config/proposer/loader/loader.go @@ -15,7 +15,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/validator/db/iface" log "github.com/sirupsen/logrus" "github.com/urfave/cli/v2" - "google.golang.org/protobuf/types/known/wrapperspb" ) type settingsType int @@ -38,7 +37,7 @@ type settingsLoader struct { type flagOptions struct { builderConfig *proposer.BuilderConfig gasLimit *validator.Uint64 - builderBoostFactor *wrapperspb.UInt64Value + builderBoostFactor *uint64 } // SettingsLoaderOption sets additional options that affect the proposer settings @@ -81,7 +80,7 @@ func WithBuilderBoostFactor() SettingsLoaderOption { return func(cliCtx *cli.Context, psl *settingsLoader) error { if cliCtx.IsSet(flags.BuilderBoostFactorFlag.Name) { bbf := cliCtx.Uint64(flags.BuilderBoostFactorFlag.Name) - psl.options.builderBoostFactor = &wrapperspb.UInt64Value{Value: bbf} + psl.options.builderBoostFactor = &bbf } return nil } @@ -130,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 { + if psl.options.gasLimit != nil { + psl.options.builderConfig.GasLimit = *psl.options.gasLimit + } + psl.options.builderConfig.BuilderBoostFactor = psl.options.builderBoostFactor } // check if database has settings already @@ -218,24 +220,8 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v // loaded settings have higher priority than db settings newSettings := &validatorpb.ProposerSettingsPayload{} - var builderConfig *validatorpb.BuilderConfig - var gasLimitOnly *validator.Uint64 - var builderBoostFactor *wrapperspb.UInt64Value - - if psl.options != nil { - if psl.options.builderConfig != nil { - builderConfig = psl.options.builderConfig.ToConsensus() - } - if psl.options.gasLimit != nil { - gasLimitOnly = psl.options.gasLimit - } - if psl.options.builderBoostFactor != nil { - builderBoostFactor = psl.options.builderBoostFactor - } - } - if dbSettings != nil && dbSettings.DefaultConfig != nil { - if builderConfig == nil { + if psl.options == nil || psl.options.builderConfig == nil { dbSettings.DefaultConfig.Builder = nil } newSettings.DefaultConfig = dbSettings.DefaultConfig @@ -246,12 +232,12 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v // process any builder overrides on defaults if newSettings.DefaultConfig != nil { - newSettings.DefaultConfig.Builder = processBuilderConfig(newSettings.DefaultConfig.Builder, builderConfig, gasLimitOnly, builderBoostFactor) + newSettings.DefaultConfig.Builder = processBuilderConfig(newSettings.DefaultConfig.Builder, psl.options) } if dbSettings != nil && len(dbSettings.ProposerConfig) != 0 { for _, option := range dbSettings.ProposerConfig { - if builderConfig == nil { + if psl.options == nil || psl.options.builderConfig == nil { option.Builder = nil } } @@ -264,7 +250,7 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v // process any overrides for proposer config for _, option := range newSettings.ProposerConfig { if option != nil { - option.Builder = processBuilderConfig(option.Builder, builderConfig, gasLimitOnly, builderBoostFactor) + option.Builder = processBuilderConfig(option.Builder, psl.options) } } @@ -276,21 +262,38 @@ func (psl *settingsLoader) processProposerSettings(loadedSettings, dbSettings *v return newSettings } -func processBuilderConfig(current *validatorpb.BuilderConfig, override *validatorpb.BuilderConfig, gasLimitOnly *validator.Uint64, builderBoostFactor *wrapperspb.UInt64Value) *validatorpb.BuilderConfig { - if current != nil { - current.GasLimit = reviewGasLimit(current.GasLimit) - if override != nil { - current.Enabled = override.Enabled - } - if gasLimitOnly != nil { - current.GasLimit = *gasLimitOnly - } - if builderBoostFactor != nil { - current.BuilderBoostFactor = builderBoostFactor - } +func processBuilderConfig(current *validatorpb.BuilderConfig, options *flagOptions) *validatorpb.BuilderConfig { + // If there are no options, return what was passed in + if options == nil { return current } - return override + + // Initialize an override variable + var override *validatorpb.BuilderConfig + if options.builderConfig != nil { + // Convert the builder config to consensus form if it exists + override = options.builderConfig.ToConsensus() + } + // If there's nothing to process further, return the override or current based on what's available + if current == nil { + return override + } + + if override != nil { + current.Enabled = override.Enabled + } + + if options.gasLimit != nil { + current.GasLimit = *options.gasLimit + } + + current.GasLimit = reviewGasLimit(current.GasLimit) + + if options.builderBoostFactor != nil { + current.BuilderBoostFactor = options.builderBoostFactor + } + + return current } func reviewGasLimit(gasLimit validator.Uint64) validator.Uint64 { diff --git a/config/proposer/loader/loader_test.go b/config/proposer/loader/loader_test.go index 211791e9c933..0df94a89f7b3 100644 --- a/config/proposer/loader/loader_test.go +++ b/config/proposer/loader/loader_test.go @@ -26,6 +26,7 @@ import ( ) func TestProposerSettingsLoader(t *testing.T) { + bbf := uint64(100) hook := logtest.NewGlobal() type proposerSettingsFlag struct { dir string @@ -50,6 +51,132 @@ func TestProposerSettingsLoader(t *testing.T) { validatorRegistrationEnabled bool skipDBSavedCheck bool }{ + { + name: "builder boost factor set in proposer settings", + args: args{ + proposerSettingsFlagValues: &proposerSettingsFlag{ + dir: "./testdata/good-prepare-beacon-proposer-with-builder-boost-config.yaml", + url: "", + defaultfee: "", + }, + }, + want: func() *proposer.Settings { + key1, err := hexutil.Decode("0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a") + require.NoError(t, err) + tempBBF := uint64(90) + return &proposer.Settings{ + ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option{ + bytesutil.ToBytes48(key1): { + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: 40000000, + BuilderBoostFactor: &tempBBF, + }, + }, + }, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: false, + GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), + }, + }, + } + }, + withdb: func(db iface.ValidatorDB) error { + key1, err := hexutil.Decode("0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a") + require.NoError(t, err) + tempBBF := uint64(90) + settings := &proposer.Settings{ + ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option{ + bytesutil.ToBytes48(key1): { + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: 40000000, + BuilderBoostFactor: &tempBBF, + }, + }, + }, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: false, + GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), + }, + }, + } + return db.SaveProposerSettings(context.Background(), settings) + }, + }, + { + name: "builder boost factor set happy path", + args: args{ + proposerSettingsFlagValues: &proposerSettingsFlag{ + dir: "", + url: "", + defaultfee: "0x6e35733c5af9B61374A128e6F85f553aF09ff89A", + builderBoostFactor: &bbf, + }, + }, + want: func() *proposer.Settings { + return &proposer.Settings{ + ProposeConfig: nil, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: validator.Uint64(30000000), + BuilderBoostFactor: &bbf, + }, + }, + } + }, + withdb: func(db iface.ValidatorDB) error { + settings := &proposer.Settings{ + ProposeConfig: nil, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: validator.Uint64(30000000), + BuilderBoostFactor: &bbf, + }, + }, + } + return db.SaveProposerSettings(context.Background(), settings) + }, + validatorRegistrationEnabled: true, + }, + { + name: "builder boost factor set without builder enabled", + args: args{ + proposerSettingsFlagValues: &proposerSettingsFlag{ + dir: "", + url: "", + defaultfee: "", + builderBoostFactor: &bbf, + }, + }, + want: func() *proposer.Settings { + return nil + }, + wantLog: "No proposer settings were provided", + skipDBSavedCheck: true, + }, { name: "graffiti in db without fee recipient", args: args{ @@ -928,7 +1055,8 @@ func TestProposerSettingsLoader(t *testing.T) { require.NoError(t, set.Set(flags.BuilderGasLimitFlag.Name, tt.args.proposerSettingsFlagValues.defaultgas)) } if tt.args.proposerSettingsFlagValues.builderBoostFactor != nil { - set.Uint64(flags.BuilderBoostFactorFlag.Name, *tt.args.proposerSettingsFlagValues.builderBoostFactor, "") + set.Uint64(flags.BuilderBoostFactorFlag.Name, uint64(*tt.args.proposerSettingsFlagValues.builderBoostFactor), "") + require.NoError(t, set.Set(flags.BuilderBoostFactorFlag.Name, fmt.Sprintf("%d", *tt.args.proposerSettingsFlagValues.builderBoostFactor))) } if tt.validatorRegistrationEnabled { set.Bool(flags.EnableBuilderFlag.Name, true, "") diff --git a/config/proposer/loader/testdata/good-prepare-beacon-proposer-with-builder-boost-config.yaml b/config/proposer/loader/testdata/good-prepare-beacon-proposer-with-builder-boost-config.yaml new file mode 100644 index 000000000000..e5833de8cf90 --- /dev/null +++ b/config/proposer/loader/testdata/good-prepare-beacon-proposer-with-builder-boost-config.yaml @@ -0,0 +1,13 @@ +--- +proposer_config: + '0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a': + fee_recipient: '0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3' + builder: + enabled: true + gas_limit: 40000000 + builder_boost_factor: 90 +default_config: + fee_recipient: '0x6e35733c5af9B61374A128e6F85f553aF09ff89A' + builder: + enabled: false + gas_limit: '30000000' \ No newline at end of file diff --git a/config/proposer/settings.go b/config/proposer/settings.go index 88a2c7d7edf2..151438ab2e67 100644 --- a/config/proposer/settings.go +++ b/config/proposer/settings.go @@ -11,7 +11,6 @@ import ( "github.com/prysmaticlabs/prysm/v5/consensus-types/validator" "github.com/prysmaticlabs/prysm/v5/encoding/bytesutil" validatorpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1/validator-client" - "google.golang.org/protobuf/types/known/wrapperspb" ) // SettingFromConsensus converts struct to Settings while verifying the fields @@ -91,14 +90,10 @@ func BuilderConfigFromConsensus(from *validatorpb.BuilderConfig) *BuilderConfig if from == nil { return nil } - var bbf *uint64 - if from.BuilderBoostFactor != nil { - bbf = &from.BuilderBoostFactor.Value - } c := &BuilderConfig{ Enabled: from.Enabled, GasLimit: from.GasLimit, - BuilderBoostFactor: bbf, + BuilderBoostFactor: from.BuilderBoostFactor, } if from.Relays != nil { relays := make([]string, len(from.Relays)) @@ -263,8 +258,7 @@ func (bc *BuilderConfig) ToConsensus() *validatorpb.BuilderConfig { c.Relays = relays } c.GasLimit = bc.GasLimit - if bc.BuilderBoostFactor != nil { - c.BuilderBoostFactor = &wrapperspb.UInt64Value{Value: *bc.BuilderBoostFactor} - } + c.BuilderBoostFactor = bc.BuilderBoostFactor + return c } diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go index 5a8414defcaf..b6475d353ab9 100755 --- a/proto/prysm/v1alpha1/validator-client/keymanager.pb.go +++ b/proto/prysm/v1alpha1/validator-client/keymanager.pb.go @@ -16,7 +16,6 @@ import ( v1alpha1 "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -527,7 +526,7 @@ type BuilderConfig struct { Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` GasLimit github_com_prysmaticlabs_prysm_v5_consensus_types_validator.Uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty" cast-type:"github.com/prysmaticlabs/prysm/v5/consensus-types/validator.Uint64"` Relays []string `protobuf:"bytes,3,rep,name=relays,proto3" json:"relays,omitempty"` - BuilderBoostFactor *wrapperspb.UInt64Value `protobuf:"bytes,4,opt,name=builder_boost_factor,json=builderBoostFactor,proto3" json:"builder_boost_factor,omitempty"` + BuilderBoostFactor *uint64 `protobuf:"varint,4,opt,name=builder_boost_factor,json=builderBoostFactor,proto3,oneof" json:"builder_boost_factor,omitempty"` } func (x *BuilderConfig) Reset() { @@ -583,11 +582,11 @@ func (x *BuilderConfig) GetRelays() []string { return nil } -func (x *BuilderConfig) GetBuilderBoostFactor() *wrapperspb.UInt64Value { - if x != nil { - return x.BuilderBoostFactor +func (x *BuilderConfig) GetBuilderBoostFactor() uint64 { + if x != nil && x.BuilderBoostFactor != nil { + return *x.BuilderBoostFactor } - return nil + return 0 } type ProposerSettingsPayload struct { @@ -653,9 +652,7 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x2d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6b, 0x65, 0x79, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x76, 0x32, 0x1a, 0x1b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x65, 0x78, 0x74, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x61, 0x74, 0x74, 0x65, @@ -812,11 +809,11 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_rawDesc = []byte 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x08, 0x67, 0x61, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, - 0x6c, 0x61, 0x79, 0x73, 0x12, 0x4e, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, + 0x6c, 0x61, 0x79, 0x73, 0x12, 0x35, 0x0a, 0x14, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x42, 0x6f, 0x6f, 0x73, 0x74, 0x46, 0x61, + 0x28, 0x04, 0x48, 0x00, 0x52, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x42, 0x6f, 0x6f, + 0x73, 0x74, 0x46, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x61, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xe7, 0x02, 0x0a, 0x17, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x74, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, @@ -892,7 +889,6 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_goTypes = []inte (*v1alpha1.BlindedBeaconBlockCapella)(nil), // 18: ethereum.eth.v1alpha1.BlindedBeaconBlockCapella (*v1alpha1.BeaconBlockDeneb)(nil), // 19: ethereum.eth.v1alpha1.BeaconBlockDeneb (*v1alpha1.BlindedBeaconBlockDeneb)(nil), // 20: ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb - (*wrapperspb.UInt64Value)(nil), // 21: google.protobuf.UInt64Value } var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int32{ 7, // 0: ethereum.validator.accounts.v2.SignRequest.block:type_name -> ethereum.eth.v1alpha1.BeaconBlock @@ -911,15 +907,14 @@ var file_proto_prysm_v1alpha1_validator_client_keymanager_proto_depIdxs = []int3 20, // 13: ethereum.validator.accounts.v2.SignRequest.blinded_block_deneb:type_name -> ethereum.eth.v1alpha1.BlindedBeaconBlockDeneb 0, // 14: ethereum.validator.accounts.v2.SignResponse.status:type_name -> ethereum.validator.accounts.v2.SignResponse.Status 4, // 15: ethereum.validator.accounts.v2.ProposerOptionPayload.builder:type_name -> ethereum.validator.accounts.v2.BuilderConfig - 21, // 16: ethereum.validator.accounts.v2.BuilderConfig.builder_boost_factor:type_name -> google.protobuf.UInt64Value - 6, // 17: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry - 3, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload - 3, // 19: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 6, // 16: ethereum.validator.accounts.v2.ProposerSettingsPayload.proposer_config:type_name -> ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry + 3, // 17: ethereum.validator.accounts.v2.ProposerSettingsPayload.default_config:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload + 3, // 18: ethereum.validator.accounts.v2.ProposerSettingsPayload.ProposerConfigEntry.value:type_name -> ethereum.validator.accounts.v2.ProposerOptionPayload + 19, // [19:19] is the sub-list for method output_type + 19, // [19:19] is the sub-list for method input_type + 19, // [19:19] is the sub-list for extension type_name + 19, // [19:19] is the sub-list for extension extendee + 0, // [0:19] is the sub-list for field type_name } func init() { file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() } @@ -1009,6 +1004,7 @@ func file_proto_prysm_v1alpha1_validator_client_keymanager_proto_init() { (*SignRequest_BlindedBlockDeneb)(nil), } file_proto_prysm_v1alpha1_validator_client_keymanager_proto_msgTypes[2].OneofWrappers = []interface{}{} + file_proto_prysm_v1alpha1_validator_client_keymanager_proto_msgTypes[3].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/prysm/v1alpha1/validator-client/keymanager.proto b/proto/prysm/v1alpha1/validator-client/keymanager.proto index ad6d97f37eac..a4453bd1c161 100644 --- a/proto/prysm/v1alpha1/validator-client/keymanager.proto +++ b/proto/prysm/v1alpha1/validator-client/keymanager.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package ethereum.validator.accounts.v2; -import "google/protobuf/wrappers.proto"; import "proto/eth/ext/options.proto"; import "proto/prysm/v1alpha1/attestation.proto"; import "proto/prysm/v1alpha1/beacon_block.proto"; @@ -96,7 +95,7 @@ message BuilderConfig { bool enabled = 1; uint64 gas_limit = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v5/consensus-types/validator.Uint64"]; repeated string relays = 3; - google.protobuf.UInt64Value builder_boost_factor = 4; + optional uint64 builder_boost_factor = 4; } // ProposerSettingsPayload is used to unmarshal files sent from the validator flag as well as safe to bolt db bucket From b0be7cafb341e4667165683af5c7ed3940daf206 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 22 Mar 2024 14:42:25 -0500 Subject: [PATCH 11/19] renaming test --- config/proposer/loader/loader_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/proposer/loader/loader_test.go b/config/proposer/loader/loader_test.go index 0df94a89f7b3..f95d41cad68f 100644 --- a/config/proposer/loader/loader_test.go +++ b/config/proposer/loader/loader_test.go @@ -119,7 +119,7 @@ func TestProposerSettingsLoader(t *testing.T) { }, }, { - name: "builder boost factor set happy path", + name: "builder boost factor set from flag happy path", args: args{ proposerSettingsFlagValues: &proposerSettingsFlag{ dir: "", From f8c4a94b09ace74a3e874b6d80d7a2f6a0b2fa59 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 22 Mar 2024 15:00:09 -0500 Subject: [PATCH 12/19] adding more tests --- config/proposer/settings_test.go | 54 +++++++++++++++++++------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/config/proposer/settings_test.go b/config/proposer/settings_test.go index 0a5853a72a91..c5dc2e731638 100644 --- a/config/proposer/settings_test.go +++ b/config/proposer/settings_test.go @@ -16,6 +16,7 @@ func Test_Proposer_Setting_Cloning(t *testing.T) { key1hex := "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a" key1, err := hexutil.Decode(key1hex) require.NoError(t, err) + bbf := uint64(100) settings := &Settings{ ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*Option{ bytesutil.ToBytes48(key1): { @@ -23,9 +24,10 @@ func Test_Proposer_Setting_Cloning(t *testing.T) { FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), }, BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, @@ -34,9 +36,10 @@ func Test_Proposer_Setting_Cloning(t *testing.T) { FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), }, BuilderConfig: &BuilderConfig{ - Enabled: false, - GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), - Relays: []string{"https://example-relay.com"}, + Enabled: false, + GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, } @@ -57,6 +60,8 @@ func Test_Proposer_Setting_Cloning(t *testing.T) { require.DeepEqual(t, settings.DefaultConfig.BuilderConfig, clone) settings.DefaultConfig.BuilderConfig.GasLimit = 1 require.NotEqual(t, settings.DefaultConfig.BuilderConfig.GasLimit, clone.GasLimit) + settings.DefaultConfig.BuilderConfig.BuilderBoostFactor = nil + require.NotEqual(t, settings.DefaultConfig.BuilderConfig.BuilderBoostFactor, clone.BuilderBoostFactor) }) t.Run("Happy Path BuilderConfigFromConsensus", func(t *testing.T) { @@ -84,6 +89,7 @@ func Test_Proposer_Setting_Cloning(t *testing.T) { require.Equal(t, option.FeeRecipientConfig.FeeRecipient.Hex(), noption.FeeRecipientConfig.FeeRecipient.Hex()) require.Equal(t, option.BuilderConfig.GasLimit, option.BuilderConfig.GasLimit) require.Equal(t, option.BuilderConfig.Enabled, option.BuilderConfig.Enabled) + require.Equal(t, option.BuilderConfig.BuilderBoostFactor, option.BuilderConfig.BuilderBoostFactor) }) } @@ -91,6 +97,7 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { key1hex := "0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a" key1, err := hexutil.Decode(key1hex) require.NoError(t, err) + bbf := uint64(100) type fields struct { ProposeConfig map[[fieldparams.BLSPubkeyLength]byte]*Option DefaultConfig *Option @@ -109,9 +116,10 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), }, BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, @@ -128,9 +136,10 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), }, BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, @@ -145,9 +154,10 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), }, BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, @@ -156,9 +166,10 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), }, BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, @@ -179,9 +190,10 @@ func TestProposerSettings_ShouldBeSaved(t *testing.T) { ProposeConfig: nil, DefaultConfig: &Option{ BuilderConfig: &BuilderConfig{ - Enabled: true, - GasLimit: validator.Uint64(40000000), - Relays: []string{"https://example-relay.com"}, + Enabled: true, + GasLimit: validator.Uint64(40000000), + Relays: []string{"https://example-relay.com"}, + BuilderBoostFactor: &bbf, }, }, }, From 54920185229577b1683d31c15d858ac2e08a166f Mon Sep 17 00:00:00 2001 From: james-prysm <90280386+james-prysm@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:09:17 -0500 Subject: [PATCH 13/19] Update config/proposer/settings.go Co-authored-by: Manu NALEPA --- config/proposer/settings.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/config/proposer/settings.go b/config/proposer/settings.go index 151438ab2e67..2bd8dcd3e42c 100644 --- a/config/proposer/settings.go +++ b/config/proposer/settings.go @@ -223,14 +223,19 @@ func (bc *BuilderConfig) Clone() *BuilderConfig { if bc == nil { return nil } - c := &BuilderConfig{} - c.Enabled = bc.Enabled - c.GasLimit = bc.GasLimit - c.BuilderBoostFactor = bc.BuilderBoostFactor var relays []string if bc.Relays != nil { relays = make([]string, len(bc.Relays)) copy(relays, bc.Relays) + } + + return &BuilderConfig{ + Enabled: bc.Enabled, + GasLimit: bc.GasLimit, + BuilderBoostFactor: bc.BuilderBoostFactor, + Relays: relays + } + copy(relays, bc.Relays) c.Relays = relays } return c From bdb2158035f78d5610bd1bdd40330c1486369a74 Mon Sep 17 00:00:00 2001 From: james-prysm <90280386+james-prysm@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:09:31 -0500 Subject: [PATCH 14/19] Update config/proposer/settings.go Co-authored-by: Manu NALEPA --- config/proposer/settings.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/config/proposer/settings.go b/config/proposer/settings.go index 2bd8dcd3e42c..f1cc8aad01f3 100644 --- a/config/proposer/settings.go +++ b/config/proposer/settings.go @@ -260,10 +260,16 @@ func (bc *BuilderConfig) ToConsensus() *validatorpb.BuilderConfig { if bc.Relays != nil { relays = make([]string, len(bc.Relays)) copy(relays, bc.Relays) - c.Relays = relays + var relays []string + if bc.Relays != nil { + relays = make([]string, len(bc.Relays)) + copy(relays, bc.Relays) } - c.GasLimit = bc.GasLimit - c.BuilderBoostFactor = bc.BuilderBoostFactor - return c + return &validatorpb.BuilderConfig{ + Enabled: bc.Enabled, + GasLimit: bc.GasLimit, + Relays: relays, + BuilderBoostFactor: bc.BuilderBoostFactor, + } } From 421f967ba2e886630cd22f4df587f82e6cb463a1 Mon Sep 17 00:00:00 2001 From: james-prysm <90280386+james-prysm@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:10:56 -0500 Subject: [PATCH 15/19] Update validator/client/propose.go Co-authored-by: Manu NALEPA --- validator/client/propose.go | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/validator/client/propose.go b/validator/client/propose.go index d3b559e2901b..756f7844443e 100644 --- a/validator/client/propose.go +++ b/validator/client/propose.go @@ -228,23 +228,27 @@ func (v *validator) ProposeBlock(ctx context.Context, slot primitives.Slot, pubK } func findBuilderBoost(pubKey [fieldparams.BLSPubkeyLength]byte, proposerSettings *proposer.Settings) *wrapperspb.UInt64Value { - if proposerSettings != nil { - if proposerSettings.ProposeConfig != nil { - option, ok := proposerSettings.ProposeConfig[pubKey] - if ok && option.BuilderConfig != nil && option.BuilderConfig.BuilderBoostFactor != nil { - return &wrapperspb.UInt64Value{ - Value: *option.BuilderConfig.BuilderBoostFactor, - } - } - } - if proposerSettings.DefaultConfig != nil && - proposerSettings.DefaultConfig.BuilderConfig != nil && - proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor != nil { + if proposerSettings == nil { + return nil + } + + if proposerSettings.ProposeConfig != nil { + option, ok := proposerSettings.ProposeConfig[pubKey] + if ok && option.BuilderConfig != nil && option.BuilderConfig.BuilderBoostFactor != nil { return &wrapperspb.UInt64Value{ - Value: *proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor, + Value: *option.BuilderConfig.BuilderBoostFactor, } } } + + if proposerSettings.DefaultConfig != nil && + proposerSettings.DefaultConfig.BuilderConfig != nil && + proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor != nil { + return &wrapperspb.UInt64Value{ + Value: *proposerSettings.DefaultConfig.BuilderConfig.BuilderBoostFactor, + } + } + return nil } From 062518b6525a1be2e5b09c40c0ca9249d662a1f6 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 25 Mar 2024 12:57:25 -0500 Subject: [PATCH 16/19] addressing comments --- cmd/beacon-chain/flags/base.go | 4 +- cmd/validator/flags/flags.go | 4 +- config/proposer/loader/loader.go | 2 +- config/proposer/loader/loader_test.go | 68 +++++++++++++++++++++++++++ config/proposer/settings.go | 15 ++---- 5 files changed, 76 insertions(+), 17 deletions(-) diff --git a/cmd/beacon-chain/flags/base.go b/cmd/beacon-chain/flags/base.go index 5e1560deb5f2..f02c7a864723 100644 --- a/cmd/beacon-chain/flags/base.go +++ b/cmd/beacon-chain/flags/base.go @@ -27,8 +27,8 @@ var ( // LocalBlockValueBoost sets a percentage boost for local block construction while using a custom builder. 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: builderValueGwei*builderBoostFactor(default is 100) > local_block_value * (local-block-value-boost + 100)", + 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_value * builder-boost-factor > local_value * (local-block-value-boost + 100)", Value: 10, } // ExecutionEngineEndpoint provides an HTTP access endpoint to connect to an execution client on the execution layer diff --git a/cmd/validator/flags/flags.go b/cmd/validator/flags/flags.go index cf71b8e79769..cf668e3c6a7d 100644 --- a/cmd/validator/flags/flags.go +++ b/cmd/validator/flags/flags.go @@ -369,8 +369,8 @@ var ( // BuilderBoostFactorFlag sets a multiplier for builder block construction as a Uint64. BuilderBoostFactorFlag = &cli.Uint64Flag{ Name: "builder-boost-factor", - Usage: "A multiplier for builder block construction as a Uint64 with a default of 100. This is used to prioritize local block construction over relay/builder block construction" + - "Boost factor is a multiplier against the builder value. Use builder block if: builderValueGwei*builderBoostFactor(default is 100) > local_block_value * (local-block-value-boost + 100)", + Usage: "A multiplier for builder block construction as a Uint64. This is used to prioritize relay/builder block construction over local block construction. " + + "Boost factor is a multiplier against the builder value. Use builder block if: builder_value * builder-boost-factor > local_value * (local-block-value-boost + 100)", Value: 100, } diff --git a/config/proposer/loader/loader.go b/config/proposer/loader/loader.go index 1153a5dd49c4..35d3a0e63ded 100644 --- a/config/proposer/loader/loader.go +++ b/config/proposer/loader/loader.go @@ -129,7 +129,7 @@ func (psl *settingsLoader) Load(cliCtx *cli.Context) (*proposer.Settings, error) loadConfig := &validatorpb.ProposerSettingsPayload{} // override settings based on other options - if psl.options.builderConfig != nil { + if psl.options != nil && psl.options.builderConfig != nil { if psl.options.gasLimit != nil { psl.options.builderConfig.GasLimit = *psl.options.gasLimit } diff --git a/config/proposer/loader/loader_test.go b/config/proposer/loader/loader_test.go index f95d41cad68f..091edbbd1c18 100644 --- a/config/proposer/loader/loader_test.go +++ b/config/proposer/loader/loader_test.go @@ -118,6 +118,74 @@ func TestProposerSettingsLoader(t *testing.T) { return db.SaveProposerSettings(context.Background(), settings) }, }, + { + name: "builder boost factor flag set with proposer settings file", + args: args{ + proposerSettingsFlagValues: &proposerSettingsFlag{ + dir: "./testdata/good-prepare-beacon-proposer-config.yaml", + url: "", + defaultfee: "", + builderBoostFactor: &bbf, + }, + }, + want: func() *proposer.Settings { + key1, err := hexutil.Decode("0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a") + require.NoError(t, err) + return &proposer.Settings{ + ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option{ + bytesutil.ToBytes48(key1): { + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: 40000000, + BuilderBoostFactor: &bbf, + }, + }, + }, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: false, + GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), + BuilderBoostFactor: &bbf, + }, + }, + } + }, + withdb: func(db iface.ValidatorDB) error { + key1, err := hexutil.Decode("0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a") + require.NoError(t, err) + settings := &proposer.Settings{ + ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*proposer.Option{ + bytesutil.ToBytes48(key1): { + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: true, + GasLimit: 40000000, + BuilderBoostFactor: &bbf, + }, + }, + }, + DefaultConfig: &proposer.Option{ + FeeRecipientConfig: &proposer.FeeRecipientConfig{ + FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"), + }, + BuilderConfig: &proposer.BuilderConfig{ + Enabled: false, + GasLimit: validator.Uint64(params.BeaconConfig().DefaultBuilderGasLimit), + BuilderBoostFactor: &bbf, + }, + }, + } + return db.SaveProposerSettings(context.Background(), settings) + }, + }, { name: "builder boost factor set from flag happy path", args: args{ diff --git a/config/proposer/settings.go b/config/proposer/settings.go index f1cc8aad01f3..30a508a8b248 100644 --- a/config/proposer/settings.go +++ b/config/proposer/settings.go @@ -228,17 +228,13 @@ func (bc *BuilderConfig) Clone() *BuilderConfig { relays = make([]string, len(bc.Relays)) copy(relays, bc.Relays) } - + return &BuilderConfig{ Enabled: bc.Enabled, GasLimit: bc.GasLimit, BuilderBoostFactor: bc.BuilderBoostFactor, - Relays: relays - } - copy(relays, bc.Relays) - c.Relays = relays + Relays: relays, } - return c } // Clone creates a deep copy of graffiti config @@ -254,12 +250,7 @@ func (bc *BuilderConfig) ToConsensus() *validatorpb.BuilderConfig { if bc == nil { return nil } - c := &validatorpb.BuilderConfig{} - c.Enabled = bc.Enabled - var relays []string - if bc.Relays != nil { - relays = make([]string, len(bc.Relays)) - copy(relays, bc.Relays) + var relays []string if bc.Relays != nil { relays = make([]string, len(bc.Relays)) From fd7df5545c515649596fb0f5f6087e5ec2c398e4 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 29 Mar 2024 11:13:23 -0500 Subject: [PATCH 17/19] ignore builder boost if local boost is set --- .../rpc/prysm/v1alpha1/validator/proposer_bellatrix.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go index c7baa85b3fb8..7fa460619642 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go @@ -92,15 +92,16 @@ func setExecutionData(ctx context.Context, blk interfaces.SignedBeaconBlock, loc // Use builder payload if the following in true: // builder_bid_value * builderBoostFactor(default 100) > local_block_value * (local-block-value-boost + 100) boost := params.BeaconConfig().LocalBlockValueBoost - higherValueBuilder := builderValueGwei*builderBoostFactor > localValueGwei*(100+boost) if boost > 0 && builderBoostFactor != defaultBuilderBoostFactor { log.WithFields(logrus.Fields{ "localGweiValue": localValueGwei, "localBoostPercentage": boost, "builderGweiValue": builderValueGwei, "builderBoostFactor": builderBoostFactor, - }).Warn("Proposer: both local boost and builder boost are using non default values") + }).Warn("Proposer: builder boost will be ignored, because local boost is activated") + builderBoostFactor = defaultBuilderBoostFactor } + higherValueBuilder := builderValueGwei*builderBoostFactor > localValueGwei*(100+boost) builderValueGweiGauge.Set(float64(builderValueGwei)) localValueGweiGauge.Set(float64(localValueGwei)) From 749cb98d77b2028f973bbde53bf337e5b33c7c3c Mon Sep 17 00:00:00 2001 From: james-prysm Date: Fri, 29 Mar 2024 11:41:22 -0500 Subject: [PATCH 18/19] adding test based on review change --- .../validator/proposer_bellatrix_test.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix_test.go index 7dae54bfaa89..e1ff3b0e5502 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix_test.go @@ -290,7 +290,7 @@ func TestServer_setExecutionData(t *testing.T) { require.NoError(t, err) require.Equal(t, uint64(2), e.BlockNumber()) // builder block }) - t.Run("Builder builder has higher value but forced to local payload with builder boost factor", func(t *testing.T) { + t.Run("Builder has higher value but forced to local payload with builder boost factor at 0", func(t *testing.T) { blk, err := blocks.NewSignedBeaconBlock(util.NewBlindedBeaconBlockCapella()) require.NoError(t, err) require.NoError(t, vs.BeaconDB.SaveRegistrationsByValidatorIDs(ctx, []primitives.ValidatorIndex{blk.Block().ProposerIndex()}, @@ -370,6 +370,23 @@ func TestServer_setExecutionData(t *testing.T) { require.LogsContain(t, hook, "builderGweiValue=1 localBoostPercentage=0 localGweiValue=2") }) + t.Run("Builder configured. Local block has higher value even with higher builder boost factor", func(t *testing.T) { + blk, err := blocks.NewSignedBeaconBlock(util.NewBeaconBlockCapella()) + require.NoError(t, err) + vs.ExecutionEngineCaller = &powtesting.EngineClient{PayloadIDBytes: id, ExecutionPayloadCapella: &v1.ExecutionPayloadCapella{BlockNumber: 3}, BlockValue: 2 * 1e9} + b := blk.Block() + localPayload, _, err := vs.getLocalPayload(ctx, b, capellaTransitionState) + require.NoError(t, err) + builderPayload, builderKzgCommitments, err := vs.getBuilderPayloadAndBlobs(ctx, b.Slot(), b.ProposerIndex()) + require.NoError(t, err) + require.DeepEqual(t, [][]uint8(nil), builderKzgCommitments) + require.NoError(t, setExecutionData(context.Background(), blk, localPayload, builderPayload, builderKzgCommitments, 99999)) + e, err := blk.Block().Body().Execution() + require.NoError(t, err) + require.Equal(t, uint64(3), e.BlockNumber()) // Local block + + require.LogsContain(t, hook, "builderGweiValue=1 localBoostPercentage=0 localGweiValue=2") + }) t.Run("Builder configured. Local block and local boost has higher value", func(t *testing.T) { cfg := params.BeaconConfig().Copy() cfg.LocalBlockValueBoost = 1 // Boost 1%. From 85772bf4e7f60fc4f3fef708f321914bfef02daa Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 1 Apr 2024 11:08:55 -0500 Subject: [PATCH 19/19] small update to use the builder boost if it's below the default of 100 --- .../rpc/prysm/v1alpha1/validator/proposer_bellatrix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go index 7fa460619642..be4ec6734e89 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_bellatrix.go @@ -92,13 +92,13 @@ func setExecutionData(ctx context.Context, blk interfaces.SignedBeaconBlock, loc // Use builder payload if the following in true: // builder_bid_value * builderBoostFactor(default 100) > local_block_value * (local-block-value-boost + 100) boost := params.BeaconConfig().LocalBlockValueBoost - if boost > 0 && builderBoostFactor != defaultBuilderBoostFactor { + if boost > 0 && builderBoostFactor > defaultBuilderBoostFactor { log.WithFields(logrus.Fields{ "localGweiValue": localValueGwei, "localBoostPercentage": boost, "builderGweiValue": builderValueGwei, "builderBoostFactor": builderBoostFactor, - }).Warn("Proposer: builder boost will be ignored, because local boost is activated") + }).Warn("Proposer: builder boost will be ignored, because local boost is activated and builder boost is above the default") builderBoostFactor = defaultBuilderBoostFactor } higherValueBuilder := builderValueGwei*builderBoostFactor > localValueGwei*(100+boost)