validator

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// ModuleKey is the name of the module
	ModuleName = "validator"

	// RouterKey is the message route for gov
	RouterKey = ModuleName

	// QuerierRoute is the querier route for gov
	QuerierRoute = ModuleName

	QueryValidator     = "validator"
	QueryValidatorList = "valList"
)

Variables

This section is empty.

Functions

func BeginBlocker

func BeginBlocker(
	ctx sdk.Context, req abci.RequestBeginBlock, vm ValidatorManager) (panelty types.Coin)

BeginBlocker - execute before every block, update signing info and record validator set

func ErrAccountNotFound

func ErrAccountNotFound() sdk.Error

ErrAccountNotFound - error when account is not found

func ErrIllegalWithdraw

func ErrIllegalWithdraw() sdk.Error

ErrIllegalWithdraw - error if withdraw less than minimum withdraw requirement

func ErrInsufficientDeposit

func ErrInsufficientDeposit() sdk.Error

ErrInsufficientDeposit - error when deposit is insufficient

func ErrInvalidCoin

func ErrInvalidCoin() sdk.Error

ErrInvalidCoin - error if coin in msg is invalid

func ErrInvalidUsername

func ErrInvalidUsername() sdk.Error

ErrInvalidUsername - error if username is invalid

func ErrInvalidWebsite

func ErrInvalidWebsite() sdk.Error

ErrInvalidWebsite - error if website is invalid

func ErrQueryFailed added in v0.2.0

func ErrQueryFailed() sdk.Error

ErrQueryFailed - error when query validator store failed

func ErrUnbalancedAccount

func ErrUnbalancedAccount() sdk.Error

ErrInsufficientDeposit - error if required voting deposit less than committing deposit

func ErrValidatorPubKeyAlreadyExist

func ErrValidatorPubKeyAlreadyExist() sdk.Error

ErrValidatorPubKeyAlreadyExist - error if validator public key is already exist

func NewHandler

func NewHandler(am acc.AccountManager, valManager ValidatorManager, voteManager vote.VoteManager, gm *global.GlobalManager) sdk.Handler

NewHandler - Handle all "validator" type messages.

func NewQuerier added in v0.2.0

func NewQuerier(vm ValidatorManager) sdk.Querier

creates a querier for validator REST endpoints

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type ValidatorDepositMsg

type ValidatorDepositMsg struct {
	Username  types.AccountKey `json:"username"`
	Deposit   types.LNO        `json:"deposit"`
	ValPubKey crypto.PubKey    `json:"validator_public_key"`
	Link      string           `json:"link"`
}

ValidatorDepositMsg - deposit to become validator or add deposit

func NewValidatorDepositMsg

func NewValidatorDepositMsg(validator string, deposit types.LNO, pubKey crypto.PubKey, link string) ValidatorDepositMsg

ValidatorDepositMsg Msg Implementations

func (ValidatorDepositMsg) GetConsumeAmount

func (msg ValidatorDepositMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implement types.Msg

func (ValidatorDepositMsg) GetPermission

func (msg ValidatorDepositMsg) GetPermission() types.Permission

GetPermission - implement types.Msg

func (ValidatorDepositMsg) GetSignBytes

func (msg ValidatorDepositMsg) GetSignBytes() []byte

GetSignBytes - implement sdk.Msg

func (ValidatorDepositMsg) GetSigners

func (msg ValidatorDepositMsg) GetSigners() []sdk.AccAddress

GetSigners - implement sdk.Msg

func (ValidatorDepositMsg) Route added in v0.2.0

func (msg ValidatorDepositMsg) Route() string

Route - implement sdk.Msg

func (ValidatorDepositMsg) String

func (msg ValidatorDepositMsg) String() string

func (ValidatorDepositMsg) Type

func (msg ValidatorDepositMsg) Type() string

Type - implement sdk.Msg

func (ValidatorDepositMsg) ValidateBasic

func (msg ValidatorDepositMsg) ValidateBasic() sdk.Error

ValidateBasic - implement sdk.Msg

type ValidatorManager

type ValidatorManager struct {
	// contains filtered or unexported fields
}

ValidatorManager - validator manager

func NewValidatorManager

func NewValidatorManager(key sdk.StoreKey, holder param.ParamHolder) ValidatorManager

func (ValidatorManager) AdjustValidatorList

func (vm ValidatorManager) AdjustValidatorList(ctx sdk.Context) sdk.Error

if any change happens in oncall validator(remove, punish), we should call this function to adjust validator list

func (ValidatorManager) Deposit

func (vm ValidatorManager) Deposit(
	ctx sdk.Context, username types.AccountKey, coin types.Coin, link string) sdk.Error

Deposit - deposit money to validator

func (ValidatorManager) DoesValidatorExist

func (vm ValidatorManager) DoesValidatorExist(ctx sdk.Context, accKey types.AccountKey) bool

DoesValidatorExist - check if validator exists in KVStore or not

func (ValidatorManager) Export added in v0.2.0

Export storage state.

func (ValidatorManager) FireIncompetentValidator

func (vm ValidatorManager) FireIncompetentValidator(
	ctx sdk.Context, byzantineValidators []abci.Evidence) (types.Coin, sdk.Error)

FireIncompetentValidator - fire oncall validator if 1) deposit insufficient 2) byzantine

