keeper

package
v6.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitCreateClientEvent

func EmitCreateClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState)

EmitCreateClientEvent emits a create client event

func EmitSubmitMisbehaviourEvent

func EmitSubmitMisbehaviourEvent(ctx sdk.Context, clientID string, clientState exported.ClientState)

EmitSubmitMisbehaviourEvent emits a client misbehaviour event

func EmitSubmitMisbehaviourEventOnUpdate

func EmitSubmitMisbehaviourEventOnUpdate(ctx sdk.Context, clientID string, clientState exported.ClientState, consensusHeight exported.Height, headerStr string)

EmitSubmitMisbehaviourEventOnUpdate emits a client misbehaviour event on a client update event

func EmitUpdateClientEvent

func EmitUpdateClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState, consensusHeight exported.Height, headerStr string)

EmitUpdateClientEvent emits an update client event

func EmitUpdateClientProposalEvent

func EmitUpdateClientProposalEvent(ctx sdk.Context, clientID string, clientState exported.ClientState)

EmitUpdateClientProposalEvent emits an update client proposal event

func EmitUpgradeClientEvent

func EmitUpgradeClientEvent(ctx sdk.Context, clientID string, clientState exported.ClientState)

EmitUpdateClientEvent emits an upgrade client event

func EmitUpgradeClientProposalEvent

func EmitUpgradeClientProposalEvent(ctx sdk.Context, title string, height int64)

EmitUpgradeClientProposalEvent emits an upgrade client proposal event

Types

type Keeper

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

Keeper represents a type that grants read and write permissions to any client state information

func NewKeeper

NewKeeper creates a new NewKeeper instance

func (Keeper) CheckMisbehaviourAndUpdateState

func (k Keeper) CheckMisbehaviourAndUpdateState(ctx sdk.Context, misbehaviour exported.Misbehaviour) error

CheckMisbehaviourAndUpdateState checks for client misbehaviour and freezes the client if so.

func (Keeper) ClientParams

ClientParams implements the Query/ClientParams gRPC method

func (Keeper) ClientState

ClientState implements the Query/ClientState gRPC method

func (Keeper) ClientStates

ClientStates implements the Query/ClientStates gRPC method

func (Keeper) ClientStatus

ClientStatus implements the Query/ClientStatus gRPC method

func (Keeper) ClientStore

func (k Keeper) ClientStore(ctx sdk.Context, clientID string) sdk.KVStore

ClientStore returns isolated prefix store for each client so they can read/write in separate namespace without being able to read/write other client's data

func (Keeper) ClientUpdateProposal

func (k Keeper) ClientUpdateProposal(ctx sdk.Context, p *types.ClientUpdateProposal) error

