types

package
v0.0.0-...-3ea6778 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	EventTypeCompleteUnstaking     = "complete_unstaking"
	EventTypeCreateValidator       = "create_validator"
	EventTypeStake                 = "upokt"
	EventTypeBeginUnstake          = "begin_unstake"
	EventTypeUnstake               = "unstake"
	EventTypeProposerReward        = "proposer_reward"
	EventTypeSlash                 = "slash"
	EventTypeLiveness              = "liveness"
	AttributeKeyAddress            = "address"
	AttributeKeyHeight             = "height"
	AttributeKeyPower              = "power"
	AttributeKeyReason             = "reason"
	AttributeKeyJailed             = "jailed"
	AttributeKeyMissedBlocks       = "missed_blocks"
	AttributeValueDoubleSign       = "double_sign"
	AttributeValueMissingSignature = "missing_signature"
	AttributeKeyValidator          = "validator"
	AttributeValueCategory         = ModuleName
)

pos module event types

View Source
const (
	ModuleName   = "pos"
	StoreKey     = ModuleName // StoreKey is the string store representation
	QuerierRoute = ModuleName // QuerierRoute is the querier route for the staking module
	RouterKey    = ModuleName // RouterKey is the msg router key for the staking module
)
View Source
const (
	DefaultUnstakingTime                      = time.Hour * 24 * 7 * 3
	DefaultMaxValidators               uint64 = 100000
	DefaultMinStake                    int64  = 1000000
	DefaultBaseProposerAwardPercentage        = 90
	DefaultMaxEvidenceAge                     = 60 * 2 * time.Second
	DefaultSignedBlocksWindow                 = int64(100)
	DefaultDowntimeJailDuration               = 60 * 10 * time.Second
)

POS params default values

View Source
const (
	QueryValidators          = "validators"
	QueryValidator           = "validator"
	QueryUnstakingValidators = "unstaking_validators"
	QueryStakedValidators    = "staked_validators"
	QueryUnstakedValidators  = "unstaked_validators"
	QueryStakedPool          = "stakedPool"
	QueryUnstakedPool        = "unstakedPool"
	QueryParameters          = "parameters"
	QuerySigningInfo         = "signingInfo"
	QuerySigningInfos        = "signingInfos"
	QueryAccountBalance      = "account_balance"
)

query endpoints supported by the staking Querier

View Source
const (
	StakedPoolName = "staked_tokens_pool"
)

names used as root for pool module accounts: - StakingPool -> "staked_tokens_pool"

Variables

View Source
var (
	ProposerKey                     = []byte{0x01} // key for the proposer address used for rewards
	ValidatorSigningInfoKey         = []byte{0x11} // Prefix for signing info used in slashing
	ValidatorMissedBlockBitArrayKey = []byte{0x12} // Prefix for missed block bit array used in slashing
	AddrPubkeyRelationKey           = []byte{0x13} // Prefix for address-pubkey relation used in slashing
	AllValidatorsKey                = []byte{0x21} // prefix for each key to a validator
	StakedValidatorsKey             = []byte{0x23} // prefix for each key to a staked validator index, sorted by power
	PrevStateValidatorsPowerKey     = []byte{0x31} // prefix for the key to the validators of the prevState state
	PrevStateTotalPowerKey          = []byte{0x32} // prefix for the total power of the prevState state
	UnstakingValidatorsKey          = []byte{0x41} // prefix for unstaking validator
	UnstakedValidatorsKey           = []byte{0x42} // prefix for unstaked validators // todo remove
	AwardValidatorKey               = []byte{0x51} // prefix for awarding validators
	BurnValidatorKey                = []byte{0x52} // prefix for awarding validators
)

nolint

View Source
var (
	KeyUnstakingTime               = []byte("UnstakingTime")
	KeyMaxValidators               = []byte("MaxValidators")
	KeyStakeDenom                  = []byte("StakeDenom")
	KeyStakeMinimum                = []byte("StakeMinimum")
	KeyProposerRewardPercentage    = []byte("ProposerRewardPercentage")
	KeyMaxEvidenceAge              = []byte("MaxEvidenceAge")
	KeySignedBlocksWindow          = []byte("SignedBlocksWindow")
	KeyMinSignedPerWindow          = []byte("MinSignedPerWindow")
	KeyDowntimeJailDuration        = []byte("DowntimeJailDuration")
	KeySlashFractionDoubleSign     = []byte("SlashFractionDoubleSign")
	KeySlashFractionDowntime       = []byte("SlashFractionDowntime")
	DoubleSignJailEndTime          = time.Unix(253402300799, 0) // forever
	DefaultMinSignedPerWindow      = sdk.NewDecWithPrec(5, 1)
	DefaultSlashFractionDoubleSign = sdk.NewDec(1).Quo(sdk.NewDec(20))
	DefaultSlashFractionDowntime   = sdk.NewDec(1).Quo(sdk.NewDec(100))
)

nolint - PublicKeys for parameter access

View Source
var ModuleCdc *codec.Codec // generic sealed codec to be used throughout this module

Functions

func AddressFromKey

func AddressFromKey(key []byte) []byte

Removes the prefix bytes from a key to expose true address

func ErrBadDelegationAmount

func ErrBadDelegationAmount(codespace sdk.CodespaceType) sdk.Error

func ErrBadDenom

func ErrBadDenom(codespace sdk.CodespaceType) sdk.Error

func ErrBadSendAmount

func ErrBadSendAmount(codespace sdk.CodespaceType) sdk.Error

func ErrBadValidatorAddr

func ErrBadValidatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrCantHandleEvidence

func ErrCantHandleEvidence(codespace sdk.CodespaceType) sdk.Error

func ErrMinimumStake

func ErrMinimumStake(codespace sdk.CodespaceType) sdk.Error

func ErrMinimumUnstake

func ErrMinimumUnstake(codespace sdk.CodespaceType) sdk.Error

func ErrMissingSelfDelegation

func ErrMissingSelfDelegation(codespace sdk.CodespaceType) sdk.Error

func ErrNilValidatorAddr

func ErrNilValidatorAddr(codespace sdk.CodespaceType) sdk.Error

func ErrNoSigningInfoFound

func ErrNoSigningInfoFound(codespace sdk.CodespaceType, address sdk.Address) sdk.Error

func ErrNoValidatorForAddress

func ErrNoValidatorForAddress(codespace sdk.CodespaceType) sdk.Error

func ErrNoValidatorFound

func ErrNoValidatorFound(codespace sdk.CodespaceType) sdk.Error

func ErrNotEnoughCoins

func ErrNotEnoughCoins(codespace sdk.CodespaceType) sdk.Error

func ErrSelfDelegationTooLowToUnjail

