Documentation ¶
Index ¶
- Constants
- func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, vm ValidatorManager) (panelty types.Coin)
- func ErrAccountNotFound() sdk.Error
- func ErrIllegalWithdraw() sdk.Error
- func ErrInsufficientDeposit() sdk.Error
- func ErrInvalidCoin() sdk.Error
- func ErrInvalidUsername() sdk.Error
- func ErrInvalidWebsite() sdk.Error
- func ErrQueryFailed() sdk.Error
- func ErrUnbalancedAccount() sdk.Error
- func ErrValidatorPubKeyAlreadyExist() sdk.Error
- func NewHandler(am acc.AccountManager, valManager ValidatorManager, ...) sdk.Handler
- func NewQuerier(vm ValidatorManager) sdk.Querier
- func RegisterWire(cdc *wire.Codec)
- type ValidatorDepositMsg
- func (msg ValidatorDepositMsg) GetConsumeAmount() types.Coin
- func (msg ValidatorDepositMsg) GetPermission() types.Permission
- func (msg ValidatorDepositMsg) GetSignBytes() []byte
- func (msg ValidatorDepositMsg) GetSigners() []sdk.AccAddress
- func (msg ValidatorDepositMsg) Route() string
- func (msg ValidatorDepositMsg) String() string
- func (msg ValidatorDepositMsg) Type() string
- func (msg ValidatorDepositMsg) ValidateBasic() sdk.Error
- type ValidatorManager
- func (vm ValidatorManager) AdjustValidatorList(ctx sdk.Context) sdk.Error
- func (vm ValidatorManager) Deposit(ctx sdk.Context, username types.AccountKey, coin types.Coin, link string) sdk.Error
- func (vm ValidatorManager) DoesValidatorExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (vm ValidatorManager) Export(ctx sdk.Context) *model.ValidatorTables
- func (vm ValidatorManager) FireIncompetentValidator(ctx sdk.Context, byzantineValidators []abci.Evidence) (types.Coin, sdk.Error)
- func (vm ValidatorManager) GetInitValidators(ctx sdk.Context) ([]abci.ValidatorUpdate, sdk.Error)
- func (vm ValidatorManager) GetValidatorDeposit(ctx sdk.Context, accKey types.AccountKey) (types.Coin, sdk.Error)
- func (vm ValidatorManager) GetValidatorList(ctx sdk.Context) (*model.ValidatorList, sdk.Error)
- func (vm ValidatorManager) GetValidatorUpdates(ctx sdk.Context) ([]abci.ValidatorUpdate, sdk.Error)
- func (vm ValidatorManager) Import(ctx sdk.Context, tb *model.ValidatorTablesIR)
- func (vm ValidatorManager) InitGenesis(ctx sdk.Context) error
- func (vm ValidatorManager) IsBalancedAccount(ctx sdk.Context, accKey types.AccountKey, votingDeposit types.Coin) bool
- func (vm ValidatorManager) IsLegalWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) bool
- func (vm ValidatorManager) PunishOncallValidator(ctx sdk.Context, username types.AccountKey, penalty types.Coin, ...) (types.Coin, sdk.Error)
- func (vm ValidatorManager) PunishValidatorsDidntVote(ctx sdk.Context, penaltyList []types.AccountKey) (types.Coin, sdk.Error)
- func (vm ValidatorManager) RegisterValidator(ctx sdk.Context, username types.AccountKey, pubKey crypto.PubKey, ...) sdk.Error
- func (vm ValidatorManager) RemoveValidatorFromAllLists(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (vm ValidatorManager) SetValidatorList(ctx sdk.Context, lst *model.ValidatorList) sdk.Error
- func (vm ValidatorManager) TryBecomeOncallValidator(ctx sdk.Context, username types.AccountKey) sdk.Error
- func (vm ValidatorManager) UpdateSigningStats(ctx sdk.Context, voteInfos []abci.VoteInfo) sdk.Error
- func (vm ValidatorManager) ValidatorWithdraw(ctx sdk.Context, username types.AccountKey, coin types.Coin) sdk.Error
- func (vm ValidatorManager) ValidatorWithdrawAll(ctx sdk.Context, username types.AccountKey) (types.Coin, sdk.Error)
- type ValidatorRevokeMsg
- func (msg ValidatorRevokeMsg) GetConsumeAmount() types.Coin
- func (msg ValidatorRevokeMsg) GetPermission() types.Permission
- func (msg ValidatorRevokeMsg) GetSignBytes() []byte
- func (msg ValidatorRevokeMsg) GetSigners() []sdk.AccAddress
- func (msg ValidatorRevokeMsg) Route() string
- func (msg ValidatorRevokeMsg) String() string
- func (msg ValidatorRevokeMsg) Type() string
- func (msg ValidatorRevokeMsg) ValidateBasic() sdk.Error
- type ValidatorWithdrawMsg
- func (msg ValidatorWithdrawMsg) GetConsumeAmount() types.Coin
- func (msg ValidatorWithdrawMsg) GetPermission() types.Permission
- func (msg ValidatorWithdrawMsg) GetSignBytes() []byte
- func (msg ValidatorWithdrawMsg) GetSigners() []sdk.AccAddress
- func (msg ValidatorWithdrawMsg) Route() string
- func (msg ValidatorWithdrawMsg) String() string
- func (msg ValidatorWithdrawMsg) Type() string
- func (msg ValidatorWithdrawMsg) ValidateBasic() sdk.Error
Constants ¶
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 ¶
ErrAccountNotFound - error when account is not found
func ErrIllegalWithdraw ¶
ErrIllegalWithdraw - error if withdraw less than minimum withdraw requirement
func ErrInsufficientDeposit ¶
ErrInsufficientDeposit - error when deposit is insufficient
func ErrInvalidCoin ¶
ErrInvalidCoin - error if coin in msg is invalid
func ErrInvalidUsername ¶
ErrInvalidUsername - error if username is invalid
func ErrInvalidWebsite ¶
ErrInvalidWebsite - error if website is invalid
func ErrQueryFailed ¶ added in v0.2.0
ErrQueryFailed - error when query validator store failed
func ErrUnbalancedAccount ¶
ErrInsufficientDeposit - error if required voting deposit less than committing deposit
func ErrValidatorPubKeyAlreadyExist ¶
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
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
func (vm ValidatorManager) Export(ctx sdk.Context) *model.ValidatorTables
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