keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_BLOCKS_PER_EPOCH = 10

Variables

View Source
var EPOCH_NUMBER_KEY = []byte{0}

Functions

func DiffOperatorWeightedSharesWith

func DiffOperatorWeightedSharesWith(
	oldList,
	newList *xsecuritytypes.LSTOperatorWeightedShareList,
) []*xsecuritytypes.LSTOperatorWeightedShare

DiffOperatorWeightedSharesWith compares two operator weighted share lists and returns the differences

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey, memKey storetypes.StoreKey,
	stakingKeeper types.StakingKeeper,
	slashingKeeper types.SlashingKeeper,
	pevmKeeper types.PevmKeeper,
	relayerKeeper types.RelayerKeeper,
	restakingKeeper types.RestakingKeeper,
	authorityKeeper types.AuthorityKeeper,
) *Keeper

func (Keeper) AddOperatorRegistration

func (k Keeper) AddOperatorRegistration(ctx sdk.Context, registration *types.LSTOperatorRegistration)

AddOperatorRegistration adds a new operator registration to the operator registration list

func (Keeper) AddOperatorWeightedShare

func (k Keeper) AddOperatorWeightedShare(ctx sdk.Context, operatorData *types.LSTOperatorWeightedShare)

AddOperatorWeightedShare adds a new operator registration to the operator registration list

func (Keeper) AddPools

func (k Keeper) AddPools(goctx context.Context, msg *types.MsgAddPools) (*types.MsgAddPoolsResponse, error)

AddPools adds pools to the group

func (Keeper) CalcNativeVotingPower

func (k Keeper) CalcNativeVotingPower(ctx sdk.Context, nativeValidators []stakingtypes.Validator) (*math.Int, error)

CalcNativeVotingPower calculates the total voting power of native validators totalNativeVotingPower = sum(validator.ConsensusPower(powerReduction))

func (Keeper) CalcValidatorUpdatesByLSTTokenShares

func (k Keeper) CalcValidatorUpdatesByLSTTokenShares(ctx sdk.Context, nativeVotingPower *math.Int) ([]types.ValidatorUpdate, error)

CalcValidatorUpdatesByLSTTokenShares calculates validator updates based on LST token shares If the total voting power in ctx.VoteInfo() is 5000, then the total voting power of LST is 2500. Query the specific staking weight information in OperatorShares and allocate the 2500 voting power proportionally to the validators corresponding to the operators. Update the validator content and return it to the end blocker's ctx.

func (Keeper) CalcWeightedShares

CalcWeightedShares is a function to calculate weighted shares

func (Keeper) Codec

func (k Keeper) Codec() codec.BinaryCodec

func (Keeper) CreateGroup

CreateGroup creates a DVS group

func (Keeper) CreateRegistryRouter

CreateRegistryRouter creates a system level registry router for LST tokens. It will call the RegistryRouterFactory system contract in the pevm module to create a RegistryRouter contract. The transaction that creates the contract will return a RegistryRouterCreated event, which includes the address of the stakeRegistryRouter contract and needs to be recorded as well.

func (Keeper) FilterSharesInfoByOperatorList

func (k Keeper) FilterSharesInfoByOperatorList(ctx sdk.Context, allShares []*restakingtypes.OperatorShares) ([]*restakingtypes.OperatorShares, error)

FilterSharesInfoByOperatorList is a function to filter shares by operator list

func (Keeper) GetAuthorityKeeper

func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper

func (Keeper) GetBlocksPerEpoch

func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) (blocksPerEpoch uint64, exist bool)

GetBlocksPerEpoch get blocks per epoch Returns the number of blocks per epoch and a boolean indicating if it exists in the store

func (Keeper) GetChangedSharesByEpoch

func (k Keeper) GetChangedSharesByEpoch(ctx sdk.Context) ([]*xsecuritytypes.LSTOperatorWeightedShare, error)

GetChangedSharesByEpoch is a function to get changed shares by epoch

func (Keeper) GetEpochNumber

func (k Keeper) GetEpochNumber(ctx sdk.Context) (epochNumber uint64, exists bool)

GetEpochNumber gets the epoch number Returns the current epoch number and a boolean indicating if it exists in the store

func (Keeper) GetGroupInfo

func (k Keeper) GetGroupInfo(ctx sdk.Context) (*types.LSTGroupInfo, bool)

GetGroupInfo returns the LSTGroupInfo

