Skip to content

Commit

Permalink
Fee recipient flag rename for beacon node (#10402)
Browse files Browse the repository at this point in the history
* initial commit

* fixing comment

* fixing bazel
  • Loading branch information
james-prysm authored Mar 21, 2022
1 parent cf0bd63 commit 131fb43
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions beacon-chain/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ func configureInteropConfig(cliCtx *cli.Context) {
}

func configureExecutionSetting(cliCtx *cli.Context) error {
if !cliCtx.IsSet(flags.FeeRecipient.Name) {
if !cliCtx.IsSet(flags.SuggestedFeeRecipient.Name) {
return nil
}

c := params.BeaconConfig()
ha := cliCtx.String(flags.FeeRecipient.Name)
ha := cliCtx.String(flags.SuggestedFeeRecipient.Name)
if !common.IsHexAddress(ha) {
return fmt.Errorf("%s is not a valid fee recipient address", ha)
}
Expand Down
8 changes: 4 additions & 4 deletions beacon-chain/node/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ func TestConfigureExecutionSetting(t *testing.T) {

app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(flags.FeeRecipient.Name, "", "")
require.NoError(t, set.Set(flags.FeeRecipient.Name, "0xB"))
set.String(flags.SuggestedFeeRecipient.Name, "", "")
require.NoError(t, set.Set(flags.SuggestedFeeRecipient.Name, "0xB"))
cliCtx := cli.NewContext(&app, set, nil)
err := configureExecutionSetting(cliCtx)
require.ErrorContains(t, "0xB is not a valid fee recipient address", err)

require.NoError(t, set.Set(flags.FeeRecipient.Name, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
require.NoError(t, set.Set(flags.SuggestedFeeRecipient.Name, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
cliCtx = cli.NewContext(&app, set, nil)
err = configureExecutionSetting(cliCtx)
require.NoError(t, err)
assert.Equal(t, common.HexToAddress("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"), params.BeaconConfig().DefaultFeeRecipient)

require.NoError(t, set.Set(flags.FeeRecipient.Name, "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
require.NoError(t, set.Set(flags.SuggestedFeeRecipient.Name, "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"))
cliCtx = cli.NewContext(&app, set, nil)
err = configureExecutionSetting(cliCtx)
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions cmd/beacon-chain/flags/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ go_library(
],
deps = [
"//cmd:go_default_library",
"//config/fieldparams:go_default_library",
"//config/params:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@com_github_urfave_cli_v2//:go_default_library",
Expand Down
12 changes: 6 additions & 6 deletions cmd/beacon-chain/flags/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
package flags

import (
"encoding/hex"
"strings"

fieldparams "github.com/prysmaticlabs/prysm/config/fieldparams"
"github.com/prysmaticlabs/prysm/config/params"
"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -216,10 +216,10 @@ var (
Usage: "Sets the minimum number of peers that a node will attempt to peer with that are subscribed to a subnet.",
Value: 6,
}
// FeeRecipient specifies the fee recipient for the transaction fees.
FeeRecipient = &cli.StringFlag{
Name: "fee-recipient",
Usage: "Post bellatrix, this address will receive the transaction fees produced by any blocks from this node. Default to junk whilst bellatrix is in development state.",
Value: hex.EncodeToString([]byte("0x0000000000000000000000000000000000000001")),
// SuggestedFeeRecipient specifies the fee recipient for the transaction fees.
SuggestedFeeRecipient = &cli.StringFlag{
Name: "suggested-fee-recipient",
Usage: "Post bellatrix, this address will receive the transaction fees produced by any blocks from this node. Default to junk whilst bellatrix is in development state. Validator client can override this value through the preparebeaconproposer api.",
Value: fieldparams.EthBurnAddressHex,
}
)
2 changes: 1 addition & 1 deletion cmd/beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var appFlags = []cli.Flag{
flags.Eth1HeaderReqLimit,
flags.GenesisStatePath,
flags.MinPeersPerSubnet,
flags.FeeRecipient,
flags.SuggestedFeeRecipient,
cmd.EnableBackupWebhookFlag,
cmd.BackupWebhookOutputDir,
cmd.MinimalConfigFlag,
Expand Down
2 changes: 1 addition & 1 deletion cmd/beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ var appHelpFlagGroups = []flagGroup{
{
Name: "merge",
Flags: []cli.Flag{
flags.FeeRecipient,
flags.SuggestedFeeRecipient,
},
},
{
Expand Down

0 comments on commit 131fb43

Please sign in to comment.