keeper

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ABI                                 = mustGetABI(bindings.ConsensusValidatorEntrypointMetaData)
	EventMsgRegisterValidator           = mustGetEvent(ABI, "MsgRegisterValidator")
	EventMsgDepositCollateral           = mustGetEvent(ABI, "MsgDepositCollateral")
	EventMsgWithdrawCollateral          = mustGetEvent(ABI, "MsgWithdrawCollateral")
	EventMsgTransferCollateralOwnership = mustGetEvent(ABI, "MsgTransferCollateralOwnership")
	EventMsgUnjail                      = mustGetEvent(ABI, "MsgUnjail")
	EventMsgUpdateExtraVotingPower      = mustGetEvent(ABI, "MsgUpdateExtraVotingPower")

	EventsByID = map[common.Hash]abi.Event{
		EventMsgRegisterValidator.ID:           EventMsgRegisterValidator,
		EventMsgDepositCollateral.ID:           EventMsgDepositCollateral,
		EventMsgWithdrawCollateral.ID:          EventMsgWithdrawCollateral,
		EventMsgTransferCollateralOwnership.ID: EventMsgTransferCollateralOwnership,
		EventMsgUnjail.ID:                      EventMsgUnjail,
		EventMsgUpdateExtraVotingPower.ID:      EventMsgUpdateExtraVotingPower,
	}
)

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) types.MsgServer

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

func NewQueryServer

func NewQueryServer(keeper *Keeper) types.QueryServer

NewQueryServer creates a new QueryServer instance

Types

type Keeper

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

Keeper of the evmvalidator store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey storetypes.StoreKey,
	validatorAddressCodec address.Codec,
	consensusAddressCodec address.Codec,
	authority string,
) *Keeper

NewKeeper creates a new keeper

func (Keeper) AddNewWithdrawalWithNextID

func (k Keeper) AddNewWithdrawalWithNextID(ctx sdk.Context, withdrawal *types.Withdrawal)

AddNewWithdrawalWithNextID adds a new withdrawal with the next ID

func (Keeper) ApplyAndReturnValidatorSetUpdates

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

ApplyAndReturnValidatorSetUpdates applies and returns accumulated updates to the validator set.

func (Keeper) ConsensusAddressCodec

func (k Keeper) ConsensusAddressCodec() address.Codec

ConsensusAddressCodec returns the address codec for consensus nodes

func (Keeper) DeleteCollateralOwnership

func (k Keeper) DeleteCollateralOwnership(
	ctx sdk.Context,
	valAddr mitotypes.EthAddress,
	owner mitotypes.EthAddress,
)

DeleteCollateralOwnership deletes collateral ownership

func (Keeper) DeleteLastValidatorPower

func (k Keeper) DeleteLastValidatorPower(ctx sdk.Context, valAddr mitotypes.EthAddress)

DeleteLastValidatorPower deletes the last validator power for a validator

func (Keeper) DeleteValidatorByPowerIndex

func (k Keeper) DeleteValidatorByPowerIndex(ctx sdk.Context, power int64, valAddr mitotypes.EthAddress)

DeleteValidatorByPowerIndex deletes a validator from the power index

func (Keeper) DeleteWithdrawal

func (k Keeper) DeleteWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal)

DeleteWithdrawal deletes the withdrawal

func (*Keeper) Deliver

func (k *Keeper) Deliver(ctx context.Context, blockHash common.Hash, elog evmengtypes.EVMEvent) error

Deliver delivers related EVM log events

func (Keeper) DepositCollateral

func (k Keeper) DepositCollateral(ctx sdk.Context, validator *types.Validator, owner mitotypes.EthAddress, amount sdkmath.Uint)

func (Keeper) EndBlocker

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

EndBlocker is called at the end of every block

func (Keeper) ExportGenesis

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

ExportGenesis returns the evmvalidator module's exported genesis state

func (*Keeper) FallbackDepositCollateral

func (k *Keeper) FallbackDepositCollateral(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgDepositCollateral) error

