-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the chain queries required by the relayer #128
Comments
Still trying to get a get sense of the key space, the store layout, and the actual abci queries to fetch everything. But just a note we can query for entire substores with eg.
I believe this will give us all the items under I'm not sure if there's a way to fetch just the list of identifiers; it seems with this you fetch all the underlying values too. |
Ok, so far we have been thinking about the relayer as something which interacts with two primary API endpoints from Tendermint on default port 26657:
Both of these are generic to tendermint. However the SDK also exposes it's own REST API on default port 1317 that allows you to query SDK-specific data and send SDK-specific transactions, all in JSON without any amino or protobuf encoding. It will even sign the transactions for you, assuming it has access to the relevant key. Documentation for this API in the pre-IBC version of the SDK is here: https://cosmos.network/rpc/v0.37.9. I'm not sure if the latest version of the docs is built somewhere, but you can see all the endpoints by grepping for For instance you can query all connections with In the past (ie. v0.37.9 and before, where v0.37.9 is the latest version used for the Cosmos Hub), this REST API server ran as a "proxy server", ie. a separate process from full nodes, eg. on a local machine, so it would do the raw abci queries and transaction sends to a remote full node, and expose a REST API locally so that local applications (eg. some wallet UI) could have a more convenient interface and wouldn't have to worry about protobuf and signing and that, it just deals with JSON. We called it a "proxy server" since it proxied a nice local JSON REST API into the underlying raw tendermint rpc communication with a remote full node. This way the local REST API server could also be given control of the user's local keys, so it could sign txs for the user and broadcast them to the full node. It's depicted in this diagram as the "Light Client Daemon" on the "Light Node", since it was able to run a light client and so could verify everything it got from full nodes before exposing it in JSON over the REST API. With the latest SDK, the rest server now runs as part of the full node, which means it can't be used to sign txs (since youre not going to give the full node your private key), but in principle it could still be used for queries. However if we want to use the Rust light client, we'd still need to be able to work with protobuf so we can verify Merkle proofs about the data. So ultimately we may still need the relayer to use raw abci queries and txs, but in the meantime the REST API can be used for local development and testing of the core relayer algorithm since it effectively unblocks sending txs and anything else blocked by amino/proto stuff. We could imagine, if we can still run the proxy server locally and use remote full nodes (might take a bit of work on the Go), that we could build a relayer process in Rust which uses local proxy servers for each full node it wants to talk to, and delegates all protobuf decoding, light client logic, merkle proof verification, and transaction signing to the proxy servers, leaving only the core relayer logic for it to handle, ie. how to turn events from one chain into txs for another. Of course this is a bit contrived of a setup, and probably not what we want. However in the meantime, since we can run the full nodes locally too for testing, we could consider using this API as a way to unblock developing and testing the core relayer logic against real Gaia apps. The API can be turned on for For instance, to query for all clients from it:
|
I agree we may use the REST API to make some progress. But the IBC standard way is to use gRPC/ protobuf regardless of the chain type. I think we still need to work on the protobuf. |
Yep just outlining it as a way to possibly unblock progress |
I’m also thinking about this from a chain generalization perspective. What if the Chain trait has an implementation for Tendermint chains by default? It can always be overwritten for other chains and we kind of base everything on Tendermint. Then we can introduce a CosmosSDKChain implementation of of it where we override some of the query functions. I expect some unimplemented functions in either case until we get the full list of queries in order but at least this enables us to write whichever implementation is easy, and they get sorted into the right place automatically. |
Not sure what a Tendermint chain would consist of since Tendermint doesn't specify how IBC state is encoded or where to find it or how to send transactions so that might be too generic. It seems the Chains we use have to be somewhat based on the ABCI app framework which determines how state is encoded and how txs are formed and signed ... |
I might be overgeneralizing but based on how we started working on the queries, I thought that I should be able to implement a Tendermint-based blockchain with IBC but without using the Cosmos SDK. All the pieces are there, we can even make it compatible with the SDK. But I get that it's a lot of work for not much benefit. I don't mind using the SDK as long as it's its own So |
That's right, but you'll still have to pick a "way" of doing things. It won't be the "tendermint way", because tendermint doesn't define it. Maybe one day Substrate will run on Tendermint and you can have the SubstrateTendermintChain. Or if you use Lotion instead of the CosmosSDK it will be a LotionChain, etc. |
All queries listed have been implemented |
Summary
The relayer needs to perform different types of queries. Some of them are partially implemented.
Problem Definition
The following queries need to be implemented. All should allow for
height
andprove
parameters to indicate the height of the query and whether a proof is required.Queries required for the relayer:
On start:
For IBC Event:
For a list of query paths to fetch this data from the abci app, see https://github.com/cosmos/ics/tree/master/spec/ics-024-host-requirements#path-space
Various:
unbonding_period
from the Cosmos staking moduleFor Admin Use
The text was updated successfully, but these errors were encountered: