mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 11:32:09 +00:00
Suggested-Fee-Recipient flag should not override (#10804)
* initial commit * fixing unit test * fixing gofmt * updating usage language * updating flag description Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
3f309968d4
commit
f0403afb25
@ -340,7 +340,7 @@ var (
|
||||
// SuggestedFeeRecipientFlag defines the address of the fee recipient.
|
||||
SuggestedFeeRecipientFlag = &cli.StringFlag{
|
||||
Name: "suggested-fee-recipient",
|
||||
Usage: "Sets ALL validators' mapping to a suggested an eth address to receive gas fees when proposing a block. Overrides the --fee-recipient-config-file flag if set",
|
||||
Usage: "Sets ALL validators' mapping to a suggested an eth address to receive gas fees when proposing a block. This is a fall back setting and will be overridden by other flags that update the proposer settings. ",
|
||||
Value: field_params.EthBurnAddressHex,
|
||||
}
|
||||
)
|
||||
|
@ -475,6 +475,17 @@ func feeRecipientConfig(cliCtx *cli.Context) (*validatorServiceConfig.FeeRecipie
|
||||
if cliCtx.IsSet(flags.FeeRecipientConfigFileFlag.Name) && cliCtx.IsSet(flags.FeeRecipientConfigURLFlag.Name) {
|
||||
return nil, fmt.Errorf("cannot specify both --%s and --%s", flags.FeeRecipientConfigFileFlag.Name, flags.FeeRecipientConfigURLFlag.Name)
|
||||
}
|
||||
// is overridden by file and URL flags
|
||||
if cliCtx.IsSet(flags.SuggestedFeeRecipientFlag.Name) {
|
||||
suggestedFee := cliCtx.String(flags.SuggestedFeeRecipientFlag.Name)
|
||||
fileConfig = &validatorServiceConfig.FeeRecipientFileConfig{
|
||||
ProposeConfig: nil,
|
||||
DefaultConfig: &validatorServiceConfig.FeeRecipientFileOptions{
|
||||
FeeRecipient: suggestedFee,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if cliCtx.IsSet(flags.FeeRecipientConfigFileFlag.Name) {
|
||||
if err := unmarshalFromFile(cliCtx.Context, cliCtx.String(flags.FeeRecipientConfigFileFlag.Name), &fileConfig); err != nil {
|
||||
return nil, err
|
||||
@ -485,16 +496,7 @@ func feeRecipientConfig(cliCtx *cli.Context) (*validatorServiceConfig.FeeRecipie
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
// override the default fileConfig with the fileConfig from the command line
|
||||
if cliCtx.IsSet(flags.SuggestedFeeRecipientFlag.Name) {
|
||||
suggestedFee := cliCtx.String(flags.SuggestedFeeRecipientFlag.Name)
|
||||
fileConfig = &validatorServiceConfig.FeeRecipientFileConfig{
|
||||
ProposeConfig: nil,
|
||||
DefaultConfig: &validatorServiceConfig.FeeRecipientFileOptions{
|
||||
FeeRecipient: suggestedFee,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// nothing is set, so just return nil
|
||||
if fileConfig == nil {
|
||||
return nil, nil
|
||||
|
@ -432,7 +432,7 @@ func TestFeeRecipientConfig(t *testing.T) {
|
||||
wantErr: "",
|
||||
},
|
||||
{
|
||||
name: "Suggested Fee Override Config",
|
||||
name: "Suggested Fee does not Override Config",
|
||||
args: args{
|
||||
feeRecipientFlagValues: &feeRecipientFlag{
|
||||
dir: "./testdata/good-prepare-beacon-proposer-config.json",
|
||||
@ -441,10 +441,16 @@ func TestFeeRecipientConfig(t *testing.T) {
|
||||
},
|
||||
},
|
||||
want: func() *validator_service_config.FeeRecipientConfig {
|
||||
key1, err := hexutil.Decode("0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a")
|
||||
require.NoError(t, err)
|
||||
return &validator_service_config.FeeRecipientConfig{
|
||||
ProposeConfig: nil,
|
||||
ProposeConfig: map[[fieldparams.BLSPubkeyLength]byte]*validator_service_config.FeeRecipientOptions{
|
||||
bytesutil.ToBytes48(key1): {
|
||||
FeeRecipient: common.HexToAddress("0x50155530FCE8a85ec7055A5F8b2bE214B3DaeFd3"),
|
||||
},
|
||||
},
|
||||
DefaultConfig: &validator_service_config.FeeRecipientOptions{
|
||||
FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89B"),
|
||||
FeeRecipient: common.HexToAddress("0x6e35733c5af9B61374A128e6F85f553aF09ff89A"),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user