Documentation
¶
Index ¶
- Constants
- Variables
- func ErrAccountAlreadyHasNode(address interface{}) sdk.Error
- func ErrPoolIsFull() sdk.Error
- func ErrValidatorDoesNotExist(address interface{}) sdk.Error
- func ErrValidatorExists(address interface{}) sdk.Error
- func GetValidatorKey(addr sdk.ConsAddress) []byte
- func GetValidatorLastPowerKey(addr sdk.ConsAddress) []byte
- func GetValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte
- func GetValidatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte
- func GetValidatorOwnerKey(addr sdk.AccAddress) []byte
- func GetValidatorSigningInfoKey(addr sdk.ConsAddress) []byte
- func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte
- func RegisterCodec(cdc *codec.Codec)
- type Description
- type LastValidatorPower
- type ListValidatorItems
- type ListValidatorsParams
- type MsgCreateValidator
- func (m MsgCreateValidator) GetPubKey() crypto.PubKey
- func (m MsgCreateValidator) GetSignBytes() []byte
- func (m MsgCreateValidator) GetSigners() []sdk.AccAddress
- func (m MsgCreateValidator) Route() string
- func (m MsgCreateValidator) Type() string
- func (m MsgCreateValidator) ValidateBasic() sdk.Error
- type Validator
- func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
- func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
- func (v Validator) GeOwner() sdk.AccAddress
- func (v Validator) GetConsAddress() sdk.ConsAddress
- func (v Validator) GetConsPubKey() crypto.PubKey
- func (v Validator) GetName() string
- func (v Validator) GetPower() int64
- func (v Validator) IsJailed() bool
- func (v Validator) String() string
- type ValidatorSigningInfo
- type ValidatorState
Constants ¶
const ( // Default power every validator created with. Power int64 = 10 // Zero power is used to demote validator. ZeroPower int64 = 0 // Maximum number of nodes. MaxNodes = 100 // Maximum time to accept double-sign evidence. MaxEvidenceAge = 60 * 2 * time.Second // Size (number of blocks) of the sliding window used to track validator liveness. SignedBlocksWindow int64 = 100 // Minimal number of blocks must have been signed per window. MinSignedPerWindow int64 = 50 )
const ( Codespace sdk.CodespaceType = ModuleName CodeValidatorAlreadyExist sdk.CodeType = 601 CodeValidatorDoesNotExist sdk.CodeType = 602 CodePoolIsFull sdk.CodeType = 603 CodeAccountAlreadyHasNode sdk.CodeType = 604 )
const ( EventTypeCreateValidator = "create_validator" AttributeKeyValidator = "validator" AttributeValueCategory = ModuleName )
validator module event types.
const ( // ModuleName is the name of the validator module. ModuleName = "validator" // StoreKey is the string store representation. StoreKey = ModuleName // QuerierRoute is the querier route for the validator module. QuerierRoute = ModuleName // RouterKey is the msg router key for validator module. RouterKey = ModuleName )
const ( MaxNameLength = 70 MaxIdentityLength = 3000 MaxWebsiteLength = 140 MaxDetailsLength = 280 )
Variables ¶
var ( ValidatorPrefix = []byte{0x01} // prefix for each key to a validator ValidatorLastPowerPrefix = []byte{0x02} // prefix for each key to a validator index, by last power ValidatorOwnerPrefix = []byte{0x05} // prefix for validator owner ValidatorSigningInfoPrefix = []byte{0x06} // prefix for validator signing info ValidatorMissedBlockBitArrayPrefix = []byte{0x07} // prefix for validator missed blocks )
var ModuleCdc = codec.New()
ModuleCdc is the codec for the module.
Functions ¶
func ErrPoolIsFull ¶
func ErrValidatorExists ¶
func GetValidatorKey ¶
func GetValidatorKey(addr sdk.ConsAddress) []byte
Key builder for Validator record.
func GetValidatorLastPowerKey ¶
func GetValidatorLastPowerKey(addr sdk.ConsAddress) []byte
Key builder for Last Validator Power record.
func GetValidatorMissedBlockBitArrayKey ¶
func GetValidatorMissedBlockBitArrayKey(v sdk.ConsAddress, i int64) []byte
Key builder for Validator Missed blocks.
func GetValidatorMissedBlockBitArrayPrefixKey ¶
func GetValidatorMissedBlockBitArrayPrefixKey(v sdk.ConsAddress) []byte
func GetValidatorOwnerKey ¶
func GetValidatorOwnerKey(addr sdk.AccAddress) []byte
Key builder for Validator owner record.
func GetValidatorSigningInfoKey ¶
func GetValidatorSigningInfoKey(addr sdk.ConsAddress) []byte
Key builder for Validator signing info record.
func RegisterCodec ¶
RegisterCodec registers concrete type on the Amino codec.
Types ¶
type Description ¶
type Description struct {
// name.
Name string `json:"name"`
// optional identity signature.
Identity string `json:"identity,omitempty"`
// optional website link.
Website string `json:"website,omitempty"`
// optional details.
Details string `json:"details,omitempty"`
}
Description of Validator
func NewDescription ¶
func NewDescription(name, identity, website, details string) Description
NewDescription returns a new Description with the provided values.
func (Description) Validate ¶
func (d Description) Validate() sdk.Error
Ensure the length of a validator's description.
type LastValidatorPower ¶
type LastValidatorPower struct {
ConsensusAddress sdk.ConsAddress `json:"address"`
Power int64 `json:"power"`
}
Last Validator power. needed for taking validator set updates
func NewLastValidatorPower ¶
func NewLastValidatorPower(address sdk.ConsAddress) LastValidatorPower
type ListValidatorItems ¶
Response Payload for QueryValidators query.
func NewListValidatorItems ¶
func NewListValidatorItems() ListValidatorItems
func (ListValidatorItems) String ¶
func (n ListValidatorItems) String() string
Implement fmt.Stringer.
type ListValidatorsParams ¶
type ListValidatorsParams struct {
Skip int
Take int
State ValidatorState
}
Request Payload for QueryValidators (pagination and filtering) query.
func NewListValidatorsParams ¶
func NewListValidatorsParams(pagination pagination.PaginationParams, status ValidatorState) ListValidatorsParams
type MsgCreateValidator ¶
type MsgCreateValidator struct {
Address sdk.ConsAddress `json:"validator_address"`
PubKey string `json:"validator_pubkey"`
Description Description `json:"description"`
Signer sdk.AccAddress `json:"signer"`
}
func NewMsgCreateValidator ¶
func NewMsgCreateValidator(address sdk.ConsAddress, pubKey string, description Description, signer sdk.AccAddress) MsgCreateValidator
func (MsgCreateValidator) GetPubKey ¶
func (m MsgCreateValidator) GetPubKey() crypto.PubKey
func (MsgCreateValidator) GetSignBytes ¶
func (m MsgCreateValidator) GetSignBytes() []byte
func (MsgCreateValidator) GetSigners ¶
func (m MsgCreateValidator) GetSigners() []sdk.AccAddress
func (MsgCreateValidator) Route ¶
func (m MsgCreateValidator) Route() string
func (MsgCreateValidator) Type ¶
func (m MsgCreateValidator) Type() string
func (MsgCreateValidator) ValidateBasic ¶
func (m MsgCreateValidator) ValidateBasic() sdk.Error
type Validator ¶
type Validator struct {
Description Description `json:"description"` // description of the validator
Address sdk.ConsAddress `json:"validator_address"` // the consensus address of the tendermint validator
PubKey string `json:"validator_pubkey"` // the consensus public key of the tendermint validator
Power int64 `json:"power"` // validator consensus power
Jailed bool `json:"jailed"` // has the validator been removed from validator set
JailedReason string `json:"jailed_reason,omitempty"` // the reason of validator jailing
Owner sdk.AccAddress `json:"owner"` // the account address of validator owner
}
Validator
func NewValidator ¶
func NewValidator(address sdk.ConsAddress, pubKey string, description Description, owner sdk.AccAddress) Validator
func (Validator) ABCIValidatorUpdate ¶
func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate
ABCI ValidatorUpdate message to add new validator to validator set.
func (Validator) ABCIValidatorUpdateZero ¶
func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate
ABCI ValidatorUpdate message to remove validator from validator set.
func (Validator) GeOwner ¶
func (v Validator) GeOwner() sdk.AccAddress
func (Validator) GetConsAddress ¶
func (v Validator) GetConsAddress() sdk.ConsAddress
func (Validator) GetConsPubKey ¶
type ValidatorSigningInfo ¶
type ValidatorSigningInfo struct {
// validator consensus address.
Address sdk.ConsAddress `json:"address"`
// height at which validator was added.
StartHeight int64 `json:"start_height"`
// index offset into signed block bit array.
IndexOffset int64 `json:"index_offset"`
// missed blocks counter (to avoid scanning the array every time).
MissedBlocksCounter int64 `json:"missed_blocks_counter"`
}
Validator Signing info
func NewValidatorSigningInfo ¶
func NewValidatorSigningInfo(address sdk.ConsAddress, startHeight int64) ValidatorSigningInfo
func (ValidatorSigningInfo) Reset ¶
func (v ValidatorSigningInfo) Reset() ValidatorSigningInfo
func (ValidatorSigningInfo) String ¶
func (v ValidatorSigningInfo) String() string
type ValidatorState ¶
type ValidatorState string
const ( All ValidatorState = "" Active ValidatorState = "active" Jailed ValidatorState = "jailed" )