types

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

	// StoreKey is the store key string for bor
	StoreKey = ModuleName

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

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

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	// DefaultValPower default validator power
	DefaultValPower = 10
)
View Source
const (
	QueryCurrentValidatorSet  = "current-validator-set"
	QuerySigner               = "signer"
	QueryValidator            = "validator"
	QueryValidatorStatus      = "validator-status"
	QueryProposer             = "proposer"
	QueryTotalValidatorPower  = "total-val-power"
	QueryCurrentProposer      = "current-proposer"
	QueryProposerBonusPercent = "proposer-bonus-percent"
	QueryStakingSequence      = "staking-sequence"
	QueryMilestoneProposer    = "milestone-proposer"
)

query endpoints supported by the staking Querier

View Source
const (

	// DefaultProposerBonusPercent - Proposer Signer Reward Ratio
	DefaultProposerBonusPercent = int64(10)
)

Variables

View Source
var (
	EventTypeNewProposer   = "new-proposer"
	EventTypeValidatorJoin = "validator-join"
	EventTypeSignerUpdate  = "signer-update"
	EventTypeStakeUpdate   = "stake-update"
	EventTypeValidatorExit = "validator-exit"

	AttributeKeySigner            = "signer"
	AttributeKeyDeactivationEpoch = "deactivation-epoch"
	AttributeKeyActivationEpoch   = "activation-epoch"
	AttributeKeyValidatorID       = "validator-id"
	AttributeKeyValidatorNonce    = "validator-nonce"
	AttributeKeyUpdatedAt         = "updated-at"

	AttributeValueCategory = ModuleName
)

Checkpoint tags

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

View Source
var ParamStoreKeyProposerBonusPercent = []byte("proposerbonuspercent")

ParamStoreKeyProposerBonusPercent - Store's Key for Reward amount

Functions

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable type declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SetGenesisStateToAppState

func SetGenesisStateToAppState(appState map[string]json.RawMessage, validators []*hmTypes.Validator, currentValSet hmTypes.ValidatorSet) (map[string]json.RawMessage, error)

SetGenesisStateToAppState sets state into app state

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of bor genesis data returning an error for any failed validation criteria.

Types

type GenesisState

type GenesisState struct {
	Validators       []*hmTypes.Validator `json:"validators" yaml:"validators"`
	CurrentValSet    hmTypes.ValidatorSet `json:"current_val_set" yaml:"current_val_set"`
	StakingSequences []string             `json:"staking_sequences" yaml:"staking_sequences"`
}

GenesisState is the checkpoint state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(appState map[string]json.RawMessage) GenesisState

GetGenesisStateFromAppState returns staking GenesisState given raw application genesis state

func NewGenesisState

func NewGenesisState(
	validators []*hmTypes.Validator,
	currentValSet hmTypes.ValidatorSet,
	stakingSequences []string,
) GenesisState

NewGenesisState creates a new genesis state.

type GenesisValidator

type GenesisValidator struct {
	ID         hmTypes.ValidatorID     `json:"id"`
	StartEpoch uint64                  `json:"start_epoch"`
	EndEpoch   uint64                  `json:"end_epoch"`
	Nonce      uint64                  `json:"nonce"`
	Power      uint64                  `json:"power"` // aka Amount
	PubKey     hmTypes.PubKey          `json:"pub_key"`
	Signer     hmTypes.HeimdallAddress `json:"signer"`
}

GenesisValidator genesis validator

func (*GenesisValidator) HeimdallValidator

func (v *GenesisValidator) HeimdallValidator() hmTypes.Validator

HeimdallValidator converts genesis validator validator to Heimdall validator

type MsgSignerUpdate

type MsgSignerUpdate struct {
	From            hmTypes.HeimdallAddress `json:"from"`
	ID              hmTypes.ValidatorID     `json:"id"`
	NewSignerPubKey hmTypes.PubKey          `json:"pubKey"`
	TxHash          hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex        uint64                  `json:"log_index"`
	BlockNumber     uint64                  `json:"block_number"`
	Nonce           uint64                  `json:"nonce"`
}

MsgSignerUpdate signer update struct TODO add old signer sig check

func NewMsgSignerUpdate

func NewMsgSignerUpdate(
	from hmTypes.HeimdallAddress,
	id uint64,
	pubKey hmTypes.PubKey,
	txhash hmTypes.HeimdallHash,
	logIndex uint64,
	blockNumber uint64,
	nonce uint64,
) MsgSignerUpdate

func (MsgSignerUpdate) GetLogIndex

func (msg MsgSignerUpdate) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgSignerUpdate) GetNonce added in v0.1.7

func (msg MsgSignerUpdate) GetNonce() uint64

GetNonce Returns nonce

func (MsgSignerUpdate) GetSideSignBytes added in v0.1.7

func (msg MsgSignerUpdate) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgSignerUpdate) GetSignBytes

func (msg MsgSignerUpdate) GetSignBytes() []byte

func (MsgSignerUpdate) GetSigners

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

func (MsgSignerUpdate) GetTxHash

func (msg MsgSignerUpdate) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgSignerUpdate) Route

func (msg MsgSignerUpdate) Route() string

func (MsgSignerUpdate) Type

func (msg MsgSignerUpdate) Type() string

func (MsgSignerUpdate) ValidateBasic

func (msg MsgSignerUpdate) ValidateBasic() sdk.Error

type MsgStakeUpdate

type MsgStakeUpdate struct {
	From        hmTypes.HeimdallAddress `json:"from"`
	ID          hmTypes.ValidatorID     `json:"id"`
	NewAmount   sdk.Int                 `json:"amount"`
	TxHash      hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex    uint64                  `json:"log_index"`
	BlockNumber uint64                  `json:"block_number"`
	Nonce       uint64                  `json:"nonce"`
}

MsgStakeUpdate represents stake update

func NewMsgStakeUpdate

func NewMsgStakeUpdate(from hmTypes.HeimdallAddress, id uint64, newAmount sdk.Int, txhash hmTypes.HeimdallHash, logIndex uint64, blockNumber uint64, nonce uint64) MsgStakeUpdate

NewMsgStakeUpdate represents stake update

func (MsgStakeUpdate) GetLogIndex

func (msg MsgStakeUpdate) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgStakeUpdate) GetNonce added in v0.1.7

func (msg MsgStakeUpdate) GetNonce() uint64

GetNonce Returns nonce

func (MsgStakeUpdate) GetSideSignBytes added in v0.1.7

func (msg MsgStakeUpdate) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgStakeUpdate) GetSignBytes

func (msg MsgStakeUpdate) GetSignBytes() []byte

func (MsgStakeUpdate) GetSigners

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

func (MsgStakeUpdate) GetTxHash

func (msg MsgStakeUpdate) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgStakeUpdate) Route

func (msg MsgStakeUpdate) Route() string

func (MsgStakeUpdate) Type

func (msg MsgStakeUpdate) Type() string

func (MsgStakeUpdate) ValidateBasic

func (msg MsgStakeUpdate) ValidateBasic() sdk.Error

type MsgValidatorExit

type MsgValidatorExit struct {
	From              hmTypes.HeimdallAddress `json:"from"`
	ID                hmTypes.ValidatorID     `json:"id"`
	DeactivationEpoch uint64                  `json:"deactivationEpoch"`
	TxHash            hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex          uint64                  `json:"log_index"`
	BlockNumber       uint64                  `json:"block_number"`
	Nonce             uint64                  `json:"nonce"`
}

func NewMsgValidatorExit

func NewMsgValidatorExit(from hmTypes.HeimdallAddress, id uint64, deactivationEpoch uint64, txhash hmTypes.HeimdallHash, logIndex uint64, blockNumber uint64, nonce uint64) MsgValidatorExit

func (MsgValidatorExit) GetLogIndex

func (msg MsgValidatorExit) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgValidatorExit) GetNonce added in v0.1.7

func (msg MsgValidatorExit) GetNonce() uint64

GetNonce Returns nonce

func (MsgValidatorExit) GetSideSignBytes added in v0.1.7

func (msg MsgValidatorExit) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgValidatorExit) GetSignBytes

func (msg MsgValidatorExit) GetSignBytes() []byte

func (MsgValidatorExit) GetSigners

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

func (MsgValidatorExit) GetTxHash

func (msg MsgValidatorExit) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgValidatorExit) Route

func (msg MsgValidatorExit) Route() string

func (MsgValidatorExit) Type

func (msg MsgValidatorExit) Type() string

