Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

tendermint-rs: Initial "rpc" feature #235

Merged
merged 10 commits into from
Apr 21, 2019
Merged

tendermint-rs: Initial "rpc" feature #235

merged 10 commits into from
Apr 21, 2019

Conversation

tarcieri
Copy link
Contributor

@tarcieri tarcieri commented Apr 20, 2019

I started developing a client-side Rust Tendermint RPC wrapper in a separate crate (tendermint-rpc, still unreleased) and decided it might make sense to just put it the tendermint crate for now. Based on an informal Slack poll it seems like people like that idea:

Screen Shot 2019-04-19 at 6 55 58 PM

This PR contains an initial client-side implementation of the Tendermint RPC API. Among other things this could potentially be used by the KMS to query validator state and e.g. update the internal block height state.

Implemented endpoints

  • /abci_info
  • /block
  • /blockchain
  • /commit
  • /genesis
  • /net_info
  • /status
  • /validators

@tarcieri tarcieri requested a review from liamsi April 20, 2019 01:57
@tarcieri tarcieri force-pushed the tendermint-rs/rpc branch 4 times, most recently from 74dd08d to 55f1404 Compare April 20, 2019 12:59
@@ -98,7 +98,7 @@ impl State {
new_state.height,
new_state.round,
new_state.step,
self.consensus_state.block_id.unwrap(),
self.consensus_state.block_id.as_ref().unwrap(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer Copy

@tarcieri tarcieri force-pushed the tendermint-rs/rpc branch 6 times, most recently from 3051870 to c55d442 Compare April 20, 2019 23:15
@tarcieri tarcieri force-pushed the tendermint-rs/rpc branch 2 times, most recently from 18bf10f to 7fe80dc Compare April 21, 2019 15:12
Adds a set of JSONRPC request and response types, designed to construct
JSON requests to the Tendermint RPC (HTTP) API, and parse the returned
JSON responses.
Adds initial support for parsing JSON responses from the `/status`
JSONRPC endpoint.
Initial support for querying blocks through the RPC API.

Blocks comprise a number of different types which are generally useful
(e.g. transactions), so many of them have been peppered throughout the
`tendermint` crate where applicable.

This commit also includes some debug output improvements, and factors
algorithm types under the relevant modules.
Adds support for parsing genesis files from RPC responses.

Genesis files are generic over the underlying application, and by
default use `serde_json::Value` to model arbitrary JSON data.
This commit also includes a bunch of new documentation, and renames the
`Timestamp` type to `Time` to better match upstream Tendermint.
Parses JSONRPC responses into `tendermint::rpc::Error` with a
corresponding `tendermint::rpc::error::Code` covering all presently
known RPC errors.
@tarcieri tarcieri changed the title [WIP] tendermint-rs: Initial "rpc" feature tendermint-rs: Initial "rpc" feature Apr 21, 2019
@tarcieri
Copy link
Contributor Author

Removing WIP: this should be a relatively complete first pass at the RPC API.

There are still several endpoints missing, I'd like to change requests to use JSON, and there's no integrated HTTP client. However, this does affect the serialization of several domain objects, namely their JSON serializations (as used in priv_validator_state.json files) so I'd like to get those changed ASAP.

@tarcieri
Copy link
Contributor Author

@liamsi would appreciate some retroactive review on this, but aside from some tactical i64 -> u64 upgrades where they make sense, I hope this does a fairly decent job of reflecting what's in the docs.

@tarcieri tarcieri merged commit 6aeef85 into master Apr 21, 2019
@tarcieri tarcieri deleted the tendermint-rs/rpc branch April 21, 2019 22:36
This was referenced Apr 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants