Documentation
¶
Index ¶
- Constants
- func GetNeutronChain(logger *zap.Logger, cfg *config.NeutronChainConfig, chainID string) (*relayer.Chain, error)
- func GetTargetChain(logger *zap.Logger, cfg *config.TargetChainConfig, chainID string) (*relayer.Chain, error)
- type KVProcessor
- type MessageKV
- type MessageTX
- type Relayer
- type Storage
- type Submitter
- type Subscriber
- type TrustedHeaderFetcher
Constants ¶
const TxHeight = "tx.height"
TxHeight describes tendermint filter by tx.height that we use to get only actual txs
Variables ¶
This section is empty.
Functions ¶
func GetNeutronChain ¶
func GetTargetChain ¶
Types ¶
type KVProcessor ¶
type KVProcessor interface { // ProcessAndSubmit handles an incoming KV interchain query message. It checks whether it's time // to execute the query (based on the relayer's settings), queries values and proofs for the query // keys, and submits the result to the Neutron chain. ProcessAndSubmit(ctx context.Context, m *MessageKV) error }
KVProcessor processes event query KV type. Obtains the proof for a query we need to process, and sends it to the neutron
type MessageKV ¶
type MessageKV struct { // QueryId is the ID of the query. QueryId uint64 // KVKeys is the query parameter that describes keys list to be retrieved. KVKeys types.KVKeys }
MessageKV contains params of a KV interchain query.
type MessageTX ¶
type MessageTX struct { // QueryId is the ID of the query. QueryId uint64 // TransactionsFilter is the query parameter that describes conditions for transactions search. TransactionsFilter string }
MessageTX contains params of a TX interchain query.
type Relayer ¶
type Relayer struct {
// contains filtered or unexported fields
}
Relayer is controller for the whole app: 1. takes events from Neutron chain 2. dispatches each query by type to fetch proof for the right query 3. submits proof for a query back to the Neutron chain
func NewRelayer ¶
func NewRelayer( cfg config.NeutronQueryRelayerConfig, store Storage, kvProcessor KVProcessor, targetChain *relayer.Chain, logger *zap.Logger, ) *Relayer
func (*Relayer) Run ¶
func (r *Relayer) Run( ctx context.Context, queriesTasksQueue <-chan neutrontypes.RegisteredQuery, ) error
Run starts the relaying process: subscribes on the incoming interchain query messages from the Neutron and performs the queries by interacting with the target chain and submitting them to the Neutron chain.
type Storage ¶
type Storage interface { GetLastQueryHeight(queryID uint64) (block uint64, found bool, err error) SetLastQueryHeight(queryID uint64, block uint64) error Close() error }
Storage is local storage we use to store queries history: known queries, know transactions and its statuses
type Submitter ¶
type Submitter interface {
SubmitKVProof(ctx context.Context, height, revision, queryId uint64, proof []*neutrontypes.StorageValue, updateClientMsg sdk.Msg) error
}
Submitter knows how to submit proof to the chain
type Subscriber ¶
type Subscriber interface { // returns the neutron registered query by its ID GetNeutronRegisteredQuery(ctx context.Context, queryId string) (*neutrontypes.RegisteredQuery, error) }
Subscriber is an interface that subscribes to Neutron and provides chain data in real time.