func ErrSelfDelegationTooLowToUnjail(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorJailed

func ErrValidatorJailed(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorNotJailed

func ErrValidatorNotJailed(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorPubKeyExists

func ErrValidatorPubKeyExists(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorPubKeyTypeNotSupported

func ErrValidatorPubKeyTypeNotSupported(codespace sdk.CodespaceType, keyType string, supportedTypes []string) sdk.Error

func ErrValidatorStatus

func ErrValidatorStatus(codespace sdk.CodespaceType) sdk.Error

func ErrValidatorTombstoned

func ErrValidatorTombstoned(codespace sdk.CodespaceType) sdk.Error

func GetAddrPubkeyRelationKey

func GetAddrPubkeyRelationKey(address []byte) []byte

generates pubkey relation key used to get the pubkey from the address

func GetValMissedBlockKey

func GetValMissedBlockKey(v sdk.Address, i int64) []byte

generates the key for missing val who missed block through consensus addr

func GetValMissedBlockPrefixKey

func GetValMissedBlockPrefixKey(v sdk.Address) []byte

generates the prefix key for missing val who missed block through consensus addr

func GetValidatorSigningInfoAddress

func GetValidatorSigningInfoAddress(key []byte) (v sdk.Address)

extract the address from a validator signing info key

func GetValidatorSigningInfoKey

func GetValidatorSigningInfoKey(v sdk.Address) []byte

generates the key for validator signing information by consensus addr

func KeyForUnstakingValidators

func KeyForUnstakingValidators(unstakingTime time.Time) []byte

generates the key for unstaking validators by the unstakingtime

func KeyForValByAllVals

func KeyForValByAllVals(addr sdk.Address) []byte

generates the key for the validator with address

func KeyForValidatorAward

func KeyForValidatorAward(address sdk.Address) []byte

generates the award key for a validator in the current state

func KeyForValidatorBurn

func KeyForValidatorBurn(address sdk.Address) []byte

func KeyForValidatorInStakingSet

func KeyForValidatorInStakingSet(validator Validator) []byte

generates the key for a validator in the staking set

func KeyForValidatorPrevStateStateByPower

func KeyForValidatorPrevStateStateByPower(address sdk.Address) []byte

generates the key for a validator in the prevState state

func MustMarshalValidator

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

MUST return the amino encoded version of this validator

func ParseValidatorPowerRankKey

func ParseValidatorPowerRankKey(key []byte) (operAddr []byte)

parse the validators address from power rank key

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec

Types

type AccountKeeper

type AccountKeeper interface {
	IterateAccounts(ctx sdk.Ctx, process func(authexported.Account) (stop bool))
}

AccountKeeper defines the expected account keeper (noalias)

type CodeType

type CodeType = sdk.CodeType
const (
	DefaultCodespace          sdk.CodespaceType = ModuleName
	CodeUnauthorized          CodeType          = sdk.CodeUnauthorized
	CodeInvalidValidator      CodeType          = 101
	CodeInvalidDelegation     CodeType          = 102
	CodeInvalidInput          CodeType          = 103
	CodeValidatorJailed       CodeType          = 104
	CodeValidatorNotJailed    CodeType          = 105
	CodeMissingSelfDelegation CodeType          = 106
	CodeMissingSigningInfo    CodeType          = 108
	CodeBadSend               CodeType          = 109
	CodeInvalidStatus         CodeType          = 110
	CodeMinimumStake          CodeType          = 111
	CodeNotEnoughCoins        CodeType          = 112
	CodeValidatorTombstoned   CodeType          = 113
	CodeCantHandleEvidence    CodeType          = 114
	CodeMinimumUnstake        CodeType          = 115
)

type GenesisState

type GenesisState struct {
	Params                   Params                          `json:"params" yaml:"params"`
	PrevStateTotalPower      sdk.Int                         `json:"prevState_total_power" yaml:"prevState_total_power"`
	PrevStateValidatorPowers []PrevStatePowerMapping         `json:"prevState_validator_powers" yaml:"prevState_validator_powers"`
	Validators               Validators                      `json:"validators" yaml:"validators"`
	Exported                 bool                            `json:"exported" yaml:"exported"`
	SigningInfos             map[string]ValidatorSigningInfo `json:"signing_infos" yaml:"signing_infos"`
	MissedBlocks             map[string][]MissedBlock        `json:"missed_blocks" yaml:"missed_blocks"`
	PreviousProposer         sdk.Address                     `json:"previous_proposer" yaml:"previous_proposer"`
}

GenesisState - all staking state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

get raw genesis raw message for testing

func NewGenesisState

func NewGenesisState(params Params, validators []Validator, previousProposer sdk.Address,
	signingInfos map[string]ValidatorSigningInfo, missedBlocks map[string][]MissedBlock) GenesisState

type MissedBlock

type MissedBlock struct {
	Index  int64 `json:"index" yaml:"index"`
	Missed bool  `json:"missed" yaml:"missed"`
}

MissedBlock

type MsgBeginUnstake

type MsgBeginUnstake struct {
	Address sdk.Address `json:"validator_address" yaml:"validator_address"`
}

---------------------------------------------------------------------------------------------------------------------- MsgBeginUnstake - struct for unstaking transaciton

func (MsgBeginUnstake) GetSignBytes

func (msg MsgBeginUnstake) GetSignBytes() []byte

func (MsgBeginUnstake) GetSigners

func (msg MsgBeginUnstake) GetSigners() []sdk.Address

func (MsgBeginUnstake) Route

func (msg MsgBeginUnstake) Route() string

nolint

func (MsgBeginUnstake) Type

func (msg MsgBeginUnstake) Type() string

func (MsgBeginUnstake) ValidateBasic

func (msg MsgBeginUnstake) ValidateBasic() sdk.Error

type MsgSend

type MsgSend struct {
	FromAddress sdk.Address
	ToAddress   sdk.Address
	Amount      sdk.Int
}

---------------------------------------------------------------------------------------------------------------------- MsgChangeParam structure for sending coins

func (MsgSend) GetSignBytes

func (msg MsgSend) GetSignBytes() []byte

func (MsgSend) GetSigners

func (msg MsgSend) GetSigners() []sdk.Address

func (MsgSend) Route

func (msg MsgSend) Route() string

nolint

func (MsgSend) Type

func (msg MsgSend) Type() string

func (MsgSend) ValidateBasic

func (msg MsgSend) ValidateBasic() sdk.Error

type MsgStake

type MsgStake struct {
	PubKey crypto.PublicKey `json:"pubkey" yaml:"pubkey"`
	Value  sdk.Int          `json:"value" yaml:"value"`
}

---------------------------------------------------------------------------------------------------------------------- MsgStake - struct for staking transactions

func (MsgStake) GetSignBytes

func (msg MsgStake) GetSignBytes() []byte

GetSignBytes returns the message bytes to sign over.

func (MsgStake) GetSigners

func (msg MsgStake) GetSigners() []sdk.Address

Return address(es) that must sign over msg.GetSignBytes()

func (MsgStake) Route

func (msg MsgStake) Route() string

nolint

func (MsgStake) Type

func (msg MsgStake) Type() string

func (MsgStake) ValidateBasic

func (msg MsgStake) ValidateBasic() sdk.Error

quick validity check

type MsgUnjail

type MsgUnjail struct {
	ValidatorAddr sdk.Address `json:"address" yaml:"address"` // address of the validator operator
}

---------------------------------------------------------------------------------------------------------------------- MsgUnjail - struct for unjailing jailed validator

func (MsgUnjail) GetSignBytes

func (msg MsgUnjail) GetSignBytes() []byte

func (MsgUnjail) GetSigners

func (msg MsgUnjail) GetSigners() []sdk.Address

func (MsgUnjail) Route

func (msg MsgUnjail) Route() string

nolint

func (MsgUnjail) Type

func (msg MsgUnjail) Type() string

func (MsgUnjail) ValidateBasic

func (msg MsgUnjail) ValidateBasic() sdk.Error

type MultiPOSHooks

type MultiPOSHooks []POSHooks

func (MultiPOSHooks) AfterValidatorBeginUnstaked

func (h MultiPOSHooks) AfterValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) AfterValidatorBeginUnstaking

func (h MultiPOSHooks) AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) AfterValidatorRegistered

func (h MultiPOSHooks) AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)

nolint

func (MultiPOSHooks) AfterValidatorRemoved

func (h MultiPOSHooks) AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) AfterValidatorSlashed

func (h MultiPOSHooks) AfterValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)

func (MultiPOSHooks) AfterValidatorStaked

func (h MultiPOSHooks) AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) BeforeValidatorBeginUnstaked

func (h MultiPOSHooks) BeforeValidatorBeginUnstaked(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) BeforeValidatorBeginUnstaking

func (h MultiPOSHooks) BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) BeforeValidatorRegistered

func (h MultiPOSHooks) BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) BeforeValidatorRemoved

func (h MultiPOSHooks) BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)

func (MultiPOSHooks) BeforeValidatorSlashed

func (h MultiPOSHooks) BeforeValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)

func (MultiPOSHooks) BeforeValidatorStaked

func (h MultiPOSHooks) BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)

type POSHooks

type POSHooks interface {
	BeforeValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
	AfterValidatorRegistered(ctx sdk.Ctx, valAddr sdk.Address)
	BeforeValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
	AfterValidatorRemoved(ctx sdk.Ctx, valAddr sdk.Address)
	BeforeValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
	AfterValidatorStaked(ctx sdk.Ctx, valAddr sdk.Address)
	BeforeValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
	AfterValidatorBeginUnstaking(ctx sdk.Ctx, valAddr sdk.Address)
	BeforeValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
	AfterValidatorUnstaked(ctx sdk.Ctx, valAddr sdk.Address)
	BeforeValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
	AfterValidatorSlashed(ctx sdk.Ctx, valAddr sdk.Address, fraction sdk.Dec)
}