ClientUpdateProposal will retrieve the subject and substitute client. A callback will occur to the subject client state with the client prefixed store being provided for both the subject and the substitute client. The localhost client is not allowed to be modified with a proposal. The IBC client implementations are responsible for validating the parameters of the subtitute (enusring they match the subject's parameters) as well as copying the necessary consensus states from the subtitute to the subject client store. The substitute must be Active and the subject must not be Active.

func (Keeper) ConsensusState

ConsensusState implements the Query/ConsensusState gRPC method

func (Keeper) ConsensusStateHeights

ConsensusStateHeights implements the Query/ConsensusStateHeights gRPC method

func (Keeper) ConsensusStates

ConsensusStates implements the Query/ConsensusStates gRPC method

func (Keeper) CreateClient

func (k Keeper) CreateClient(
	ctx sdk.Context, clientState exported.ClientState, consensusState exported.ConsensusState,
) (string, error)

CreateClient creates a new client state and populates it with a given consensus state as defined in https://github.com/cosmos/ibc/tree/master/spec/core/ics-002-client-semantics#create

func (Keeper) GenerateClientIdentifier

func (k Keeper) GenerateClientIdentifier(ctx sdk.Context, clientType string) string

GenerateClientIdentifier returns the next client identifier.

func (Keeper) GetAllClientMetadata

func (k Keeper) GetAllClientMetadata(ctx sdk.Context, genClients []types.IdentifiedClientState) ([]types.IdentifiedGenesisMetadata, error)

GetAllClientMetadata will take a list of IdentifiedClientState and return a list of IdentifiedGenesisMetadata necessary for exporting and importing client metadata into the client store.

func (Keeper) GetAllClients

func (k Keeper) GetAllClients(ctx sdk.Context) (states []exported.ClientState)

GetAllClients returns all stored light client State objects.

func (Keeper) GetAllConsensusStates

func (k Keeper) GetAllConsensusStates(ctx sdk.Context) types.ClientsConsensusStates

GetAllConsensusStates returns all stored client consensus states.

func (Keeper) GetAllGenesisClients

func (k Keeper) GetAllGenesisClients(ctx sdk.Context) types.IdentifiedClientStates

GetAllGenesisClients returns all the clients in state with their client ids returned as IdentifiedClientState

func (Keeper) GetAllowedClients

func (k Keeper) GetAllowedClients(ctx sdk.Context) []string

GetAllowedClients retrieves the allowed clients from the paramstore

func (Keeper) GetClientConsensusState

func (k Keeper) GetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) (exported.ConsensusState, bool)

GetClientConsensusState gets the stored consensus state from a client at a given height.

func (Keeper) GetClientState

func (k Keeper) GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool)

GetClientState gets a particular client from the store

func (Keeper) GetLatestClientConsensusState

func (k Keeper) GetLatestClientConsensusState(ctx sdk.Context, clientID string) (exported.ConsensusState, bool)

GetLatestClientConsensusState gets the latest ConsensusState stored for a given client

func (Keeper) GetNextClientSequence

func (k Keeper) GetNextClientSequence(ctx sdk.Context) uint64

GetNextClientSequence gets the next client sequence from the store.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams returns the total set of ibc-client parameters.

func (Keeper) GetSelfConsensusState

func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height exported.Height) (exported.ConsensusState, error)

GetSelfConsensusState introspects the (self) past historical info at a given height and returns the expected consensus state at that height. For now, can only retrieve self consensus states for the current revision

func (Keeper) GetUpgradePlan

func (k Keeper) GetUpgradePlan(ctx sdk.Context) (plan upgradetypes.Plan, havePlan bool)

GetUpgradePlan executes the upgrade keeper GetUpgradePlan function.

func (Keeper) GetUpgradedClient

func (k Keeper) GetUpgradedClient(ctx sdk.Context, planHeight int64) ([]byte, bool)

GetUpgradedClient executes the upgrade keeper GetUpgradeClient function.

func (Keeper) GetUpgradedConsensusState

func (k Keeper) GetUpgradedConsensusState(ctx sdk.Context, planHeight int64) ([]byte, bool)

GetUpgradedConsensusState returns the upgraded consensus state

func (Keeper) HandleUpgradeProposal

func (k Keeper) HandleUpgradeProposal(ctx sdk.Context, p *types.UpgradeProposal) error

HandleUpgradeProposal sets the upgraded client state in the upgrade store. It clears an IBC client state and consensus state if a previous plan was set. Then it will schedule an upgrade and finally set the upgraded client state in upgrade store.

func (Keeper) HasClientConsensusState

func (k Keeper) HasClientConsensusState(ctx sdk.Context, clientID string, height exported.Height) bool

HasClientConsensusState returns if keeper has a ConsensusState for a particular client at the given height

func (Keeper) IterateClients

func (k Keeper) IterateClients(ctx sdk.Context, cb func(clientID string, cs exported.ClientState) bool)

IterateClients provides an iterator over all stored light client State objects. For each State object, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) IterateConsensusStates

func (k Keeper) IterateConsensusStates(ctx sdk.Context, cb func(clientID string, cs types.ConsensusStateWithHeight) bool)

