keeper

package
v0.0.0-...-1929ff6 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 25 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(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (Hooks) AfterUnbondingInitiated

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

func (Hooks) AfterValidatorBeginUnbonding

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

func (Hooks) AfterValidatorBonded

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

func (Hooks) AfterValidatorCreated

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

func (Hooks) AfterValidatorRemoved

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

func (Hooks) BeforeDelegationCreated

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

func (Hooks) BeforeDelegationRemoved

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

func (Hooks) BeforeDelegationSharesModified

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

func (Hooks) BeforeValidatorModified

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

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	stakingKeeper types.StakingKeeper,
	slashinKeeper types.SlashingKeeper,
	authorityKeeper types.AuthorityKeeper,
	lightclientKeeper types.LightclientKeeper,
	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) BlameByIdentifier

func (Keeper) CheckAndCleanObserver

func (k Keeper) CheckAndCleanObserver(ctx sdk.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(
	ctx sdk.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) CheckObserverSelfDelegation

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

func (Keeper) CheckUpdateReason

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

func (Keeper) CleanObservers

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

CleanObservers cleans a observer Mapper without checking delegation amount

func (Keeper) CleanSlashedValidator

func (k Keeper) CleanSlashedValidator(ctx sdk.Context, valAddress sdk.ValAddress, fraction sdk.Dec) error

func (Keeper) Codec

func (k Keeper) Codec() codec.BinaryCodec

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) 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) GetBallotList

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

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) 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) IsNonTombstonedObserver

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

IsNonTombstonedObserver checks whether a signer is authorized to sign This function checks if the signer is present in the observer set and also checks if the signer is not tombstoned

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) 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)

RemoveObserverFromSet removes an observer from the observer set.

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) 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) Migrate1to2

func (m Migrator) Migrate1to2(_ sdk.Context) error

Migrate1to2 migrates the store from consensus version 1 to 2

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(_ sdk.Context) error

Migrate2to3 migrates the store from consensus version 2 to 3

func (Migrator) Migrate3to4

func (m Migrator) Migrate3to4(_ sdk.Context) error

func (Migrator) Migrate4to5

func (m Migrator) Migrate4to5(_ sdk.Context) error

func (Migrator) Migrate5to6

func (m Migrator) Migrate5to6(_ sdk.Context) error

func (Migrator) Migrate6to7

func (m Migrator) Migrate6to7(_ sdk.Context) error

Migrate6to7 migrates the store from consensus version 6 to 7

func (Migrator) Migrate7to8

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

Migrate7to8 migrates the store from consensus version 7 to 8

Jump to

Keyboard shortcuts

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