keeper

package
v0.0.0-...-f5e5adb Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 19 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) CheckBlockHeaderVerificationEnabled

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

CheckBlockHeaderVerificationEnabled checks for a specific chain if BlockHeaderVerification is enabled or not

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

func (k Keeper) GetBlockHeaderVerification(ctx sdk.Context) (bhv types.BlockHeaderVerification, found bool)

GetBlockHeaderVerification returns the BlockHeaderVerification settings for all chains

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

HeaderEnabledChains implements the Query/HeaderEnabledChains gRPC method It returns a list of chains that have block header verification enabled.

func (Keeper) HeaderSupportedChains

HeaderSupportedChains implements the Query/HeaderEnabledChains gRPC method It returns a list for chains that support block header verification. Some chains in this list might be disabled which is indicated by the value of the `enabled` field.

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

func (k Keeper) SetBlockHeaderVerification(ctx sdk.Context, bhv types.BlockHeaderVerification)

SetBlockHeaderVerification sets BlockHeaderVerification settings for all chains

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