Documentation
¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AddUniversalValidator(ctx context.Context, coreValidatorAddr string, networkInfo types.NetworkInfo) error
- func (k Keeper) AddVoteToBallot(ctx context.Context, ballot types.Ballot, address string, ...) (types.Ballot, error)
- func (k Keeper) AllActiveBallotIDs(goCtx context.Context, req *types.QueryActiveBallotIDsRequest) (*types.QueryActiveBallotIDsResponse, error)
- func (k Keeper) CheckIfFinalizingVote(ctx context.Context, b types.Ballot) (types.Ballot, bool, error)
- func (k Keeper) CreateBallot(ctx context.Context, id string, ballotType types.BallotObservationType, ...) (types.Ballot, error)
- func (k Keeper) DeleteBallot(ctx context.Context, id string) error
- func (k Keeper) ExpireBallotsBeforeHeight(ctx context.Context, currentHeight int64) error
- func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
- func (k Keeper) GetAllUniversalValidators(ctx context.Context) ([]types.UniversalValidator, error)
- func (k Keeper) GetBallot(ctx context.Context, id string) (types.Ballot, error)
- func (k Keeper) GetBlockHeight(ctx context.Context) (int64, error)
- func (k Keeper) GetEligibleVoters(ctx context.Context) ([]types.UniversalValidator, error)
- func (k Keeper) GetOrCreateBallot(ctx context.Context, id string, ballotType types.BallotObservationType, ...) (types.Ballot, bool, error)
- func (k Keeper) GetUniversalValidator(ctx context.Context, addr sdk.ValAddress) (types.UniversalValidator, bool, error)
- func (k Keeper) GetValidatorsByStatus(ctx context.Context, status types.UVStatus) ([]types.UniversalValidator, error)
- func (k Keeper) HasUniversalValidatorInSet(ctx context.Context, uvAddr sdk.ValAddress) (bool, error)
- func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error
- func (k Keeper) IsActiveUniversalValidator(ctx context.Context, validatorOperatorAddr string) (bool, error)
- func (k Keeper) IsBondedUniversalValidator(ctx context.Context, universalValidator string) (bool, error)
- func (k Keeper) IsTombstonedUniversalValidator(ctx context.Context, universalValidator string) (bool, error)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) MarkBallotExpired(ctx context.Context, id string) error
- func (k Keeper) MarkBallotFinalized(ctx context.Context, id string, status types.BallotStatus) error
- func (k Keeper) RemoveUniversalValidator(ctx context.Context, universalValidatorAddr string) error
- func (k Keeper) RemoveUniversalValidatorFromSet(ctx context.Context, addr sdk.ValAddress) error
- func (k Keeper) SchemaBuilder() *collections.SchemaBuilder
- func (k Keeper) SetBallot(ctx context.Context, ballot types.Ballot) error
- func (k *Keeper) SetHooks(h types.UValidatorHooks) *Keeper
- func (k Keeper) UpdateParams(ctx context.Context, params types.Params) error
- func (k Keeper) UpdateUniversalValidator(ctx context.Context, coreValidatorAddr string, networkInfo types.NetworkInfo) error
- func (k Keeper) UpdateUniversalValidatorStatus(ctx context.Context, coreValidatorAddr string, newStatus types.UVStatus) error
- func (k Keeper) UpdateValidatorStatus(ctx context.Context, addr sdk.ValAddress, newStatus types.UVStatus) error
- func (k Keeper) VoteOnBallot(ctx context.Context, id string, ballotType types.BallotObservationType, ...) (ballot types.Ballot, isFinalized bool, isNew bool, err error)
- type MultiUValidatorHooks
- func (mh MultiUValidatorHooks) AfterValidatorAdded(ctx sdk.Context, valAddr sdk.ValAddress)
- func (mh MultiUValidatorHooks) AfterValidatorRemoved(ctx sdk.Context, valAddr sdk.ValAddress)
- func (mh MultiUValidatorHooks) AfterValidatorStatusChanged(ctx sdk.Context, valAddr sdk.ValAddress, oldStatus, newStatus types.UVStatus)
- type Querier
- func (k Querier) AllActiveBallots(goCtx context.Context, req *types.QueryActiveBallotsRequest) (*types.QueryActiveBallotsResponse, error)
- func (k Querier) AllBallots(goCtx context.Context, req *types.QueryBallotsRequest) (*types.QueryBallotsResponse, error)
- func (k Querier) AllExpiredBallotIDs(goCtx context.Context, req *types.QueryExpiredBallotIDsRequest) (*types.QueryExpiredBallotIDsResponse, error)
- func (k Querier) AllExpiredBallots(goCtx context.Context, req *types.QueryExpiredBallotsRequest) (*types.QueryExpiredBallotsResponse, error)
- func (k Querier) AllFinalizedBallotIDs(goCtx context.Context, req *types.QueryFinalizedBallotIDsRequest) (*types.QueryFinalizedBallotIDsResponse, error)
- func (k Querier) AllFinalizedBallots(goCtx context.Context, req *types.QueryFinalizedBallotsRequest) (*types.QueryFinalizedBallotsResponse, error)
- func (k Querier) AllUniversalValidators(goCtx context.Context, req *types.QueryUniversalValidatorsSetRequest) (*types.QueryUniversalValidatorsSetResponse, error)
- func (k Querier) Ballot(goCtx context.Context, req *types.QueryBallotRequest) (*types.QueryBallotResponse, error)
- func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) UniversalValidator(goCtx context.Context, req *types.QueryUniversalValidatorRequest) (*types.QueryUniversalValidatorResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the module MsgServer interface.
Types ¶
type Keeper ¶
type Keeper struct {
// state management
Params collections.Item[types.Params]
// TODO: write the migration from sdk.ValAddress to current structure
UniversalValidatorSet collections.Map[sdk.ValAddress, types.UniversalValidator] // Set of all registered Universal Validator addresses
// Ballots management
Ballots collections.Map[string, types.Ballot] // stores the actual ballot object, keyed by ballot ID
ActiveBallotIDs collections.KeySet[string] // set of ballot IDs currently collecting votes
ExpiredBallotIDs collections.KeySet[string] // set of ballot IDs that have expired (not yet pruned)
FinalizedBallotIDs collections.KeySet[string] // set of ballot IDs that are PASSED or REJECTED
StakingKeeper types.StakingKeeper
SlashingKeeper types.SlashingKeeper
UtssKeeper types.UtssKeeper
BankKeeper types.BankKeeper
AuthKeeper types.AccountKeeper
DistributionKeeper types.DistributionKeeper
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService storetypes.KVStoreService, logger log.Logger, authority string, bankKeeper types.BankKeeper, authKeeper types.AccountKeeper, distributionKeeper types.DistributionKeeper, stakingKeeper types.StakingKeeper, slashingKeeper types.SlashingKeeper, utssKeeper types.UtssKeeper, ) Keeper
NewKeeper creates a new Keeper instance
func (Keeper) AddUniversalValidator ¶
func (k Keeper) AddUniversalValidator( ctx context.Context, coreValidatorAddr string, networkInfo types.NetworkInfo, ) error
new validator -> added as a PENDING_JOIN status if existing: inactive -> added as a PENDING_JOIN status any other status -> revert AddUniversalValidator registers or reactivates a core validator as a universal validator. It ensures the core validator exists, is bonded, and handles lifecycle reactivation.
func (Keeper) AddVoteToBallot ¶
func (Keeper) AllActiveBallotIDs ¶
func (k Keeper) AllActiveBallotIDs(goCtx context.Context, req *types.QueryActiveBallotIDsRequest) (*types.QueryActiveBallotIDsResponse, error)
AllActiveBallotIDs implements types.QueryServer.
func (Keeper) CheckIfFinalizingVote ¶
func (Keeper) CreateBallot ¶
func (k Keeper) CreateBallot( ctx context.Context, id string, ballotType types.BallotObservationType, eligibleVoters []string, votingThreshold int64, expiryAfterBlocks int64, ) (types.Ballot, error)
CreateBallot creates a new ballot with the given parameters, stores it, and marks it as active.
func (Keeper) DeleteBallot ¶
DeleteBallot removes a ballot and its ID from all collections
func (Keeper) ExpireBallotsBeforeHeight ¶
ExpireBallotsBeforeHeight checks active ballots and marks expired ones
func (*Keeper) ExportGenesis ¶
func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState
ExportGenesis exports the module's state to a genesis state.
func (Keeper) GetAllUniversalValidators ¶
GetAllUniversalValidators returns all validators in the UniversalValidatorSet.
func (Keeper) GetEligibleVoters ¶
GetEligibleVoters returns all validators that are eligible to vote on external transactions. Eligibility: validators with status ACTIVE or PENDING_JOIN.
func (Keeper) GetOrCreateBallot ¶
func (k Keeper) GetOrCreateBallot( ctx context.Context, id string, ballotType types.BallotObservationType, voters []string, votesNeeded int64, expiryAfterBlocks int64, ) (types.Ballot, bool, error)
GetOrCreateBallot returns the ballot if it exists, otherwise creates it.
func (Keeper) GetUniversalValidator ¶
func (k Keeper) GetUniversalValidator( ctx context.Context, addr sdk.ValAddress, ) (types.UniversalValidator, bool, error)
GetUniversalValidator returns a single UniversalValidator by address.
func (Keeper) GetValidatorsByStatus ¶
func (k Keeper) GetValidatorsByStatus(ctx context.Context, status types.UVStatus) ([]types.UniversalValidator, error)
GetValidatorsByStatus returns a list of validators filtered by status (ACTIVE, PENDING_JOIN, etc.).
func (Keeper) HasUniversalValidatorInSet ¶
func (*Keeper) InitGenesis ¶
InitGenesis initializes the module's state from a genesis state.
func (Keeper) IsActiveUniversalValidator ¶ added in v0.0.13
func (k Keeper) IsActiveUniversalValidator( ctx context.Context, validatorOperatorAddr string, ) (bool, error)
IsActiveUniversalValidator returns true if the given validator address is currently registered as an active universal validator.
func (Keeper) IsBondedUniversalValidator ¶
func (Keeper) IsTombstonedUniversalValidator ¶
func (Keeper) MarkBallotExpired ¶
MarkBallotExpired moves a ballot from active to expired
func (Keeper) MarkBallotFinalized ¶
func (k Keeper) MarkBallotFinalized(ctx context.Context, id string, status types.BallotStatus) error
MarkBallotFinalized moves a ballot from active to finalized (PASSED or REJECTED)
func (Keeper) RemoveUniversalValidator ¶
func (k Keeper) RemoveUniversalValidator( ctx context.Context, universalValidatorAddr string, ) error
RemoveUniversalValidator handles universal validator removal lifecycle:
- ACTIVE -> PENDING_LEAVE
- PENDING_JOIN ->
- if in current TSS process (ongoing) → revert (keygen ongoing)
- if not in current TSS process (ongoing) → INACTIVE
It ensures the validator exists before removal and triggers hooks on status change.
func (Keeper) RemoveUniversalValidatorFromSet ¶
func (Keeper) SchemaBuilder ¶
func (k Keeper) SchemaBuilder() *collections.SchemaBuilder
func (Keeper) UpdateParams ¶
updateParams is for updating params collections of the module
func (Keeper) UpdateUniversalValidator ¶
func (k Keeper) UpdateUniversalValidator( ctx context.Context, coreValidatorAddr string, networkInfo types.NetworkInfo, ) error
UpdateUniversalValidator updates the metadata of the registered universal validator
func (Keeper) UpdateUniversalValidatorStatus ¶
func (k Keeper) UpdateUniversalValidatorStatus( ctx context.Context, coreValidatorAddr string, newStatus types.UVStatus, ) error
UpdateUniversalValidatorStatus updates the UV status from PENDING_LEAVE to ACTIVE any other case of status change must fail
func (Keeper) UpdateValidatorStatus ¶
func (k Keeper) UpdateValidatorStatus(ctx context.Context, addr sdk.ValAddress, newStatus types.UVStatus) error
UpdateValidatorStatus updates the validator’s lifecycle status. It appends a LifecycleEvent, validates legal transitions, and saves the updated record.
func (Keeper) VoteOnBallot ¶
type MultiUValidatorHooks ¶
type MultiUValidatorHooks []types.UValidatorHooks
MultiUValidatorHooks allows multiple modules to listen to the same events.
func NewMultiUValidatorHooks ¶
func NewMultiUValidatorHooks(hooks ...types.UValidatorHooks) MultiUValidatorHooks
NewMultiUValidatorHooks creates a new combined hook instance.
func (MultiUValidatorHooks) AfterValidatorAdded ¶
func (mh MultiUValidatorHooks) AfterValidatorAdded(ctx sdk.Context, valAddr sdk.ValAddress)
AfterValidatorAdded calls every hook in the list.
func (MultiUValidatorHooks) AfterValidatorRemoved ¶
func (mh MultiUValidatorHooks) AfterValidatorRemoved(ctx sdk.Context, valAddr sdk.ValAddress)
AfterValidatorRemoved calls every hook in the list.
func (MultiUValidatorHooks) AfterValidatorStatusChanged ¶
func (mh MultiUValidatorHooks) AfterValidatorStatusChanged(ctx sdk.Context, valAddr sdk.ValAddress, oldStatus, newStatus types.UVStatus)
AfterValidatorStatusChanged calls every hook in the list.
type Querier ¶
type Querier struct {
Keeper
}
func NewQuerier ¶
func (Querier) AllActiveBallots ¶
func (k Querier) AllActiveBallots(goCtx context.Context, req *types.QueryActiveBallotsRequest) (*types.QueryActiveBallotsResponse, error)
ActiveBallots implements types.QueryServer.
func (Querier) AllBallots ¶
func (k Querier) AllBallots(goCtx context.Context, req *types.QueryBallotsRequest) (*types.QueryBallotsResponse, error)
AllBallots implements types.QueryServer.
func (Querier) AllExpiredBallotIDs ¶
func (k Querier) AllExpiredBallotIDs(goCtx context.Context, req *types.QueryExpiredBallotIDsRequest) (*types.QueryExpiredBallotIDsResponse, error)
AllExpiredBallotIDs implements types.QueryServer.
func (Querier) AllExpiredBallots ¶
func (k Querier) AllExpiredBallots(goCtx context.Context, req *types.QueryExpiredBallotsRequest) (*types.QueryExpiredBallotsResponse, error)
AllExpiredBallots implements types.QueryServer.
func (Querier) AllFinalizedBallotIDs ¶
func (k Querier) AllFinalizedBallotIDs(goCtx context.Context, req *types.QueryFinalizedBallotIDsRequest) (*types.QueryFinalizedBallotIDsResponse, error)
FinalizedBallotIDs implements types.QueryServer.
func (Querier) AllFinalizedBallots ¶
func (k Querier) AllFinalizedBallots(goCtx context.Context, req *types.QueryFinalizedBallotsRequest) (*types.QueryFinalizedBallotsResponse, error)
FinalizedBallots implements types.QueryServer.
func (Querier) AllUniversalValidators ¶
func (k Querier) AllUniversalValidators(goCtx context.Context, req *types.QueryUniversalValidatorsSetRequest) (*types.QueryUniversalValidatorsSetResponse, error)
func (Querier) Ballot ¶
func (k Querier) Ballot(goCtx context.Context, req *types.QueryBallotRequest) (*types.QueryBallotResponse, error)
Ballot implements types.QueryServer.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) UniversalValidator ¶
func (k Querier) UniversalValidator(goCtx context.Context, req *types.QueryUniversalValidatorRequest) (*types.QueryUniversalValidatorResponse, error)