diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_execution_payload.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_execution_payload.go index 9474b337d..cc8bc4700 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_execution_payload.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_execution_payload.go @@ -1,6 +1,7 @@ package validator import ( + "bytes" "context" "fmt" "math/big" @@ -98,14 +99,19 @@ func (vs *Server) getExecutionPayload(ctx context.Context, slot types.Slot, vIdx feeRecipient := params.BeaconConfig().DefaultFeeRecipient recipient, err := vs.BeaconDB.FeeRecipientByValidatorID(ctx, vIdx) + burnAddr := bytesutil.PadTo([]byte{}, fieldparams.FeeRecipientLength) switch err == nil { case true: feeRecipient = recipient - case errors.As(err, kv.ErrNotFoundFeeRecipient): // If fee recipient is not found, use the default fee recipient. - logrus.WithFields(logrus.Fields{ - "validatorIndex": vIdx, - "defaultFeeRecipient": feeRecipient, - }).Error("Fee recipient not found. Using default fee recipient") + case errors.As(err, kv.ErrNotFoundFeeRecipient): + // If fee recipient is not found in DB and not set from beacon node CLI, + // use the burn address. + if bytes.Equal(feeRecipient.Bytes(), burnAddr) { + logrus.WithFields(logrus.Fields{ + "validatorIndex": vIdx, + "burnAddress": burnAddr, + }).Error("Fee recipient not set. Using burn address") + } default: return nil, errors.Wrap(err, "could not get fee recipient in db") } diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go index cb4d8d6fd..45534278c 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go @@ -2349,10 +2349,6 @@ func TestProposer_GetBeaconBlock_BellatrixEpoch(t *testing.T) { Graffiti: graffiti[:], } - proposerIndex := types.ValidatorIndex(40) - addr := common.Address{'a'} - require.NoError(t, proposerServer.BeaconDB.SaveFeeRecipientsByValidatorIDs(ctx, []types.ValidatorIndex{proposerIndex}, []common.Address{addr})) - block, err := proposerServer.GetBeaconBlock(ctx, req) require.NoError(t, err) bellatrixBlk, ok := block.GetBlock().(*ethpb.GenericBeaconBlock_Bellatrix) @@ -2363,8 +2359,18 @@ func TestProposer_GetBeaconBlock_BellatrixEpoch(t *testing.T) { assert.DeepEqual(t, randaoReveal, bellatrixBlk.Bellatrix.Body.RandaoReveal, "Expected block to have correct randao reveal") assert.DeepEqual(t, req.Graffiti, bellatrixBlk.Bellatrix.Body.Graffiti, "Expected block to have correct Graffiti") - require.LogsDoNotContain(t, hook, "Fee recipient not found. Using default fee recipient.") + require.LogsContain(t, hook, "Fee recipient not set. Using burn address") require.DeepEqual(t, payload, bellatrixBlk.Bellatrix.Body.ExecutionPayload) // Payload should equal. + + // Operator sets default fee recipient to not be burned through beacon node cli. + newHook := logTest.NewGlobal() + params.SetupTestConfigCleanup(t) + cfg = params.MainnetConfig().Copy() + cfg.DefaultFeeRecipient = common.Address{'b'} + params.OverrideBeaconConfig(cfg) + _, err = proposerServer.GetBeaconBlock(ctx, req) + require.NoError(t, err) + require.LogsDoNotContain(t, newHook, "Fee recipient not set. Using burn address") } func TestProposer_GetBeaconBlock_Optimistic(t *testing.T) {