FallbackDepositCollateral handles the case when the MsgDepositCollateral event fails to process

func (*Keeper) FallbackRegisterValidator

func (k *Keeper) FallbackRegisterValidator(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgRegisterValidator) error

FallbackRegisterValidator handles the case when the MsgRegisterValidator event fails to process

func (*Keeper) FilterParams

func (k *Keeper) FilterParams(ctx context.Context) ([]common.Address, [][]common.Hash)

FilterParams defines the matching EVM log events

func (Keeper) GetAllCollateralOwnerships

func (k Keeper) GetAllCollateralOwnerships(ctx sdk.Context) []types.CollateralOwnership

GetAllCollateralOwnerships gets all collateral ownerships

func (Keeper) GetAllValidators

func (k Keeper) GetAllValidators(ctx sdk.Context) []types.Validator

GetAllValidators gets all validators

func (Keeper) GetAllWithdrawals

func (k Keeper) GetAllWithdrawals(ctx sdk.Context) []types.Withdrawal

GetAllWithdrawals gets all withdrawals

func (Keeper) GetCollateralOwnership

func (k Keeper) GetCollateralOwnership(
	ctx sdk.Context,
	valAddr mitotypes.EthAddress,
	owner mitotypes.EthAddress,
) (ownership types.CollateralOwnership, found bool)

GetCollateralOwnership gets collateral ownership by validator and owner

func (Keeper) GetLastValidatorPower

func (k Keeper) GetLastValidatorPower(ctx sdk.Context, valAddr mitotypes.EthAddress) (power int64, found bool)

GetLastValidatorPower gets the last validator power for a validator

func (Keeper) GetLastValidatorPowers

func (k Keeper) GetLastValidatorPowers(ctx sdk.Context) []types.LastValidatorPower

GetLastValidatorPowers gets all last validator powers

func (Keeper) GetNotJailedValidatorsByPower

func (k Keeper) GetNotJailedValidatorsByPower(ctx sdk.Context, maxValidators uint32) []types.Validator

GetNotJailedValidatorsByPower gets not jailed validators sorted by power

func (Keeper) GetParams

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

GetParams gets the parameters for the x/evmvalidator module

func (Keeper) GetValidator

func (k Keeper) GetValidator(ctx sdk.Context, valAddr mitotypes.EthAddress) (validator types.Validator, found bool)

GetValidator gets a validator by address

func (Keeper) GetValidatorByConsAddr

func (k Keeper) GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (types.Validator, bool)

GetValidatorByConsAddr returns a validator by consensus address

func (Keeper) GetValidatorByPowerIndex

func (k Keeper) GetValidatorByPowerIndex(ctx sdk.Context, power int64, valAddr mitotypes.EthAddress) (mitotypes.EthAddress, bool)

GetValidatorByPowerIndex returns a validator by power and address

func (Keeper) GetValidatorEntrypointContractAddr

func (k Keeper) GetValidatorEntrypointContractAddr(ctx sdk.Context) mitotypes.EthAddress

GetValidatorEntrypointContractAddr gets the ConsensusValidatorEntrypoint contract address

func (Keeper) GetValidatorsByPowerIndexIterator

func (k Keeper) GetValidatorsByPowerIndexIterator(ctx sdk.Context) storetypes.Iterator

GetValidatorsByPowerIndexIterator returns an iterator for the power index (starting from the most powerful)

func (Keeper) GetWithdrawalLastID

func (k Keeper) GetWithdrawalLastID(ctx sdk.Context) uint64

func (Keeper) HasValidator

func (k Keeper) HasValidator(ctx sdk.Context, valAddr mitotypes.EthAddress) bool

HasValidator checks if a validator exists

func (Keeper) InitGenesis

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

InitGenesis initializes the evmvalidator module's state from a provided genesis state

func (Keeper) IsValidatorJailed

func (k Keeper) IsValidatorJailed(ctx context.Context, addr sdk.ConsAddress) (bool, error)

