Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AddBlockHeader(ctx sdk.Context, chainID int64, height int64, blockHash []byte, ...)
- func (k Keeper) BlockHeader(c context.Context, req *types.QueryGetBlockHeaderRequest) (*types.QueryGetBlockHeaderResponse, error)
- func (k Keeper) BlockHeaderAll(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error)
- func (k Keeper) ChainState(c context.Context, req *types.QueryGetChainStateRequest) (*types.QueryGetChainStateResponse, error)
- func (k Keeper) ChainStateAll(c context.Context, req *types.QueryAllChainStateRequest) (*types.QueryAllChainStateResponse, error)
- func (k Keeper) CheckBlockHeaderVerificationEnabled(ctx sdk.Context, chainID int64) error
- func (k Keeper) CheckNewBlockHeader(ctx sdk.Context, chainID int64, blockHash []byte, height int64, ...) ([]byte, error)
- func (k Keeper) GetAllBlockHeaders(ctx sdk.Context) (list []proofs.BlockHeader)
- func (k Keeper) GetAllChainStates(ctx sdk.Context) (list []types.ChainState)
- func (k Keeper) GetAuthorityKeeper() types.AuthorityKeeper
- func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val proofs.BlockHeader, found bool)
- func (k Keeper) GetBlockHeaderVerification(ctx sdk.Context) (bhv types.BlockHeaderVerification, found bool)
- func (k Keeper) GetChainState(ctx sdk.Context, chainID int64) (val types.ChainState, found bool)
- func (k Keeper) GetCodec() codec.Codec
- func (k Keeper) GetMemKey() storetypes.StoreKey
- func (k Keeper) GetStoreKey() storetypes.StoreKey
- func (k Keeper) HeaderEnabledChains(c context.Context, req *types.QueryHeaderEnabledChainsRequest) (*types.QueryHeaderEnabledChainsResponse, error)
- func (k Keeper) HeaderSupportedChains(c context.Context, req *types.QueryHeaderSupportedChainsRequest) (*types.QueryHeaderSupportedChainsResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.QueryProveResponse, error)
- func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte)
- func (k Keeper) SetBlockHeader(ctx sdk.Context, header proofs.BlockHeader)
- func (k Keeper) SetBlockHeaderVerification(ctx sdk.Context, bhv types.BlockHeaderVerification)
- func (k Keeper) SetChainState(ctx sdk.Context, chainState types.ChainState)
- func (k Keeper) VerifyProof(ctx sdk.Context, proof *proofs.Proof, chainID int64, blockHash string, ...) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 ¶
func (k Keeper) BlockHeader( c context.Context, req *types.QueryGetBlockHeaderRequest, ) (*types.QueryGetBlockHeaderResponse, error)
BlockHeader queries block header by hash
func (Keeper) BlockHeaderAll ¶
func (k Keeper) BlockHeaderAll( c context.Context, req *types.QueryAllBlockHeaderRequest, ) (*types.QueryAllBlockHeaderResponse, error)
BlockHeaderAll queries all block headers
func (Keeper) ChainState ¶
func (k Keeper) ChainState( c context.Context, req *types.QueryGetChainStateRequest, ) (*types.QueryGetChainStateResponse, error)
ChainState queries chain state by chain
func (Keeper) ChainStateAll ¶
func (k Keeper) ChainStateAll( c context.Context, req *types.QueryAllChainStateRequest, ) (*types.QueryAllChainStateResponse, error)
ChainStateAll queries all chain statess
func (Keeper) CheckBlockHeaderVerificationEnabled ¶
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 ¶
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 ¶
GetChainState returns a chain state from its chainID
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 ¶
func (k Keeper) HeaderEnabledChains( c context.Context, req *types.QueryHeaderEnabledChainsRequest, ) (*types.QueryHeaderEnabledChainsResponse, error)
HeaderEnabledChains implements the Query/HeaderEnabledChains gRPC method It returns a list of chains that have block header verification enabled.
func (Keeper) HeaderSupportedChains ¶
func (k Keeper) HeaderSupportedChains( c context.Context, req *types.QueryHeaderSupportedChainsRequest, ) (*types.QueryHeaderSupportedChainsResponse, error)
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) Prove ¶
func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.QueryProveResponse, error)
Prove checks two things: 1. the block header is available 2. the proof is valid
func (Keeper) RemoveBlockHeader ¶
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
Source Files ¶
- block_header.go
- block_header_verification.go
- chain_state.go
- grpc_query.go
- grpc_query_block_header.go
- grpc_query_chain_state.go
- grpc_query_header_enabled_chains.go
- grpc_query_prove.go
- keeper.go
- msg_server.go
- msg_server_disable_block_header_verification.go
- msg_server_enable_block_header_verification.go
- proof.go