func (ValidatorManager) GetInitValidators added in v0.2.0

func (vm ValidatorManager) GetInitValidators(ctx sdk.Context) ([]abci.ValidatorUpdate, sdk.Error)

GetInitValidators return all validators in state. XXX(yumin): This is intended to be used only in initChainer

func (ValidatorManager) GetValidatorDeposit

func (vm ValidatorManager) GetValidatorDeposit(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)

GetValidatorDeposit - get validator deposit

func (ValidatorManager) GetValidatorList

func (vm ValidatorManager) GetValidatorList(ctx sdk.Context) (*model.ValidatorList, sdk.Error)

GetValidatorList - get validator list from KV Store

func (ValidatorManager) GetValidatorUpdates added in v0.2.0

func (vm ValidatorManager) GetValidatorUpdates(ctx sdk.Context) ([]abci.ValidatorUpdate, sdk.Error)

GetValidatorUpdates - after a block, compare updated validator set with recorded validator set before block execution

func (ValidatorManager) Import added in v0.2.0

func (vm ValidatorManager) Import(ctx sdk.Context, tb *model.ValidatorTablesIR)

Import storage state.

func (ValidatorManager) InitGenesis

func (vm ValidatorManager) InitGenesis(ctx sdk.Context) error

InitGenesis - initialize KVStore

func (ValidatorManager) IsBalancedAccount

func (vm ValidatorManager) IsBalancedAccount(
	ctx sdk.Context, accKey types.AccountKey, votingDeposit types.Coin) bool

IsBalancedAccount - make sure voting deposit is much than committing (validator) deposit

func (ValidatorManager) IsLegalWithdraw

func (vm ValidatorManager) IsLegalWithdraw(
	ctx sdk.Context, username types.AccountKey, coin types.Coin) bool

IsLegalWithdraw - check if withdraw is legal or not

func (ValidatorManager) PunishOncallValidator

func (vm ValidatorManager) PunishOncallValidator(
	ctx sdk.Context, username types.AccountKey, penalty types.Coin, punishType types.PunishType) (types.Coin, sdk.Error)

PunishOncallValidator - punish oncall validator if 1) byzantine or 2) missing blocks reach limiation

func (ValidatorManager) PunishValidatorsDidntVote

func (vm ValidatorManager) PunishValidatorsDidntVote(
	ctx sdk.Context, penaltyList []types.AccountKey) (types.Coin, sdk.Error)

PunishValidatorsDidntVote - validators are required to vote Protocol Upgrade and Parameter Change proposal

func (ValidatorManager) RegisterValidator

func (vm ValidatorManager) RegisterValidator(
	ctx sdk.Context, username types.AccountKey, pubKey crypto.PubKey, coin types.Coin, link string) sdk.Error

RegisterValidator - register validator

func (ValidatorManager) RemoveValidatorFromAllLists

func (vm ValidatorManager) RemoveValidatorFromAllLists(ctx sdk.Context, username types.AccountKey) sdk.Error

RemoveValidatorFromAllLists - remove the user from both oncall and allValidators lists

func (ValidatorManager) SetValidatorList

func (vm ValidatorManager) SetValidatorList(ctx sdk.Context, lst *model.ValidatorList) sdk.Error