func (MsgValidatorExit) ValidateBasic

func (msg MsgValidatorExit) ValidateBasic() sdk.Error

type MsgValidatorJoin

type MsgValidatorJoin struct {
	From            hmTypes.HeimdallAddress `json:"from"`
	ID              hmTypes.ValidatorID     `json:"id"`
	ActivationEpoch uint64                  `json:"activationEpoch"`
	Amount          sdk.Int                 `json:"amount"`
	SignerPubKey    hmTypes.PubKey          `json:"pub_key"`
	TxHash          hmTypes.HeimdallHash    `json:"tx_hash"`
	LogIndex        uint64                  `json:"log_index"`
	BlockNumber     uint64                  `json:"block_number"`
	Nonce           uint64                  `json:"nonce"`
}

func NewMsgValidatorJoin

func NewMsgValidatorJoin(
	from hmTypes.HeimdallAddress,
	id uint64,
	activationEpoch uint64,
	amount sdk.Int,
	pubkey hmTypes.PubKey,
	txhash hmTypes.HeimdallHash,
	logIndex uint64,
	blockNumber uint64,
	nonce uint64,
) MsgValidatorJoin

NewMsgValidatorJoin creates new validator-join

func (MsgValidatorJoin) GetLogIndex

func (msg MsgValidatorJoin) GetLogIndex() uint64

GetLogIndex Returns log index

func (MsgValidatorJoin) GetNonce added in v0.1.7

func (msg MsgValidatorJoin) GetNonce() uint64

GetNonce Returns nonce

func (MsgValidatorJoin) GetSideSignBytes added in v0.1.7

func (msg MsgValidatorJoin) GetSideSignBytes() []byte

GetSideSignBytes returns side sign bytes

func (MsgValidatorJoin) GetSignBytes

func (msg MsgValidatorJoin) GetSignBytes() []byte

func (MsgValidatorJoin) GetSigners

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

func (MsgValidatorJoin) GetTxHash

func (msg MsgValidatorJoin) GetTxHash() types.HeimdallHash

GetTxHash Returns tx hash

func (MsgValidatorJoin) Route

func (msg MsgValidatorJoin) Route() string

func (MsgValidatorJoin) Type

func (msg MsgValidatorJoin) Type() string

func (MsgValidatorJoin) ValidateBasic

func (msg MsgValidatorJoin) ValidateBasic() sdk.Error

type QueryProposerParams

type QueryProposerParams struct {
	Times uint64 `json:"times"`
}

QueryProposerParams defines the params for querying val status.

func NewQueryProposerParams

func NewQueryProposerParams(times uint64) QueryProposerParams

NewQueryProposerParams creates a new instance of QueryProposerParams.

type QuerySignerParams

type QuerySignerParams struct {
	SignerAddress []byte `json:"signer_address"`
}

QuerySignerParams defines the params for querying by address

func NewQuerySignerParams

func NewQuerySignerParams(signerAddress []byte) QuerySignerParams

NewQuerySignerParams creates a new instance of QuerySignerParams.

type QueryStakingSequenceParams added in v0.1.5

type QueryStakingSequenceParams struct {
	TxHash   string
	LogIndex uint64
}

QueryStakingSequenceParams defines the params for querying an account Sequence.

func NewQueryStakingSequenceParams added in v0.1.5

func NewQueryStakingSequenceParams(txHash string, logIndex uint64) QueryStakingSequenceParams

NewQueryStakingSequenceParams creates a new instance of QueryStakingSequenceParams.

type QueryValidatorParams

type QueryValidatorParams struct {
	ValidatorID types.ValidatorID `json:"validator_id"`
}

QueryValidatorParams defines the params for querying val status.

func NewQueryValidatorParams

func NewQueryValidatorParams(validatorID types.ValidatorID) QueryValidatorParams

NewQueryValidatorParams creates a new instance of QueryValidatorParams.

type QueryValidatorStatusParams

type QueryValidatorStatusParams struct {
	SignerAddress []byte
}

QueryValidatorStatusParams defines the params for querying val status.

func NewQueryValidatorStatusParams

func NewQueryValidatorStatusParams(signerAddress []byte) QueryValidatorStatusParams

NewQueryValidatorStatusParams creates a new instance of QueryValidatorStatusParams.

Jump to

Keyboard shortcuts

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