types

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	Codespace sdk.CodespaceType = ModuleName

	CodeValidatorAlreadyExist sdk.CodeType = 601
	CodeValidatorDoesNotExist sdk.CodeType = 602
	CodePoolIsFull            sdk.CodeType = 603
	CodeAccountAlreadyHasNode sdk.CodeType = 604
)
View Source
const (
	EventTypeCreateValidator = "create_validator"

	AttributeKeyValidator  = "validator"
	AttributeValueCategory = ModuleName
)

validator module event types.

View Source
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
)
View Source
const (
	MaxNameLength     = 70
	MaxIdentityLength = 3000
	MaxWebsiteLength  = 140
	MaxDetailsLength  = 280
)

Variables

View Source
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

)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module.

Functions

func ErrAccountAlreadyHasNode

func ErrAccountAlreadyHasNode(address interface{}) sdk.Error

func ErrPoolIsFull

func ErrPoolIsFull() sdk.Error

func ErrValidatorDoesNotExist

func ErrValidatorDoesNotExist(address interface{}) sdk.Error

func ErrValidatorExists

func ErrValidatorExists(address interface{}) sdk.Error

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 MustMarshalValidator

func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

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

type ListValidatorItems struct {
	Total int         `json:"total"`
	Items []Validator `json:"items"`
}

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 MustUnmarshalBinaryBareValidator

func MustUnmarshalBinaryBareValidator(cdc *codec.Codec, value []byte) Validator

func NewValidator

func NewValidator(address sdk.ConsAddress, pubKey string, description Description, owner sdk.AccAddress) Validator

func UnmarshalBinaryBareValidator

func UnmarshalBinaryBareValidator(cdc *codec.Codec, value []byte) (v Validator, err error)

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

func (v Validator) GetConsPubKey() crypto.PubKey

func (Validator) GetName

func (v Validator) GetName() string

func (Validator) GetPower

func (v Validator) GetPower() int64

func (Validator) IsJailed

func (v Validator) IsJailed() bool

func (Validator) String

func (v Validator) String() string

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 (ValidatorSigningInfo) String

func (v ValidatorSigningInfo) String() string

type ValidatorState

type ValidatorState string
const (
	All    ValidatorState = ""
	Active ValidatorState = "active"
	Jailed ValidatorState = "jailed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL