keeper

package
v1.6.0-rc02 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	ps paramtypes.Subspace,
) *Keeper

func (Keeper) DeleteHistoricalInfo

func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64)

DeleteHistoricalInfo deletes the historical info at a given height

func (Keeper) DeleteSequencer

func (k Keeper) DeleteSequencer(ctx sdk.Context, sequencer stakingtypes.Validator)

delete the main record holding sequencer details

func (*Keeper) ExportGenesis

func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the sequencers module's exported genesis.

func (Keeper) GetAllHistoricalInfo

func (k Keeper) GetAllHistoricalInfo(ctx sdk.Context) []stakingtypes.HistoricalInfo

GetAllHistoricalInfo returns all stored HistoricalInfo objects.

func (Keeper) GetAllSequencers

func (k Keeper) GetAllSequencers(ctx sdk.Context) (sequencers []stakingtypes.Validator)

get the set of all sequencers with no limits, used during genesis dump

func (Keeper) GetHistoricalInfo

func (k Keeper) GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)

GetHistoricalInfo gets the historical info at a given height

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of sequencers parameters.

func (Keeper) GetSequencer

func (k Keeper) GetSequencer(ctx sdk.Context, addr sdk.ValAddress) (sequencer stakingtypes.Validator, found bool)
--------------------------------- GETTERS --------------------------------

get a single sequencer

func (Keeper) GetSequencerByConsAddr

func (k Keeper) GetSequencerByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (sequencer stakingtypes.Validator, found bool)

get a single sequencer by consensus address

func (Keeper) GetValidatorByConsAddr

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool)
---------------------------------- alias ---------------------------------

get a single validator by consensus address

func (Keeper) HistoricalEntries

func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32)

HistoricalEntries = number of historical info entries to persist in store

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) []abci.ValidatorUpdate

InitGenesis initializes the sequencers module's state from a provided genesis state. We return the for ValidatorUpdate only the sequencers set by dymint

func (Keeper) IterateHistoricalInfo

func (k Keeper) IterateHistoricalInfo(ctx sdk.Context, cb func(stakingtypes.HistoricalInfo) bool)

IterateHistoricalInfo provides an interator over all stored HistoricalInfo

objects. For each HistoricalInfo object, cb will be called. If the cb returns

true, the iterator will close and stop.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) SetDymintSequencers

func (k Keeper) SetDymintSequencers(ctx sdk.Context, sequencers []abci.ValidatorUpdate)

SetDymintSequencers sets the sequencers set by dymint on InitChain. As currently we're using the abci InitChain, there are 2 obstacles we need to face, unlike when creating a validator: 1. InitChain expected the validatorUpdate it gets in return to be the same as it sends 2. We need someway to set the operator address, which is the address that will be used for rewards for the sequencer. To overcome those obstacles, we do the following:

  1. Upon InitChain, call SetDymintSequencers and create a dummy sequencer object with the consensus pubkey and power we get from the validatorUpdate.
  2. Afterwards, upon initGenesis, we build a validator-like object where the operator address is the one we set in the genesis file and the consensus pubkey and power are the ones we set in the dummy sequencer object.

At the end we delete the dummy sequencer object.

func (Keeper) SetHistoricalInfo

func (k Keeper) SetHistoricalInfo(ctx sdk.Context, height int64, hi *stakingtypes.HistoricalInfo)

SetHistoricalInfo sets the historical info at a given height

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the sequencers parameters to the param space.

func (Keeper) SetSequencer

func (k Keeper) SetSequencer(ctx sdk.Context, sequencer stakingtypes.Validator)
--------------------------------- SETTERS --------------------------------

set the main record holding sequencer details

func (Keeper) SetSequencerByConsAddr

func (k Keeper) SetSequencerByConsAddr(ctx sdk.Context, sequencer stakingtypes.Validator) error

func (Keeper) TrackHistoricalInfo

func (k Keeper) TrackHistoricalInfo(ctx sdk.Context)

TrackHistoricalInfo saves the latest historical-info and deletes the oldest heights that are below pruning height

func (Keeper) UnbondingTime

func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration)

UnbondingTime

type Querier

type Querier struct {
	Keeper
}

func (Querier) Params

func (Querier) Sequencer

Sequencer queries sequencer info for given sequencer address.

func (Querier) Sequencers

Sequencers queries all sequencers that match the given status.

type StakingKeeper

type StakingKeeper interface {
	GetHistoricalInfo(ctx sdk.Context, height int64) (stakingtypes.HistoricalInfo, bool)
	GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool)
	UnbondingTime(ctx sdk.Context) time.Duration
}

StakingKeeper returns the historical headers kept in store.

Jump to

Keyboard shortcuts

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