Documentation
¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func VerifyAppHashInclusion(appHash []byte, appHashRoot []byte, proof *tmcrypto.Proof) error
- type DropValidatorMsgDecorator
- type Hooks
- func (h Hooks) AfterBlsKeyRegistered(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
- func (h Hooks) AfterRawCheckpointConfirmed(ctx sdk.Context, epoch uint64) error
- func (h Hooks) AfterRawCheckpointFinalized(ctx sdk.Context, epoch uint64) error
- func (h Hooks) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
- func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error
- func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
- type Keeper
- func (k Keeper) AddSlashedValidator(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (k Keeper) AfterEpochBegins(ctx sdk.Context, epoch uint64)
- func (k Keeper) AfterEpochEnds(ctx sdk.Context, epoch uint64)
- func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) []abci.ValidatorUpdate
- func (k Keeper) ApplyMatureUnbonding(ctx sdk.Context, epochNumber uint64)
- func (k Keeper) BeforeSlashThreshold(ctx sdk.Context, valSet types.ValidatorSet)
- func (k Keeper) CheckMsgCreateValidator(ctx sdk.Context, msg *stakingtypes.MsgCreateValidator) error
- func (k Keeper) ClearSlashedValidators(ctx sdk.Context, epochNumber uint64)
- func (k Keeper) ClearValidatorSet(ctx sdk.Context, epochNumber uint64)
- func (k Keeper) CurrentEpoch(c context.Context, req *types.QueryCurrentEpochRequest) (*types.QueryCurrentEpochResponse, error)
- func (k Keeper) DelegationLifecycle(c context.Context, req *types.QueryDelegationLifecycleRequest) (*types.QueryDelegationLifecycleResponse, error)
- func (k Keeper) EnqueueMsg(ctx sdk.Context, msg types.QueuedMessage)
- func (k Keeper) EpochInfo(c context.Context, req *types.QueryEpochInfoRequest) (*types.QueryEpochInfoResponse, error)
- func (k Keeper) EpochMsgs(c context.Context, req *types.QueryEpochMsgsRequest) (*types.QueryEpochMsgsResponse, error)
- func (k Keeper) EpochValSet(c context.Context, req *types.QueryEpochValSetRequest) (*types.QueryEpochValSetResponse, error)
- func (k Keeper) EpochsInfo(c context.Context, req *types.QueryEpochsInfoRequest) (*types.QueryEpochsInfoResponse, error)
- func (k Keeper) GetAllAppHashsForEpoch(ctx sdk.Context, epoch *types.Epoch) ([][]byte, error)
- func (k Keeper) GetAppHash(ctx sdk.Context, height uint64) ([]byte, error)
- func (k Keeper) GetCurrentEpochMsgs(ctx sdk.Context) []*types.QueuedMessage
- func (k Keeper) GetCurrentQueueLength(ctx sdk.Context) uint64
- func (k Keeper) GetCurrentValidatorSet(ctx sdk.Context) types.ValidatorSet
- func (k Keeper) GetCurrentValidatorVotingPower(ctx sdk.Context, valAddr sdk.ValAddress) (int64, error)
- func (k Keeper) GetDelegationLifecycle(ctx sdk.Context, delAddr sdk.AccAddress) *types.DelegationLifecycle
- func (k Keeper) GetEpoch(ctx sdk.Context) *types.Epoch
- func (k Keeper) GetEpochMsgs(ctx sdk.Context, epochNumber uint64) []*types.QueuedMessage
- func (k Keeper) GetHistoricalEpoch(ctx sdk.Context, epochNumber uint64) (*types.Epoch, error)
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetQueueLength(ctx sdk.Context, epochNumber uint64) uint64
- func (k Keeper) GetSlashedValidators(ctx sdk.Context, epochNumber uint64) types.ValidatorSet
- func (k Keeper) GetSlashedVotingPower(ctx sdk.Context, epochNumber uint64) int64
- func (k Keeper) GetTotalVotingPower(ctx sdk.Context, epochNumber uint64) int64
- func (k Keeper) GetValLifecycle(ctx sdk.Context, valAddr sdk.ValAddress) *types.ValidatorLifecycle
- func (k Keeper) GetValidatorPubkey(ctx sdk.Context, valAddr sdk.ValAddress) (cryptotypes.PubKey, bool)
- func (k Keeper) GetValidatorSet(ctx sdk.Context, epochNumber uint64) types.ValidatorSet
- func (k Keeper) GetValidatorVotingPower(ctx sdk.Context, epochNumber uint64, valAddr sdk.ValAddress) (int64, error)
- func (k Keeper) HandleQueuedMsg(ctx sdk.Context, msg *types.QueuedMessage) (*sdk.Result, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) IncEpoch(ctx sdk.Context) types.Epoch
- func (k Keeper) InitEpoch(ctx sdk.Context)
- func (k Keeper) InitMsgQueue(ctx sdk.Context)
- func (k Keeper) InitSlashedVotingPower(ctx sdk.Context)
- func (k Keeper) InitValidatorSet(ctx sdk.Context)
- func (k Keeper) LatestEpochMsgs(c context.Context, req *types.QueryLatestEpochMsgsRequest) (*types.QueryLatestEpochMsgsResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProveAppHashInEpoch(ctx sdk.Context, height uint64, epochNumber uint64) (*tmcrypto.Proof, error)
- func (k Keeper) RecordAppHash(ctx sdk.Context)
- func (k Keeper) RecordLastHeaderAndAppHashRoot(ctx sdk.Context) error
- func (k Keeper) RecordNewDelegationState(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, ...) error
- func (k Keeper) RecordNewValState(ctx sdk.Context, valAddr sdk.ValAddress, state types.BondState) error
- func (k Keeper) RecordSealerHeaderForPrevEpoch(ctx sdk.Context) *types.Epoch
- func (k Keeper) SetDelegationLifecycle(ctx sdk.Context, delAddr sdk.AccAddress, lc *types.DelegationLifecycle)
- func (k *Keeper) SetHooks(eh types.EpochingHooks) *Keeper
- func (k *Keeper) SetMsgServiceRouter(router *baseapp.MsgServiceRouter) *Keeper
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) SetValLifecycle(ctx sdk.Context, valAddr sdk.ValAddress, lc *types.ValidatorLifecycle)
- func (k Keeper) ValidatorLifecycle(c context.Context, req *types.QueryValidatorLifecycleRequest) (*types.QueryValidatorLifecycleResponse, error)
- type Querier
Constants ¶
const (
DefaultEpochNumber = 0
)
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type DropValidatorMsgDecorator ¶
type DropValidatorMsgDecorator struct {
// contains filtered or unexported fields
}
DropValidatorMsgDecorator defines an AnteHandler decorator that rejects all messages that might change the validator set.
func NewDropValidatorMsgDecorator ¶
func NewDropValidatorMsgDecorator(ek Keeper) *DropValidatorMsgDecorator
NewDropValidatorMsgDecorator creates a new DropValidatorMsgDecorator
func (DropValidatorMsgDecorator) AnteHandle ¶
func (qmd DropValidatorMsgDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle performs an AnteHandler check that rejects all non-wrapped validator-related messages. It will reject the following types of messages: - MsgCreateValidator - MsgDelegate - MsgUndelegate - MsgBeginRedelegate TODO (non-urgent): after we bump to Cosmos SDK v0.46, add MsgCancelUnbondingDelegation
func (DropValidatorMsgDecorator) IsValidatorRelatedMsg ¶
func (qmd DropValidatorMsgDecorator) IsValidatorRelatedMsg(msg sdk.Msg) bool
IsValidatorRelatedMsg checks if the given message is of non-wrapped type, which should be rejected
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Wrapper struct
func (Hooks) AfterBlsKeyRegistered ¶
func (Hooks) AfterDelegationModified ¶
func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterRawCheckpointBlsSigVerified ¶
func (h Hooks) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
func (Hooks) AfterRawCheckpointConfirmed ¶
func (Hooks) AfterRawCheckpointFinalized ¶
func (Hooks) AfterRawCheckpointForgotten ¶
func (h Hooks) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
func (Hooks) AfterUnbondingInitiated ¶ added in v0.6.0
func (Hooks) AfterValidatorBeginUnbonding ¶
func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorBonded ¶
func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) AfterValidatorCreated ¶
func (Hooks) AfterValidatorRemoved ¶
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationCreated ¶
func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationRemoved ¶
func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeDelegationSharesModified ¶
func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error
func (Hooks) BeforeValidatorModified ¶
Other hooks that are not used in the epoching module
func (Hooks) BeforeValidatorSlashed ¶
func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error
BeforeValidatorSlashed records the slash event
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, bk types.BankKeeper, stk types.StakingKeeper, authority string, ) Keeper
func (Keeper) AddSlashedValidator ¶
AddSlashedValidator adds a slashed validator to the set of the current epoch This is called upon hook `BeforeValidatorSlashed` exposed by the staking module
func (Keeper) AfterEpochBegins ¶
AfterEpochBegins - call hook if registered
func (Keeper) AfterEpochEnds ¶
AfterEpochEnds - call hook if registered
func (Keeper) ApplyAndReturnValidatorSetUpdates ¶
func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) []abci.ValidatorUpdate
ApplyAndReturnValidatorSetUpdates applies and return accumulated updates to the bonded validator set, including * Updates the active validator set as keyed by LastValidatorPowerKey. * Updates the total power as keyed by LastTotalPowerKey. * Updates validator status' according to updated powers. * Updates the fee pool bonded vs not-bonded tokens. * Updates relevant indices. Triggered upon every epoch. (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/x/staking/keeper/val_state_change.go#L18-L30)
func (Keeper) ApplyMatureUnbonding ¶
ApplyMatureUnbonding - unbonds all mature validators/delegations, and - finishes all mature redelegations in the corresponding queues, where - an unbonding/redelegation becomes mature when its corresponding epoch and all previous epochs have been checkpointed. Triggered by the checkpointing module upon the above condition. (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/x/staking/keeper/val_state_change.go#L32-L91)
func (Keeper) BeforeSlashThreshold ¶
func (k Keeper) BeforeSlashThreshold(ctx sdk.Context, valSet types.ValidatorSet)
BeforeSlashThreshold triggers the BeforeSlashThreshold hook for other modules that register this hook
func (Keeper) CheckMsgCreateValidator ¶ added in v0.6.0
func (k Keeper) CheckMsgCreateValidator(ctx sdk.Context, msg *stakingtypes.MsgCreateValidator) error
CheckMsgCreateValidator performs checks on a given `MsgCreateValidator` message The checkpointing module will use this function to verify the `MsgCreateValidator` message inside a `MsgWrappedCreateValidator` message. (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.46.10/x/staking/keeper/msg_server.go#L34-L108)
func (Keeper) ClearSlashedValidators ¶
ClearSlashedValidators removes all slashed validators in the set TODO: This is called upon the epoch is checkpointed
func (Keeper) ClearValidatorSet ¶
ClearValidatorSet removes the validator set of a given epoch TODO: This is called upon the epoch is checkpointed
func (Keeper) CurrentEpoch ¶
func (k Keeper) CurrentEpoch(c context.Context, req *types.QueryCurrentEpochRequest) (*types.QueryCurrentEpochResponse, error)
CurrentEpoch handles the QueryCurrentEpochRequest query
func (Keeper) DelegationLifecycle ¶
func (k Keeper) DelegationLifecycle(c context.Context, req *types.QueryDelegationLifecycleRequest) (*types.QueryDelegationLifecycleResponse, error)
DelegationLifecycle handles the QueryDelegationLifecycleRequest query TODO: test this API
func (Keeper) EnqueueMsg ¶
func (k Keeper) EnqueueMsg(ctx sdk.Context, msg types.QueuedMessage)
EnqueueMsg enqueues a message to the queue of the current epoch
func (Keeper) EpochInfo ¶
func (k Keeper) EpochInfo(c context.Context, req *types.QueryEpochInfoRequest) (*types.QueryEpochInfoResponse, error)
EpochInfo handles the QueryEpochInfoRequest query
func (Keeper) EpochMsgs ¶
func (k Keeper) EpochMsgs(c context.Context, req *types.QueryEpochMsgsRequest) (*types.QueryEpochMsgsResponse, error)
EpochMsgs handles the QueryEpochMsgsRequest query
func (Keeper) EpochValSet ¶
func (k Keeper) EpochValSet(c context.Context, req *types.QueryEpochValSetRequest) (*types.QueryEpochValSetResponse, error)
func (Keeper) EpochsInfo ¶
func (k Keeper) EpochsInfo(c context.Context, req *types.QueryEpochsInfoRequest) (*types.QueryEpochsInfoResponse, error)
EpochsInfo handles the QueryEpochsInfoRequest query
func (Keeper) GetAllAppHashsForEpoch ¶
GetAllAppHashsForEpoch fetches all AppHashs in the given epoch
func (Keeper) GetAppHash ¶
GetAppHash gets the AppHash of the header at the given height
func (Keeper) GetCurrentEpochMsgs ¶
func (k Keeper) GetCurrentEpochMsgs(ctx sdk.Context) []*types.QueuedMessage
GetCurrentEpochMsgs returns the set of messages queued in the current epoch
func (Keeper) GetCurrentQueueLength ¶
GetQueueLength fetches the number of queued messages of the current epoch
func (Keeper) GetCurrentValidatorSet ¶
func (k Keeper) GetCurrentValidatorSet(ctx sdk.Context) types.ValidatorSet
func (Keeper) GetCurrentValidatorVotingPower ¶
func (Keeper) GetDelegationLifecycle ¶
func (k Keeper) GetDelegationLifecycle(ctx sdk.Context, delAddr sdk.AccAddress) *types.DelegationLifecycle
func (Keeper) GetEpochMsgs ¶
GetEpochMsgs returns the set of messages queued in a given epoch
func (Keeper) GetHistoricalEpoch ¶
func (Keeper) GetQueueLength ¶
GetQueueLength fetches the number of queued messages of a given epoch
func (Keeper) GetSlashedValidators ¶
GetSlashedValidators returns the set of slashed validators of a given epoch
func (Keeper) GetSlashedVotingPower ¶
GetSlashedVotingPower fetches the amount of slashed voting power of a given epoch
func (Keeper) GetTotalVotingPower ¶
GetTotalVotingPower returns the total voting power of a given epoch
func (Keeper) GetValLifecycle ¶
func (k Keeper) GetValLifecycle(ctx sdk.Context, valAddr sdk.ValAddress) *types.ValidatorLifecycle
func (Keeper) GetValidatorPubkey ¶
func (k Keeper) GetValidatorPubkey(ctx sdk.Context, valAddr sdk.ValAddress) (cryptotypes.PubKey, bool)
func (Keeper) GetValidatorSet ¶
GetValidatorSet returns the set of validators of a given epoch, where the validators are ordered by their address in ascending order
func (Keeper) GetValidatorVotingPower ¶
func (k Keeper) GetValidatorVotingPower(ctx sdk.Context, epochNumber uint64, valAddr sdk.ValAddress) (int64, error)
GetValidatorVotingPower returns the voting power of a given validator in a given epoch
func (Keeper) HandleQueuedMsg ¶
HandleQueuedMsg unwraps a QueuedMessage and forwards it to the staking module
func (Keeper) IncEpoch ¶
IncEpoch adds epoch number by 1 CONTRACT: can only be invoked at the first block of an epoch
func (Keeper) InitMsgQueue ¶
InitMsgQueue initialises the msg queue length of the current epoch to 0
func (Keeper) InitSlashedVotingPower ¶
InitSlashedVotingPower sets the slashed voting power of the current epoch to 0 This is called upon initialising the genesis state and upon a new epoch
func (Keeper) InitValidatorSet ¶
InitValidatorSet stores the validator set in the beginning of the current epoch This is called upon BeginBlock
func (Keeper) LatestEpochMsgs ¶
func (k Keeper) LatestEpochMsgs(c context.Context, req *types.QueryLatestEpochMsgsRequest) (*types.QueryLatestEpochMsgsResponse, error)
LatestEpochMsgs handles the QueryLatestEpochMsgsRequest query TODO: test this API
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) ProveAppHashInEpoch ¶
func (k Keeper) ProveAppHashInEpoch(ctx sdk.Context, height uint64, epochNumber uint64) (*tmcrypto.Proof, error)
ProveAppHashInEpoch generates a proof that the given appHash is in a given epoch
func (Keeper) RecordAppHash ¶
RecordAppHash stores the AppHash of the current header to KVStore
func (Keeper) RecordLastHeaderAndAppHashRoot ¶
RecordLastHeaderAndAppHashRoot records the last header and Merkle root of all AppHashs for the current epoch, and stores the epoch metadata to KVStore
func (Keeper) RecordNewDelegationState ¶
func (k Keeper) RecordNewDelegationState(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, state types.BondState) error
RecordNewDelegationState adds a state for a delegation lifecycle, including created, bonded, unbonding and unbonded
func (Keeper) RecordNewValState ¶
func (k Keeper) RecordNewValState(ctx sdk.Context, valAddr sdk.ValAddress, state types.BondState) error
RecordNewValState adds a state for a validator lifecycle, including bonded, unbonding and unbonded
func (Keeper) RecordSealerHeaderForPrevEpoch ¶
RecordSealerHeaderForPrevEpoch records the sealer header for the previous epoch, where the sealer header of an epoch is the 2nd header of the next epoch This validator set of the epoch has generated a BLS multisig on `last_commit_hash` of the sealer header
func (Keeper) SetDelegationLifecycle ¶
func (k Keeper) SetDelegationLifecycle(ctx sdk.Context, delAddr sdk.AccAddress, lc *types.DelegationLifecycle)
func (*Keeper) SetHooks ¶
func (k *Keeper) SetHooks(eh types.EpochingHooks) *Keeper
SetHooks sets the validator hooks
func (*Keeper) SetMsgServiceRouter ¶
func (k *Keeper) SetMsgServiceRouter(router *baseapp.MsgServiceRouter) *Keeper
SetMsgServiceRouter sets the msgServiceRouter
func (Keeper) SetParams ¶
GetParams get all parameters as types.Params SetParams sets the x/epoching module parameters.
func (Keeper) SetValLifecycle ¶
func (k Keeper) SetValLifecycle(ctx sdk.Context, valAddr sdk.ValAddress, lc *types.ValidatorLifecycle)
func (Keeper) ValidatorLifecycle ¶
func (k Keeper) ValidatorLifecycle(c context.Context, req *types.QueryValidatorLifecycleRequest) (*types.QueryValidatorLifecycleResponse, error)
ValidatorLifecycle handles the QueryValidatorLifecycleRequest query TODO: test this API