validator

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestAccountKVStoreKey   = sdk.NewKVStoreKey("account")
	TestValidatorKVStoreKey = sdk.NewKVStoreKey("validator")
	TestGlobalKVStoreKey    = sdk.NewKVStoreKey("global")
	TestVoteKVStoreKey      = sdk.NewKVStoreKey("vote")
	TestParamKVStoreKey     = sdk.NewKVStoreKey("param")
)

Functions

func BeginBlocker

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

func ErrAccountNotFound

func ErrAccountNotFound() sdk.Error

func ErrIllegalWithdraw

func ErrIllegalWithdraw() sdk.Error

func ErrInsufficientDeposit

func ErrInsufficientDeposit() sdk.Error

func ErrInvalidCoin

func ErrInvalidCoin() sdk.Error

func ErrInvalidUsername

func ErrInvalidUsername() sdk.Error

func ErrInvalidWebsite

func ErrInvalidWebsite() sdk.Error

func ErrUnbalancedAccount

func ErrUnbalancedAccount() sdk.Error

func ErrValidatorPubKeyAlreadyExist

func ErrValidatorPubKeyAlreadyExist() sdk.Error

func FindAccountInList

func FindAccountInList(me types.AccountKey, lst []types.AccountKey) int

func InitGlobalManager

func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error

func NewHandler

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

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"`
}

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

Implements Msg.

func (ValidatorDepositMsg) GetPermission

func (msg ValidatorDepositMsg) GetPermission() types.Permission

func (ValidatorDepositMsg) GetSignBytes

func (msg ValidatorDepositMsg) GetSignBytes() []byte

func (ValidatorDepositMsg) GetSigners

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

func (ValidatorDepositMsg) String

func (msg ValidatorDepositMsg) String() string

func (ValidatorDepositMsg) Type

func (msg ValidatorDepositMsg) Type() string

func (ValidatorDepositMsg) ValidateBasic

func (msg ValidatorDepositMsg) ValidateBasic() sdk.Error

type ValidatorManager

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

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

func (ValidatorManager) DoesValidatorExist

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

func (ValidatorManager) FireIncompetentValidator

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

func (ValidatorManager) GetUpdateValidatorList

func (vm ValidatorManager) GetUpdateValidatorList(ctx sdk.Context) ([]abci.Validator, sdk.Error)

func (ValidatorManager) GetValidatorDeposit

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

func (ValidatorManager) GetValidatorList

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

func (ValidatorManager) InitGenesis

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

func (ValidatorManager) IsBalancedAccount

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

func (ValidatorManager) IsLegalWithdraw

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

func (ValidatorManager) PunishOncallValidator

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

func (ValidatorManager) PunishValidatorsDidntVote

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

func (ValidatorManager) RegisterValidator

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

func (ValidatorManager) RemoveValidatorFromAllLists

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

remove the user from both oncall and allValidators lists

func (ValidatorManager) SetValidatorList

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

func (ValidatorManager) TryBecomeOncallValidator

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

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) UpdateSigningValidator

func (vm ValidatorManager) UpdateSigningValidator(
	ctx sdk.Context, signingValidators []abci.SigningValidator) sdk.Error

func (ValidatorManager) ValidatorWithdraw

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

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)

type ValidatorRevokeMsg

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

func NewValidatorRevokeMsg

func NewValidatorRevokeMsg(validator string) ValidatorRevokeMsg

ValidatorRevokeMsg Msg Implementations

func (ValidatorRevokeMsg) GetConsumeAmount

func (msg ValidatorRevokeMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (ValidatorRevokeMsg) GetPermission

func (msg ValidatorRevokeMsg) GetPermission() types.Permission

func (ValidatorRevokeMsg) GetSignBytes

func (msg ValidatorRevokeMsg) GetSignBytes() []byte

func (ValidatorRevokeMsg) GetSigners

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

func (ValidatorRevokeMsg) String

func (msg ValidatorRevokeMsg) String() string

func (ValidatorRevokeMsg) Type

func (msg ValidatorRevokeMsg) Type() string

func (ValidatorRevokeMsg) ValidateBasic

func (msg ValidatorRevokeMsg) ValidateBasic() sdk.Error

type ValidatorWithdrawMsg

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

func NewValidatorWithdrawMsg

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

ValidatorWithdrawMsg Msg Implementations

func (ValidatorWithdrawMsg) GetConsumeAmount

func (msg ValidatorWithdrawMsg) GetConsumeAmount() types.Coin

Implements Msg.

func (ValidatorWithdrawMsg) GetPermission

func (msg ValidatorWithdrawMsg) GetPermission() types.Permission

func (ValidatorWithdrawMsg) GetSignBytes

func (msg ValidatorWithdrawMsg) GetSignBytes() []byte

func (ValidatorWithdrawMsg) GetSigners

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

func (ValidatorWithdrawMsg) String

func (msg ValidatorWithdrawMsg) String() string

func (ValidatorWithdrawMsg) Type

func (msg ValidatorWithdrawMsg) Type() string

func (ValidatorWithdrawMsg) ValidateBasic

func (msg ValidatorWithdrawMsg) ValidateBasic() sdk.Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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