POSHooks event hooks for staking validator object (noalias)

type Params

type Params struct {
	UnstakingTime            time.Duration `json:"unstaking_time" yaml:"unstaking_time"`           // duration of unstaking
	MaxValidators            uint64        `json:"max_validators" yaml:"max_validators"`           // maximum number of validators
	StakeDenom               string        `json:"stake_denom" yaml:"stake_denom"`                 // stakeable coin denomination
	StakeMinimum             int64         `json:"stake_minimum" yaml:"stake_minimum"`             // minimum amount needed to stake
	ProposerRewardPercentage int8          `json:"base_proposer_award" yaml:"base_proposer_award"` // minimum award for the proposer
	// slashing params
	MaxEvidenceAge          time.Duration `json:"max_evidence_age" yaml:"max_evidence_age"`
	SignedBlocksWindow      int64         `json:"signed_blocks_window" yaml:"signed_blocks_window"`
	MinSignedPerWindow      sdk.Dec       `json:"min_signed_per_window" yaml:"min_signed_per_window"`
	DowntimeJailDuration    time.Duration `json:"downtime_jail_duration" yaml:"downtime_jail_duration"`
	SlashFractionDoubleSign sdk.Dec       `json:"slash_fraction_double_sign" yaml:"slash_fraction_double_sign"`
	SlashFractionDowntime   sdk.Dec       `json:"slash_fraction_downtime" yaml:"slash_fraction_downtime"`
}

Params defines the high level settings for pos module

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current pos params value from store key or panic

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current pos params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Checks the equality of two param objects

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() sdk.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type Pool

type Pool struct {
	Tokens sdk.Int
}

func NewPool

func NewPool(tokens sdk.Int) Pool

NewPool creates a new Tokens instance used for queries

type PrevStatePowerMapping

type PrevStatePowerMapping struct {
	Address sdk.Address
	Power   int64
}

PrevState validator power, needed for validator set update logic

type QueryAccountBalanceParams

type QueryAccountBalanceParams struct {
	sdk.Address
}

type QuerySigningInfoParams

type QuerySigningInfoParams struct {
	Address sdk.Address
}

QuerySigningInfoParams defines the params for the following queries: - 'custom/slashing/signingInfo'

func NewQuerySigningInfoParams

func NewQuerySigningInfoParams(address sdk.Address) QuerySigningInfoParams

type QuerySigningInfosParams

type QuerySigningInfosParams struct {
	Page, Limit int
}

QuerySigningInfosParams defines the params for the following queries: - 'custom/slashing/signingInfos'

func NewQuerySigningInfosParams

func NewQuerySigningInfosParams(page, limit int) QuerySigningInfosParams

type QueryStakedValidatorsParams

type QueryStakedValidatorsParams struct {
	Page, Limit int
}

func NewQueryStakedValidatorsParams

func NewQueryStakedValidatorsParams(page, limit int) QueryStakedValidatorsParams

type QueryUnstakedValidatorsParams

type QueryUnstakedValidatorsParams struct {
	Page, Limit int
}

func NewQueryUnstakedValidatorsParams

func NewQueryUnstakedValidatorsParams(page, limit int) QueryUnstakedValidatorsParams

type QueryUnstakingValidatorsParams

type QueryUnstakingValidatorsParams struct {
	Page, Limit int
}

func NewQueryUnstakingValidatorsParams

func NewQueryUnstakingValidatorsParams(page, limit int) QueryUnstakingValidatorsParams

type QueryValidatorParams

type QueryValidatorParams struct {
	Address sdk.Address
}

func NewQueryValidatorParams

func NewQueryValidatorParams(validatorAddr sdk.Address) QueryValidatorParams

type QueryValidatorsParams

type QueryValidatorsParams struct {
	Page, Limit int
}

func NewQueryValidatorsParams

func NewQueryValidatorsParams(page, limit int) QueryValidatorsParams

type StakingPool

type StakingPool Pool

Tokens - tracking staked token supply

func (StakingPool) String

func (bp StakingPool) String() string

String returns a human readable string representation of a pool.

type SupplyKeeper

type SupplyKeeper interface {
	// get total supply of tokens
	GetSupply(ctx sdk.Ctx) supplyexported.SupplyI
	// get the address of a module account
	GetModuleAddress(name string) sdk.Address
	// get the module account structure
	GetModuleAccount(ctx sdk.Ctx, moduleName string) supplyexported.ModuleAccountI
	// set module account structure
	SetModuleAccount(sdk.Ctx, supplyexported.ModuleAccountI)
	// send coins to/from module accounts
	SendCoinsFromModuleToModule(ctx sdk.Ctx, senderModule, recipientModule string, amt sdk.Coins) sdk.Error
	// send coins from module to validator
	SendCoinsFromModuleToAccount(ctx sdk.Ctx, senderModule string, recipientAddr sdk.Address, amt sdk.Coins) sdk.Error
	// send coins from validator to module
	SendCoinsFromAccountToModule(ctx sdk.Ctx, senderAddr sdk.Address, recipientModule string, amt sdk.Coins) sdk.Error
	// mint coins
	MintCoins(ctx sdk.Ctx, moduleName string, amt sdk.Coins) sdk.Error
	// burn coins
	BurnCoins(ctx sdk.Ctx, name string, amt sdk.Coins) sdk.Error
}

SupplyKeeper defines the expected supply Keeper (noalias)

type Validator

type Validator struct {
	Address                 sdk.Address      `json:"address" yaml:"address"`               // address of the validator;
	PublicKey               crypto.PublicKey `json:"public_key" yaml:"public_key"`         // the consensus public key of the validator;
	Jailed                  bool             `json:"jailed" yaml:"jailed"`                 // has the validator been jailed from staked status?
	Status                  sdk.StakeStatus  `json:"status" yaml:"status"`                 // validator status (staked/unstaking/unstaked)
	StakedTokens            sdk.Int          `json:"tokens" yaml:"tokens"`                 // tokens staked in the network
	UnstakingCompletionTime time.Time        `json:"unstaking_time" yaml:"unstaking_time"` // if unstaking, min time for the validator to complete unstaking
}

func MustUnmarshalValidator

func MustUnmarshalValidator(cdc *codec.Codec, valBytes []byte) Validator

MUST decode the validator from the bytes

func NewValidator

func NewValidator(addr sdk.Address, pubKey crypto.PublicKey, tokensToStake sdk.Int) Validator

NewValidator - initialize a new validator

func UnmarshalValidator

func UnmarshalValidator(cdc *codec.Codec, valBytes []byte) (validator Validator, err error)

unmarshal the validator

func (Validator) ABCIValidatorUpdate

func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate

ABCIValidatorUpdate returns an abci.ValidatorUpdate from a staking validator type with the full validator power

func (Validator) ABCIValidatorUpdateZero

func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate

ABCIValidatorUpdateZero returns an abci.ValidatorUpdate from a staking validator type with zero power used for validator updates.

func (Validator) AddStakedTokens

func (v Validator) AddStakedTokens(tokens sdk.Int) Validator

AddStakedTokens tokens to staked field for a validator

func (Validator) ConsensusPower

func (v Validator) ConsensusPower() int64

get the consensus-engine power a reduction of 10^6 from validator tokens is applied

func (Validator) Equals

func (v Validator) Equals(v2 Validator) bool

compares the vital fields of two validator structures

func (Validator) GetAddress

func (v Validator) GetAddress() sdk.Address

func (Validator) GetConsensusPower

func (v Validator) GetConsensusPower() int64

func (Validator) GetPublicKey

func (v Validator) GetPublicKey() crypto.PublicKey

func (Validator) GetStatus

func (v Validator) GetStatus() sdk.StakeStatus

func (Validator) GetTokens

func (v Validator) GetTokens() sdk.Int

func (Validator) IsJailed

func (v Validator) IsJailed() bool

func (Validator) IsStaked

func (v Validator) IsStaked() bool

func (Validator) IsUnstaked

func (v Validator) IsUnstaked() bool

func (Validator) IsUnstaking

func (v Validator) IsUnstaking() bool

func (Validator) MarshalJSON

func (v Validator) MarshalJSON() ([]byte, error)

MarshalJSON marshals the validator to JSON using Hex

func (Validator) PotentialConsensusPower

func (v Validator) PotentialConsensusPower() int64

potential consensus-engine power

func (Validator) RemoveStakedTokens

func (v Validator) RemoveStakedTokens(tokens sdk.Int) Validator

RemoveStakedTokens removes tokens from a validator

func (Validator) String

func (v Validator) String() string

String returns a human readable string representation of a validator.

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the validator from JSON using Hex

func (Validator) UpdateStatus

func (v Validator) UpdateStatus(newStatus sdk.StakeStatus) Validator

UpdateStatus updates the staking status

type ValidatorSet

type ValidatorSet interface {
	// iterate through validators by address, execute func for each validator
	IterateAndExecuteOverVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool))
	// iterate through staked validators by address, execute func for each validator
	IterateAndExecuteOverStakedVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool))
	// iterate through the validator set of the prevState block by address, execute func for each validator
	IterateAndExecuteOverPrevStateVals(sdk.Ctx, func(index int64, validator posexported.ValidatorI) (stop bool))
	// get a particular validator by address
	Validator(sdk.Ctx, sdk.Address) posexported.ValidatorI
	// total staked tokens within the validator set
	TotalTokens(sdk.Ctx) sdk.Int
	// jail a validator
	JailValidator(sdk.Ctx, sdk.Address)
	// unjail a validator
	UnjailValidator(sdk.Ctx, sdk.Address)
	// MaxValidators returns the maximum amount of staked validators
	MaxValidators(sdk.Ctx) uint64
}

ValidatorSet expected properties for the set of all validators (noalias) todo this is here so other modules can conform to this interface

type ValidatorSigningInfo

type ValidatorSigningInfo struct {
	Address             sdk.Address `json:"address" yaml:"address"`                             // validator consensus address
	StartHeight         int64       `json:"start_height" yaml:"start_height"`                   // height at which validator was first a candidate OR was unjailed
	IndexOffset         int64       `json:"index_offset" yaml:"index_offset"`                   // index offset into signed block bit array
	JailedUntil         time.Time   `json:"jailed_until" yaml:"jailed_until"`                   // timestamp validator cannot be unjailed until
	Tombstoned          bool        `json:"tombstoned" yaml:"tombstoned"`                       // whether or not a validator has been tombstoned (killed out of validator set)
	MissedBlocksCounter int64       `json:"missed_blocks_counter" yaml:"missed_blocks_counter"` // missed blocks counter (to avoid scanning the array every time)
}

Signing info for a validator

func (ValidatorSigningInfo) String

func (i ValidatorSigningInfo) String() string

Return human readable signing info

type Validators

type Validators []Validator

Validators is a collection of Validator

func (Validators) String

func (v Validators) String() (out string)

Jump to

Keyboard shortcuts

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