IsValidatorJailed implements the StakingKeeper interface

func (Keeper) IterateCollateralOwnerships

func (k Keeper) IterateCollateralOwnerships(
	ctx sdk.Context,
	cb func(ownership types.CollateralOwnership) (stop bool),
)

IterateCollateralOwnerships iterates over all collateral ownerships

func (Keeper) IterateCollateralOwnershipsByValidator

func (k Keeper) IterateCollateralOwnershipsByValidator(
	ctx sdk.Context,
	valAddr mitotypes.EthAddress,
	cb func(ownership types.CollateralOwnership) (stop bool),
)

IterateCollateralOwnershipsByValidator iterates over all collateral ownerships for a validator

func (Keeper) IterateLastValidatorPowers

func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, cb func(valAddr mitotypes.EthAddress, power int64) (stop bool))

IterateLastValidatorPowers iterates through all last validator powers

func (Keeper) IterateLastValidators

func (k Keeper) IterateLastValidators(ctx sdk.Context, cb func(index int64, validator types.Validator) (stop bool)) error

IterateLastValidators iterates through the active validator set and perform the provided function

func (Keeper) IterateValidators

func (k Keeper) IterateValidators(ctx context.Context, fn func(index int64, validator slashingtypes.ValidatorI) (stop bool)) error

IterateValidators implements the StakingKeeper interface It iterates through validators and executes the provided function for each validator

func (Keeper) IterateValidators_

func (k Keeper) IterateValidators_(ctx sdk.Context, fn func(index int64, validator types.Validator) (stop bool))

IterateValidators_ iterates through all validators and performs the provided function

func (Keeper) IterateWithdrawalsByMaturesAt

func (k Keeper) IterateWithdrawalsByMaturesAt(ctx sdk.Context, cb func(withdrawal types.Withdrawal) (stop bool))

IterateWithdrawalsByMaturesAt iterates through all withdrawals by maturesAt (sorted by maturesAt)

func (Keeper) IterateWithdrawalsForValidator

func (k Keeper) IterateWithdrawalsForValidator(
	ctx sdk.Context,
	valAddr mitotypes.EthAddress,
	cb func(withdrawal types.Withdrawal) (stop bool),
)

func (*Keeper) Jail

func (k *Keeper) Jail(ctx context.Context, consAddress sdk.ConsAddress) error

func (Keeper) Jail_

func (k Keeper) Jail_(ctx sdk.Context, validator *types.Validator, reason string)

Jail_ jails a validator

func (Keeper) Logger

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

Logger returns a module-specific logger

func (Keeper) MaxValidators

func (k Keeper) MaxValidators(ctx context.Context) (uint32, error)

MaxValidators implements the StakingKeeper interface

func (*Keeper) Name

func (*Keeper) Name() string

Name returns the name of the module

func (*Keeper) ProcessDepositCollateral

func (k *Keeper) ProcessDepositCollateral(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgDepositCollateral) (error, bool)

ProcessDepositCollateral processes MsgDepositCollateral event The second return value indicates whether it is okay to ignore the error

func (*Keeper) ProcessEvent

func (k *Keeper) ProcessEvent(originCtx sdk.Context, blockHash common.Hash, elog evmengtypes.EVMEvent) (error, bool)

ProcessEvent parses the provided event and processes it. If the second return value is true, the error will be ignored.

func (Keeper) ProcessMaturedWithdrawals

func (k Keeper) ProcessMaturedWithdrawals(ctx sdk.Context) error

ProcessMaturedWithdrawals processes withdrawals that have matured

func (*Keeper) ProcessRegisterValidator

func (k *Keeper) ProcessRegisterValidator(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgRegisterValidator) (error, bool)

ProcessRegisterValidator processes MsgRegisterValidator event The second return value indicates whether it is okay to ignore the error

func (*Keeper) ProcessTransferCollateralOwnership

func (k *Keeper) ProcessTransferCollateralOwnership(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgTransferCollateralOwnership) (error, bool)

