keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey,
	memKey storetypes.StoreKey,
	authorityKeeper types.AuthorityKeeper,
) Keeper

NewKeeper creates new instances of the lightclient Keeper

func (Keeper) AddBlockHeader

func (k Keeper) AddBlockHeader(
	ctx sdk.Context,
	chainID int64,
	height int64,
	blockHash []byte,
	header proofs.HeaderData,
	parentHash []byte,
)

AddBlockHeader adds a new block header to the store and updates the chain state

func (Keeper) BlockHeader

BlockHeader queries block header by hash

func (Keeper) BlockHeaderAll

BlockHeaderAll queries all block headers

func (Keeper) ChainState

ChainState queries chain state by chain

func (Keeper) ChainStateAll

ChainStateAll queries all chain statess

func (Keeper) CheckNewBlockHeader

func (k Keeper) CheckNewBlockHeader(
	ctx sdk.Context,
	chainID int64,
	blockHash []byte,
	height int64,
	header proofs.HeaderData,
) ([]byte, error)

CheckNewBlockHeader checks if a new block header is valid and can be added to the store It checks that the parent block header exists and that the block height is valid It also checks that the block header does not already exist It returns an error if the block header is invalid Upon success, it returns the parent hash

func (Keeper) CheckVerificationFlagsEnabled

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

CheckVerificationFlagsEnabled checks for a specific chain if the verification flags are enabled It returns an error if the chain is not enabled

func (Keeper) GetAllBlockHeaders

func (k Keeper) GetAllBlockHeaders(ctx sdk.Context) (list []proofs.BlockHeader)

GetAllBlockHeaders returns all block headers

func (Keeper) GetAllChainStates

func (k Keeper) GetAllChainStates(ctx sdk.Context) (list []types.ChainState)

GetAllChainStates returns all chain states

func (Keeper) GetAuthorityKeeper

func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper

GetAuthorityKeeper returns the authority keeper

func (Keeper) GetBlockHeader

func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val proofs.BlockHeader, found bool)

GetBlockHeader returns a block header from its hash

func (Keeper) GetChainState

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

GetChainState returns a chain state from its chainID

func (Keeper) GetCodec

func (k Keeper) GetCodec() codec.Codec

GetCodec returns the codec for lightclient

func (Keeper) GetMemKey

func (k Keeper) GetMemKey() storetypes.StoreKey

GetMemKey returns the mem key to the store for lightclient

func (Keeper) GetStoreKey

func (k Keeper) GetStoreKey() storetypes.StoreKey

GetStoreKey returns the key to the store for lightclient

func (Keeper) GetVerificationFlags

func (k Keeper) GetVerificationFlags(ctx sdk.Context) (val types.VerificationFlags, found bool)

GetVerificationFlags returns the verification flags

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Prove

Prove checks two things: 1. the block header is available 2. the proof is valid

func (Keeper) RemoveBlockHeader

func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte)

RemoveBlockHeader removes a block header from the store

func (Keeper) SetBlockHeader

func (k Keeper) SetBlockHeader(ctx sdk.Context, header proofs.BlockHeader)

SetBlockHeader set a specific block header in the store from its index

func (Keeper) SetChainState

func (k Keeper) SetChainState(ctx sdk.Context, chainState types.ChainState)

SetChainState set a specific chain state in the store from its index

func (Keeper) SetVerificationFlags

func (k Keeper) SetVerificationFlags(ctx sdk.Context, crosschainFlags types.VerificationFlags)

SetVerificationFlags set the verification flags in the store

func (Keeper) VerificationFlags

VerificationFlags implements the Query/VerificationFlags gRPC method

func (Keeper) VerifyProof

func (k Keeper) VerifyProof(ctx sdk.Context, proof *proofs.Proof, chainID int64, blockHash string, txIndex int64) ([]byte, error)

VerifyProof verifies the merkle proof for a given chain and block header It returns the transaction bytes if the proof is valid

Jump to

Keyboard shortcuts

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