IterateConsensusStates provides an iterator over all stored consensus states. objects. For each State object, cb will be called. If the cb returns true, the iterator will close and stop.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MustMarshalClientState

func (k Keeper) MustMarshalClientState(clientState exported.ClientState) []byte

MustMarshalClientState attempts to encode an ClientState object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustMarshalConsensusState

func (k Keeper) MustMarshalConsensusState(consensusState exported.ConsensusState) []byte

MustMarshalConsensusState attempts to encode an ConsensusState object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalClientState

func (k Keeper) MustUnmarshalClientState(bz []byte) exported.ClientState

MustUnmarshalClientState attempts to decode and return an ClientState object from raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalConsensusState

func (k Keeper) MustUnmarshalConsensusState(bz []byte) exported.ConsensusState

MustUnmarshalConsensusState attempts to decode and return an ConsensusState object from raw encoded bytes. It panics on error.

func (Keeper) SetAllClientMetadata

func (k Keeper) SetAllClientMetadata(ctx sdk.Context, genMetadata []types.IdentifiedGenesisMetadata)

SetAllClientMetadata takes a list of IdentifiedGenesisMetadata and stores all of the metadata in the client store at the appropriate paths.

func (Keeper) SetClientConsensusState

func (k Keeper) SetClientConsensusState(ctx sdk.Context, clientID string, height exported.Height, consensusState exported.ConsensusState)

SetClientConsensusState sets a ConsensusState to a particular client at the given height

func (Keeper) SetClientState

func (k Keeper) SetClientState(ctx sdk.Context, clientID string, clientState exported.ClientState)

SetClientState sets a particular Client to the store

func (Keeper) SetNextClientSequence

func (k Keeper) SetNextClientSequence(ctx sdk.Context, sequence uint64)

SetNextClientSequence sets the next client sequence to the store.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the total set of ibc-client parameters.

func (Keeper) SetUpgradedConsensusState

func (k Keeper) SetUpgradedConsensusState(ctx sdk.Context, planHeight int64, bz []byte) error

SetUpgradedConsensusState executes the upgrade keeper SetUpgradedConsensusState function.

func (Keeper) UnmarshalClientState

func (k Keeper) UnmarshalClientState(bz []byte) (exported.ClientState, error)

UnmarshalClientState attempts to decode and return an ClientState object from raw encoded bytes.

func (Keeper) UnmarshalConsensusState

func (k Keeper) UnmarshalConsensusState(bz []byte) (exported.ConsensusState, error)

UnmarshalConsensusState attempts to decode and return an ConsensusState object from raw encoded bytes.

func (Keeper) UpdateClient

func (k Keeper) UpdateClient(ctx sdk.Context, clientID string, header exported.Header) error

UpdateClient updates the consensus state and the state root from a provided header.

func (Keeper) UpgradeClient

func (k Keeper) UpgradeClient(ctx sdk.Context, clientID string, upgradedClient exported.ClientState, upgradedConsState exported.ConsensusState,
	proofUpgradeClient, proofUpgradeConsState []byte,
) error

UpgradeClient upgrades the client to a new client state if this new client was committed to by the old client at the specified upgrade height

func (Keeper) UpgradedClientState

UpgradedClientState implements the Query/UpgradedClientState gRPC method

func (Keeper) UpgradedConsensusState

UpgradedConsensusState implements the Query/UpgradedConsensusState gRPC method

func (Keeper) ValidateSelfClient

func (k Keeper) ValidateSelfClient(ctx sdk.Context, clientState exported.ClientState) error

ValidateSelfClient validates the client parameters for a client of the running chain This function is only used to validate the client state the counterparty stores for this chain Client must be in same revision as the executing 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(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2. This migration - migrates solo machine client states from v1 to v2 protobuf definition - prunes solo machine consensus states - prunes expired tendermint consensus states - adds iteration and processed height keys for unexpired tendermint consensus states

Jump to

Keyboard shortcuts

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