prysm-pulse/config/validator/service/fee-recipient-config.go

33 lines
1.5 KiB
Go
Raw Normal View History

Implement Fee Recipient: CLI flags and Calling Beacon API (#10312) * send proposer data to config * wip implementation with file and url based config import * improving logic on get validator index * fix function * optimizing function for map and address bug * fixing log * update cache if it doesn't exist * updating flags * initial unit test scaffold * fixing validator to call rpc call, removed temporary dependency * adding the API calls for the runner * fixing broken build * fixing deepsource * fixing interface * fixing fatal * fixing more deepsource issues * adding test placeholders * updating proposer config to add validation * changing how if statement throws error * removing unneeded validation, validating in a different way * wip improving tests * more unit test work * fixing unit test * fixing unit tests and edge cases * adding unit tests and adjusting how the config is created * fixing bazel builds * fixing proto generation * fixing imports * fixing unit tests * Update cmd/validator/flags/flags.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * updating flags based on comments, fixing unit tests * fixing bazel * removing unneeded function * fixing unit tests * refactors and unit test fixes based on comments * fixing bazel build * refactor the cache out fo the fee recipient function * adding usecase for multiple fee recipient * refactor burn name * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * fixing bug with validator index based on code review * edited flag descriptions to better communicate usage * fixing manual reference to flag name * fixing code review comments * fixing linting * Update validator/client/validator.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * addressing comments and renaming functions * fixing linting * Update cmd/validator/flags/flags.go * Update cmd/validator/flags/flags.go * Update cmd/validator/flags/flags.go * improving comments Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
2022-03-21 18:48:02 +00:00
package validator_service_config
import (
"github.com/ethereum/go-ethereum/common"
field_params "github.com/prysmaticlabs/prysm/config/fieldparams"
)
// FeeRecipientFileConfig is the struct representation of the JSON config file set in the validator through the CLI.
// ProposeConfig is the map of validator address to fee recipient options all in hex format.
// DefaultConfig is the default fee recipient address for all validators unless otherwise specified in the propose config.required.
type FeeRecipientFileConfig struct {
ProposeConfig map[string]*FeeRecipientFileOptions `json:"proposer_config"`
DefaultConfig *FeeRecipientFileOptions `json:"default_config"`
}
// FeeRecipientFileOptions is the struct representation of the JSON config file set in the validator through the CLI.
// FeeRecipient is set to an eth address in hex string format with 0x prefix.
type FeeRecipientFileOptions struct {
FeeRecipient string `json:"fee_recipient"`
}
// FeeRecipientConfig is a Prysm internal representation of the fee recipient config on the validator client.
// FeeRecipientFileConfig maps to FeeRecipientConfig on import through the CLI.
type FeeRecipientConfig struct {
ProposeConfig map[[field_params.BLSPubkeyLength]byte]*FeeRecipientOptions
DefaultConfig *FeeRecipientOptions
}
// FeeRecipientOptions is a Prysm internal representation of the FeeRecipientFileOptions on the validator client in bytes format instead of hex.
type FeeRecipientOptions struct {
FeeRecipient common.Address
}