-
Notifications
You must be signed in to change notification settings - Fork 225
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
Light Client RPC Service #219
Comments
The goal here is essentially a light-node: a process that syncs the blockchain using light-client verification and exposes an http API for interacting with the blockchain (ie. queries, transactions). Such an API could be used to build local applications that read/write to the blockchain securely without needing a local full node. In Go, we have To start, we should expose two http endpoints in the light-node process:
Once we have the basics, we can draft a longer term plan for this API, and consider something like the complete |
Cross posting this here for @xla:
These are the routes that need to be implemented: |
Introducing a proxy which serves the Tendermint RPC API with the help of connect rpc client. Later to be extended to add light client functionality. This is in nature equivalent to the Go proxy[0]. Instead of reaching for hyper this change introduces warp to build an http server. This decision should be evaluated very carefully, while warp is a thinly wrapper around hyper, it brings a lot of very important tooling (including websockets), it also has its own set of dependencies. Also currently unclear if the module that implements the rpc API with lite client functionality should live in the rpc source tree. Part of #219 [0] https://github.com/tendermint/tendermint/tree/master/light/proxy
Just a note that we probably shouldn't start with a full proxy yet as a lot is likely to change this year in the Go RPC, and we might want to wait for that. I was thinking to start we would just expose the two endpoints I outlined above, one to get some status info and one for the latest state. We could extend the latest state one to also return previous state or to fetch state it doesn't have. But I think we should hold off on the full proxy for now. |
@brapse Two clarifications inline.
Probably unnecessary nit-picking, but isn't that the we want the light node to make these available through an RPC API?
Which requirements dictate the constraint for RPC to run on a separate runtime. |
Right, the light node naming here makes sense. The light client runs in its own thread as to not necessarily block the RPC or Relayer when doing long verification runs. |
To proceed more information is needed for the following points:
Any other thoughts appreciated as well. |
So
And then the connected nodes aren't in a light block but would come from the supervisor. |
@ebuchman Thanks for the clarification, I'm not quite sure what the benefit is of the mostly duplicated data, except the next_val_set_hash I guess. Thought the On the upside the |
It's a snapshot of the latest state. Similar to the way the |
As we start to depend on the surface of the `Handle` we benefit from it being a trait that can be implemented on a per need basis. This will result in less overhead constructing object graphs in places where we wannt to assert behaviour of other types in remote places, i.e. the light-node rpc server. Overall we hope for an increased ease in writing tests on module level. Ref #219
* light-client: turn Handle into a trait As we start to depend on the surface of the `Handle` we benefit from it being a trait that can be implemented on a per need basis. This will result in less overhead constructing object graphs in places where we wannt to assert behaviour of other types in remote places, i.e. the light-node rpc server. Overall we hope for an increased ease in writing tests on module level. Ref #219 * Add changes entry * Apply suggestions from code review Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com> Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
* light-client: turn Handle into a trait As we start to depend on the surface of the `Handle` we benefit from it being a trait that can be implemented on a per need basis. This will result in less overhead constructing object graphs in places where we wannt to assert behaviour of other types in remote places, i.e. the light-node rpc server. Overall we hope for an increased ease in writing tests on module level. Ref #219 * Add changes entry * Remove async trait methods * Make supervisor more CSP * Improve crate imports * Relax mutability on Handle * Provide noop default implementations * Update adr status * Handle crossbeam errors honestly * Add changes entry * Mention ADR in change entry * Correct PR link * Simplify example
* light-client: turn Handle into a trait As we start to depend on the surface of the `Handle` we benefit from it being a trait that can be implemented on a per need basis. This will result in less overhead constructing object graphs in places where we wannt to assert behaviour of other types in remote places, i.e. the light-node rpc server. Overall we hope for an increased ease in writing tests on module level. Ref #219 * Add changes entry * Remove async trait methods * Make supervisor more CSP * Improve crate imports * Relax mutability on Handle * Provide noop default implementations * Update adr status * Handle crossbeam errors honestly * Add changes entry * WIP * Mock out actual endpoints * Assert actual response shapes * Use async tests * Integrate Handle in node rpc server * Adjust to move to trait * Adjust to latest trait changes * Remove unused import * Start error infra * Use json input for tests * Remove unused status endpoint * Seal and expose proper run functionality * Correct address configuration * Add temp example * Update light-node/src/rpc.rs Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com> * Remove unused errors * Improve error propagation * Correct wording Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
The |
@ebuchman for the
It's probably sufficient to return a list of PeerIDs for the list of connected full nodes? Is there any benefit in highlighting the primary? My currentl thinking is that the rust struct returned by a yet to be created handler will look like this: pub struct LatestStatus {
pub height: Height,
pub block_hash: Hash,
pub valset_hash: Hash,
pub connected_nodes: Vec<PeerId>,
} Am I missing anything? |
Updated to reflect the conclusion of the discussion in comments and slack
The light client fetches headers/validator sets from other nodes to perform verification. The light client should also make those headers/validator sets available to the network through an RPC service.
The goal here is to create an RPC service operating in a separate runtime with access to it's own light client handler similar to:
tendermint-rs/light-client/examples/light_client.rs
Line 155 in 1df3ac3
This issue should exclusively include endpoints for:
/status
: returns local status information, like the latest height, latest block and valset hashes, list of of connected full nodes (primary and secondaries), etc./state
: returns the latest header, commit, and validator setFollow up issues can address potential further improvements.
The text was updated successfully, but these errors were encountered: