From 50e53265a1bc5f917c8a09a759d6a435687248d9 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 24 Aug 2024 01:28:26 +0900 Subject: [PATCH 1/3] bugfix : Removed the default value of the bootnode flag to prevent it from being overridden during testnet usage (#14357) * Removed the default value of the bootnode flag to prevent it from being overridden during testnet usage * bugfix for checking stringslice flag to use isSet --- beacon-chain/node/config.go | 2 +- validator/node/node.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/beacon-chain/node/config.go b/beacon-chain/node/config.go index 19f7d74d700a..f389cba98eae 100644 --- a/beacon-chain/node/config.go +++ b/beacon-chain/node/config.go @@ -132,7 +132,7 @@ func configureEth1Config(cliCtx *cli.Context) error { } func configureNetwork(cliCtx *cli.Context) { - if len(cliCtx.StringSlice(cmd.BootstrapNode.Name)) > 0 { + if cliCtx.IsSet(cmd.BootstrapNode.Name) { c := params.BeaconNetworkConfig() c.BootstrapNodes = cliCtx.StringSlice(cmd.BootstrapNode.Name) params.OverrideBeaconNetworkConfig(c) diff --git a/validator/node/node.go b/validator/node/node.go index ed80038020c7..fb7cc8f9c405 100644 --- a/validator/node/node.go +++ b/validator/node/node.go @@ -560,8 +560,8 @@ func Web3SignerConfig(cliCtx *cli.Context) (*remoteweb3signer.SetupConfig, error if cliCtx.IsSet(flags.WalletPasswordFileFlag.Name) { log.Warnf("%s was provided while using web3signer and will be ignored", flags.WalletPasswordFileFlag.Name) } - - if publicKeysSlice := cliCtx.StringSlice(flags.Web3SignerPublicValidatorKeysFlag.Name); len(publicKeysSlice) > 0 { + if cliCtx.IsSet(flags.Web3SignerPublicValidatorKeysFlag.Name) { + publicKeysSlice := cliCtx.StringSlice(flags.Web3SignerPublicValidatorKeysFlag.Name) if len(publicKeysSlice) == 1 { pURL, err := url.ParseRequestURI(publicKeysSlice[0]) if err == nil && pURL.Scheme != "" && pURL.Host != "" { From 6ad8a104dd1bb1482941c6cefcfae31c31c69139 Mon Sep 17 00:00:00 2001 From: Sammy Rosso <15244892+saolyn@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:38:49 -0700 Subject: [PATCH 2/3] Re-use duplicate code in aggregator (#14342) * move shared duplicate code * rename function --- .../prysm/v1alpha1/validator/aggregator.go | 105 ++++++------------ 1 file changed, 32 insertions(+), 73 deletions(-) diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator.go b/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator.go index 4376d0cab058..cee94fe76759 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/aggregator.go @@ -23,49 +23,10 @@ func (vs *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. defer span.End() span.AddAttributes(trace.Int64Attribute("slot", int64(req.Slot))) - if vs.SyncChecker.Syncing() { - return nil, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond") - } - - // An optimistic validator MUST NOT participate in attestation - // (i.e., sign across the DOMAIN_BEACON_ATTESTER, DOMAIN_SELECTION_PROOF or DOMAIN_AGGREGATE_AND_PROOF domains). - if err := vs.optimisticStatus(ctx); err != nil { - return nil, err - } - - st, err := vs.HeadFetcher.HeadStateReadOnly(ctx) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not determine head state: %v", err) - } - - validatorIndex, exists := st.ValidatorIndexByPubkey(bytesutil.ToBytes48(req.PublicKey)) - if !exists { - return nil, status.Error(codes.Internal, "Could not locate validator index in DB") - } - - epoch := slots.ToEpoch(req.Slot) - activeValidatorIndices, err := helpers.ActiveValidatorIndices(ctx, st, epoch) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get validators: %v", err) - } - seed, err := helpers.Seed(st, epoch, params.BeaconConfig().DomainBeaconAttester) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get seed: %v", err) - } - committee, err := helpers.BeaconCommittee(ctx, activeValidatorIndices, seed, req.Slot, req.CommitteeIndex) + indexInCommittee, validatorIndex, err := vs.processAggregateSelection(ctx, req) if err != nil { return nil, err } - - // Check if the validator is an aggregator - isAggregator, err := helpers.IsAggregator(uint64(len(committee)), req.SlotSignature) - if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get aggregator status: %v", err) - } - if !isAggregator { - return nil, status.Errorf(codes.InvalidArgument, "Validator is not an aggregator") - } - atts := vs.AttPool.AggregatedAttestationsBySlotIndex(ctx, req.Slot, req.CommitteeIndex) // Filter out the best aggregated attestation (ie. the one with the most aggregated bits). if len(atts) == 0 { @@ -74,14 +35,6 @@ func (vs *Server) SubmitAggregateSelectionProof(ctx context.Context, req *ethpb. return nil, status.Errorf(codes.NotFound, "Could not find attestation for slot and committee in pool") } } - - var indexInCommittee uint64 - for i, idx := range committee { - if idx == validatorIndex { - indexInCommittee = uint64(i) - } - } - best := bestAggregate(atts, req.CommitteeIndex, indexInCommittee) attAndProof := ðpb.AggregateAttestationAndProof{ Aggregate: best, @@ -102,55 +55,68 @@ func (vs *Server) SubmitAggregateSelectionProofElectra( defer span.End() span.AddAttributes(trace.Int64Attribute("slot", int64(req.Slot))) + indexInCommittee, validatorIndex, err := vs.processAggregateSelection(ctx, req) + if err != nil { + return nil, err + } + atts := vs.AttPool.AggregatedAttestationsBySlotIndexElectra(ctx, req.Slot, req.CommitteeIndex) + if len(atts) == 0 { + atts = vs.AttPool.UnaggregatedAttestationsBySlotIndexElectra(ctx, req.Slot, req.CommitteeIndex) + if len(atts) == 0 { + return nil, status.Errorf(codes.NotFound, "No attestations found in pool") + } + } + best := bestAggregate(atts, req.CommitteeIndex, indexInCommittee) + attAndProof := ðpb.AggregateAttestationAndProofElectra{ + Aggregate: best, + SelectionProof: req.SlotSignature, + AggregatorIndex: validatorIndex, + } + return ðpb.AggregateSelectionElectraResponse{AggregateAndProof: attAndProof}, nil +} + +func (vs *Server) processAggregateSelection(ctx context.Context, req *ethpb.AggregateSelectionRequest) (uint64, primitives.ValidatorIndex, error) { if vs.SyncChecker.Syncing() { - return nil, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond") + return 0, 0, status.Errorf(codes.Unavailable, "Syncing to latest head, not ready to respond") } // An optimistic validator MUST NOT participate in attestation // (i.e., sign across the DOMAIN_BEACON_ATTESTER, DOMAIN_SELECTION_PROOF or DOMAIN_AGGREGATE_AND_PROOF domains). if err := vs.optimisticStatus(ctx); err != nil { - return nil, err + return 0, 0, err } st, err := vs.HeadFetcher.HeadStateReadOnly(ctx) if err != nil { - return nil, status.Errorf(codes.Internal, "Could not determine head state: %v", err) + return 0, 0, status.Errorf(codes.Internal, "Could not determine head state: %v", err) } validatorIndex, exists := st.ValidatorIndexByPubkey(bytesutil.ToBytes48(req.PublicKey)) if !exists { - return nil, status.Error(codes.Internal, "Could not locate validator index in DB") + return 0, 0, status.Error(codes.Internal, "Could not locate validator index in DB") } epoch := slots.ToEpoch(req.Slot) activeValidatorIndices, err := helpers.ActiveValidatorIndices(ctx, st, epoch) if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get validators: %v", err) + return 0, 0, status.Errorf(codes.Internal, "Could not get validators: %v", err) } seed, err := helpers.Seed(st, epoch, params.BeaconConfig().DomainBeaconAttester) if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get seed: %v", err) + return 0, 0, status.Errorf(codes.Internal, "Could not get seed: %v", err) } committee, err := helpers.BeaconCommittee(ctx, activeValidatorIndices, seed, req.Slot, req.CommitteeIndex) if err != nil { - return nil, err + return 0, 0, err } // Check if the validator is an aggregator isAggregator, err := helpers.IsAggregator(uint64(len(committee)), req.SlotSignature) if err != nil { - return nil, status.Errorf(codes.Internal, "Could not get aggregator status: %v", err) + return 0, 0, status.Errorf(codes.Internal, "Could not get aggregator status: %v", err) } if !isAggregator { - return nil, status.Errorf(codes.InvalidArgument, "Validator is not an aggregator") - } - - atts := vs.AttPool.AggregatedAttestationsBySlotIndexElectra(ctx, req.Slot, req.CommitteeIndex) - if len(atts) == 0 { - atts = vs.AttPool.UnaggregatedAttestationsBySlotIndexElectra(ctx, req.Slot, req.CommitteeIndex) - if len(atts) == 0 { - return nil, status.Errorf(codes.NotFound, "No attestations found in pool") - } + return 0, 0, status.Errorf(codes.InvalidArgument, "Validator is not an aggregator") } var indexInCommittee uint64 @@ -159,14 +125,7 @@ func (vs *Server) SubmitAggregateSelectionProofElectra( indexInCommittee = uint64(i) } } - - best := bestAggregate(atts, req.CommitteeIndex, indexInCommittee) - attAndProof := ðpb.AggregateAttestationAndProofElectra{ - Aggregate: best, - SelectionProof: req.SlotSignature, - AggregatorIndex: validatorIndex, - } - return ðpb.AggregateSelectionElectraResponse{AggregateAndProof: attAndProof}, nil + return indexInCommittee, validatorIndex, nil } // SubmitSignedAggregateSelectionProof is called by a validator to broadcast a signed From 261921ae4cedfd21d308cdc9056ff5341fc8c1ad Mon Sep 17 00:00:00 2001 From: james-prysm <90280386+james-prysm@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:47:47 -0500 Subject: [PATCH 3/3] reduce validator registration logs (#14370) * reduce validator registration logs * reverting a log change that's probably better as warn * Update CHANGELOG.md --------- Co-authored-by: Preston Van Loon Co-authored-by: Preston Van Loon --- CHANGELOG.md | 1 + validator/client/registration.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96333a68ef4..2329b9765a63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve - Beacon chain now asserts that the external builder block uses the expected gas limit. - Electra: Add electra objects to beacon API. - Electra: Updated block publishing beacon APIs to support Electra. +- "Submitted builder validator registration settings for custom builders" log message moved to debug level. ### Deprecated diff --git a/validator/client/registration.go b/validator/client/registration.go index fa5ca997f841..bc4ae46bfcab 100644 --- a/validator/client/registration.go +++ b/validator/client/registration.go @@ -52,7 +52,7 @@ func SubmitValidatorRegistrations( } if lastErr == nil { - log.Infoln("Submitted builder validator registration settings for custom builders") + log.Debugln("Submitted builder validator registration settings for custom builders") } else { log.WithError(lastErr).Warn("Could not submit all signed registrations to beacon node") }