Documentation
¶
Index ¶
- Constants
- Variables
- func DiffOperatorWeightedSharesWith(oldList, newList *xsecuritytypes.LSTOperatorWeightedShareList) []*xsecuritytypes.LSTOperatorWeightedShare
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AddOperatorRegistration(ctx sdk.Context, registration *types.LSTOperatorRegistration)
- func (k Keeper) AddOperatorWeightedShare(ctx sdk.Context, operatorData *types.LSTOperatorWeightedShare)
- func (k Keeper) AddPools(goctx context.Context, msg *types.MsgAddPools) (*types.MsgAddPoolsResponse, error)
- func (k Keeper) CalcNativeVotingPower(ctx sdk.Context, nativeValidators []stakingtypes.Validator) (*math.Int, error)
- func (k Keeper) CalcValidatorUpdatesByLSTTokenShares(ctx sdk.Context, nativeVotingPower *math.Int) ([]types.ValidatorUpdate, error)
- func (k Keeper) CalcWeightedShares(ctx sdk.Context, shares []*restakingtypes.OperatorShares) (*xsecuritytypes.LSTOperatorWeightedShareList, error)
- func (k Keeper) Codec() codec.BinaryCodec
- func (k Keeper) CreateGroup(goCtx context.Context, msg *types.MsgCreateGroup) (*types.MsgCreateGroupResponse, error)
- func (k Keeper) CreateRegistryRouter(goCtx context.Context, msg *types.MsgCreateRegistryRouter) (*types.MsgCreateRegistryRouterResponse, error)
- func (k Keeper) FilterSharesInfoByOperatorList(ctx sdk.Context, allShares []*restakingtypes.OperatorShares) ([]*restakingtypes.OperatorShares, error)
- func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper
- func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) (blocksPerEpoch uint64, exist bool)
- func (k Keeper) GetChangedSharesByEpoch(ctx sdk.Context) ([]*xsecuritytypes.LSTOperatorWeightedShare, error)
- func (k Keeper) GetEpochNumber(ctx sdk.Context) (epochNumber uint64, exists bool)
- func (k Keeper) GetGroupInfo(ctx sdk.Context) (*types.LSTGroupInfo, bool)
- func (k Keeper) GetGroupNumberFromReceipt(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse) (uint64, error)
- func (k Keeper) GetLSTRegistryRouterAddress(ctx sdk.Context) (*types.LSTRegistryRouterAddress, bool)
- func (k Keeper) GetLSTStakingEnabled(ctx sdk.Context) (*types.LSTStakingEnabled, bool)
- func (k Keeper) GetLSTVotingPowerRatio(ctx sdk.Context) (*types.LSTVotingPowerRatio, bool)
- func (k Keeper) GetLastNativeVotingPower(ctx sdk.Context) (votingPower int64, exists bool)
- func (k Keeper) GetLastRoundOperatorWeightedShareList(ctx sdk.Context) (*types.LSTOperatorWeightedShareList, bool)
- func (k Keeper) GetOperatorIdFromReceipt(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse) ([]byte, error)
- func (k Keeper) GetOperatorRegistrationList(ctx sdk.Context) (*types.LSTOperatorRegistrationList, bool)
- func (k Keeper) GetOperatorWeightedShareList(ctx sdk.Context) (*types.LSTOperatorWeightedShareList, bool)
- func (k Keeper) GetPevmKeeper() types.PevmKeeper
- func (k Keeper) GetRegistryRouterAddressFromReceipt(ctx sdk.Context, receipt *evmtypes.MsgEthereumTxResponse) (registryRouterAddress string, stakeRegistryRouterAddress string, err error)
- func (k Keeper) GetRelayerKeeper() types.RelayerKeeper
- func (k Keeper) GetRestakingKeeper() types.RestakingKeeper
- func (k Keeper) GetSlashingKeeper() types.SlashingKeeper
- func (k Keeper) GetStakingKeeper() types.StakingKeeper
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) ProcessEpoch(goctx context.Context) ([]types.ValidatorUpdate, error)
- func (k Keeper) QueryGroupInfo(goCtx context.Context, req *types.QueryGroupInfoRequest) (*types.QueryGroupInfoResponse, error)
- func (k Keeper) QueryLSTStakingEnabled(goCtx context.Context, req *types.QueryLSTStakingEnabledRequest) (*types.QueryLSTStakingEnabledResponse, error)
- func (k Keeper) QueryOperatorRegistrationList(goCtx context.Context, req *types.QueryOperatorRegistrationListRequest) (*types.QueryOperatorRegistrationListResponse, error)
- func (k Keeper) QueryOperatorWeightedShares(goCtx context.Context, req *types.QueryOperatorWeightedSharesRequest) (*types.QueryOperatorWeightedSharesResponse, error)
- func (k Keeper) QueryRegistryRouterAddress(goCtx context.Context, req *types.QueryRegistryRouterAddressRequest) (*types.QueryRegistryRouterAddressResponse, error)
- func (k Keeper) QueryValidatorInfoFromStakingModule(ctx sdk.Context, signer string) (stakingtypes.Validator, error)
- func (k Keeper) QueryVotingPowerRatio(goCtx context.Context, req *types.QueryVotingPowerRatioRequest) (*types.QueryVotingPowerRatioResponse, error)
- func (k Keeper) RegisterOperator(goCtx context.Context, msg *types.MsgRegisterOperator) (*types.MsgRegisterOperatorResponse, error)
- func (k Keeper) RegisterOperatorToDVS(ctx sdk.Context, msg *types.MsgRegisterOperator, ...) ([]byte, error)
- func (k Keeper) RemovePools(goctx context.Context, msg *types.MsgRemovePools) (*types.MsgRemovePoolsResponse, error)
- func (k Keeper) SetBlocksPerEpoch(ctx sdk.Context, blocks uint64)
- func (k Keeper) SetEpochNumber(ctx sdk.Context, epochNumber uint64)
- func (k Keeper) SetGroupInfo(ctx sdk.Context, groupInfo *types.LSTGroupInfo)
- func (k Keeper) SetGroupParam(goctx context.Context, msg *types.MsgSetGroupParam) (*types.MsgSetGroupParamResponse, error)
- func (k Keeper) SetLSTRegistryRouterAddress(ctx sdk.Context, addr *types.LSTRegistryRouterAddress)
- func (k Keeper) SetLSTStakingEnabled(ctx sdk.Context, enabled bool)
- func (k Keeper) SetLSTVotingPowerRatio(ctx sdk.Context, numerator, denominator math.Int)
- func (k Keeper) SetLastNativeVotingPower(ctx sdk.Context, votingPower int64)
- func (k Keeper) SetLastRoundOperatorWeightedShareList(ctx sdk.Context, list *types.LSTOperatorWeightedShareList)
- func (k Keeper) SetOperatorWeightedShareList(ctx sdk.Context, list *types.LSTOperatorWeightedShareList)
- func (k Keeper) SnapshotSharesFromRestakingModuleByEpoch(ctx sdk.Context) error
- func (k Keeper) StoreKey() storetypes.StoreKey
- func (k Keeper) UpdateLSTStakingEnabled(goctx context.Context, msg *types.MsgUpdateLSTStakingEnabled) (*types.MsgUpdateLSTStakingEnabledResponse, error)
- func (k Keeper) UpdateVotingPowerRatio(goctx context.Context, msg *types.MsgUpdateVotingPowerRatio) (*types.MsgUpdateVotingPowerRatioResponse, error)
Constants ¶
const DEFAULT_BLOCKS_PER_EPOCH = 10
Variables ¶
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 ¶
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 ¶
func (k Keeper) CalcWeightedShares(ctx sdk.Context, shares []*restakingtypes.OperatorShares) (*xsecuritytypes.LSTOperatorWeightedShareList, error)
CalcWeightedShares is a function to calculate weighted shares
func (Keeper) Codec ¶
func (k Keeper) Codec() codec.BinaryCodec
func (Keeper) CreateGroup ¶
func (k Keeper) CreateGroup(goCtx context.Context, msg *types.MsgCreateGroup) (*types.MsgCreateGroupResponse, error)
CreateGroup creates a DVS group
func (Keeper) CreateRegistryRouter ¶
func (k Keeper) CreateRegistryRouter(goCtx context.Context, msg *types.MsgCreateRegistryRouter) (*types.MsgCreateRegistryRouterResponse, error)
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 ¶
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 ¶
GetEpochNumber gets the epoch number Returns the current epoch number and a boolean indicating if it exists in the store
func (Keeper) GetGroupInfo ¶
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 ¶
GetLSTStakingEnabled gets the LST staking enabled status
func (Keeper) GetLSTVotingPowerRatio ¶
GetLSTVotingPowerRatio gets the LST voting power ratio
func (Keeper) GetLastNativeVotingPower ¶
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) ProcessEpoch ¶
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 ¶
func (k Keeper) QueryGroupInfo(goCtx context.Context, req *types.QueryGroupInfoRequest) (*types.QueryGroupInfoResponse, error)
QueryGroupInfo return the group info
func (Keeper) QueryLSTStakingEnabled ¶
func (k Keeper) QueryLSTStakingEnabled(goCtx context.Context, req *types.QueryLSTStakingEnabledRequest) (*types.QueryLSTStakingEnabledResponse, error)
QueryLSTStakingEnabled is a gRPC query handler for the LST staking enabled status.
func (Keeper) QueryOperatorRegistrationList ¶
func (k Keeper) QueryOperatorRegistrationList(goCtx context.Context, req *types.QueryOperatorRegistrationListRequest) (*types.QueryOperatorRegistrationListResponse, error)
QueryOperatorRegistrationList return the operator registration list
func (Keeper) QueryOperatorWeightedShares ¶
func (k Keeper) QueryOperatorWeightedShares(goCtx context.Context, req *types.QueryOperatorWeightedSharesRequest) (*types.QueryOperatorWeightedSharesResponse, error)
QueryOperatorWeightedShares return the operator weighted shares
func (Keeper) QueryRegistryRouterAddress ¶
func (k Keeper) QueryRegistryRouterAddress(goCtx context.Context, req *types.QueryRegistryRouterAddressRequest) (*types.QueryRegistryRouterAddressResponse, error)
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 ¶
func (k Keeper) QueryVotingPowerRatio(goCtx context.Context, req *types.QueryVotingPowerRatioRequest) (*types.QueryVotingPowerRatioResponse, error)
QueryVotingPowerRatio queries the voting power ratio of the LST
func (Keeper) RegisterOperator ¶
func (k Keeper) RegisterOperator(goCtx context.Context, msg *types.MsgRegisterOperator) (*types.MsgRegisterOperatorResponse, error)
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 ¶
func (k Keeper) RemovePools(goctx context.Context, msg *types.MsgRemovePools) (*types.MsgRemovePoolsResponse, error)
RemovePools removes pools from the group
func (Keeper) SetBlocksPerEpoch ¶
SetBlocksPerEpoch set blocks per epoch
func (Keeper) SetEpochNumber ¶
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 ¶
func (k Keeper) SetGroupParam(goctx context.Context, msg *types.MsgSetGroupParam) (*types.MsgSetGroupParamResponse, error)
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 ¶
SetLSTStakingEnabled sets the LST staking enabled status
func (Keeper) SetLSTVotingPowerRatio ¶
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 ¶
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 ¶
SnapshotSharesFromRestakingModuleByEpoch is a function to snapshot shares from restaking module by epoch
func (Keeper) StoreKey ¶
func (k Keeper) StoreKey() storetypes.StoreKey
func (Keeper) UpdateLSTStakingEnabled ¶
func (k Keeper) UpdateLSTStakingEnabled(goctx context.Context, msg *types.MsgUpdateLSTStakingEnabled) (*types.MsgUpdateLSTStakingEnabledResponse, error)
UpdateLSTStakingEnabled updates the LST staking enabled status
func (Keeper) UpdateVotingPowerRatio ¶
func (k Keeper) UpdateVotingPowerRatio(goctx context.Context, msg *types.MsgUpdateVotingPowerRatio) (*types.MsgUpdateVotingPowerRatioResponse, error)
UpdateVotingPowerRatio updates the voting power ratio for LST tokens
Source Files
¶
- grpc_query.go
- grpc_query_group_info.go
- grpc_query_lst_staking_enabled.go
- grpc_query_operator_registration.go
- grpc_query_operator_share.go
- grpc_query_registry_router_address.go
- grpc_query_voting_power_ratio.go
- init.go
- keeper.go
- lst_staking.go
- msg_server.go
- msg_server_create_group.go
- msg_server_create_registry_router.go
- msg_server_operate_pools.go
- msg_server_register_operator.go
- msg_server_set_group_param.go
- msg_server_update_lst_staking_enabled.go
- msg_server_update_voting_power_ratio.go
- snapshot_shares.go
- store_epochs.go
- store_group.go
- store_lst_staking_enabled.go
- store_operator_registration.go
- store_operator_share.go
- store_registry_router.go
- store_voting_power.go