keeper

package
v0.0.0-...-54ba5db Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitEventAddObserver

func EmitEventAddObserver(
	ctx sdk.Context,
	observerCount uint64,
	operatorAddress, zetaclientGranteeAddress, zetaclientGranteePubkey string,
)

func EmitEventBallotCreated

func EmitEventBallotCreated(ctx sdk.Context, ballot types.Ballot, observationHash, observationChain string)

func EmitEventKeyGenBlockUpdated

func EmitEventKeyGenBlockUpdated(ctx sdk.Context, keygen *types.Keygen)

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func UpdateObserverList

func UpdateObserverList(list []string, oldObserverAddresss, newObserverAddress string)

Types

type Hooks

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

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(c context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (Hooks) AfterUnbondingInitiated

func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(c context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(c context.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(c context.Context, valAddr sdk.ValAddress, fraction sdkmath.LegacyDec) error

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey,
	memKey storetypes.StoreKey,
	stakingKeeper types.StakingKeeper,
	slashinKeeper types.SlashingKeeper,
	authorityKeeper types.AuthorityKeeper,
	lightclientKeeper types.LightclientKeeper,
	bankKeeper types.BankKeeper,
	authKeeper types.AccountKeeper,
	authority string,
) *Keeper

func (Keeper) AddBallotToList

func (k Keeper) AddBallotToList(ctx sdk.Context, ballot types.Ballot)

AddBallotToList adds a ballot to the list of ballots for a given height.

func (Keeper) AddObserverToSet

func (k Keeper) AddObserverToSet(ctx sdk.Context, address string) (uint64, error)

AddObserverToSet adds an observer to the observer set.It makes sure the updated observer set is valid. It also sets the observer count and returns the updated length of the observer set.

func (Keeper) AddVoteToBallot

func (k Keeper) AddVoteToBallot(
	ctx sdk.Context,
	ballot types.Ballot,
	address string,
	observationType types.VoteType,
) (types.Ballot, error)

func (Keeper) AppendTss

func (k Keeper) AppendTss(ctx sdk.Context, tss types.TSS)

AppendTss appends a tss to the TSSHistoryKey store and update the current TSS to the latest one

func (Keeper) Ballots

Ballots queries all the ballots. It is a paginated query

func (Keeper) BlameByIdentifier

func (Keeper) CheckAndCleanObserver

func (k Keeper) CheckAndCleanObserver(c context.Context, valAddress sdk.ValAddress) error

CheckAndCleanObserver checks if the observer self-delegation is sufficient, if not it removes the observer from the set

func (Keeper) CheckAndCleanObserverDelegator

func (k Keeper) CheckAndCleanObserverDelegator(
	c context.Context,
	valAddress sdk.ValAddress,
	delAddress sdk.AccAddress,
) error

CheckAndCleanObserverDelegator first checks if the delegation is self delegation, if it is, then it checks if the total delegation is sufficient after the delegation is removed, if not it removes the observer from the set

func (Keeper) CheckIfFinalizingVote

func (k Keeper) CheckIfFinalizingVote(ctx sdk.Context, ballot types.Ballot) (types.Ballot, bool)

CheckIfFinalizingVote checks if the ballot is finalized in this block and if it is, it sets the ballot in the store This function with only return true if the ballot moves for pending to success or failed status with this vote. If the ballot is already finalized in the previous vote , it will return false

func (Keeper) CheckIfTssPubkeyHasBeenGenerated

func (k Keeper) CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey string) (types.TSS, bool)

func (Keeper) CheckObserverCanVote

func (k Keeper) CheckObserverCanVote(ctx sdk.Context, address string) error

CheckObserverCanVote checks if the address is a valid observer

func (Keeper) CheckObserverSelfDelegation

func (k Keeper) CheckObserverSelfDelegation(ctx sdk.Context, accAddress string) error

func (Keeper) CheckSystemTxAuthorization

func (k Keeper) CheckSystemTxAuthorization(ctx sdk.Context, observer string, msgExecSigner string) error

CheckSystemTxAuthorization checks if the observer is authorized and, if the tx was submitted via MsgExec (msgExecSigner is non-empty), verifies the signer is the observer's registered hotkey.

func (Keeper) CheckUpdateReason

func (k Keeper) CheckUpdateReason(ctx sdk.Context, msg *types.MsgUpdateObserver) (bool, error)

func (Keeper) CleanObservers

func (k Keeper) CleanObservers(ctx context.Context, valAddress sdk.ValAddress) error

CleanObservers cleans a observer Mapper without checking delegation amount

func (Keeper) CleanSlashedValidator

func (k Keeper) CleanSlashedValidator(
	ctx context.Context,
	valAddress sdk.ValAddress,
	fraction sdkmath.LegacyDec,
) error

func (Keeper) ClearFinalizedMaturedBallots

func (k Keeper) ClearFinalizedMaturedBallots(ctx sdk.Context, maturityBlocks int64, forceDeleteAllBallots bool)

ClearFinalizedMaturedBallots deletes matured ballots and optionally the ballot list for a given height. If deleteAllBallots is true, it deletes all ballots and always deletes the ballot list. If deleteAllBallots is false, it only deletes finalized ballots and only deletes the ballot list if all ballots are deleted. It emits an event for each ballot deleted.

func (Keeper) Codec

func (k Keeper) Codec() codec.Codec

func (Keeper) DeleteBallot

func (k Keeper) DeleteBallot(ctx sdk.Context, index string)

func (Keeper) DeleteBallotListForHeight

func (k Keeper) DeleteBallotListForHeight(ctx sdk.Context, height int64)

func (Keeper) DisableInboundOnly

func (k Keeper) DisableInboundOnly(ctx sdk.Context)

func (Keeper) FindBallot

func (k Keeper) FindBallot(
	ctx sdk.Context,
	index string,
	chain chains.Chain,
	observationType types.ObservationType,
) (ballot types.Ballot, isNew bool, err error)

FindBallot finds the ballot for the given index If the ballot is not found, it creates a new ballot and returns it

func (Keeper) GetAllBallots

func (k Keeper) GetAllBallots(ctx sdk.Context) (voters []*types.Ballot)

func (Keeper) GetAllBlame

func (k Keeper) GetAllBlame(ctx sdk.Context) (BlameRecords []types.Blame)

func (Keeper) GetAllBlamePaginated

func (k Keeper) GetAllBlamePaginated(
	ctx sdk.Context,
	pagination *query.PageRequest,
) (blameRecords []types.Blame, pageRes *query.PageResponse, err error)

func (Keeper) GetAllBlameRecords

func (k Keeper) GetAllBlameRecords(
	goCtx context.Context,
	request *types.QueryAllBlameRecordsRequest,
) (*types.QueryAllBlameRecordsResponse, error)

func (Keeper) GetAllChainNonces

func (k Keeper) GetAllChainNonces(ctx sdk.Context) (list []types.ChainNonces)

GetAllChainNonces returns all chainNonces

func (Keeper) GetAllNodeAccount

func (k Keeper) GetAllNodeAccount(ctx sdk.Context) (list []types.NodeAccount)

GetAllNodeAccount returns all nodeAccount

func (Keeper) GetAllNonceToCctx

func (k Keeper) GetAllNonceToCctx(ctx sdk.Context) (list []types.NonceToCctx)

func (Keeper) GetAllPendingNonces

func (k Keeper) GetAllPendingNonces(ctx sdk.Context) (list []types.PendingNonces, err error)

func (Keeper) GetAllPendingNoncesPaginated

func (k Keeper) GetAllPendingNoncesPaginated(
	ctx sdk.Context,
	pagination *query.PageRequest,
) (list []types.PendingNonces, pageRes *query.PageResponse, err error)

func (Keeper) GetAllTSS

func (k Keeper) GetAllTSS(ctx sdk.Context) (list []types.TSS)

GetAllTSS returns all tss historical information from the store

func (Keeper) GetAllTSSPaginated

func (k Keeper) GetAllTSSPaginated(
	ctx sdk.Context,
	pagination *query.PageRequest,
) (list []types.TSS, pageRes *query.PageResponse, err error)

func (Keeper) GetAllTssFundMigrators

func (k Keeper) GetAllTssFundMigrators(ctx sdk.Context) (fms []types.TssFundMigratorInfo)

func (Keeper) GetAuthKeeper

func (k Keeper) GetAuthKeeper() types.AccountKeeper

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

func (Keeper) GetAuthorityKeeper

func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper

func (Keeper) GetBallot

func (k Keeper) GetBallot(ctx sdk.Context, index string) (val types.Ballot, found bool)

func (Keeper) GetBallotListForHeight

func (k Keeper) GetBallotListForHeight(ctx sdk.Context, height int64) (val types.BallotListForHeight, found bool)

func (Keeper) GetBankKeeper

func (k Keeper) GetBankKeeper() types.BankKeeper

func (Keeper) GetBlame

func (k Keeper) GetBlame(ctx sdk.Context, index string) (val types.Blame, found bool)

func (Keeper) GetBlamesByChainAndNonce

func (k Keeper) GetBlamesByChainAndNonce(
	ctx sdk.Context,
	chainID int64,
	nonce int64,
) (BlameRecords []*types.Blame, found bool)

func (Keeper) GetChainNonces

func (k Keeper) GetChainNonces(ctx sdk.Context, chainID int64) (val types.ChainNonces, found bool)

GetChainNonces returns a chainNonces from its index

func (Keeper) GetChainParamsByChainID

func (k Keeper) GetChainParamsByChainID(ctx sdk.Context, chainID int64) (*types.ChainParams, bool)

func (Keeper) GetChainParamsList

func (k Keeper) GetChainParamsList(ctx sdk.Context) (val types.ChainParamsList, found bool)

func (Keeper) GetCrosschainFlags

func (k Keeper) GetCrosschainFlags(ctx sdk.Context) (val types.CrosschainFlags, found bool)

GetCrosschainFlags returns the crosschain flags

func (Keeper) GetFundMigrator

func (k Keeper) GetFundMigrator(ctx sdk.Context, chainID int64) (val types.TssFundMigratorInfo, found bool)

func (Keeper) GetHistoricalTssByFinalizedHeight

func (k Keeper) GetHistoricalTssByFinalizedHeight(ctx sdk.Context, finalizedZetaHeight int64) (types.TSS, bool)

GetHistoricalTssByFinalizedHeight Returns the TSS address the specified finalized zeta height Finalized zeta height is the zeta block height at which the voting for the generation of a new TSS is finalized

func (Keeper) GetKeygen

func (k Keeper) GetKeygen(ctx sdk.Context) (val types.Keygen, found bool)

GetKeygen returns keygen

func (Keeper) GetLastObserverCount

func (k Keeper) GetLastObserverCount(ctx sdk.Context) (val types.LastObserverCount, found bool)

func (Keeper) GetLightclientKeeper

func (k Keeper) GetLightclientKeeper() types.LightclientKeeper

func (Keeper) GetMaturedBallots

func (k Keeper) GetMaturedBallots(ctx sdk.Context, maturityBlocks int64) (val types.BallotListForHeight, found bool)

func (Keeper) GetNodeAccount

func (k Keeper) GetNodeAccount(ctx sdk.Context, index string) (val types.NodeAccount, found bool)

GetNodeAccount returns a nodeAccount from its index

func (Keeper) GetNonceToCctx

func (k Keeper) GetNonceToCctx(
	ctx sdk.Context,
	tss string,
	chainID int64,
	nonce int64,
) (val types.NonceToCctx, found bool)

func (Keeper) GetObserverSet

func (k Keeper) GetObserverSet(ctx sdk.Context) (val types.ObserverSet, found bool)

func (Keeper) GetOperationalFlags

func (k Keeper) GetOperationalFlags(ctx sdk.Context) (val types.OperationalFlags, found bool)

func (Keeper) GetPendingNonces

func (k Keeper) GetPendingNonces(ctx sdk.Context, tss string, chainID int64) (val types.PendingNonces, found bool)

func (Keeper) GetPreviousTSS

func (k Keeper) GetPreviousTSS(ctx sdk.Context) (val types.TSS, found bool)

GetPreviousTSS returns the previous tss information

func (Keeper) GetSlashingKeeper

func (k Keeper) GetSlashingKeeper() types.SlashingKeeper

func (Keeper) GetStakingKeeper

func (k Keeper) GetStakingKeeper() types.StakingKeeper

func (Keeper) GetSupportedChainFromChainID

func (k Keeper) GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) (chains.Chain, bool)

GetSupportedChainFromChainID returns the chain from the chain id it returns nil if the chain doesn't exist or is not supported

func (Keeper) GetSupportedChains

func (k Keeper) GetSupportedChains(ctx sdk.Context) []chains.Chain

GetSupportedChains returns the list of supported chains

func (Keeper) GetTSS

func (k Keeper) GetTSS(ctx sdk.Context) (val types.TSS, found bool)

GetTSS returns the current tss information

func (Keeper) GetTssAddress

func (Keeper) HasVoted

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IsAddressPartOfObserverSet

func (k Keeper) IsAddressPartOfObserverSet(ctx sdk.Context, address string) bool

func (Keeper) IsInboundEnabled

func (k Keeper) IsInboundEnabled(ctx sdk.Context) (found bool)

func (Keeper) IsOperatorTombstoned

func (k Keeper) IsOperatorTombstoned(ctx sdk.Context, creator string) (bool, error)

func (Keeper) IsOutboundEnabled

func (k Keeper) IsOutboundEnabled(ctx sdk.Context) (found bool)

func (Keeper) IsV2ZetaEnabled

func (k Keeper) IsV2ZetaEnabled(ctx sdk.Context) bool

IsV2ZetaEnabled returns true if V2 ZETA gateway flows are enabled

func (Keeper) IsValidator

