Documentation ¶
Index ¶
- Constants
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) CheckTransactionIsAlreadyProcessed(ctx sdk.Context, queryID uint64, txHash []byte) bool
- func (k *Keeper) CollectDeposit(ctx sdk.Context, queryInfo types.RegisteredQuery) error
- func (k Keeper) GetAllRegisteredQueries(ctx sdk.Context) []*types.RegisteredQuery
- func (k Keeper) GetClientState(ctx sdk.Context, clientID string) (*tendermintLightClientTypes.ClientState, error)
- func (k Keeper) GetLastRegisteredQueryKey(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetQueryByID(ctx sdk.Context, id uint64) (*types.RegisteredQuery, error)
- func (k Keeper) GetQueryResultByID(ctx sdk.Context, id uint64) (*types.QueryResult, error)
- func (k Keeper) GetRegisteredQueries(ctx sdk.Context, req *types.QueryRegisteredQueriesRequest) (*types.QueryRegisteredQueriesResponse, error)
- func (k Keeper) GetTxQueriesToRemove(ctx sdk.Context, limit uint64) []uint64
- func (k Keeper) LastRemoteHeight(goCtx context.Context, request *types.QueryLastRemoteHeight) (*types.QueryLastRemoteHeightResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MustPayOutDeposit(ctx sdk.Context, deposit sdk.Coins, sender sdk.AccAddress)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProcessBlock(ctx sdk.Context, queryOwner sdk.AccAddress, queryID uint64, clientID string, ...) error
- func (k Keeper) QueryResult(goCtx context.Context, request *types.QueryRegisteredQueryResultRequest) (*types.QueryRegisteredQueryResultResponse, error)
- func (k Keeper) RegisteredQueries(goCtx context.Context, req *types.QueryRegisteredQueriesRequest) (*types.QueryRegisteredQueriesResponse, error)
- func (k Keeper) RegisteredQuery(goCtx context.Context, request *types.QueryRegisteredQueryRequest) (*types.QueryRegisteredQueryResponse, error)
- func (k Keeper) RemoveQuery(ctx sdk.Context, query *types.RegisteredQuery)
- func (k Keeper) SaveKVQueryResult(ctx sdk.Context, queryID uint64, result *types.QueryResult) error
- func (k Keeper) SaveQuery(ctx sdk.Context, query *types.RegisteredQuery) error
- func (k Keeper) SaveTransactionAsProcessed(ctx sdk.Context, queryID uint64, txHash []byte)
- func (k Keeper) SetLastRegisteredQueryKey(ctx sdk.Context, id uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) TxQueriesCleanup(ctx sdk.Context)
- func (k Keeper) UpdateLastLocalHeight(ctx sdk.Context, queryID uint64, newLocalHeight uint64) error
- func (k Keeper) UpdateLastRemoteHeight(ctx sdk.Context, queryID uint64, newRemoteHeight ibcclienttypes.Height) error
- type TransactionVerifier
- type TxQueryToRemove
- type Verifier
Constants ¶
const (
LabelRegisterInterchainQuery = "register_interchain_query"
)
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
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, ibcKeeper *ibckeeper.Keeper, bank types.BankKeeper, contractManagerKeeper types.ContractManagerKeeper, headerVerifier types.HeaderVerifier, transactionVerifier types.TransactionVerifier, ) *Keeper
func (Keeper) CheckTransactionIsAlreadyProcessed ¶
func (*Keeper) CollectDeposit ¶
func (Keeper) GetAllRegisteredQueries ¶ added in v0.2.0
func (k Keeper) GetAllRegisteredQueries(ctx sdk.Context) []*types.RegisteredQuery
GetAllRegisteredQueries returns all registered queries
func (Keeper) GetClientState ¶
func (k Keeper) GetClientState(ctx sdk.Context, clientID string) (*tendermintLightClientTypes.ClientState, error)
func (Keeper) GetLastRegisteredQueryKey ¶
func (Keeper) GetQueryByID ¶
func (Keeper) GetQueryResultByID ¶
GetQueryResultByID returns a QueryResult for query with id
func (Keeper) GetRegisteredQueries ¶
func (k Keeper) GetRegisteredQueries(ctx sdk.Context, req *types.QueryRegisteredQueriesRequest) (*types.QueryRegisteredQueriesResponse, error)
func (Keeper) GetTxQueriesToRemove ¶ added in v0.3.0
GetTxQueriesToRemove retrieves the list of TX queries registered to be removed. Returns a slice with no more than limit entities or all entities if limit is 0.
func (Keeper) LastRemoteHeight ¶
func (k Keeper) LastRemoteHeight(goCtx context.Context, request *types.QueryLastRemoteHeight) (*types.QueryLastRemoteHeightResponse, error)
func (Keeper) MustPayOutDeposit ¶
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) ProcessBlock ¶
func (k Keeper) ProcessBlock(ctx sdk.Context, queryOwner sdk.AccAddress, queryID uint64, clientID string, block *types.Block) error
ProcessBlock verifies headers and transaction in the block, and then passes the tx query result to the querying contract's sudo handler.
func (Keeper) QueryResult ¶
func (k Keeper) QueryResult(goCtx context.Context, request *types.QueryRegisteredQueryResultRequest) (*types.QueryRegisteredQueryResultResponse, error)
func (Keeper) RegisteredQueries ¶
func (k Keeper) RegisteredQueries(goCtx context.Context, req *types.QueryRegisteredQueriesRequest) (*types.QueryRegisteredQueriesResponse, error)
func (Keeper) RegisteredQuery ¶
func (k Keeper) RegisteredQuery(goCtx context.Context, request *types.QueryRegisteredQueryRequest) (*types.QueryRegisteredQueryResponse, error)
func (Keeper) RemoveQuery ¶ added in v0.3.0
func (k Keeper) RemoveQuery(ctx sdk.Context, query *types.RegisteredQuery)
RemoveQuery removes the given query and relative result data from the store. For a KV query it deletes the *types.QueryResult stored by the query ID, for a TX query it stores the query ID to the list of queries to be removed so the ICQ module can remove the query hashes later.
func (Keeper) SaveKVQueryResult ¶
SaveKVQueryResult saves the result of the query and updates the query's local and remote heights of last result submission. The result's height must be greater than the current remote height of the last query result submission, otherwise operation fails.
func (Keeper) SaveTransactionAsProcessed ¶
SaveTransactionAsProcessed simply stores a key (SubmittedTxKey + bigEndianBytes(queryID) + tx_hash) with mock data. This key can be used to check whether a certain transaction was already submitted for a specific transaction query.
func (Keeper) SetLastRegisteredQueryKey ¶
func (Keeper) TxQueriesCleanup ¶ added in v0.3.0
TxQueriesCleanup cleans the module store from obsolete registered TX queries and relative stored transaction hashes. Cleans up to params.TxQueryRemovalLimit hashes at a time or all the hashes if params.TxQueryRemovalLimit is 0.
func (Keeper) UpdateLastLocalHeight ¶
func (Keeper) UpdateLastRemoteHeight ¶
func (k Keeper) UpdateLastRemoteHeight(ctx sdk.Context, queryID uint64, newRemoteHeight ibcclienttypes.Height) error
UpdateLastRemoteHeight updates the relative query's remote height of the last result submission. The height must be greater than the current remote height of the last query result submission, otherwise operation fails.
type TransactionVerifier ¶ added in v0.2.0
type TransactionVerifier struct{}
func (TransactionVerifier) VerifyTransaction ¶ added in v0.2.0
func (v TransactionVerifier) VerifyTransaction( header *tendermintLightClientTypes.Header, nextHeader *tendermintLightClientTypes.Header, tx *types.TxValue, ) error
VerifyTransaction verifies that some transaction is included in block, and the transaction was executed successfully. The function checks: * transaction is included in block - header.DataHash merkle root contains transactions hash; * transactions was executed successfully - transaction's responseDeliveryTx.Code == 0; * transaction's responseDeliveryTx is legitimate - nextHeaderLastResultsDataHash merkle root contains deterministicResponseDeliverTx(ResponseDeliveryTx).Bytes()
type TxQueryToRemove ¶ added in v0.3.0
type TxQueryToRemove struct { // ID is the query ID. ID uint64 // Hashes is the list of tx hashes previously submitted for the query. It can be either // the whole list of tx hashes of the query of only a part of them to fit removal limit. Hashes [][]byte // CompleteRemoval represents whether all tx hashes (true) of the query or only a part of // them (false) are collected in the Hashes field. CompleteRemoval bool }
TxQueryToRemove contains data related to a single query listed for removal and needed in the removal process.
type Verifier ¶ added in v0.2.0
type Verifier struct{}
func (Verifier) UnpackHeader ¶ added in v0.2.0
func (Verifier) VerifyHeaders ¶ added in v0.2.0
func (v Verifier) VerifyHeaders(ctx sdk.Context, clientKeeper clientkeeper.Keeper, clientID string, header exported.Header, nextHeader exported.Header) error
VerifyHeaders verify that headers are valid tendermint headers, checks them on validity by trying call ibcClient.UpdateClient(header) to update light client's consensus state and checks that they are sequential (tl;dr header.Height + 1 == nextHeader.Height)