SetValidatorList - set validator list

func (ValidatorManager) TryBecomeOncallValidator

func (vm ValidatorManager) TryBecomeOncallValidator(ctx sdk.Context, username types.AccountKey) sdk.Error

TryBecomeOncallValidator - try to join the oncall validator list, the action will success if either 1. the validator list is not full or 2. someone in the validator list has a lower power than current validator

func (ValidatorManager) UpdateSigningStats added in v0.2.0

func (vm ValidatorManager) UpdateSigningStats(
	ctx sdk.Context, voteInfos []abci.VoteInfo) sdk.Error

UpdateSigningStats - based on info in beginBlocker, record last block singing info

func (ValidatorManager) ValidatorWithdraw

func (vm ValidatorManager) ValidatorWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error

ValidatorWithdraw - this method won't check if it is a legal withdraw, caller should check by itself

func (ValidatorManager) ValidatorWithdrawAll

func (vm ValidatorManager) ValidatorWithdrawAll(ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)

ValidatorWithdrawAll - revoke validator

type ValidatorRevokeMsg

type ValidatorRevokeMsg struct {
	Username types.AccountKey `json:"username"`
}

ValidatorRevokeMsg - revoke validator

func NewValidatorRevokeMsg

func NewValidatorRevokeMsg(validator string) ValidatorRevokeMsg

ValidatorRevokeMsg Msg Implementations

func (ValidatorRevokeMsg) GetConsumeAmount

func (msg ValidatorRevokeMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implement types.Msg

func (ValidatorRevokeMsg) GetPermission

func (msg ValidatorRevokeMsg) GetPermission() types.Permission

GetPermission - implement types.Msg

func (ValidatorRevokeMsg) GetSignBytes

func (msg ValidatorRevokeMsg) GetSignBytes() []byte

GetSignBytes - implement sdk.Msg

func (ValidatorRevokeMsg) GetSigners

func (msg ValidatorRevokeMsg) GetSigners() []sdk.AccAddress

GetSigners - implement sdk.Msg

func (ValidatorRevokeMsg) Route added in v0.2.0

func (msg ValidatorRevokeMsg) Route() string

Route - implement sdk.Msg

func (ValidatorRevokeMsg) String

func (msg ValidatorRevokeMsg) String() string

func (ValidatorRevokeMsg) Type

func (msg ValidatorRevokeMsg) Type() string

Type - implement sdk.Msg

func (ValidatorRevokeMsg) ValidateBasic

func (msg ValidatorRevokeMsg) ValidateBasic() sdk.Error

ValidateBasic - implement sdk.Msg

type ValidatorWithdrawMsg

type ValidatorWithdrawMsg struct {
	Username types.AccountKey `json:"username"`
	Amount   types.LNO        `json:"amount"`
}

ValidatorWithdrawMsg - withdraw validator deposit

func NewValidatorWithdrawMsg

func NewValidatorWithdrawMsg(validator string, amount types.LNO) ValidatorWithdrawMsg

ValidatorWithdrawMsg Msg Implementations

func (ValidatorWithdrawMsg) GetConsumeAmount

func (msg ValidatorWithdrawMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implement types.Msg

func (ValidatorWithdrawMsg) GetPermission

func (msg ValidatorWithdrawMsg) GetPermission() types.Permission

GetPermission - implement types.Msg

func (ValidatorWithdrawMsg) GetSignBytes

func (msg ValidatorWithdrawMsg) GetSignBytes() []byte

GetSignBytes - implement sdk.Msg

func (ValidatorWithdrawMsg) GetSigners

func (msg ValidatorWithdrawMsg) GetSigners() []sdk.AccAddress

GetSigners - implement sdk.Msg

func (ValidatorWithdrawMsg) Route added in v0.2.0

func (msg ValidatorWithdrawMsg) Route() string

Route - implement sdk.Msg

func (ValidatorWithdrawMsg) String

func (msg ValidatorWithdrawMsg) String() string

func (ValidatorWithdrawMsg) Type

func (msg ValidatorWithdrawMsg) Type() string

Type - implement sdk.Msg

func (ValidatorWithdrawMsg) ValidateBasic

func (msg ValidatorWithdrawMsg) ValidateBasic() sdk.Error

ValidateBasic - implement sdk.Msg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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