func (k Keeper) IsValidator(ctx sdk.Context, creator string) error

func (Keeper) Logger

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

func (Keeper) ObserverSet

func (k Keeper) ObserverSet(
	goCtx context.Context,
	req *types.QueryObserverSet,
) (*types.QueryObserverSetResponse, error)

func (Keeper) RemoveAllExistingMigrators

func (k Keeper) RemoveAllExistingMigrators(ctx sdk.Context)

func (Keeper) RemoveChainNonces

func (k Keeper) RemoveChainNonces(ctx sdk.Context, chainID int64)

RemoveChainNonces removes a chainNonces from the store

func (Keeper) RemoveCrosschainFlags

func (k Keeper) RemoveCrosschainFlags(ctx sdk.Context)

RemoveCrosschainFlags removes crosschain flags from the store

func (Keeper) RemoveFromPendingNonces

func (k Keeper) RemoveFromPendingNonces(ctx sdk.Context, tssPubkey string, chainID int64, nonce int64)

func (Keeper) RemoveKeygen

func (k Keeper) RemoveKeygen(ctx sdk.Context)

RemoveKeygen removes keygen from the store

func (Keeper) RemoveNodeAccount

func (k Keeper) RemoveNodeAccount(ctx sdk.Context, index string)

RemoveNodeAccount removes a nodeAccount from the store