ProcessTransferCollateralOwnership processes MsgTransferCollateralOwnership event The second return value indicates whether it is okay to ignore the error

func (*Keeper) ProcessUnjail

func (k *Keeper) ProcessUnjail(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgUnjail) (error, bool)

ProcessUnjail processes MsgUnjail event The second return value indicates whether it is okay to ignore the error

func (*Keeper) ProcessUpdateExtraVotingPower

func (k *Keeper) ProcessUpdateExtraVotingPower(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgUpdateExtraVotingPower) (error, bool)

ProcessUpdateExtraVotingPower processes MsgUpdateExtraVotingPower event The second return value indicates whether it is okay to ignore the error

func (*Keeper) ProcessWithdrawCollateral

func (k *Keeper) ProcessWithdrawCollateral(ctx sdk.Context, event *bindings.ConsensusValidatorEntrypointMsgWithdrawCollateral) (error, bool)

ProcessWithdrawCollateral processes MsgWithdrawCollateral event The second return value indicates whether it is okay to ignore the error

func (Keeper) RegisterValidator

func (k Keeper) RegisterValidator(
	ctx sdk.Context,
	valAddr mitotypes.EthAddress,
	pubkey []byte,
	initialCollateralOwner mitotypes.EthAddress,
	initialCollateral sdkmath.Uint,
	extraVotingPower sdkmath.Uint,
	jailed bool,
) error

func (Keeper) SetCollateralOwnership

func (k Keeper) SetCollateralOwnership(ctx sdk.Context, ownership types.CollateralOwnership)

SetCollateralOwnership sets collateral ownership for validator and owner

func (*Keeper) SetEvmEngineKeeper

func (k *Keeper) SetEvmEngineKeeper(evmEngKeeper types.EvmEngineKeeper)

SetEvmEngineKeeper sets the evm engine keeper

func (Keeper) SetLastValidatorPower

func (k Keeper) SetLastValidatorPower(ctx sdk.Context, valAddr mitotypes.EthAddress, power int64)

SetLastValidatorPower sets the last validator power for a validator

func (Keeper) SetParams

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

SetParams sets the parameters for the x/evmvalidator module

func (*Keeper) SetSlashingKeeper

func (k *Keeper) SetSlashingKeeper(slashingKeeper types.SlashingKeeper)

SetSlashingKeeper sets the slashing keeper

func (Keeper) SetValidator

func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator)

SetValidator sets a validator and updates the consensus address mapping

func (Keeper) SetValidatorByConsAddr

func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr mitotypes.EthAddress)

SetValidatorByConsAddr sets a validator EVM address by consensus address

func (Keeper) SetValidatorByPowerIndex

func (k Keeper) SetValidatorByPowerIndex(ctx sdk.Context, power int64, valAddr mitotypes.EthAddress)

SetValidatorByPowerIndex sets a validator in the power index

func (Keeper) SetValidatorEntrypointContractAddr

func (k Keeper) SetValidatorEntrypointContractAddr(ctx sdk.Context, addr mitotypes.EthAddress)

SetValidatorEntrypointContractAddr sets the ConsensusValidatorEntrypoint contract address

func (Keeper) SetWithdrawal

func (k Keeper) SetWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal)

SetWithdrawal set the withdrawal

func (Keeper) SetWithdrawalLastID

func (k Keeper) SetWithdrawalLastID(ctx sdk.Context, lastID uint64)

func (*Keeper) Slash

func (k *Keeper) Slash(
	ctx context.Context,
	consAddress sdk.ConsAddress,
	infractionHeight int64,
	power int64,
	slashFraction math.LegacyDec,
) (math.Int, error)

func (Keeper) SlashWithInfractionReason

func (k Keeper) SlashWithInfractionReason(
	ctx context.Context,
	consAddr sdk.ConsAddress,
	infractionHeight int64,
	power int64,
	slashFraction math.LegacyDec,
	_ stakingtypes.Infraction,
) (math.Int, error)

