keeper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuerierClients

func QuerierClients(ctx sdk.Context, req abci.RequestQuery, k Keeper) ([]byte, error)

QuerierClients defines the sdk.Querier to query all the light client states.

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

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, sk types.StakingKeeper) Keeper

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

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

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

CONTRACT: ClientState was constructed correctly from given initial consensusState

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) (clientConsStates []types.ClientConsensusStates)

GetAllConsensusStates returns all stored client consensus states. NOTE: non deterministic.

func (Keeper) GetClientConsensusState

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

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

func (Keeper) GetClientConsensusStateLTE

func (k Keeper) GetClientConsensusStateLTE(ctx sdk.Context, clientID string, maxHeight uint64) (exported.ConsensusState, bool)

GetClientConsensusStateLTE will get the latest ConsensusState of a particular client at the latest height less than or equal to the 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) GetClientType

func (k Keeper) GetClientType(ctx sdk.Context, clientID string) (exported.ClientType, bool)

GetClientType gets the consensus type for a specific client

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

func (k Keeper) GetSelfConsensusState(ctx sdk.Context, height uint64) (exported.ConsensusState, bool)

GetSelfConsensusState introspects the (self) past historical info at a given height and returns the expected consensus state at that height.

func (Keeper) HasClientConsensusState

func (k Keeper) HasClientConsensusState(ctx sdk.Context, clientID string, height uint64) 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(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 exported.ConsensusState) 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) SetClientConsensusState

func (k Keeper) SetClientConsensusState(ctx sdk.Context, clientID string, height uint64, 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, clientState exported.ClientState)

SetClientState sets a particular Client to the store

func (Keeper) SetClientType

func (k Keeper) SetClientType(ctx sdk.Context, clientID string, clientType exported.ClientType)

SetClientType sets the specific client consensus type to the provable store

func (Keeper) UpdateClient

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

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

Jump to

Keyboard shortcuts

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