Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type LastValidatorPower
- type MsgCreateValidatorPOA
- type MsgVoteValidator
- type ParamSubspace
- type Params
- type QueryValidatorParams
- type QueryValidatorResolve
- type QueryVoteParams
- type QueryVoteResolve
- type Validator
- type Vote
Constants ¶
const ( EventTypeVote = "vote" AttributeKeyCandidate = "name" AttributeValueCategory = ModuleName )
poa module event types
const ( // ModuleName is the name of the module ModuleName = "poa" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey to be used for routing msgs RouterKey = ModuleName // QuerierRoute to be used for querier msgs QuerierRoute = ModuleName )
const ( // Default percentage of votes to join the set DefaultQuorum uint16 = 49 // Default maximum number of bonded validators DefaultMaxValidators uint16 = 100 )
Default parameter namespace
const ( QueryValidatorPOA = "validator-poa" QueryAllValidatorsPOA = "validators" QueryVotePOA = "vote-poa" QueryAllVotesPOA = "votes" )
Variables ¶
var ( ErrEmptyValidatorAddr = sdkerrors.Register(ModuleName, 1, "empty validator address") ErrBadValidatorAddr = sdkerrors.Register(ModuleName, 2, "validator address is invalid") ErrNoValidatorFound = sdkerrors.Register(ModuleName, 3, "validator does not exist") ErrNoAcceptedValidatorFound = sdkerrors.Register(ModuleName, 4, "accepted validator does not exist") )
var ( ValidatorsKey = []byte{0x51} // prefix for each key to a validator ValidatorsByAddressKey = []byte{0x52} // prefix for each key to a validator VotesKey = []byte{0x53} // prefix for each key to a vote VotesByValidatorKey = []byte{0x54} // prefix for each key to a validator )
var ( NewMsgCreateValidatorPOA = msg.NewMsgCreateValidatorPOA NewMsgVoteValidator = msg.NewMsgVoteValidator )
var ( KeyQuorum = []byte("Quorum") KeyMaxValidators = []byte("MaxValidators") )
nolint - Keys for parameter access
Functions ¶
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the authority genesis parameters
Types ¶
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` Validators []Validator `json:"validators" yaml:"validators"` }
GenesisState - all authority state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState gets the raw genesis raw message for testing
func NewGenesisState ¶
func NewGenesisState(params Params, validators []Validator) GenesisState
NewGenesisState creates a new GenesisState instanc e
type LastValidatorPower ¶
type LastValidatorPower struct { Address sdk.ValAddress Power int64 }
LastValidatorPower required for validator set update logic
type MsgCreateValidatorPOA ¶
type MsgCreateValidatorPOA = msg.MsgCreateValidatorPOA
This is a work around to allow messages to be defined in another package while allowing the hander to function as expected
type MsgVoteValidator ¶
type MsgVoteValidator = msg.MsgVoteValidator
This is a work around to allow messages to be defined in another package while allowing the hander to function as expected
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interfacace
type Params ¶
type Params struct { Quorum uint16 `json:"quorum" yaml:"quorum"` // percentage of validators that need to vote MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535) }
Params - used for initializing default parameter for poa at genesis
func DefaultParams ¶
func DefaultParams() Params
DefaultParams defines the parameters for this module
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs - Implements params.ParamSet
type QueryValidatorParams ¶
type QueryValidatorParams struct {
Name string
}
QueryValidatorParams
func NewQueryValidatorParams ¶
func NewQueryValidatorParams(name string) QueryValidatorParams
NewQueryValidatorParams
type QueryValidatorResolve ¶
QueryValidatorResolve Queries Result Payload for a resolve query
type QueryVoteParams ¶
QueryVoteParams
func NewQueryVoteParams ¶
func NewQueryVoteParams(name string, voter string) QueryVoteParams
NewQueryVoteParams
type QueryVoteResolve ¶
type QueryVoteResolve struct { Name string `json:"name"` Voter string `json:"voter"` InFavor bool `json:"in_favor"` }
QueryVoteResolve Queries Result Payload for a resolve query
type Validator ¶
type Validator struct { Name string `json:"name" yaml:"name"` Address sdk.ValAddress `json:"address" yaml:"address"` PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` Description stakingtypes.Description `json:"description" yaml:"description"` Accepted bool `json:"accepted" yaml:"accepted"` InSet bool `json:"inset" yaml:"inset"` }
Validator - Data structure to define validators for consensus
func NewValidator ¶
func NewValidator(name string, address sdk.ValAddress, pubKey crypto.PubKey, description stakingtypes.Description) Validator
NewValidator - initialize a new validator
func (Validator) ABCIValidatorUpdate ¶
func (v Validator) ABCIValidatorUpdate(power int64) abci.ValidatorUpdate
ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staking validator type with the full validator power