SlashWithInfractionReason implements the StakingKeeper interface It slashes a validator for an infraction committed at a specific height with a specific reason

func (Keeper) Slash_

func (k Keeper) Slash_(ctx sdk.Context, validator *types.Validator, infractionHeight int64, power int64, slashFraction sdkmath.LegacyDec) (sdkmath.Uint, error)

Slash_ slashes a validator's collateral by a fraction

func (Keeper) TransferCollateralOwnership

func (k Keeper) TransferCollateralOwnership(
	ctx sdk.Context,
	validator *types.Validator,
	prevOwnership types.CollateralOwnership,
	newOwner mitotypes.EthAddress,
)

TransferCollateralOwnership transfers collateral ownership from one owner to another

func (*Keeper) Unjail

func (k *Keeper) Unjail(ctx context.Context, consAddress sdk.ConsAddress) error

func (Keeper) Unjail_

func (k Keeper) Unjail_(ctx sdk.Context, validator *types.Validator) error

Unjail_ unjails a validator

func (Keeper) UpdateExtraVotingPower

func (k Keeper) UpdateExtraVotingPower(ctx sdk.Context, validator *types.Validator, extraVotingPower sdkmath.Uint)

func (Keeper) UpdateValidatorState

func (k Keeper) UpdateValidatorState(ctx sdk.Context, validator *types.Validator, context string)

func (Keeper) ValidatorAddressCodec

func (k Keeper) ValidatorAddressCodec() address.Codec

ValidatorAddressCodec returns the address codec for validators

func (*Keeper) ValidatorByConsAddr

func (k *Keeper) ValidatorByConsAddr(ctx context.Context, consAddress sdk.ConsAddress) (slashingtypes.ValidatorI, error)

func (Keeper) WithdrawCollateral

func (k Keeper) WithdrawCollateral(
	ctx sdk.Context,
	validator *types.Validator,
	owner mitotypes.EthAddress,
	withdrawal *types.Withdrawal,
) error

func (Keeper) WriteValidators

func (k Keeper) WriteValidators(ctx sdk.Context) (vals []cmttypes.GenesisValidator, returnErr error)

WriteValidators returns a slice of bonded genesis validators.

type KeeperWrapperForEvidence

type KeeperWrapperForEvidence struct {
	K *Keeper
}

func (KeeperWrapperForEvidence) ConsensusAddressCodec

func (k KeeperWrapperForEvidence) ConsensusAddressCodec() address.Codec

func (KeeperWrapperForEvidence) ValidatorByConsAddr

func (k KeeperWrapperForEvidence) ValidatorByConsAddr(ctx context.Context, consAddress sdk.ConsAddress) (evidencetypes.ValidatorI, error)

type QueryServer

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

QueryServer implements the QueryServer interface for the evmvalidator module

func (QueryServer) CollateralOwnership

CollateralOwnership returns the collateral ownership for a specific validator and owner

func (QueryServer) CollateralOwnerships

CollateralOwnerships returns all collateral ownerships with withdrawable amounts

func (QueryServer) CollateralOwnershipsByValidator

CollateralOwnershipsByValidator returns all collateral ownerships for a specific validator

func (QueryServer) Params

Params returns the module's parameters

func (QueryServer) Validator

Validator returns a specific validator by validator address

func (QueryServer) ValidatorByConsAddr

ValidatorByConsAddr returns a validator by consensus address

func (QueryServer) ValidatorEntrypointContractAddr

ValidatorEntrypointContractAddr returns the address of the ConsensusValidatorEntrypoint contract

func (QueryServer) Validators

Validators returns all validators

func (QueryServer) Withdrawal

Withdrawal returns a specific withdrawal by ID

func (QueryServer) Withdrawals

Withdrawals returns all withdrawals

func (QueryServer) WithdrawalsByValidator

WithdrawalsByValidator returns withdrawals for a specific validator

Jump to

Keyboard shortcuts

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