keeper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the staking MsgServer interface for the provided Keeper.

func NewQueryServer

func NewQueryServer(k *Keeper) types.QueryServer

NewQueryServer creates a new querier for stake clients. It uses the underlying keeper and its contractCaller to interact with Ethereum chain.

func NewSideMsgServerImpl

func NewSideMsgServerImpl(keeper *Keeper) sidetxs.SideMsgServer

NewSideMsgServerImpl returns an implementation of the staking MsgServer interface for the provided Keeper.

Types

type Keeper

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

Keeper stores all stake related data

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService storetypes.KVStoreService,
	bankKeeper types.BankKeeper,
	cmKeeper cmKeeper.Keeper,
	validatorAddressCodec addresscodec.Codec,
	contractCaller helper.IContractCaller,
) Keeper

NewKeeper creates a new stake Keeper instance

func (*Keeper) AddValidator

func (k *Keeper) AddValidator(ctx context.Context, validator types.Validator) error

AddValidator adds validator indexed with address

func (Keeper) ApplyAndReturnValidatorSetUpdates

func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx context.Context) (updates []abci.ValidatorUpdate, err error)

func (*Keeper) DoesValIdExist

func (k *Keeper) DoesValIdExist(ctx context.Context, valID uint64) (bool, error)

DoesValIdExist checks if validator ID exists in store

func (*Keeper) EndBlocker

func (k *Keeper) EndBlocker(ctx context.Context) ([]abci.ValidatorUpdate, error)

EndBlocker called at the end of every block, and returns validator updates

func (Keeper) ExportGenesis

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

ExportGenesis returns a GenesisState for the given stake context and keeper. The GenesisState will contain the validators and the staking sequences

func (*Keeper) GetActiveValidatorInfo

func (k *Keeper) GetActiveValidatorInfo(ctx context.Context, address string) (validator types.Validator, err error)

GetActiveValidatorInfo returns active validator

func (*Keeper) GetAllValidators

func (k *Keeper) GetAllValidators(ctx context.Context) (validators []*types.Validator)

GetAllValidators returns all validators

func (*Keeper) GetCurrentProposer

func (k *Keeper) GetCurrentProposer(ctx context.Context) *types.Validator

GetCurrentProposer returns the current proposer from the validator set

func (*Keeper) GetCurrentValidators

func (k *Keeper) GetCurrentValidators(ctx context.Context) (validators []types.Validator)

GetCurrentValidators returns all validators who are in validator set

func (Keeper) GetLastBlockTxs

func (k Keeper) GetLastBlockTxs(ctx sdk.Context) (types.LastBlockTxs, error)

GetLastBlockTxs gets the last block's txs from the store

func (*Keeper) GetLastUpdated

func (k *Keeper) GetLastUpdated(ctx context.Context, valID uint64) (updatedAt string, err error)

GetLastUpdated get last updated at for validator

func (*Keeper) GetMilestoneCurrentProposer

func (k *Keeper) GetMilestoneCurrentProposer(ctx context.Context) *types.Validator

GetMilestoneCurrentProposer returns current proposer

func (*Keeper) GetMilestoneValidatorSet

func (k *Keeper) GetMilestoneValidatorSet(ctx context.Context) (validatorSet types.ValidatorSet, err error)

GetMilestoneValidatorSet returns current milestone Validator Set from store

func (*Keeper) GetNextProposer

func (k *Keeper) GetNextProposer(ctx context.Context) *types.Validator

GetNextProposer returns next proposer

func (*Keeper) GetPreviousBlockValidatorSet

func (k *Keeper) GetPreviousBlockValidatorSet(ctx context.Context) (validatorSet types.ValidatorSet, err error)

GetPreviousBlockValidatorSet returns the previous block's validator set from store

func (*Keeper) GetSignerFromValidatorID

func (k *Keeper) GetSignerFromValidatorID(ctx context.Context, valID uint64) (string, error)

GetSignerFromValidatorID gets the signer address from the validator id

func (*Keeper) GetSpanEligibleValidators

func (k *Keeper) GetSpanEligibleValidators(ctx context.Context) (validators []types.Validator)

GetSpanEligibleValidators returns current validators who are not getting deactivated in between next span

func (*Keeper) GetStakingSequences

func (k *Keeper) GetStakingSequences(ctx context.Context) (sequences []string, err error)

GetStakingSequences returns all the sequences appended together

func (*Keeper) GetTotalPower

func (k *Keeper) GetTotalPower(ctx context.Context) (totalPower int64, err error)

func (*Keeper) GetValIdFromAddress

func (k *Keeper) GetValIdFromAddress(ctx context.Context, address string) (uint64, error)

GetValIdFromAddress returns a validator's id given its address string

