prysm-pulse/config/validator/service/proposer-settings.go

45 lines
2.0 KiB
Go
Raw Normal View History

Validator client builder support (#10749) * Startinb builder service and interface * Get header from builder * Add get builder block * Single validator registration * Add mev-builder http cli flag * Add method to verify registration signature * Add builder registration * Add submit validator registration * suporting yaml * fix yaml unmarshaling * rolling back some changes from unmarshal from file * adding yaml support * adding register validator support * added new validator requests into client/validator * fixing gofmt * updating flags and including gas limit, unit tests are still broken * fixing bazel * more name changes and fixing unit tests * fixing unit tests and renaming functions * fixing unit tests and renaming to match changes * adding new test for yaml * fixing bazel linter * reverting change on validator service proto * adding clarifying logs * renaming function name to be more descriptive * renaming variable * rolling back some files that will be added from the builder-1 branch * reverting more * more reverting * need placeholder * need placeholder * fixing unit test * fixing unit test * fixing unit test * fixing unit test * fixing more unit tests * fixing more unit tests * rolling back mockgen * fixing bazel * rolling back changes * removing duplicate function * fixing client mock * removing unused type * fixing missing brace * fixing bad field name * fixing bazel * updating naming * fixing bazel * fixing unit test * fixing bazel linting * unhandled err * fixing gofmt * simplifying name based on feedback * using corrected function * moving default fee recipient and gaslimit to beaconconfig * missing a few constant changes * fixing bazel * fixing more missed default renames * fixing more constants in tests * fixing bazel * adding update proposer setting per epoch * refactoring to reduce complexity * adding unit test for proposer settings * Update validator/client/validator.go Co-authored-by: terencechain <terence@prysmaticlabs.com> * trying out renaming based on feedback * adjusting based on review comments * making tests more appropriate * fixing bazel * updating flag description based on review feedback * addressing review feedback * switching to pushing at start of epoch for more time * adding new unit test and properly throwing error * switching keys in error to count * fixing log variable * resolving conflict * resolving more conflicts * adjusting error message Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
2022-06-06 19:32:41 +00:00
package validator_service_config
import (
"github.com/ethereum/go-ethereum/common"
field_params "github.com/prysmaticlabs/prysm/config/fieldparams"
Keymanager APIs: fee recipient api (#10850) * initial commit wip * setting protos for fee recipient * updating proto based on specs * updating apimiddleware * generated APIs * updating proto to fit spec * fixing naming of fields * fixing endpoint_factory and associated structs * fixing imports * adding in custom http types to grpc gateway * adding import options * changing package option * still testing protos * adding to bazel * testing dependency changes * more tests * more tests * more tests * more tests * more tests * more tests * testing changing repo dep * testing deps * testing deps * testing deps * testing deps * testing deps * testing deps * reverting * testing import * testing bazel * bazel test * testing * testing * testing import * updating generated proto code * wip set fee recipient by pubkey * adding list fee recipient logic * fixing thrown error * fixing bug with API * fee recipient delete function * updating generated proto logic * fixing deposit api and adding postman tests * fixing proto imports * fixing unit tests and checksums * fixing test * adding unit tests * fixing bazel * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * resolving review comments * fixing return * Update config/validator/service/proposer-settings.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * updating proto * updating message name * fixing imports * updating based on review comments * adding middleware unit tests * capitalizing errors * using error instead of errorf * fixing missed unit test variable rename * fixing format variable * fixing unit test * Update validator/rpc/standard_api.go * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2022-06-16 15:10:23 +00:00
"github.com/prysmaticlabs/prysm/config/params"
Validator client builder support (#10749) * Startinb builder service and interface * Get header from builder * Add get builder block * Single validator registration * Add mev-builder http cli flag * Add method to verify registration signature * Add builder registration * Add submit validator registration * suporting yaml * fix yaml unmarshaling * rolling back some changes from unmarshal from file * adding yaml support * adding register validator support * added new validator requests into client/validator * fixing gofmt * updating flags and including gas limit, unit tests are still broken * fixing bazel * more name changes and fixing unit tests * fixing unit tests and renaming functions * fixing unit tests and renaming to match changes * adding new test for yaml * fixing bazel linter * reverting change on validator service proto * adding clarifying logs * renaming function name to be more descriptive * renaming variable * rolling back some files that will be added from the builder-1 branch * reverting more * more reverting * need placeholder * need placeholder * fixing unit test * fixing unit test * fixing unit test * fixing unit test * fixing more unit tests * fixing more unit tests * rolling back mockgen * fixing bazel * rolling back changes * removing duplicate function * fixing client mock * removing unused type * fixing missing brace * fixing bad field name * fixing bazel * updating naming * fixing bazel * fixing unit test * fixing bazel linting * unhandled err * fixing gofmt * simplifying name based on feedback * using corrected function * moving default fee recipient and gaslimit to beaconconfig * missing a few constant changes * fixing bazel * fixing more missed default renames * fixing more constants in tests * fixing bazel * adding update proposer setting per epoch * refactoring to reduce complexity * adding unit test for proposer settings * Update validator/client/validator.go Co-authored-by: terencechain <terence@prysmaticlabs.com> * trying out renaming based on feedback * adjusting based on review comments * making tests more appropriate * fixing bazel * updating flag description based on review feedback * addressing review feedback * switching to pushing at start of epoch for more time * adding new unit test and properly throwing error * switching keys in error to count * fixing log variable * resolving conflict * resolving more conflicts * adjusting error message Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
2022-06-06 19:32:41 +00:00
)
// ProposerSettingsPayload is the struct representation of the JSON or YAML payload 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 ProposerSettingsPayload struct {
ProposeConfig map[string]*ProposerOptionPayload `json:"proposer_config" yaml:"proposer_config"`
DefaultConfig *ProposerOptionPayload `json:"default_config" yaml:"default_config"`
}
// ProposerOptionPayload 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.
// GasLimit is a number set to help the network decide on the maximum gas in each block.
type ProposerOptionPayload struct {
FeeRecipient string `json:"fee_recipient" yaml:"fee_recipient"`
GasLimit uint64 `json:"gas_limit,omitempty" yaml:"gas_limit,omitempty"`
}
// ProposerSettings is a Prysm internal representation of the fee recipient config on the validator client.
// ProposerSettingsPayload maps to ProposerSettings on import through the CLI.
type ProposerSettings struct {
ProposeConfig map[[field_params.BLSPubkeyLength]byte]*ProposerOption
DefaultConfig *ProposerOption
}
// ProposerOption is a Prysm internal representation of the ProposerOptionPayload on the validator client in bytes format instead of hex.
type ProposerOption struct {
FeeRecipient common.Address
GasLimit uint64
}
Keymanager APIs: fee recipient api (#10850) * initial commit wip * setting protos for fee recipient * updating proto based on specs * updating apimiddleware * generated APIs * updating proto to fit spec * fixing naming of fields * fixing endpoint_factory and associated structs * fixing imports * adding in custom http types to grpc gateway * adding import options * changing package option * still testing protos * adding to bazel * testing dependency changes * more tests * more tests * more tests * more tests * more tests * more tests * testing changing repo dep * testing deps * testing deps * testing deps * testing deps * testing deps * testing deps * reverting * testing import * testing bazel * bazel test * testing * testing * testing import * updating generated proto code * wip set fee recipient by pubkey * adding list fee recipient logic * fixing thrown error * fixing bug with API * fee recipient delete function * updating generated proto logic * fixing deposit api and adding postman tests * fixing proto imports * fixing unit tests and checksums * fixing test * adding unit tests * fixing bazel * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> * resolving review comments * fixing return * Update config/validator/service/proposer-settings.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <rkapka@wp.pl> * updating proto * updating message name * fixing imports * updating based on review comments * adding middleware unit tests * capitalizing errors * using error instead of errorf * fixing missed unit test variable rename * fixing format variable * fixing unit test * Update validator/rpc/standard_api.go * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2022-06-16 15:10:23 +00:00
// DefaultProposerOption returns a Proposer Option with defaults filled
func DefaultProposerOption() ProposerOption {
return ProposerOption{
FeeRecipient: params.BeaconConfig().DefaultFeeRecipient,
GasLimit: params.BeaconConfig().DefaultBuilderGasLimit,
}
}