func (Keeper) GetGroupNumberFromReceipt

func (k Keeper) GetGroupNumberFromReceipt(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse) (uint64, error)

GetGroupNumberFromReceipt filters the group number from the receipt

func (Keeper) GetLSTRegistryRouterAddress

func (k Keeper) GetLSTRegistryRouterAddress(ctx sdk.Context) (*types.LSTRegistryRouterAddress, bool)

GetLSTRegistryRouterAddress reads the stored unique LSTRegistryRouterAddress If it does not exist, the second return value is false

func (Keeper) GetLSTStakingEnabled

func (k Keeper) GetLSTStakingEnabled(ctx sdk.Context) (*types.LSTStakingEnabled, bool)

GetLSTStakingEnabled gets the LST staking enabled status

func (Keeper) GetLSTVotingPowerRatio

func (k Keeper) GetLSTVotingPowerRatio(ctx sdk.Context) (*types.LSTVotingPowerRatio, bool)

GetLSTVotingPowerRatio gets the LST voting power ratio

func (Keeper) GetLastNativeVotingPower

func (k Keeper) GetLastNativeVotingPower(ctx sdk.Context) (votingPower int64, exists bool)

GetLastNativeVotingPower retrieves the last native voting power value from the store Returns the voting power value and a boolean indicating if the value exists

func (Keeper) GetLastRoundOperatorWeightedShareList

func (k Keeper) GetLastRoundOperatorWeightedShareList(ctx sdk.Context) (*types.LSTOperatorWeightedShareList, bool)

GetLastRoundOperatorWeightedShareList returns the last round operator registration list

func (Keeper) GetOperatorIdFromReceipt

func (k Keeper) GetOperatorIdFromReceipt(
	ctx sdk.Context,
	receipt *evmtypes.MsgEthereumTxResponse,
) ([]byte, error)

GetOperatorIdFromReceipt extracts the operatorId from the SyncRegisterOperator event log in the transaction receipt.

func (Keeper) GetOperatorRegistrationList

func (k Keeper) GetOperatorRegistrationList(ctx sdk.Context) (*types.LSTOperatorRegistrationList, bool)

GetOperatorRegistrationList returns the operator registration list for the given registry router address

func (Keeper) GetOperatorWeightedShareList

func (k Keeper) GetOperatorWeightedShareList(ctx sdk.Context) (*types.LSTOperatorWeightedShareList, bool)

GetOperatorWeightedShareList returns the operator registration list for the given registry router address

func (Keeper) GetPevmKeeper

func (k Keeper) GetPevmKeeper() types.PevmKeeper

func (Keeper) GetRegistryRouterAddressFromReceipt

func (k Keeper) GetRegistryRouterAddressFromReceipt(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse) (registryRouterAddress string, stakeRegistryRouterAddress string, err error)

GetRegistryRouterAddressFromReceipt filters the registry router address from the receipt

func (Keeper) GetRelayerKeeper

func (k Keeper) GetRelayerKeeper() types.RelayerKeeper

func (Keeper) GetRestakingKeeper

func (k Keeper) GetRestakingKeeper() types.RestakingKeeper

func (Keeper) GetSlashingKeeper

func (k Keeper) GetSlashingKeeper() types.SlashingKeeper

func (Keeper) GetStakingKeeper

func (k Keeper) GetStakingKeeper() types.StakingKeeper

func (Keeper) Logger

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

func (Keeper) ProcessEpoch

func (k Keeper) ProcessEpoch(goctx context.Context) ([]types.ValidatorUpdate, error)

ProcessEpoch processes each epoch for the xsecurity module When conditions are met, calculates and returns validator updates 1. Gather the current state of native staking validators 2. Calculate the total native validator voting power 3. Derive the total LST voting power based on a configured ratio 4. Distribute the LST voting power among registered operators proportionally to their shares 5. Generate validator updates that combine native staking power with LST-derived power

func (Keeper) QueryGroupInfo

QueryGroupInfo return the group info

func (Keeper) QueryLSTStakingEnabled

QueryLSTStakingEnabled is a gRPC query handler for the LST staking enabled status.

func (Keeper) QueryOperatorRegistrationList

QueryOperatorRegistrationList return the operator registration list

func (Keeper) QueryOperatorWeightedShares

QueryOperatorWeightedShares return the operator weighted shares

func (Keeper) QueryRegistryRouterAddress

QueryRegistryRouterAddress returns the registry router address and stake registry router address

func (Keeper) QueryValidatorInfoFromStakingModule

func (k Keeper) QueryValidatorInfoFromStakingModule(ctx sdk.Context, signer string) (stakingtypes.Validator, error)

QueryValidatorInfoFromStakingModule queries the validator info from the staking module

func (Keeper) QueryVotingPowerRatio

QueryVotingPowerRatio queries the voting power ratio of the LST

func (Keeper) RegisterOperator

RegisterOperator registers an operator This transaction will first register the operator to DVS, and then bind the operator address to the validator address. The specific process is as follows: 1. Call the registry router contract of the pevm contract to register the operator as DVS. During registration, the contract has already verified the BLS signature and saved the operator -> BLS correspondence in the contract. If this step is successful, continue with the subsequent steps. 2. From the staking module, query the validator address information based on the Cosmos signer address. 3. From the registry router, query the BLS public key, operator ID, and other information based on the operator's address. 4. The transaction binds the operator's BLS public key to the validator_address. This transaction can only be initiated by the validator's account itself:

func (Keeper) RegisterOperatorToDVS

func (k Keeper) RegisterOperatorToDVS(ctx sdk.Context, msg *types.MsgRegisterOperator, registryRouterAddress *types.LSTRegistryRouterAddress, groupInfo *types.LSTGroupInfo) ([]byte, error)

RegisterOperatorToDVS registers an operator to DVS

func (Keeper) RemovePools

RemovePools removes pools from the group

func (Keeper) SetBlocksPerEpoch

func (k Keeper) SetBlocksPerEpoch(ctx sdk.Context, blocks uint64)

SetBlocksPerEpoch set blocks per epoch

func (Keeper) SetEpochNumber

func (k Keeper) SetEpochNumber(ctx sdk.Context, epochNumber uint64)

SetEpochNumber sets the epoch number

func (Keeper) SetGroupInfo

func (k Keeper) SetGroupInfo(ctx sdk.Context, groupInfo *types.LSTGroupInfo)

SetGroupInfo stores the LSTGroupInfo

func (Keeper) SetGroupParam

SetGroupParam sets the group parameters

func (Keeper) SetLSTRegistryRouterAddress

func (k Keeper) SetLSTRegistryRouterAddress(ctx sdk.Context, addr *types.LSTRegistryRouterAddress)

SetLSTRegistryRouterAddress stores (or overwrites) the unique LSTRegistryRouterAddress

func (Keeper) SetLSTStakingEnabled

func (k Keeper) SetLSTStakingEnabled(ctx sdk.Context, enabled bool)

SetLSTStakingEnabled sets the LST staking enabled status

func (Keeper) SetLSTVotingPowerRatio

func (k Keeper) SetLSTVotingPowerRatio(ctx sdk.Context, numerator, denominator math.Int)

SetLSTVotingPowerRatio sets the LST voting power ratio This is used to calculate the voting power of LST tokens The ratio is a uint64 value that represents the percentage of voting power such as ratio=20 means 20% of the voting power

func (Keeper) SetLastNativeVotingPower

func (k Keeper) SetLastNativeVotingPower(ctx sdk.Context, votingPower int64)

SetLastNativeVotingPower sets the last native voting power value in the store

func (Keeper) SetLastRoundOperatorWeightedShareList

func (k Keeper) SetLastRoundOperatorWeightedShareList(ctx sdk.Context, list *types.LSTOperatorWeightedShareList)

SetLastRoundOperatorWeightedShareList overwrites the last round operator registration list with the given list Stores the previously updated weight information, using the same data structure as OperatorShares, to check if the shares information has changed.

func (Keeper) SetOperatorWeightedShareList

func (k Keeper) SetOperatorWeightedShareList(ctx sdk.Context, list *types.LSTOperatorWeightedShareList)

SetOperatorWeightedShareList overwrites the operator registration list with the given list

func (Keeper) SnapshotSharesFromRestakingModuleByEpoch

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

SnapshotSharesFromRestakingModuleByEpoch is a function to snapshot shares from restaking module by epoch

func (Keeper) StoreKey

func (k Keeper) StoreKey() storetypes.StoreKey

func (Keeper) UpdateLSTStakingEnabled

UpdateLSTStakingEnabled updates the LST staking enabled status

func (Keeper) UpdateVotingPowerRatio

UpdateVotingPowerRatio updates the voting power ratio for LST tokens

Jump to

Keyboard shortcuts

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