-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into romac/upgrade-tokio
- Loading branch information
Showing
33 changed files
with
1,664 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ members = [ | |
"light-node", | ||
"proto", | ||
"rpc", | ||
"rpc-probe", | ||
"tendermint", | ||
"testgen" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "tendermint-proto" | ||
version = "0.17.0-rc2" | ||
version = "0.17.0-rc3" | ||
authors = ["Greg Szabo <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//! Serialize and deserialize part_set_header.total (from string or u32), (into u32 in | ||
//! part_set_header.total). | ||
//! | ||
//! The deserializer is created for backwards compatibility: `total` was changed from a | ||
//! string-quoted integer value into an integer value without quotes in Tendermint Core v0.34.0. | ||
//! This deserializer allows backwards-compatibility by deserializing both ways. | ||
//! See also: https://github.com/informalsystems/tendermint-rs/issues/679 | ||
use serde::{de::Error, de::Visitor, Deserializer, Serialize, Serializer}; | ||
use std::convert::TryFrom; | ||
use std::fmt::Formatter; | ||
|
||
struct PartSetHeaderTotalStringOrU32; | ||
|
||
/// Deserialize (string or u32) into u32(part_set_header.total) | ||
pub fn deserialize<'de, D>(deserializer: D) -> Result<u32, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
deserializer.deserialize_any(PartSetHeaderTotalStringOrU32) | ||
} | ||
|
||
/// Serialize from u32(part_set_header.total) into u32 | ||
pub fn serialize<S>(value: &u32, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
value.serialize(serializer) | ||
} | ||
|
||
impl<'de> Visitor<'de> for PartSetHeaderTotalStringOrU32 { | ||
type Value = u32; | ||
|
||
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result { | ||
formatter.write_str("an u32 integer or string between 0 and 2^32") | ||
} | ||
|
||
fn visit_u64<E>(self, v: u64) -> Result<Self::Value, E> | ||
where | ||
E: Error, | ||
{ | ||
u32::try_from(v).map_err(|e| E::custom(format!("part_set_header.total {}", e))) | ||
} | ||
|
||
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> | ||
where | ||
E: Error, | ||
{ | ||
v.parse::<u32>() | ||
.map_err(|e| E::custom(format!("part_set_header.total {}", e))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[package] | ||
name = "tendermint-rpc-probe" | ||
version = "0.17.0-rc3" | ||
authors = ["Thane Thomson <[email protected]>"] | ||
edition = "2018" | ||
license = "Apache-2.0" | ||
homepage = "https://www.tendermint.com/" | ||
repository = "https://github.com/informalsystems/tendermint-rs" | ||
readme = "README.md" | ||
|
||
description = """ | ||
tendermint-rpc-probe allows us to probe a running Tendermint instance with | ||
a given sequence of requests, capturing those requests and/or responses. | ||
""" | ||
|
||
[package.metadata.docs.rs] | ||
all-features = true | ||
|
||
[dependencies] | ||
async-tungstenite = { version = "0.10", features = [ "tokio-runtime" ] } | ||
futures = "0.3" | ||
getrandom = "0.1" | ||
log = "0.4" | ||
serde = { version = "1", features = [ "derive" ] } | ||
serde_json = "1" | ||
simple_logger = "1.11" | ||
structopt = "0.3" | ||
subtle-encoding = "0.5.1" | ||
thiserror = "1.0" | ||
tokio = { version = "0.3", features = [ "full" ] } | ||
uuid = "0.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Tendermint RPC Probe | ||
|
||
The Tendermint RPC probe is an application that assists in testing the various | ||
crates in this repository. It currently allows you to execute a quick probe of | ||
a running [Tendermint] node, where a quick probe executes requests against all | ||
of the [Tendermint RPC] endpoints (including subscriptions for different event | ||
types), and saves all of the responses it gets as JSON files. These JSON files | ||
can be used in testing in other crates. | ||
|
||
## Requirements | ||
|
||
To run this probe locally, you will need: | ||
|
||
* The Rust toolchain (latest stable) | ||
* Docker | ||
|
||
## Usage (with Docker) | ||
|
||
From the root of the tendermint.rs repository: | ||
|
||
```bash | ||
cd rpc-probe | ||
./run-with-docker.sh | ||
``` | ||
|
||
This will: | ||
|
||
1. Build the `tendermint-rpc-probe` executable | ||
2. Pull the latest version of the Tendermint Docker image | ||
3. Initialize and run a Tendermint node with the `kvstore` app in the | ||
background. (This node exposes a WebSocket endpoint at | ||
`ws://127.0.0.1:26657/websocket`) | ||
4. Run `tendermint-rpc-probe` against the running Tendermint node. | ||
5. Terminate the Docker image. | ||
|
||
To run a specific version of Tendermint, simply: | ||
|
||
```bash | ||
TENDERMINT_TAG="v0.33.8" ./run-with-docker.sh | ||
``` | ||
|
||
## Usage (without Docker) | ||
|
||
Simply run: | ||
|
||
```bash | ||
cargo run -- --help | ||
``` | ||
|
||
to see what options are available to run the probe. | ||
|
||
For example: | ||
|
||
```bash | ||
# Executes the probe with all default options (i.e. against a Tendermint node | ||
# listening on 127.0.0.1:26657) | ||
cargo run | ||
|
||
# Customize the address | ||
cargo run -- --addr ws://192.168.1.15:26657/websocket | ||
|
||
# Customize how long to wait before each request (in milliseconds) | ||
# Defaults to 1000ms | ||
cargo run -- --request-wait 100 | ||
``` | ||
|
||
## Output | ||
|
||
By default, all request and response JSON-RPC messages will be written into a | ||
folder called `probe-results` in the `rpc-probe` directory. | ||
|
||
For example, the `probe-results/incoming/abci_info.json` file (returned by the | ||
[`abci_info`] RPC request) could look something like: | ||
|
||
```json | ||
{ | ||
"id": "8944f639-7da0-4595-ac5e-3e432079f510", | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"response": { | ||
"app_version": "1", | ||
"data": "{\"size\":0}", | ||
"last_block_app_hash": "AAAAAAAAAAA=", | ||
"last_block_height": "13", | ||
"version": "0.17.0" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
The full JSON-RPC wrapper is saved to disk. | ||
|
||
[Tendermint]: https://github.com/tendermint/tendermint | ||
[Tendermint RPC]: https://docs.tendermint.com/master/rpc/ | ||
[`abci_info`]: https://docs.tendermint.com/master/rpc/#/ABCI/abci_info |
Oops, something went wrong.