func (Keeper) RemoveNonceToCctx

func (k Keeper) RemoveNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx)

func (Keeper) RemoveObserverFromSet

func (k Keeper) RemoveObserverFromSet(ctx sdk.Context, address string) uint64

RemoveObserverFromSet removes an observer from the observer set. Returns the observer count after the operation

func (Keeper) RemovePendingNonces

func (k Keeper) RemovePendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces)

func (Keeper) RemoveTSS

func (k Keeper) RemoveTSS(ctx sdk.Context)

RemoveTSS removes tss information from the store

func (Keeper) SetBallot

func (k Keeper) SetBallot(ctx sdk.Context, ballot *types.Ballot)

func (Keeper) SetBallotList

func (k Keeper) SetBallotList(ctx sdk.Context, ballotlist *types.BallotListForHeight)

func (Keeper) SetBlame

func (k Keeper) SetBlame(ctx sdk.Context, blame types.Blame)

func (Keeper) SetChainNonces

func (k Keeper) SetChainNonces(ctx sdk.Context, chainNonces types.ChainNonces)

SetChainNonces set a specific chainNonces in the store from its index

func (Keeper) SetChainParamsList

func (k Keeper) SetChainParamsList(ctx sdk.Context, chainParams types.ChainParamsList)

func (Keeper) SetCrosschainFlags

func (k Keeper) SetCrosschainFlags(ctx sdk.Context, crosschainFlags types.CrosschainFlags)

SetCrosschainFlags set the crosschain flags in the store

func (Keeper) SetFundMigrator

func (k Keeper) SetFundMigrator(ctx sdk.Context, fm types.TssFundMigratorInfo)

func (Keeper) SetKeygen

