keeper

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelRegisterInterchainQuery = "register_interchain_query"
)

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
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ibcKeeper *ibckeeper.Keeper,
	bank types.BankKeeper,
	contractManagerKeeper types.ContractManagerKeeper,
	headerVerifier types.HeaderVerifier,
	transactionVerifier types.TransactionVerifier,
	authority string,
) *Keeper

func (Keeper) CheckTransactionIsAlreadyProcessed

func (k Keeper) CheckTransactionIsAlreadyProcessed(ctx sdk.Context, queryID uint64, txHash []byte) bool

func (*Keeper) CollectDeposit

func (k *Keeper) CollectDeposit(ctx sdk.Context, queryInfo types.RegisteredQuery) error

func (Keeper) GetAllRegisteredQueries

func (k Keeper) GetAllRegisteredQueries(ctx sdk.Context) []*types.RegisteredQuery

GetAllRegisteredQueries returns all registered queries

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

func (Keeper) GetClientState

func (k Keeper) GetClientState(ctx sdk.Context, clientID string) (*tendermintLightClientTypes.ClientState, error)

func (Keeper) GetLastRegisteredQueryKey

func (k Keeper) GetLastRegisteredQueryKey(ctx sdk.Context) uint64

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams get all parameters as types.Params

func (Keeper) GetQueryByID

func (k Keeper) GetQueryByID(ctx sdk.Context, id uint64) (*types.RegisteredQuery, error)

func (Keeper) GetQueryResultByID

func (k Keeper) GetQueryResultByID(ctx sdk.Context, id uint64) (*types.QueryResult, error)

GetQueryResultByID returns a QueryResult for query with id

func (Keeper) GetTxQueriesToRemove

func (k Keeper) GetTxQueriesToRemove(ctx sdk.Context, limit uint64) []uint64

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 (Keeper) Logger

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

func (Keeper) MustPayOutDeposit

func (k Keeper) MustPayOutDeposit(ctx sdk.Context, deposit sdk.Coins, sender sdk.AccAddress)

func (Keeper) Params

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

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

func (k Keeper) SaveKVQueryResult(ctx sdk.Context, queryID uint64, result *types.QueryResult) error

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

func (k Keeper) SaveQuery(ctx sdk.Context, query *types.RegisteredQuery) error

func (Keeper) SaveTransactionAsProcessed

func (k Keeper) SaveTransactionAsProcessed(ctx sdk.Context, queryID uint64, txHash []byte)

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 (k Keeper) SetLastRegisteredQueryKey(ctx sdk.Context, id uint64)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error

SetParams set the params

func (Keeper) TxQueriesCleanup

func (k Keeper) TxQueriesCleanup(ctx sdk.Context)

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 (k Keeper) UpdateLastLocalHeight(ctx sdk.Context, queryID, newLocalHeight uint64) error

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.

func (Keeper) UpdateParams

UpdateParams updates the module parameters

type TransactionVerifier

type TransactionVerifier struct{}

func (TransactionVerifier) VerifyTransaction

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

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

type Verifier struct{}

func (Verifier) UnpackHeader

func (v Verifier) UnpackHeader(any *codectypes.Any) (exported.ClientMessage, error)

func (Verifier) VerifyHeaders

func (v Verifier) VerifyHeaders(ctx sdk.Context, clientKeeper clientkeeper.Keeper, clientID string, header, nextHeader exported.ClientMessage) 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)

Jump to

Keyboard shortcuts

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