func (*Keeper) GetValidatorFromValID

func (k *Keeper) GetValidatorFromValID(ctx context.Context, valID uint64) (validator types.Validator, err error)

GetValidatorFromValID returns signer from validator ID

func (*Keeper) GetValidatorInfo

func (k *Keeper) GetValidatorInfo(ctx context.Context, address string) (validator types.Validator, err error)

GetValidatorInfo returns the validator info given its address

func (*Keeper) GetValidatorSet

func (k *Keeper) GetValidatorSet(ctx context.Context) (validatorSet types.ValidatorSet, err error)

GetValidatorSet returns current validator set from store

func (*Keeper) HasStakingSequence

func (k *Keeper) HasStakingSequence(ctx context.Context, sequence string) bool

HasStakingSequence checks if staking sequence already exists

func (*Keeper) IncrementAccum

func (k *Keeper) IncrementAccum(ctx context.Context, times int) error

IncrementAccum increments accum for validator set by n times and replace validator set in store

func (Keeper) InitGenesis

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

InitGenesis sets validator information for genesis in x/stake module

func (*Keeper) IsCurrentValidatorByAddress

func (k *Keeper) IsCurrentValidatorByAddress(ctx context.Context, address string) bool

IsCurrentValidatorByAddress check if validator is in current validator set by signer address

func (Keeper) IterateCurrentValidatorsAndApplyFn

func (k Keeper) IterateCurrentValidatorsAndApplyFn(ctx context.Context, f func(validator types.Validator) bool) error

IterateCurrentValidatorsAndApplyFn iterate through current validators

func (*Keeper) IterateStakingSequencesAndApplyFn

func (k *Keeper) IterateStakingSequencesAndApplyFn(ctx context.Context, f func(sequence string) error) (e error)

IterateStakingSequencesAndApplyFn iterates staking sequences and applies the given function.

func (*Keeper) IterateValidatorsAndApplyFn

func (k *Keeper) IterateValidatorsAndApplyFn(ctx context.Context, f func(validator types.Validator) error)

IterateValidatorsAndApplyFn iterate validators and apply the given function.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) MilestoneIncrementAccum

func (k *Keeper) MilestoneIncrementAccum(ctx context.Context, times int)

MilestoneIncrementAccum increments accum for milestone validator set by n times and replace validator set in store

func (*Keeper) PanicIfSetupIsIncomplete

func (k *Keeper) PanicIfSetupIsIncomplete()

PanicIfSetupIsIncomplete panics if the setup is incomplete, meaning that the checkpointKeeper is not set

func (*Keeper) SetCheckpointKeeper

func (k *Keeper) SetCheckpointKeeper(checkpointKeeper types.CheckpointKeeper)

SetCheckpointKeeper sets the checkpoint keeper in the stake keeper This solves the circular dependency between the two keepers The setupComplete flag is set to true after the checkpoint keeper is set, otherwise all the functions will panic

func (Keeper) SetLastBlockTxs

func (k Keeper) SetLastBlockTxs(ctx sdk.Context, txs [][]byte) error

SetLastBlockTxs sets the last block's txs in the store

func (*Keeper) SetStakingSequence

func (k *Keeper) SetStakingSequence(ctx context.Context, sequence string) error

SetStakingSequence sets staking sequence

func (*Keeper) SetValidatorIDToSignerAddr

func (k *Keeper) SetValidatorIDToSignerAddr(ctx context.Context, valID uint64, signerAddr string)

SetValidatorIDToSignerAddr sets mapping for validator ID to signer address

func (*Keeper) UpdateMilestoneValidatorSetInStore

func (k *Keeper) UpdateMilestoneValidatorSetInStore(ctx context.Context, newValidatorSet types.ValidatorSet) error

UpdateMilestoneValidatorSetInStore adds milestone validator set to store

func (*Keeper) UpdatePreviousBlockValidatorSetInStore

func (k *Keeper) UpdatePreviousBlockValidatorSetInStore(ctx context.Context, newValidatorSet types.ValidatorSet) error

UpdatePreviousBlockValidatorSetInStore adds previous block's validator set to store

func (*Keeper) UpdateSigner

func (k *Keeper) UpdateSigner(ctx context.Context, newSigner string, newPubKey []byte, prevSigner string) error

UpdateSigner updates validator fields in store

func (*Keeper) UpdateValidatorSetInStore

func (k *Keeper) UpdateValidatorSetInStore(ctx context.Context, newValidatorSet types.ValidatorSet) error

UpdateValidatorSetInStore adds validator set to store

func (*Keeper) ValidatorAddressCodec

func (k *Keeper) ValidatorAddressCodec() addresscodec.Codec

ValidatorAddressCodec return the validator address codec

Jump to

Keyboard shortcuts

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