func (k Keeper) SetKeygen(ctx sdk.Context, keygen types.Keygen)

SetKeygen set keygen in the store

func (Keeper) SetLastObserverCount

func (k Keeper) SetLastObserverCount(ctx sdk.Context, lbc *types.LastObserverCount)

func (Keeper) SetNodeAccount

func (k Keeper) SetNodeAccount(ctx sdk.Context, nodeAccount types.NodeAccount)

SetNodeAccount set a specific nodeAccount in the store from its index

func (Keeper) SetNonceToCctx

func (k Keeper) SetNonceToCctx(ctx sdk.Context, nonceToCctx types.NonceToCctx)

func (Keeper) SetObserverSet

func (k Keeper) SetObserverSet(ctx sdk.Context, om types.ObserverSet)

func (Keeper) SetOperationalFlags

func (k Keeper) SetOperationalFlags(ctx sdk.Context, operationalFlags types.OperationalFlags)

func (Keeper) SetPendingNonces

func (k Keeper) SetPendingNonces(ctx sdk.Context, pendingNonces types.PendingNonces)

func (Keeper) SetTSS

func (k Keeper) SetTSS(ctx sdk.Context, tss types.TSS)

SetTSS sets tss information to the store

func (Keeper) SetTSSHistory

func (k Keeper) SetTSSHistory(ctx sdk.Context, tss types.TSS)

SetTSSHistory Sets a new TSS into the TSS history store

func (Keeper) SetTssAndUpdateNonce

func (k Keeper) SetTssAndUpdateNonce(ctx sdk.Context, tss types.TSS)

func (Keeper) StoreKey

func (k Keeper) StoreKey() storetypes.StoreKey

func (Keeper) SupportedChains

func (Keeper) TSS

TSS returns the tss address for the current tss only

func (Keeper) TssFundsMigratorInfo

TssFundsMigratorInfo queries a tss fund migrator info

func (Keeper) TssFundsMigratorInfoAll

TssFundsMigratorInfoAll queries all tss fund migrator info for all chains

func (Keeper) TssHistory

TssHistory Query historical list of TSS information

func (Keeper) UpdateObserverAddress

func (k Keeper) UpdateObserverAddress(ctx sdk.Context, oldObserverAddress, newObserverAddress string) error

UpdateObserverAddress updates an observer address in the observer set.It makes sure the updated observer set is valid.

func (Keeper) VoteOnBallot

func (k Keeper) VoteOnBallot(
	ctx sdk.Context,
	chain chains.Chain,
	ballotIndex string,
	observationType types.ObservationType,
	voter string,
	voteType types.VoteType,
) (
	ballot types.Ballot,
	isFinalized bool,
	isNew bool,
	err error)

VoteOnBallot finds a ballot or creates a new one if not found, and casts a vote on it. Then proceed to check if the vote has been finalized. This function holds generic logic for all types of votes.

func (Keeper) VoteOnInboundBallot

func (k Keeper) VoteOnInboundBallot(
	ctx sdk.Context,
	senderChainID int64,
	receiverChainID int64,
	coinType coin.CoinType,
	voter string,
	ballotIndex string,
	inboundHash string,
) (isFinalized bool, isNew bool, err error)

VoteOnInboundBallot casts a vote on an inbound transaction observed on a connected chain. If this is the first vote, a new ballot is created. When a threshold of votes is reached, the ballot is finalized.

func (Keeper) VoteOnOutboundBallot

func (k Keeper) VoteOnOutboundBallot(
	ctx sdk.Context,
	ballotIndex string,
	outTxChainID int64,
	receiveStatus chains.ReceiveStatus,
	voter string,
) (isFinalized bool, isNew bool, ballot observertypes.Ballot, observationChainName string, err error)

VoteOnOutboundBallot casts a vote on an outbound transaction observed on a connected chain (after it has been broadcasted to and finalized on a connected chain). If this is the first vote, a new ballot is created. When a threshold of votes is reached, the ballot is finalized. returns if the vote is finalized, if the ballot is new, the ballot status and the name of the observation chain

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate11to12

func (m Migrator) Migrate11to12(ctx sdk.Context) error

Migrate11to12 migrates the store from consensus version 11 to 12

Jump to

Keyboard shortcuts

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