From bb6c5d6627dd5bb086dde245097c00c2bd8e6b20 Mon Sep 17 00:00:00 2001 From: Greg Szabo <16846635+greg-szabo@users.noreply.github.com> Date: Tue, 22 Dec 2020 09:49:56 -0500 Subject: [PATCH] rpc-probe fixes and kvstore-fixtures and tests (#758) * rpc-probe kvstore-fixtures * More tests * search result tests * clippy advisory * Found the bug again * Changed rpc-probe "output" default value * Update CHANGELOG Signed-off-by: Thane Thomson Co-authored-by: Thane Thomson --- CHANGELOG.md | 12 + Cargo.toml | 1 - rpc-probe/run-with-docker.sh | 69 - rpc/Cargo.toml | 1 + rpc/src/endpoint/abci_query.rs | 1 + rpc/tests/kvstore_fixtures.rs | 1330 +++++++++++++++++ .../kvstore_fixtures/incoming/abci_info.json | 13 + .../abci_query_with_existing_key.json | 17 + .../abci_query_with_non_existent_key.json | 17 + .../incoming/block_at_height_0.json | 9 + .../incoming/block_at_height_1.json | 58 + .../incoming/block_at_height_10.json | 65 + .../incoming/block_results_at_height_10.json | 12 + .../incoming/blockchain_from_1_to_10.json | 369 +++++ .../incoming/broadcast_tx_async.json | 11 + .../incoming/broadcast_tx_commit.json | 54 + .../incoming/broadcast_tx_sync.json | 11 + .../incoming/commit_at_height_10.json | 53 + .../incoming/consensus_state.json | 30 + .../kvstore_fixtures/incoming/genesis.json | 41 + .../kvstore_fixtures/incoming/net_info.json | 12 + .../kvstore_fixtures/incoming/status.json | 42 + .../incoming/subscribe_malformed.json | 9 + .../incoming/subscribe_newblock.json | 1 + .../incoming/subscribe_newblock_0.json | 73 + .../incoming/subscribe_newblock_1.json | 73 + .../incoming/subscribe_newblock_2.json | 73 + .../incoming/subscribe_newblock_3.json | 73 + .../incoming/subscribe_newblock_4.json | 73 + .../incoming/subscribe_txs.json | 5 + .../incoming/subscribe_txs_0.json | 68 + .../incoming/subscribe_txs_1.json | 68 + .../incoming/subscribe_txs_2.json | 69 + .../incoming/subscribe_txs_3.json | 68 + .../incoming/subscribe_txs_4.json | 68 + .../subscribe_txs_broadcast_tx_0.json | 11 + .../subscribe_txs_broadcast_tx_1.json | 11 + .../subscribe_txs_broadcast_tx_2.json | 11 + .../subscribe_txs_broadcast_tx_3.json | 11 + .../subscribe_txs_broadcast_tx_4.json | 11 + .../subscribe_txs_broadcast_tx_5.json | 11 + .../incoming/tx_search_no_prove.json | 345 +++++ .../incoming/tx_search_with_prove.json | 437 ++++++ .../kvstore_fixtures/outgoing/abci_info.json | 6 + .../abci_query_with_existing_key.json | 8 + .../abci_query_with_non_existent_key.json | 8 + .../outgoing/block_at_height_0.json | 8 + .../outgoing/block_at_height_1.json | 8 + .../outgoing/block_at_height_10.json | 8 + .../outgoing/block_results_at_height_10.json | 8 + .../outgoing/blockchain_from_1_to_10.json | 9 + .../outgoing/broadcast_tx_async.json | 8 + .../outgoing/broadcast_tx_commit.json | 8 + .../outgoing/broadcast_tx_sync.json | 8 + .../outgoing/commit_at_height_10.json | 8 + .../outgoing/consensus_state.json | 6 + .../kvstore_fixtures/outgoing/genesis.json | 6 + .../kvstore_fixtures/outgoing/net_info.json | 6 + .../kvstore_fixtures/outgoing/status.json | 6 + .../outgoing/subscribe_malformed.json | 8 + .../outgoing/subscribe_newblock.json | 8 + .../outgoing/subscribe_txs.json | 8 + .../subscribe_txs_broadcast_tx_0.json | 8 + .../subscribe_txs_broadcast_tx_1.json | 8 + .../subscribe_txs_broadcast_tx_2.json | 8 + .../subscribe_txs_broadcast_tx_3.json | 8 + .../subscribe_txs_broadcast_tx_4.json | 8 + .../subscribe_txs_broadcast_tx_5.json | 8 + .../outgoing/tx_search_no_prove.json | 12 + .../outgoing/tx_search_with_prove.json | 12 + tendermint/src/abci/transaction/hash.rs | 2 +- tools/Cargo.toml | 3 +- {rpc-probe => tools/rpc-probe}/Cargo.toml | 0 tools/rpc-probe/Makefile.toml | 39 + {rpc-probe => tools/rpc-probe}/README.md | 11 +- {rpc-probe => tools/rpc-probe}/src/client.rs | 0 {rpc-probe => tools/rpc-probe}/src/error.rs | 0 {rpc-probe => tools/rpc-probe}/src/kvstore.rs | 10 +- {rpc-probe => tools/rpc-probe}/src/main.rs | 35 +- {rpc-probe => tools/rpc-probe}/src/plan.rs | 0 {rpc-probe => tools/rpc-probe}/src/quick.rs | 0 {rpc-probe => tools/rpc-probe}/src/request.rs | 0 .../rpc-probe}/src/subscription.rs | 0 {rpc-probe => tools/rpc-probe}/src/utils.rs | 0 84 files changed, 4027 insertions(+), 85 deletions(-) delete mode 100755 rpc-probe/run-with-docker.sh create mode 100644 rpc/tests/kvstore_fixtures.rs create mode 100644 rpc/tests/kvstore_fixtures/incoming/abci_info.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/abci_query_with_existing_key.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/abci_query_with_non_existent_key.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/block_at_height_0.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/block_at_height_1.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/block_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/block_results_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/blockchain_from_1_to_10.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/broadcast_tx_async.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/broadcast_tx_commit.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/broadcast_tx_sync.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/commit_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/consensus_state.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/genesis.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/net_info.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/status.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_malformed.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_0.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_1.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_2.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_3.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_4.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_0.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_1.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_2.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_3.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_4.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_0.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_1.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_2.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_3.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_4.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_5.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/tx_search_no_prove.json create mode 100644 rpc/tests/kvstore_fixtures/incoming/tx_search_with_prove.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/abci_info.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/abci_query_with_existing_key.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/abci_query_with_non_existent_key.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/block_at_height_0.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/block_at_height_1.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/block_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/block_results_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/blockchain_from_1_to_10.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_async.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_commit.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_sync.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/commit_at_height_10.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/consensus_state.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/genesis.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/net_info.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/status.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_malformed.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_newblock.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_0.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_1.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_2.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_3.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_4.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_5.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/tx_search_no_prove.json create mode 100644 rpc/tests/kvstore_fixtures/outgoing/tx_search_with_prove.json rename {rpc-probe => tools/rpc-probe}/Cargo.toml (100%) create mode 100644 tools/rpc-probe/Makefile.toml rename {rpc-probe => tools/rpc-probe}/README.md (88%) rename {rpc-probe => tools/rpc-probe}/src/client.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/error.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/kvstore.rs (90%) rename {rpc-probe => tools/rpc-probe}/src/main.rs (63%) rename {rpc-probe => tools/rpc-probe}/src/plan.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/quick.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/request.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/subscription.rs (100%) rename {rpc-probe => tools/rpc-probe}/src/utils.rs (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a60deed5a..fc1cf2a7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## Unreleased + +### IMPROVEMENTS: + +* `[rpc, tools]` The RPC probe has been moved into the `tools` folder and can + now be easily executed against a Tendermint node running the kvstore app by + way of [cargo make]. `tendermint-rpc` test coverage has been expanded here + too. ([#758]) + +[#758]: https://github.com/informalsystems/tendermint-rs/pull/758 +[cargo make]: https://github.com/sagiegurari/cargo-make + ## v0.17.0 *Dec 17, 2020* diff --git a/Cargo.toml b/Cargo.toml index 3a0569528..3541dc634 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ members = [ "p2p", "proto", "rpc", - "rpc-probe", "tendermint", "testgen" ] diff --git a/rpc-probe/run-with-docker.sh b/rpc-probe/run-with-docker.sh deleted file mode 100755 index d71878605..000000000 --- a/rpc-probe/run-with-docker.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -set -euo pipefail - -# run-with-docker.sh is a helper script that sets up a Docker container with a running Tendermint node. -# The scripts input parameters are defined through environment variables. The script also accepts -# regular input parameters that are forwarded to the `rpc-probe` application. -# -# Script input variables examples: -# -# Use specific tag from official DockerHub tendermint repository: -# TENDERMINT_TAG=v0.33.0 ./run-with-docker.sh -# -# Use custom DockerHub image: -# TENDERMINT_IMAGE=informaldev/tendermint:0.34.0-stargate4 ./run-with-docker.sh -# -# Use custom local Docker image: -# DOCKER_PULL=0 TENDERMINT_IMAGE=a1c86c07867e ./run-with-docker.sh -# -# Override local tmp folder (it has to exist): -# TMP_DIR=/tmp/tendermint ./run-with-docker.sh -# -# ### -# -# rpc-probe input parameter examples: -# -# Verbose output: -# ./run-with-docker.sh -v -# -# Override output directory (default: "probe-results"): -# ./run-with-docker.sh --output "my-other-probe-results" -# -# Change request wait times when probing (default: 1000): -# ./run-with-docker.sh --request-wait 2000 - -DEFAULT_TENDERMINT_IMAGE="tendermint/tendermint:${TENDERMINT_TAG:-latest}" -echo "DOCKER_PULL=${DOCKER_PULL:=1}" -echo "TENDERMINT_IMAGE=${TENDERMINT_IMAGE:=$DEFAULT_TENDERMINT_IMAGE}" -echo "Application input: $@" - -cargo build - -echo "TMP_DIR=${TMP_DIR:=$(mktemp -d)}" - -if [ "${DOCKER_PULL}" -eq "1" ]; then - docker pull "${TENDERMINT_IMAGE}" -else - echo "Skipping pulling of Docker image" -fi - -docker run -it --rm -v "${TMP_DIR}:/tendermint" "${TENDERMINT_IMAGE}" init -docker run -d \ - --name rpc-probe-tendermint \ - --rm \ - -v "${TMP_DIR}:/tendermint" \ - -p 26657:26657 \ - "${TENDERMINT_IMAGE}" node --proxy_app=kvstore - -echo "Waiting for local Docker node to come up..." -sleep 5 - -set +e # Try to clean up even if execution failed. -cargo run -- $@ - -docker stop rpc-probe-tendermint - -echo "DOCKER_PULL=${DOCKER_PULL}" -echo "TENDERMINT_IMAGE=${TENDERMINT_IMAGE}" -echo "Application input: $@" -echo "TMP_DIR=${TMP_DIR}" diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index a96f4a898..dcb3ac1a2 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -59,6 +59,7 @@ tendermint-proto = { version = "0.17.0", path = "../proto" } thiserror = "1" uuid = { version = "0.8", default-features = false } subtle-encoding = { version = "0.5", features = ["bech32-preview"] } +walkdir = "2.3" async-trait = { version = "0.1", optional = true } async-tungstenite = { version = "0.9", features = ["tokio-runtime"], optional = true } diff --git a/rpc/src/endpoint/abci_query.rs b/rpc/src/endpoint/abci_query.rs index f97eb8392..b492687b0 100644 --- a/rpc/src/endpoint/abci_query.rs +++ b/rpc/src/endpoint/abci_query.rs @@ -23,6 +23,7 @@ pub struct Request { pub height: Option, /// Include proof in response + #[serde(default)] pub prove: bool, } diff --git a/rpc/tests/kvstore_fixtures.rs b/rpc/tests/kvstore_fixtures.rs new file mode 100644 index 000000000..3c67ee697 --- /dev/null +++ b/rpc/tests/kvstore_fixtures.rs @@ -0,0 +1,1330 @@ +//! Tendermint kvstore RPC endpoint testing. + +use std::str::FromStr; +use std::{fs, path::PathBuf}; +use subtle_encoding::{base64, hex}; +use tendermint_rpc::{endpoint, error::Code, request::Wrapper as RequestWrapper, Order, Response}; +use walkdir::WalkDir; + +const CHAIN_ID: &str = "dockerchain"; + +fn find_fixtures(in_out_folder_name: &str) -> Vec { + WalkDir::new( + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("tests") + .join("kvstore_fixtures") + .join(in_out_folder_name), + ) + .into_iter() + .filter_map(|e| e.ok()) + .filter(|e| { + e.file_type().is_file() + && e.path().extension().is_some() + && e.path().extension().unwrap() == "json" + }) + .map(|e| e.into_path()) + .collect::>() +} + +#[test] +fn outgoing_fixtures() { + for json_file in find_fixtures("outgoing") { + let file_name = json_file + .file_name() + .unwrap() + .to_str() + .unwrap() + .strip_suffix(".json") + .unwrap(); + let content = fs::read_to_string(&json_file).unwrap(); + match file_name { + "abci_info" => assert!(serde_json::from_str::< + RequestWrapper, + >(&content) + .is_ok()), + "abci_query_with_existing_key" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert!(wrapped.params().path.is_none()); + assert_eq!(wrapped.params().data, hex::decode("747830").unwrap()); + assert!(wrapped.params().height.is_none()); + assert!(!wrapped.params().prove); + } + "abci_query_with_non_existent_key" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert!(wrapped.params().path.is_none()); + assert_eq!( + wrapped.params().data, + hex::decode("6e6f6e5f6578697374656e745f6b6579").unwrap() + ); + assert!(wrapped.params().height.is_none()); + assert!(!wrapped.params().prove); + } + "block_at_height_0" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().height.unwrap().value(), 0); + } + "block_at_height_1" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().height.unwrap().value(), 1); + } + "block_at_height_10" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().height.unwrap().value(), 10); + } + "block_results_at_height_10" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!(wrapped.params().height.unwrap().value(), 10); + } + "blockchain_from_1_to_10" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().min_height.value(), 1); + assert_eq!(wrapped.params().max_height.value(), 10); + } + "broadcast_tx_async" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("YXN5bmMta2V5PXZhbHVl").unwrap() + ); + } + "broadcast_tx_commit" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("Y29tbWl0LWtleT12YWx1ZQ==").unwrap() + ); + } + "broadcast_tx_sync" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("c3luYy1rZXk9dmFsdWU=").unwrap() + ); + } + "commit_at_height_10" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().height.unwrap().value(), 10); + } + "consensus_state" => { + assert!( + serde_json::from_str::>( + &content + ) + .is_ok() + ) + } + "genesis" => { + assert!( + serde_json::from_str::>(&content) + .is_ok() + ) + } + "net_info" => { + assert!( + serde_json::from_str::>(&content) + .is_ok() + ) + } + "status" => { + assert!( + serde_json::from_str::>(&content) + .is_ok() + ) + } + "subscribe_malformed" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().query, "malformed query"); + } + "subscribe_newblock" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().query, "tm.event = 'NewBlock'"); + } + "subscribe_txs" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().query, "tm.event = 'Tx'"); + } + "subscribe_txs_broadcast_tx_0" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHgwPXZhbHVl").unwrap() + ); + } + "subscribe_txs_broadcast_tx_1" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHgxPXZhbHVl").unwrap() + ); + } + "subscribe_txs_broadcast_tx_2" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHgyPXZhbHVl").unwrap() + ); + } + "subscribe_txs_broadcast_tx_3" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHgzPXZhbHVl").unwrap() + ); + } + "subscribe_txs_broadcast_tx_4" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHg0PXZhbHVl").unwrap() + ); + } + "subscribe_txs_broadcast_tx_5" => { + let wrapped = serde_json::from_str::< + RequestWrapper, + >(&content) + .unwrap(); + assert_eq!( + wrapped.params().tx.as_bytes(), + base64::decode("dHg1PXZhbHVl").unwrap() + ); + } + "tx_search_no_prove" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().query, "tx.height > 1"); + assert!(!wrapped.params().prove); + assert_eq!(wrapped.params().page, 1); + assert_eq!(wrapped.params().per_page, 10); + assert_eq!(wrapped.params().order_by, Order::Ascending); + } + "tx_search_with_prove" => { + let wrapped = + serde_json::from_str::>(&content) + .unwrap(); + assert_eq!(wrapped.params().query, "tx.height > 1"); + assert!(wrapped.params().prove); + assert_eq!(wrapped.params().page, 1); + assert_eq!(wrapped.params().per_page, 10); + assert_eq!(wrapped.params().order_by, Order::Ascending); + } + _ => { + panic!("cannot parse file name: {}", file_name); + } + } + } +} + +#[test] +fn incoming_fixtures() { + let empty_merkle_root_hash = Some( + tendermint::Hash::from_hex_upper( + tendermint::hash::Algorithm::Sha256, + "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + ) + .unwrap(), + ); + let informal_epoch = + tendermint::Time::parse_from_rfc3339("2020-01-01T00:00:00.000000000Z").unwrap(); + + for json_file in find_fixtures("incoming") { + let file_name = json_file + .file_name() + .unwrap() + .to_str() + .unwrap() + .strip_suffix(".json") + .unwrap(); + let content = fs::read_to_string(&json_file).unwrap(); + match file_name { + "abci_info" => { + let result = endpoint::abci_info::Response::from_string(content).unwrap(); + assert_eq!(result.response.app_version, 1); + assert_eq!(result.response.data, "{\"size\":0}"); + assert_eq!(result.response.last_block_app_hash, b"AAAAAAAAAAA="); + assert_eq!(result.response.version, "0.17.0"); + } + "abci_query_with_existing_key" => { + let result = endpoint::abci_query::Response::from_string(content).unwrap(); + assert_eq!(result.response.code.value(), 0); + assert!(result.response.codespace.is_empty()); + assert_eq!(result.response.index, 0); + assert!(result.response.info.is_empty()); + assert_eq!(result.response.key, base64::decode("dHgw").unwrap()); + assert_eq!(result.response.log.value(), "exists"); + assert!(result.response.proof.is_none()); + assert_eq!(result.response.value, base64::decode("dmFsdWU=").unwrap()); + } + "abci_query_with_non_existent_key" => { + let result = endpoint::abci_query::Response::from_string(content).unwrap(); + assert_eq!(result.response.code.value(), 0); + assert!(result.response.codespace.is_empty()); + assert_eq!(result.response.index, 0); + assert!(result.response.info.is_empty()); + assert_eq!( + result.response.key, + base64::decode("bm9uX2V4aXN0ZW50X2tleQ==").unwrap() + ); + assert_eq!(result.response.log.value(), "does not exist"); + assert!(result.response.proof.is_none()); + assert!(result.response.value.is_empty()); + } + "block_at_height_0" => { + let error = endpoint::block::Response::from_string(&content) + .err() + .unwrap(); + assert_eq!(error.code(), Code::InternalError); + assert_eq!(error.message(), "Internal error"); + assert_eq!( + error.data(), + Some("height must be greater than 0, but got 0") + ); + } + "block_at_height_1" => { + let result = endpoint::block::Response::from_string(content).unwrap(); + assert!(result.block.data.iter().next().is_none()); + assert!(result.block.evidence.iter().next().is_none()); + assert!(result.block.header.app_hash.value().is_empty()); + assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID); + assert!(!result.block.header.consensus_hash.is_empty()); + assert_eq!(result.block.header.data_hash, empty_merkle_root_hash); + assert_eq!(result.block.header.evidence_hash, empty_merkle_root_hash); + assert_eq!(result.block.header.height.value(), 1); + assert!(result.block.header.last_block_id.is_none()); + assert_eq!(result.block.header.last_commit_hash, empty_merkle_root_hash); + assert_eq!( + result.block.header.last_results_hash, + empty_merkle_root_hash + ); + assert!(!result.block.header.next_validators_hash.is_empty()); + assert_ne!( + result.block.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + result + .block + .header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!result.block.header.validators_hash.is_empty()); + assert_eq!( + result.block.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + assert!(result.block.last_commit.is_none()); + assert!(!result.block_id.hash.is_empty()); + assert!(!result.block_id.part_set_header.hash.is_empty()); + assert_eq!(result.block_id.part_set_header.total, 1); + } + "block_at_height_10" => { + let result = endpoint::block::Response::from_string(content).unwrap(); + assert!(result.block.data.iter().next().is_none()); + assert!(result.block.evidence.iter().next().is_none()); + assert_eq!(result.block.header.app_hash.value(), [0u8; 8]); + assert_eq!(result.block.header.chain_id.as_str(), CHAIN_ID); + assert!(!result.block.header.consensus_hash.is_empty()); + assert_eq!(result.block.header.data_hash, empty_merkle_root_hash); + assert_eq!(result.block.header.evidence_hash, empty_merkle_root_hash); + assert_eq!(result.block.header.height.value(), 10); + assert!(result.block.header.last_block_id.is_some()); + assert!(result.block.header.last_commit_hash.is_some()); + assert!(result.block.header.last_results_hash.is_some()); + assert!(!result.block.header.next_validators_hash.is_empty()); + assert_ne!( + result.block.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + result + .block + .header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!result.block.header.validators_hash.is_empty()); + assert_eq!( + result.block.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = result.block.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.height.value(), 9); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + // It's weird but there is no implementation to get the signature out of CommitSig. + assert!(!result.block_id.hash.is_empty()); + assert!(!result.block_id.part_set_header.hash.is_empty()); + assert_eq!(result.block_id.part_set_header.total, 1); + } + "block_results_at_height_10" => { + let result = endpoint::block_results::Response::from_string(content).unwrap(); + assert!(result.begin_block_events.is_none()); + assert!(result.consensus_param_updates.is_none()); + assert!(result.end_block_events.is_none()); + assert_eq!(result.height.value(), 10); + assert!(result.txs_results.is_none()); + assert!(result.validator_updates.is_empty()); + } + "blockchain_from_1_to_10" => { + let result = endpoint::blockchain::Response::from_string(content).unwrap(); + assert_eq!(result.block_metas.len(), 10); + for block_meta in result.block_metas { + assert!(!block_meta.block_id.hash.is_empty()); + assert!(!block_meta.block_id.part_set_header.hash.is_empty()); + assert_eq!(block_meta.block_id.part_set_header.total, 1); + assert!(block_meta.block_size > 0); + if block_meta.header.height.value() == 1 { + assert!(block_meta.header.app_hash.value().is_empty()); + assert_eq!(block_meta.header.data_hash, empty_merkle_root_hash); + assert_eq!(block_meta.header.evidence_hash, empty_merkle_root_hash); + assert!(block_meta.header.last_block_id.is_none()); + assert_eq!(block_meta.header.last_commit_hash, empty_merkle_root_hash); + assert_eq!(block_meta.header.last_results_hash, empty_merkle_root_hash); + } else { + assert!(!block_meta.header.app_hash.value().is_empty()); + assert!(block_meta.header.data_hash.is_some()); + assert!(block_meta.header.evidence_hash.is_some()); + assert!(block_meta.header.last_block_id.is_some()); + assert!(block_meta.header.last_commit_hash.is_some()); + assert!(block_meta.header.last_results_hash.is_some()); + } + assert_eq!(block_meta.header.chain_id.as_str(), CHAIN_ID); + assert!(!block_meta.header.consensus_hash.is_empty()); + assert!(!block_meta.header.next_validators_hash.is_empty()); + assert_ne!( + block_meta.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + block_meta + .header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!block_meta.header.validators_hash.is_empty()); + assert_eq!( + block_meta.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + assert_eq!(block_meta.num_txs, 0); + } + } + "broadcast_tx_async" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "broadcast_tx_commit" => { + let result = + endpoint::broadcast::tx_commit::Response::from_string(content).unwrap(); + assert_eq!(result.check_tx.code, tendermint::abci::Code::Ok); + assert_eq!( + result.check_tx.codespace, + tendermint::abci::responses::Codespace::default() + ); + assert!(result.check_tx.data.is_none()); + assert!(result.check_tx.events.is_empty()); + assert_eq!(result.check_tx.gas_used.value(), 0); + // Todo: https://github.com/informalsystems/tendermint-rs/issues/761 + //assert_eq!(result.check_tx.gas_wanted.value(), 1); + assert!(result.check_tx.info.to_string().is_empty()); + assert!(result.check_tx.log.value().is_empty()); + assert_eq!(result.deliver_tx.code, tendermint::abci::Code::Ok); + assert_eq!( + result.deliver_tx.codespace, + tendermint::abci::responses::Codespace::default() + ); + assert!(result.deliver_tx.data.is_none()); + assert_eq!(result.deliver_tx.events.len(), 1); + assert_eq!(result.deliver_tx.events[0].attributes.len(), 4); + assert_eq!( + result.deliver_tx.events[0].attributes[0] + .key + .to_string() + .as_bytes(), + base64::decode("Y3JlYXRvcg==").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[0] + .value + .to_string() + .as_bytes(), + base64::decode("Q29zbW9zaGkgTmV0b3dva28=").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[1] + .key + .to_string() + .as_bytes(), + base64::decode("a2V5").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[1] + .value + .to_string() + .as_bytes(), + base64::decode("Y29tbWl0LWtleQ==").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[2] + .key + .to_string() + .as_bytes(), + base64::decode("aW5kZXhfa2V5").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[2] + .value + .to_string() + .as_bytes(), + base64::decode("aW5kZXggaXMgd29ya2luZw==").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[3] + .key + .to_string() + .as_bytes(), + base64::decode("bm9pbmRleF9rZXk=").unwrap() + ); + assert_eq!( + result.deliver_tx.events[0].attributes[3] + .value + .to_string() + .as_bytes(), + base64::decode("aW5kZXggaXMgd29ya2luZw==").unwrap() + ); + assert_eq!(result.deliver_tx.events[0].type_str, "app"); + assert_eq!(result.deliver_tx.gas_used.value(), 0); + assert_eq!(result.deliver_tx.gas_wanted.value(), 0); + assert!(result.deliver_tx.info.to_string().is_empty()); + assert!(result.deliver_tx.log.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + } + "broadcast_tx_sync" => { + let result = endpoint::broadcast::tx_sync::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "commit_at_height_10" => { + let result = endpoint::commit::Response::from_string(content).unwrap(); + assert!(!result.signed_header.commit.block_id.hash.is_empty()); + assert_eq!(result.signed_header.commit.height.value(), 10); + assert_eq!(result.signed_header.commit.round.value(), 0); + assert_eq!(result.signed_header.commit.signatures.len(), 1); + assert!(result.signed_header.commit.signatures[0].is_commit()); + assert!(result.signed_header.commit.signatures[0] + .validator_address() + .is_some()); + assert_eq!(result.signed_header.header.app_hash.value(), [0u8; 8]); + assert_eq!(result.signed_header.header.chain_id.as_str(), CHAIN_ID); + assert!(!result.signed_header.header.consensus_hash.is_empty()); + assert_eq!( + result.signed_header.header.data_hash, + empty_merkle_root_hash + ); + assert_eq!( + result.signed_header.header.evidence_hash, + empty_merkle_root_hash + ); + assert_eq!(result.signed_header.header.height.value(), 10); + assert!(result.signed_header.header.last_block_id.is_some()); + assert!(result.signed_header.header.last_commit_hash.is_some()); + assert!(result.signed_header.header.last_results_hash.is_some()); + assert!(!result.signed_header.header.next_validators_hash.is_empty()); + assert_ne!( + result.signed_header.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + result + .signed_header + .header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!result.signed_header.header.validators_hash.is_empty()); + assert_eq!( + result.signed_header.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + } + "consensus_state" => { + assert!(endpoint::consensus_state::Response::from_string(content).is_ok()); + } + "genesis" => { + let result = endpoint::genesis::Response::from_string(content).unwrap(); + assert!(result.genesis.app_hash.is_empty()); + assert_eq!(result.genesis.chain_id.as_str(), CHAIN_ID); + assert_eq!(result.genesis.consensus_params.block.max_bytes, 22020096); + assert_eq!(result.genesis.consensus_params.block.max_gas, -1); + assert_eq!( + result + .genesis + .consensus_params + .evidence + .max_age_duration + .0 + .as_nanos(), + 172800000000000 + ); + assert_eq!( + result.genesis.consensus_params.evidence.max_age_num_blocks, + 100000 + ); + assert_eq!(result.genesis.consensus_params.evidence.max_bytes, 1048576); + assert_eq!( + result + .genesis + .consensus_params + .validator + .pub_key_types + .len(), + 1 + ); + assert_eq!( + result.genesis.consensus_params.validator.pub_key_types[0], + tendermint::public_key::Algorithm::Ed25519 + ); + assert!(result.genesis.consensus_params.version.is_none()); + assert!( + result + .genesis + .genesis_time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert_eq!(result.genesis.validators.len(), 1); + assert_ne!( + result.genesis.validators[0].address.as_bytes(), + [0; tendermint::account::LENGTH] + ); + assert_eq!(result.genesis.validators[0].power(), 10); + assert!(result.genesis.validators[0].pub_key.ed25519().is_some()); + assert_eq!(result.genesis.validators[0].proposer_priority.value(), 0); + } + "net_info" => { + let result = endpoint::net_info::Response::from_string(content).unwrap(); + assert_eq!(result.listeners.len(), 1); + assert_eq!(result.listeners[0].to_string(), "Listener(@)"); + assert!(result.listening); + assert_eq!(result.n_peers, 0); + assert!(result.peers.is_empty()); + } + "status" => { + let result = endpoint::status::Response::from_string(content).unwrap(); + assert_eq!( + result.node_info.listen_addr.to_net_address().unwrap(), + tendermint::net::Address::from_str("tcp://0.0.0.0:26656").unwrap() + ); + assert_eq!(result.node_info.moniker.to_string(), "dockernode"); + assert_eq!(result.node_info.network.to_string(), CHAIN_ID); + assert_eq!( + result.node_info.other.rpc_address, + tendermint::net::Address::from_str("tcp://0.0.0.0:26657").unwrap() + ); + assert_eq!( + result.node_info.other.tx_index, + tendermint::node::info::TxIndexStatus::On + ); + assert_eq!( + result.node_info.protocol_version, + tendermint::node::info::ProtocolVersionInfo { + p2p: 8, + block: 11, + app: 1 + } + ); + assert_eq!(result.node_info.version.to_string(), "v0.34.0"); + assert!(!result.sync_info.catching_up); + assert_eq!(result.sync_info.latest_app_hash.value(), [0; 8]); + assert!(!result.sync_info.latest_block_hash.is_empty()); + assert!( + result + .sync_info + .latest_block_time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(result.validator_info.pub_key.ed25519().is_some()); + assert_eq!(result.validator_info.voting_power.value(), 10); + } + "subscribe_malformed" => { + let result = endpoint::subscribe::Response::from_string(content) + .err() + .unwrap(); + assert_eq!(result.code(), Code::InternalError); + assert_eq!(result.message(), "Internal error"); + assert_eq!(result.data().unwrap(),"failed to parse query: \nparse error near PegText (line 1 symbol 2 - line 1 symbol 11):\n\"malformed\"\n"); + } + "subscribe_newblock" => { + let result = endpoint::subscribe::Response::from_string(content) + .err() + .unwrap(); + assert_eq!(result.code(), Code::ParseError); + assert_eq!(result.message(), "Parse error. Invalid JSON"); + assert_eq!( + result.data().unwrap(), + "missing field `jsonrpc` at line 1 column 2" + ); + } + "subscribe_newblock_0" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + if let tendermint_rpc::event::EventData::NewBlock { + block, + result_begin_block, + result_end_block, + } = result.data + { + let b = block.unwrap(); + assert!(b.data.iter().next().is_none()); + assert!(b.evidence.iter().next().is_none()); + assert!(!b.header.app_hash.value().is_empty()); + assert_eq!(b.header.chain_id.as_str(), CHAIN_ID); + assert!(!b.header.consensus_hash.is_empty()); + assert_eq!(b.header.data_hash, empty_merkle_root_hash); + assert_eq!(b.header.evidence_hash, empty_merkle_root_hash); + assert!(b.header.last_block_id.is_some()); + assert!(b.header.last_commit_hash.is_some()); + assert!(b.header.last_results_hash.is_some()); + assert!(!b.header.next_validators_hash.is_empty()); + assert_ne!( + b.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + b.header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!b.header.validators_hash.is_empty()); + assert_eq!( + b.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = b.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + assert!(result_begin_block.unwrap().tags.is_empty()); + let reb = result_end_block.unwrap(); + assert!(reb.validator_updates.is_empty()); + assert!(reb.consensus_param_updates.is_none()); + assert!(reb.tags.is_empty()); + } else { + panic!("not a newblock"); + } + assert_eq!(result.query, "tm.event = 'NewBlock'"); + } + "subscribe_newblock_1" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + if let tendermint_rpc::event::EventData::NewBlock { + block, + result_begin_block, + result_end_block, + } = result.data + { + let b = block.unwrap(); + assert!(b.data.iter().next().is_none()); + assert!(b.evidence.iter().next().is_none()); + assert!(!b.header.app_hash.value().is_empty()); + assert_eq!(b.header.chain_id.as_str(), CHAIN_ID); + assert!(!b.header.consensus_hash.is_empty()); + assert_eq!(b.header.data_hash, empty_merkle_root_hash); + assert_eq!(b.header.evidence_hash, empty_merkle_root_hash); + assert!(b.header.last_block_id.is_some()); + assert!(b.header.last_commit_hash.is_some()); + assert!(b.header.last_results_hash.is_some()); + assert!(!b.header.next_validators_hash.is_empty()); + assert_ne!( + b.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + b.header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!b.header.validators_hash.is_empty()); + assert_eq!( + b.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = b.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + assert!(result_begin_block.unwrap().tags.is_empty()); + let reb = result_end_block.unwrap(); + assert!(reb.validator_updates.is_empty()); + assert!(reb.consensus_param_updates.is_none()); + assert!(reb.tags.is_empty()); + } else { + panic!("not a newblock"); + } + assert_eq!(result.query, "tm.event = 'NewBlock'"); + } + "subscribe_newblock_2" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + if let tendermint_rpc::event::EventData::NewBlock { + block, + result_begin_block, + result_end_block, + } = result.data + { + let b = block.unwrap(); + assert!(b.data.iter().next().is_none()); + assert!(b.evidence.iter().next().is_none()); + assert!(!b.header.app_hash.value().is_empty()); + assert_eq!(b.header.chain_id.as_str(), CHAIN_ID); + assert!(!b.header.consensus_hash.is_empty()); + assert_eq!(b.header.data_hash, empty_merkle_root_hash); + assert_eq!(b.header.evidence_hash, empty_merkle_root_hash); + assert!(b.header.last_block_id.is_some()); + assert!(b.header.last_commit_hash.is_some()); + assert!(b.header.last_results_hash.is_some()); + assert!(!b.header.next_validators_hash.is_empty()); + assert_ne!( + b.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + b.header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!b.header.validators_hash.is_empty()); + assert_eq!( + b.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = b.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + assert!(result_begin_block.unwrap().tags.is_empty()); + let reb = result_end_block.unwrap(); + assert!(reb.validator_updates.is_empty()); + assert!(reb.consensus_param_updates.is_none()); + assert!(reb.tags.is_empty()); + } else { + panic!("not a newblock"); + } + assert_eq!(result.query, "tm.event = 'NewBlock'"); + } + "subscribe_newblock_3" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + if let tendermint_rpc::event::EventData::NewBlock { + block, + result_begin_block, + result_end_block, + } = result.data + { + let b = block.unwrap(); + assert!(b.data.iter().next().is_none()); + assert!(b.evidence.iter().next().is_none()); + assert!(!b.header.app_hash.value().is_empty()); + assert_eq!(b.header.chain_id.as_str(), CHAIN_ID); + assert!(!b.header.consensus_hash.is_empty()); + assert_eq!(b.header.data_hash, empty_merkle_root_hash); + assert_eq!(b.header.evidence_hash, empty_merkle_root_hash); + assert!(b.header.last_block_id.is_some()); + assert!(b.header.last_commit_hash.is_some()); + assert!(b.header.last_results_hash.is_some()); + assert!(!b.header.next_validators_hash.is_empty()); + assert_ne!( + b.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + b.header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!b.header.validators_hash.is_empty()); + assert_eq!( + b.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = b.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + assert!(result_begin_block.unwrap().tags.is_empty()); + let reb = result_end_block.unwrap(); + assert!(reb.validator_updates.is_empty()); + assert!(reb.consensus_param_updates.is_none()); + assert!(reb.tags.is_empty()); + } else { + panic!("not a newblock"); + } + assert_eq!(result.query, "tm.event = 'NewBlock'"); + } + "subscribe_newblock_4" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + if let tendermint_rpc::event::EventData::NewBlock { + block, + result_begin_block, + result_end_block, + } = result.data + { + let b = block.unwrap(); + assert!(b.data.iter().next().is_none()); + assert!(b.evidence.iter().next().is_none()); + assert!(!b.header.app_hash.value().is_empty()); + assert_eq!(b.header.chain_id.as_str(), CHAIN_ID); + assert!(!b.header.consensus_hash.is_empty()); + assert_eq!(b.header.data_hash, empty_merkle_root_hash); + assert_eq!(b.header.evidence_hash, empty_merkle_root_hash); + assert!(b.header.last_block_id.is_some()); + assert!(b.header.last_commit_hash.is_some()); + assert!(b.header.last_results_hash.is_some()); + assert!(!b.header.next_validators_hash.is_empty()); + assert_ne!( + b.header.proposer_address.as_bytes(), + [0u8; tendermint::account::LENGTH] + ); + assert!( + b.header + .time + .duration_since(informal_epoch) + .unwrap() + .as_secs() + > 0 + ); + assert!(!b.header.validators_hash.is_empty()); + assert_eq!( + b.header.version, + tendermint::block::header::Version { block: 11, app: 1 } + ); + let last_commit = b.last_commit.unwrap(); + assert!(!last_commit.block_id.hash.is_empty()); + assert!(!last_commit.block_id.part_set_header.hash.is_empty()); + assert_eq!(last_commit.block_id.part_set_header.total, 1); + assert_eq!(last_commit.round.value(), 0); + assert_eq!(last_commit.signatures.len(), 1); + assert!(last_commit.signatures[0].is_commit()); + assert!(last_commit.signatures[0].validator_address().is_some()); + assert!(result_begin_block.unwrap().tags.is_empty()); + let reb = result_end_block.unwrap(); + assert!(reb.validator_updates.is_empty()); + assert!(reb.consensus_param_updates.is_none()); + assert!(reb.tags.is_empty()); + } else { + panic!("not a newblock"); + } + assert_eq!(result.query, "tm.event = 'NewBlock'"); + } + "subscribe_txs" => { + assert!(endpoint::subscribe::Response::from_string(content).is_ok()); + } + "subscribe_txs_0" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + let height; + if let tendermint_rpc::event::EventData::Tx { tx_result } = result.data { + height = tx_result.height; + assert!(tx_result.result.log.is_none()); + assert!(tx_result.result.gas_wanted.is_none()); + assert!(tx_result.result.gas_used.is_none()); + assert_eq!(tx_result.result.events.len(), 1); + assert_eq!(tx_result.result.events[0].event_type, "app"); + for attr in &tx_result.result.events[0].attributes { + match attr.key.as_str() { + "Y3JlYXRvcg==" => assert_eq!(attr.value, "Q29zbW9zaGkgTmV0b3dva28="), + "a2V5" => assert_eq!(attr.value, "dHgw"), + "aW5kZXhfa2V5" => assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw=="), + "bm9pbmRleF9rZXk=" => { + assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw==") + } + _ => panic!("unknown attribute found {}", attr.key), + } + } + assert_eq!(tx_result.tx, base64::decode("dHgwPXZhbHVl").unwrap()); + } else { + panic!("not a tx"); + } + for (k, v) in result.events.unwrap() { + assert_eq!(v.len(), 1); + match k.as_str() { + "app.creator" => assert_eq!(v[0], "Cosmoshi Netowoko"), + "app.index_key" => assert_eq!(v[0], "index is working"), + "app.key" => assert_eq!(v[0], "tx0"), + "app.noindex_key" => assert_eq!(v[0], "index is working"), + "tm.event" => assert_eq!(v[0], "Tx"), + "tx.hash" => assert_eq!(v[0].len(), 64), + "tx.height" => assert_eq!(v[0], height.to_string()), + _ => panic!("unknown event found {}", k), + } + } + assert_eq!(result.query, "tm.event = 'Tx'"); + } + "subscribe_txs_1" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + let height; + if let tendermint_rpc::event::EventData::Tx { tx_result } = result.data { + height = tx_result.height; + assert!(tx_result.result.log.is_none()); + assert!(tx_result.result.gas_wanted.is_none()); + assert!(tx_result.result.gas_used.is_none()); + assert_eq!(tx_result.result.events.len(), 1); + assert_eq!(tx_result.result.events[0].event_type, "app"); + for attr in &tx_result.result.events[0].attributes { + match attr.key.as_str() { + "Y3JlYXRvcg==" => assert_eq!(attr.value, "Q29zbW9zaGkgTmV0b3dva28="), + "a2V5" => assert_eq!(attr.value, "dHgx"), + "aW5kZXhfa2V5" => assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw=="), + "bm9pbmRleF9rZXk=" => { + assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw==") + } + _ => panic!("unknown attribute found {}", attr.key), + } + } + assert_eq!(tx_result.tx, base64::decode("dHgxPXZhbHVl").unwrap()); + } else { + panic!("not a tx"); + } + for (k, v) in result.events.unwrap() { + assert_eq!(v.len(), 1); + match k.as_str() { + "app.creator" => assert_eq!(v[0], "Cosmoshi Netowoko"), + "app.index_key" => assert_eq!(v[0], "index is working"), + "app.key" => assert_eq!(v[0], "tx1"), + "app.noindex_key" => assert_eq!(v[0], "index is working"), + "tm.event" => assert_eq!(v[0], "Tx"), + "tx.hash" => assert_eq!(v[0].len(), 64), + "tx.height" => assert_eq!(v[0], height.to_string()), + _ => panic!("unknown event found {}", k), + } + } + assert_eq!(result.query, "tm.event = 'Tx'"); + } + "subscribe_txs_2" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + let height; + if let tendermint_rpc::event::EventData::Tx { tx_result } = result.data { + height = tx_result.height; + assert!(tx_result.result.log.is_none()); + assert!(tx_result.result.gas_wanted.is_none()); + assert!(tx_result.result.gas_used.is_none()); + assert_eq!(tx_result.result.events.len(), 1); + assert_eq!(tx_result.result.events[0].event_type, "app"); + for attr in &tx_result.result.events[0].attributes { + match attr.key.as_str() { + "Y3JlYXRvcg==" => assert_eq!(attr.value, "Q29zbW9zaGkgTmV0b3dva28="), + "a2V5" => assert_eq!(attr.value, "dHgy"), + "aW5kZXhfa2V5" => assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw=="), + "bm9pbmRleF9rZXk=" => { + assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw==") + } + _ => panic!("unknown attribute found {}", attr.key), + } + } + assert_eq!(tx_result.tx, base64::decode("dHgyPXZhbHVl").unwrap()); + } else { + panic!("not a tx"); + } + for (k, v) in result.events.unwrap() { + assert_eq!(v.len(), 1); + match k.as_str() { + "app.creator" => assert_eq!(v[0], "Cosmoshi Netowoko"), + "app.index_key" => assert_eq!(v[0], "index is working"), + "app.key" => assert_eq!(v[0], "tx2"), + "app.noindex_key" => assert_eq!(v[0], "index is working"), + "tm.event" => assert_eq!(v[0], "Tx"), + "tx.hash" => assert_eq!(v[0].len(), 64), + "tx.height" => assert_eq!(v[0], height.to_string()), + _ => panic!("unknown event found {}", k), + } + } + assert_eq!(result.query, "tm.event = 'Tx'"); + } + "subscribe_txs_3" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + let height; + if let tendermint_rpc::event::EventData::Tx { tx_result } = result.data { + height = tx_result.height; + assert!(tx_result.result.log.is_none()); + assert!(tx_result.result.gas_wanted.is_none()); + assert!(tx_result.result.gas_used.is_none()); + assert_eq!(tx_result.result.events.len(), 1); + assert_eq!(tx_result.result.events[0].event_type, "app"); + for attr in &tx_result.result.events[0].attributes { + match attr.key.as_str() { + "Y3JlYXRvcg==" => assert_eq!(attr.value, "Q29zbW9zaGkgTmV0b3dva28="), + "a2V5" => assert_eq!(attr.value, "dHgz"), + "aW5kZXhfa2V5" => assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw=="), + "bm9pbmRleF9rZXk=" => { + assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw==") + } + _ => panic!("unknown attribute found {}", attr.key), + } + } + assert_eq!(tx_result.tx, base64::decode("dHgzPXZhbHVl").unwrap()); + } else { + panic!("not a tx"); + } + for (k, v) in result.events.unwrap() { + assert_eq!(v.len(), 1); + match k.as_str() { + "app.creator" => assert_eq!(v[0], "Cosmoshi Netowoko"), + "app.index_key" => assert_eq!(v[0], "index is working"), + "app.key" => assert_eq!(v[0], "tx3"), + "app.noindex_key" => assert_eq!(v[0], "index is working"), + "tm.event" => assert_eq!(v[0], "Tx"), + "tx.hash" => assert_eq!(v[0].len(), 64), + "tx.height" => assert_eq!(v[0], height.to_string()), + _ => panic!("unknown event found {}", k), + } + } + assert_eq!(result.query, "tm.event = 'Tx'"); + } + "subscribe_txs_4" => { + let result = tendermint_rpc::event::Event::from_string(content).unwrap(); + let height; + if let tendermint_rpc::event::EventData::Tx { tx_result } = result.data { + height = tx_result.height; + assert!(tx_result.result.log.is_none()); + assert!(tx_result.result.gas_wanted.is_none()); + assert!(tx_result.result.gas_used.is_none()); + assert_eq!(tx_result.result.events.len(), 1); + assert_eq!(tx_result.result.events[0].event_type, "app"); + for attr in &tx_result.result.events[0].attributes { + match attr.key.as_str() { + "Y3JlYXRvcg==" => assert_eq!(attr.value, "Q29zbW9zaGkgTmV0b3dva28="), + "a2V5" => assert_eq!(attr.value, "dHg0"), + "aW5kZXhfa2V5" => assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw=="), + "bm9pbmRleF9rZXk=" => { + assert_eq!(attr.value, "aW5kZXggaXMgd29ya2luZw==") + } + _ => panic!("unknown attribute found {}", attr.key), + } + } + assert_eq!(tx_result.tx, base64::decode("dHg0PXZhbHVl").unwrap()); + } else { + panic!("not a tx"); + } + for (k, v) in result.events.unwrap() { + assert_eq!(v.len(), 1); + match k.as_str() { + "app.creator" => assert_eq!(v[0], "Cosmoshi Netowoko"), + "app.index_key" => assert_eq!(v[0], "index is working"), + "app.key" => assert_eq!(v[0], "tx4"), + "app.noindex_key" => assert_eq!(v[0], "index is working"), + "tm.event" => assert_eq!(v[0], "Tx"), + "tx.hash" => assert_eq!(v[0].len(), 64), + "tx.height" => assert_eq!(v[0], height.to_string()), + _ => panic!("unknown event found {}", k), + } + } + assert_eq!(result.query, "tm.event = 'Tx'"); + } + "subscribe_txs_broadcast_tx_0" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "subscribe_txs_broadcast_tx_1" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "subscribe_txs_broadcast_tx_2" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "subscribe_txs_broadcast_tx_3" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "subscribe_txs_broadcast_tx_4" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "subscribe_txs_broadcast_tx_5" => { + let result = endpoint::broadcast::tx_async::Response::from_string(content).unwrap(); + assert_eq!(result.code, tendermint::abci::Code::Ok); + assert!(result.data.value().is_empty()); + assert_ne!( + result.hash, + tendermint::abci::transaction::Hash::new([0; 32]) + ); + assert!(result.log.value().is_empty()); + } + "tx_search_no_prove" => { + let result = endpoint::tx_search::Response::from_string(content).unwrap(); + assert_eq!(result.total_count as usize, result.txs.len()); + // Test a few selected attributes of the results. + for tx in result.txs { + assert_ne!(tx.hash.as_bytes(), [0; 32]); + assert_eq!(tx.tx_result.code, tendermint::abci::Code::Ok); + assert_eq!(tx.tx_result.events.len(), 1); + assert_eq!(tx.tx_result.events[0].type_str, "app"); + assert_eq!(tx.tx_result.gas_used.value(), 0); + assert_eq!(tx.tx_result.gas_wanted.value(), 0); + assert!(tx.tx_result.info.to_string().is_empty()); + assert!(tx.tx_result.log.value().is_empty()); + assert!(tx.proof.is_none()); + } + } + "tx_search_with_prove" => { + let result = endpoint::tx_search::Response::from_string(content).unwrap(); + assert_eq!(result.total_count as usize, result.txs.len()); + // Test a few selected attributes of the results. + for tx in result.txs { + assert_ne!(tx.hash.as_bytes(), [0; 32]); + assert_eq!(tx.tx_result.code, tendermint::abci::Code::Ok); + assert_eq!(tx.tx_result.events.len(), 1); + assert_eq!(tx.tx_result.events[0].type_str, "app"); + assert_eq!(tx.tx_result.gas_used.value(), 0); + assert_eq!(tx.tx_result.gas_wanted.value(), 0); + assert!(tx.tx_result.info.to_string().is_empty()); + assert!(tx.tx_result.log.value().is_empty()); + let proof = tx.proof.unwrap(); + assert_eq!(proof.data, tx.tx.as_bytes()); + assert!(proof.proof.is_some()); + assert_ne!(proof.root_hash, [0; 32]); + } + } + _ => { + panic!("cannot parse file name: {}", file_name); + } + } + } +} diff --git a/rpc/tests/kvstore_fixtures/incoming/abci_info.json b/rpc/tests/kvstore_fixtures/incoming/abci_info.json new file mode 100644 index 000000000..e1e84a004 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/abci_info.json @@ -0,0 +1,13 @@ +{ + "id": "8a289a02-d7e4-45ed-a0db-97445ff3825a", + "jsonrpc": "2.0", + "result": { + "response": { + "app_version": "1", + "data": "{\"size\":0}", + "last_block_app_hash": "AAAAAAAAAAA=", + "last_block_height": "14", + "version": "0.17.0" + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/abci_query_with_existing_key.json b/rpc/tests/kvstore_fixtures/incoming/abci_query_with_existing_key.json new file mode 100644 index 000000000..033433558 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/abci_query_with_existing_key.json @@ -0,0 +1,17 @@ +{ + "id": "6e4d4855-631f-4cf9-b341-d6460eab88a3", + "jsonrpc": "2.0", + "result": { + "response": { + "code": 0, + "codespace": "", + "height": "26", + "index": "0", + "info": "", + "key": "dHgw", + "log": "exists", + "proofOps": null, + "value": "dmFsdWU=" + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/abci_query_with_non_existent_key.json b/rpc/tests/kvstore_fixtures/incoming/abci_query_with_non_existent_key.json new file mode 100644 index 000000000..67ed4b626 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/abci_query_with_non_existent_key.json @@ -0,0 +1,17 @@ +{ + "id": "fbd10e8a-a975-4e47-8f9a-97646da4cb38", + "jsonrpc": "2.0", + "result": { + "response": { + "code": 0, + "codespace": "", + "height": "14", + "index": "0", + "info": "", + "key": "bm9uX2V4aXN0ZW50X2tleQ==", + "log": "does not exist", + "proofOps": null, + "value": null + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/block_at_height_0.json b/rpc/tests/kvstore_fixtures/incoming/block_at_height_0.json new file mode 100644 index 000000000..ac98523fc --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/block_at_height_0.json @@ -0,0 +1,9 @@ +{ + "error": { + "code": -32603, + "data": "height must be greater than 0, but got 0", + "message": "Internal error" + }, + "id": "8becc1c0-0c44-4b0d-bb95-8f3ff2f9893e", + "jsonrpc": "2.0" +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/block_at_height_1.json b/rpc/tests/kvstore_fixtures/incoming/block_at_height_1.json new file mode 100644 index 000000000..c9dc65ff5 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/block_at_height_1.json @@ -0,0 +1,58 @@ +{ + "id": "5be87751-4f5a-4e31-b4db-91a2562a92ea", + "jsonrpc": "2.0", + "result": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "1", + "last_block_id": { + "hash": "", + "parts": { + "hash": "", + "total": 0 + } + }, + "last_commit_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:55.8988413Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "", + "parts": { + "hash": "", + "total": 0 + } + }, + "height": "0", + "round": 0, + "signatures": [] + } + }, + "block_id": { + "hash": "F313BFEE2921709CA1DACF5BB55367FE293194F9C5A9827970C88993D97D47DC", + "parts": { + "hash": "693DBA913A007C963FBF674A99BC79B05A4C0A872E4F839B1B1FD2D7D1B588CD", + "total": 1 + } + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/block_at_height_10.json b/rpc/tests/kvstore_fixtures/incoming/block_at_height_10.json new file mode 100644 index 000000000..569d2fb90 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/block_at_height_10.json @@ -0,0 +1,65 @@ +{ + "id": "9428b752-8b5a-4dc6-b751-0ab12e3bc4f6", + "jsonrpc": "2.0", + "result": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "10", + "last_block_id": { + "hash": "904729E98E9468E2430B3691020ABDA34291EF7F95F15667C0F6EC957432C893", + "parts": { + "hash": "6D2590541B2FDF59A60B062BB17AFA5AE0903211E33F632A17DB22C591889DFC", + "total": 1 + } + }, + "last_commit_hash": "68092239B80DAFDF43C01657159CA708A2BE923B7B14F8F7DD771CA51D596F7B", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:00.5796845Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "904729E98E9468E2430B3691020ABDA34291EF7F95F15667C0F6EC957432C893", + "parts": { + "hash": "6D2590541B2FDF59A60B062BB17AFA5AE0903211E33F632A17DB22C591889DFC", + "total": 1 + } + }, + "height": "9", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "PcfqCfcTs9C+N9h/R6zC2xdu+C7fVCSWLxhEj7h0+tVe48fCxOP4HO51MV0iplHi7Og3dz6DMVXVyYQ27R+XAg==", + "timestamp": "2020-12-21T07:06:00.5796845Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "block_id": { + "hash": "84F558CDCCA7D7D7B26F4BB02862C0DA72607F74937C549AEB0ACFDEC599C877", + "parts": { + "hash": "B5647568016ECDEF740E897D95EEF5CD17A6E20221B7A58CEC7F3DFABA63C7C7", + "total": 1 + } + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/block_results_at_height_10.json b/rpc/tests/kvstore_fixtures/incoming/block_results_at_height_10.json new file mode 100644 index 000000000..d81743f38 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/block_results_at_height_10.json @@ -0,0 +1,12 @@ +{ + "id": "c8effc20-13ec-4724-b788-ac8994b21f5c", + "jsonrpc": "2.0", + "result": { + "begin_block_events": null, + "consensus_param_updates": null, + "end_block_events": null, + "height": "10", + "txs_results": null, + "validator_updates": null + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/blockchain_from_1_to_10.json b/rpc/tests/kvstore_fixtures/incoming/blockchain_from_1_to_10.json new file mode 100644 index 000000000..9e2a1370c --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/blockchain_from_1_to_10.json @@ -0,0 +1,369 @@ +{ + "id": "5566a2c8-97d5-46fc-86b8-ebe77071b499", + "jsonrpc": "2.0", + "result": { + "block_metas": [ + { + "block_id": { + "hash": "84F558CDCCA7D7D7B26F4BB02862C0DA72607F74937C549AEB0ACFDEC599C877", + "parts": { + "hash": "B5647568016ECDEF740E897D95EEF5CD17A6E20221B7A58CEC7F3DFABA63C7C7", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "10", + "last_block_id": { + "hash": "904729E98E9468E2430B3691020ABDA34291EF7F95F15667C0F6EC957432C893", + "parts": { + "hash": "6D2590541B2FDF59A60B062BB17AFA5AE0903211E33F632A17DB22C591889DFC", + "total": 1 + } + }, + "last_commit_hash": "68092239B80DAFDF43C01657159CA708A2BE923B7B14F8F7DD771CA51D596F7B", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:00.5796845Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "904729E98E9468E2430B3691020ABDA34291EF7F95F15667C0F6EC957432C893", + "parts": { + "hash": "6D2590541B2FDF59A60B062BB17AFA5AE0903211E33F632A17DB22C591889DFC", + "total": 1 + } + }, + "block_size": "569", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "9", + "last_block_id": { + "hash": "5E7B81ED16D9F8D4A0B20150E900C7CE5E08FA8C3E9D8AE8660505F7F370B5BC", + "parts": { + "hash": "9220CD585430B68EAB37BE1DFB345689D3EF3C3EFE8116AA3E02444C96D73852", + "total": 1 + } + }, + "last_commit_hash": "500CA7357C1D5F76D68360A2CB0BB743FC210F6F82749E205CA76F91EE0A038E", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:00.0688893Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "5E7B81ED16D9F8D4A0B20150E900C7CE5E08FA8C3E9D8AE8660505F7F370B5BC", + "parts": { + "hash": "9220CD585430B68EAB37BE1DFB345689D3EF3C3EFE8116AA3E02444C96D73852", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "8", + "last_block_id": { + "hash": "7FCF67C066B3DF5A3F960F85D47F437F3364AF51B95D6751C7C39FF5334F3ABF", + "parts": { + "hash": "EF72FA2678BC5B83160C9C4B3E36E85215D9A0E520BD42C7CD55343038E6F355", + "total": 1 + } + }, + "last_commit_hash": "EF1260BCFA1FA9212138ABEC3751F41446AE58E92D05AB9B1225923A3F6C4BBF", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:59.5531608Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "7FCF67C066B3DF5A3F960F85D47F437F3364AF51B95D6751C7C39FF5334F3ABF", + "parts": { + "hash": "EF72FA2678BC5B83160C9C4B3E36E85215D9A0E520BD42C7CD55343038E6F355", + "total": 1 + } + }, + "block_size": "569", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "7", + "last_block_id": { + "hash": "5232E39EA19D61ED3CC46966D1AB6895F0B47930B31B0ABEE77EBD2400BA9060", + "parts": { + "hash": "10F4CAE77632DF696025731F840FE8B487A599DBE1E68372D6FA512B0E9CC2A5", + "total": 1 + } + }, + "last_commit_hash": "E7A298D27E5AA0FFD9DCEAD163BD3EFC52618DB9FC19F98F5E6F5C194E9D14EA", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:59.0360035Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "5232E39EA19D61ED3CC46966D1AB6895F0B47930B31B0ABEE77EBD2400BA9060", + "parts": { + "hash": "10F4CAE77632DF696025731F840FE8B487A599DBE1E68372D6FA512B0E9CC2A5", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "6", + "last_block_id": { + "hash": "B7C27C2EE82BA3F0B5D503B76412E397E85224F6463EC75D649B485DFDF4AD9C", + "parts": { + "hash": "1BD8BC0D414DE2D7802A3A8C81750936945677AB8F749BA0339F470C38D553FF", + "total": 1 + } + }, + "last_commit_hash": "C920D49236C9AE260507F6AC28769CB37D3457FB39D97145F72401162C758183", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:58.5209135Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "B7C27C2EE82BA3F0B5D503B76412E397E85224F6463EC75D649B485DFDF4AD9C", + "parts": { + "hash": "1BD8BC0D414DE2D7802A3A8C81750936945677AB8F749BA0339F470C38D553FF", + "total": 1 + } + }, + "block_size": "569", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "5", + "last_block_id": { + "hash": "CB8696C91AB6F3EE49CEAD10C7B261A09634036E859419ED24C5B0E0D6EA9BB0", + "parts": { + "hash": "0347294AF558B8EE4E8A77105B6F632B5E111159C0ABAE92243EBF711D104EFA", + "total": 1 + } + }, + "last_commit_hash": "670329B628F459B8D8F31753B9524F35834749B72995CE95A9CDD29724BE711B", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:58.006814Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "CB8696C91AB6F3EE49CEAD10C7B261A09634036E859419ED24C5B0E0D6EA9BB0", + "parts": { + "hash": "0347294AF558B8EE4E8A77105B6F632B5E111159C0ABAE92243EBF711D104EFA", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "4", + "last_block_id": { + "hash": "A9EA8A118A40054B04B55976F36643BD25DAB7F600980A0A09A521066D391A06", + "parts": { + "hash": "D035E1F343D3C22A8B82353630CDD52FA5272D21573C9728400ABCB16D1B5F71", + "total": 1 + } + }, + "last_commit_hash": "AE1F78279C0B6A636DF22695D42E61621E3770623A85ED951893A0656FAB2355", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:57.4918647Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "A9EA8A118A40054B04B55976F36643BD25DAB7F600980A0A09A521066D391A06", + "parts": { + "hash": "D035E1F343D3C22A8B82353630CDD52FA5272D21573C9728400ABCB16D1B5F71", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "3", + "last_block_id": { + "hash": "B42CFAC8D53F6DB831D88B1A352403E233EF261F3A6FD7889208A802376D33D3", + "parts": { + "hash": "7309734E845F1734C7AD06EB7AEB723874B7DB38BD8E2AD2D77688AE791F1626", + "total": 1 + } + }, + "last_commit_hash": "9E88293FCBE19EFF78F01F5ED61AB2A56F75A0D43BD02DC3705989C4FCE02DF9", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:56.9736892Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "B42CFAC8D53F6DB831D88B1A352403E233EF261F3A6FD7889208A802376D33D3", + "parts": { + "hash": "7309734E845F1734C7AD06EB7AEB723874B7DB38BD8E2AD2D77688AE791F1626", + "total": 1 + } + }, + "block_size": "571", + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "2", + "last_block_id": { + "hash": "F313BFEE2921709CA1DACF5BB55367FE293194F9C5A9827970C88993D97D47DC", + "parts": { + "hash": "693DBA913A007C963FBF674A99BC79B05A4C0A872E4F839B1B1FD2D7D1B588CD", + "total": 1 + } + }, + "last_commit_hash": "551A552C005A4E2D77B72411F2F037578C1916DBA6067E73153199E016FC150A", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:56.4580898Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + }, + { + "block_id": { + "hash": "F313BFEE2921709CA1DACF5BB55367FE293194F9C5A9827970C88993D97D47DC", + "parts": { + "hash": "693DBA913A007C963FBF674A99BC79B05A4C0A872E4F839B1B1FD2D7D1B588CD", + "total": 1 + } + }, + "block_size": "312", + "header": { + "app_hash": "", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "1", + "last_block_id": { + "hash": "", + "parts": { + "hash": "", + "total": 0 + } + }, + "last_commit_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:05:55.8988413Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "num_txs": "0" + } + ], + "last_height": "15" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_async.json b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_async.json new file mode 100644 index 000000000..3d0594442 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_async.json @@ -0,0 +1,11 @@ +{ + "id": "712dcbed-2068-4471-b68e-12427d3fb93a", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "9F28904F9C0F3AB74A81CBA48E39124DA1C680B47FBFCBA0126870DB722BCC30", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_commit.json b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_commit.json new file mode 100644 index 000000000..76e55f493 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_commit.json @@ -0,0 +1,54 @@ +{ + "id": "6eaad3fa-2aa7-4c41-99e1-33e76acd1353", + "jsonrpc": "2.0", + "result": { + "check_tx": { + "code": 0, + "codespace": "", + "data": null, + "events": [], + "gas_used": "0", + "gas_wanted": "1", + "info": "", + "log": "" + }, + "deliver_tx": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "Y29tbWl0LWtleQ==" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + }, + "hash": "D63F9C23791E610410B576D8C27BB5AEAC93CC1A58522428A7B32A1276085860", + "height": "16" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_sync.json b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_sync.json new file mode 100644 index 000000000..c06e5f8a6 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/broadcast_tx_sync.json @@ -0,0 +1,11 @@ +{ + "id": "8e851ab5-3182-4518-ab31-799b80c612ce", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "57018296EE0919C9D351F2FFEA82A8D28DE223724D79965FC8D00A7477ED48BC", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/commit_at_height_10.json b/rpc/tests/kvstore_fixtures/incoming/commit_at_height_10.json new file mode 100644 index 000000000..9ecb7726f --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/commit_at_height_10.json @@ -0,0 +1,53 @@ +{ + "id": "51a22a83-7fa7-4363-81ff-9be5666c2406", + "jsonrpc": "2.0", + "result": { + "canonical": true, + "signed_header": { + "commit": { + "block_id": { + "hash": "84F558CDCCA7D7D7B26F4BB02862C0DA72607F74937C549AEB0ACFDEC599C877", + "parts": { + "hash": "B5647568016ECDEF740E897D95EEF5CD17A6E20221B7A58CEC7F3DFABA63C7C7", + "total": 1 + } + }, + "height": "10", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "uCvfz2FBzbsWEov80wT/9nYW0dlfFwYH/9KMB+02kc2qIWEjUkxuMfq14CJEOMscbTb980SiuZcKB+kV6M6LDA==", + "timestamp": "2020-12-21T07:06:01.0940072Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + }, + "header": { + "app_hash": "0000000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "10", + "last_block_id": { + "hash": "904729E98E9468E2430B3691020ABDA34291EF7F95F15667C0F6EC957432C893", + "parts": { + "hash": "6D2590541B2FDF59A60B062BB17AFA5AE0903211E33F632A17DB22C591889DFC", + "total": 1 + } + }, + "last_commit_hash": "68092239B80DAFDF43C01657159CA708A2BE923B7B14F8F7DD771CA51D596F7B", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:00.5796845Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + } + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/consensus_state.json b/rpc/tests/kvstore_fixtures/incoming/consensus_state.json new file mode 100644 index 000000000..7b275e078 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/consensus_state.json @@ -0,0 +1,30 @@ +{ + "id": "a5cbed41-8e85-4d22-92c5-db28d88646a2", + "jsonrpc": "2.0", + "result": { + "round_state": { + "height/round/step": "16/0/1", + "height_vote_set": [ + { + "precommits": [ + "nil-Vote" + ], + "precommits_bit_array": "BA{1:_} 0/10 = 0.00", + "prevotes": [ + "nil-Vote" + ], + "prevotes_bit_array": "BA{1:_} 0/10 = 0.00", + "round": 0 + } + ], + "locked_block_hash": "", + "proposal_block_hash": "", + "proposer": { + "address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "index": 0 + }, + "start_time": "2020-12-21T07:06:04.171573Z", + "valid_block_hash": "" + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/genesis.json b/rpc/tests/kvstore_fixtures/incoming/genesis.json new file mode 100644 index 000000000..8b22434b0 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/genesis.json @@ -0,0 +1,41 @@ +{ + "id": "c6ca9b93-048b-479e-b44a-a21b92d584a8", + "jsonrpc": "2.0", + "result": { + "genesis": { + "app_hash": "", + "chain_id": "dockerchain", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1", + "time_iota_ms": "500" + }, + "evidence": { + "max_age_duration": "172800000000000", + "max_age_num_blocks": "100000", + "max_bytes": "1048576" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + }, + "version": {} + }, + "genesis_time": "2020-12-21T07:05:55.8988413Z", + "initial_height": "1", + "validators": [ + { + "address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "name": "", + "power": "10", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "oDr9j9k0ntj2lTvyMWZEEIBIp1MZNodIKLmjSYLRJqQ=" + } + } + ] + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/net_info.json b/rpc/tests/kvstore_fixtures/incoming/net_info.json new file mode 100644 index 000000000..033f03f3a --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/net_info.json @@ -0,0 +1,12 @@ +{ + "id": "b1d19ed4-397b-42a0-8cfc-e261826dc66a", + "jsonrpc": "2.0", + "result": { + "listeners": [ + "Listener(@)" + ], + "listening": true, + "n_peers": "0", + "peers": [] + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/status.json b/rpc/tests/kvstore_fixtures/incoming/status.json new file mode 100644 index 000000000..3b0c894de --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/status.json @@ -0,0 +1,42 @@ +{ + "id": "371b107e-adb7-42b5-9f9a-15577c560290", + "jsonrpc": "2.0", + "result": { + "node_info": { + "channels": "40202122233038606100", + "id": "49d238c84786e2e5fda8b5cbfaaeae217e9198f8", + "listen_addr": "tcp://0.0.0.0:26656", + "moniker": "dockernode", + "network": "dockerchain", + "other": { + "rpc_address": "tcp://0.0.0.0:26657", + "tx_index": "on" + }, + "protocol_version": { + "app": "1", + "block": "11", + "p2p": "8" + }, + "version": "v0.34.0" + }, + "sync_info": { + "catching_up": false, + "earliest_app_hash": "", + "earliest_block_hash": "F313BFEE2921709CA1DACF5BB55367FE293194F9C5A9827970C88993D97D47DC", + "earliest_block_height": "1", + "earliest_block_time": "2020-12-21T07:05:55.8988413Z", + "latest_app_hash": "0000000000000000", + "latest_block_hash": "0841B9258E07365306288BAE1D3B0F9B0E8F74CAF5ED188CCA7C3F9BD1036861", + "latest_block_height": "16", + "latest_block_time": "2020-12-21T07:06:03.6688721Z" + }, + "validator_info": { + "address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "oDr9j9k0ntj2lTvyMWZEEIBIp1MZNodIKLmjSYLRJqQ=" + }, + "voting_power": "10" + } + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_malformed.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_malformed.json new file mode 100644 index 000000000..40b2aea50 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_malformed.json @@ -0,0 +1,9 @@ +{ + "error": { + "code": -32603, + "data": "failed to parse query: \nparse error near PegText (line 1 symbol 2 - line 1 symbol 11):\n\"malformed\"\n", + "message": "Internal error" + }, + "id": "89ea2fbb-981d-4df2-a8b4-aa5e0c1ecead", + "jsonrpc": "2.0" +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_0.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_0.json new file mode 100644 index 000000000..b17491196 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_0.json @@ -0,0 +1,73 @@ +{ + "id": "19228bf5-c042-4f98-8901-e271e38f1f68", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/NewBlock", + "value": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0600000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "17", + "last_block_id": { + "hash": "0841B9258E07365306288BAE1D3B0F9B0E8F74CAF5ED188CCA7C3F9BD1036861", + "parts": { + "hash": "E5752FBFF1EF94718A48DA0A96F252B092EC7BFE646E2B13A1292DFF8500BC25", + "total": 1 + } + }, + "last_commit_hash": "4C7F06AB50C1A37FDDAAAD9A9F5C8D14C0CD3F8D927D7B780FE9829E4073D1B0", + "last_results_hash": "4837665DFE640A370E7496C691987562D02462142C5F34F59E185911A12370EA", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:04.1847324Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "0841B9258E07365306288BAE1D3B0F9B0E8F74CAF5ED188CCA7C3F9BD1036861", + "parts": { + "hash": "E5752FBFF1EF94718A48DA0A96F252B092EC7BFE646E2B13A1292DFF8500BC25", + "total": 1 + } + }, + "height": "16", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "XU26NUohlGMx7vOegrykz2YkyQCLJNATR1QJ0CokK3teH71jQI+bzhdsAo9Pr1JLAX9MA2ao7vMFfIxE9jOmBA==", + "timestamp": "2020-12-21T07:06:04.1847324Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "result_begin_block": {}, + "result_end_block": { + "validator_updates": null + } + } + }, + "events": { + "tm.event": [ + "NewBlock" + ] + }, + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_1.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_1.json new file mode 100644 index 000000000..9043ce869 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_1.json @@ -0,0 +1,73 @@ +{ + "id": "19228bf5-c042-4f98-8901-e271e38f1f68", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/NewBlock", + "value": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0600000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "18", + "last_block_id": { + "hash": "EE802862B5FF1E544AFD3A4223A629491415E715086649E0613CE75165F0B631", + "parts": { + "hash": "DE69ACA137D3532B315838044E98EB7B31445C4EB508E7A81A838CA7A75CAE36", + "total": 1 + } + }, + "last_commit_hash": "CC5D6D940F59DC13C3542DD9C6F2B427BC2B97DB1CA47D91EB5244E5B428471D", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:04.7048212Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "EE802862B5FF1E544AFD3A4223A629491415E715086649E0613CE75165F0B631", + "parts": { + "hash": "DE69ACA137D3532B315838044E98EB7B31445C4EB508E7A81A838CA7A75CAE36", + "total": 1 + } + }, + "height": "17", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "N8IW1teDCJWYk7Q/yQufJQtTE9aXP6Wj5kdnQ66x+nJmi4KFTdZFAQTsuu7Ck2KL8iNSGQXyudz4tdV2hxRqDA==", + "timestamp": "2020-12-21T07:06:04.7048212Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "result_begin_block": {}, + "result_end_block": { + "validator_updates": null + } + } + }, + "events": { + "tm.event": [ + "NewBlock" + ] + }, + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_2.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_2.json new file mode 100644 index 000000000..1e04f3cfb --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_2.json @@ -0,0 +1,73 @@ +{ + "id": "19228bf5-c042-4f98-8901-e271e38f1f68", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/NewBlock", + "value": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0600000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "19", + "last_block_id": { + "hash": "EC7EBFEBD4C04B0ECE3DE07AAC1C5C38D45B162A972CA034DE327130BABEE4D1", + "parts": { + "hash": "815235B4251567E655BE23045952E0EAC0262A1C9E562542A2BC0B23A845B5A6", + "total": 1 + } + }, + "last_commit_hash": "2E590386A70DEFD8092348ADB8E0C62D893571DC76C0256812BF2F6966637A1E", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:05.2201755Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "EC7EBFEBD4C04B0ECE3DE07AAC1C5C38D45B162A972CA034DE327130BABEE4D1", + "parts": { + "hash": "815235B4251567E655BE23045952E0EAC0262A1C9E562542A2BC0B23A845B5A6", + "total": 1 + } + }, + "height": "18", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "RWFrklOcrWE0zJRcA+HELR5+wTiYmfYMDLNB9+0jAfC2CAcOegfRcb6e/tNP4JRkw5trnYHBYSL08vavpZldAA==", + "timestamp": "2020-12-21T07:06:05.2201755Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "result_begin_block": {}, + "result_end_block": { + "validator_updates": null + } + } + }, + "events": { + "tm.event": [ + "NewBlock" + ] + }, + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_3.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_3.json new file mode 100644 index 000000000..b30e9e12e --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_3.json @@ -0,0 +1,73 @@ +{ + "id": "19228bf5-c042-4f98-8901-e271e38f1f68", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/NewBlock", + "value": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0600000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "20", + "last_block_id": { + "hash": "5663C5B1AD248DDC0E7B36F9B399CF59FE52D761E37F0F71B3519EE88FEAEC64", + "parts": { + "hash": "3D3C07C430AEE862E095E43C0200598DDF36DE89EE0D9DB3709402448A8DD887", + "total": 1 + } + }, + "last_commit_hash": "A2ED309E7952EA3F5728F244089A40E5942D20A54DDB4F2395A2D213EC94ADD9", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:05.7366561Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "5663C5B1AD248DDC0E7B36F9B399CF59FE52D761E37F0F71B3519EE88FEAEC64", + "parts": { + "hash": "3D3C07C430AEE862E095E43C0200598DDF36DE89EE0D9DB3709402448A8DD887", + "total": 1 + } + }, + "height": "19", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "vL39A5WdMZFKl7v4p0GhVC6C+0okjsETppCr/k/9B8NUqc3VuBQMUsvg7JPNxApHGHIxexu85xsqnVYTaJQXCA==", + "timestamp": "2020-12-21T07:06:05.7366561Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "result_begin_block": {}, + "result_end_block": { + "validator_updates": null + } + } + }, + "events": { + "tm.event": [ + "NewBlock" + ] + }, + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_4.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_4.json new file mode 100644 index 000000000..24b94758b --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_newblock_4.json @@ -0,0 +1,73 @@ +{ + "id": "19228bf5-c042-4f98-8901-e271e38f1f68", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/NewBlock", + "value": { + "block": { + "data": { + "txs": [] + }, + "evidence": { + "evidence": [] + }, + "header": { + "app_hash": "0600000000000000", + "chain_id": "dockerchain", + "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F", + "data_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "height": "21", + "last_block_id": { + "hash": "0AB2207DD4C3D8293FC7CA17BD9FA6CE8E5B63252E7BDEDA54D04B2422FAE39A", + "parts": { + "hash": "D82E91C8E3B83CC6DFACBDD15116D635F8ADAB660CD478E00C7C2E5AFDDA748B", + "total": 1 + } + }, + "last_commit_hash": "61B4825C1CBDC5CCF56CD777150AFC9C93D54CB6E51B619EE582AAAC9FD69DA7", + "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855", + "next_validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "proposer_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF", + "time": "2020-12-21T07:06:06.2567232Z", + "validators_hash": "518FD4E4CCE99DB15463EA5EBAD3B2BEE1030C31D53065F2FD7C53F8A7BC3E7C", + "version": { + "app": "1", + "block": "11" + } + }, + "last_commit": { + "block_id": { + "hash": "0AB2207DD4C3D8293FC7CA17BD9FA6CE8E5B63252E7BDEDA54D04B2422FAE39A", + "parts": { + "hash": "D82E91C8E3B83CC6DFACBDD15116D635F8ADAB660CD478E00C7C2E5AFDDA748B", + "total": 1 + } + }, + "height": "20", + "round": 0, + "signatures": [ + { + "block_id_flag": 2, + "signature": "b7EweHIJFJ9gXmTyfTS4L+A7bHF2SkLYTZOEs0koMwT7+0SNrEgHVWYiB5N5RdVPV9CX7K5WZi12Joh0xvq/BA==", + "timestamp": "2020-12-21T07:06:06.2567232Z", + "validator_address": "ABAF73F9A1D15E78CA39C1E066E07D3F3B3BAFAF" + } + ] + } + }, + "result_begin_block": {}, + "result_end_block": { + "validator_updates": null + } + } + }, + "events": { + "tm.event": [ + "NewBlock" + ] + }, + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs.json new file mode 100644 index 000000000..71fd87513 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs.json @@ -0,0 +1,5 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": {} +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_0.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_0.json new file mode 100644 index 000000000..21dd66722 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_0.json @@ -0,0 +1,68 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/Tx", + "value": { + "TxResult": { + "height": "23", + "result": { + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgw" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ] + }, + "tx": "dHgwPXZhbHVl" + } + } + }, + "events": { + "app.creator": [ + "Cosmoshi Netowoko" + ], + "app.index_key": [ + "index is working" + ], + "app.key": [ + "tx0" + ], + "app.noindex_key": [ + "index is working" + ], + "tm.event": [ + "Tx" + ], + "tx.hash": [ + "FCB86F71C4EFF43E13C51FA12791F6DD1DDB8600A51131BE2289614D6882F6BE" + ], + "tx.height": [ + "23" + ] + }, + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_1.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_1.json new file mode 100644 index 000000000..11d9f4501 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_1.json @@ -0,0 +1,68 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/Tx", + "value": { + "TxResult": { + "height": "24", + "result": { + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgx" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ] + }, + "tx": "dHgxPXZhbHVl" + } + } + }, + "events": { + "app.creator": [ + "Cosmoshi Netowoko" + ], + "app.index_key": [ + "index is working" + ], + "app.key": [ + "tx1" + ], + "app.noindex_key": [ + "index is working" + ], + "tm.event": [ + "Tx" + ], + "tx.hash": [ + "9F424A8E634AAF63CFA61151A306AA788C9CC792F16B370F7867ED0BD972476C" + ], + "tx.height": [ + "24" + ] + }, + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_2.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_2.json new file mode 100644 index 000000000..8f407e788 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_2.json @@ -0,0 +1,69 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/Tx", + "value": { + "TxResult": { + "height": "24", + "index": 1, + "result": { + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgy" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ] + }, + "tx": "dHgyPXZhbHVl" + } + } + }, + "events": { + "app.creator": [ + "Cosmoshi Netowoko" + ], + "app.index_key": [ + "index is working" + ], + "app.key": [ + "tx2" + ], + "app.noindex_key": [ + "index is working" + ], + "tm.event": [ + "Tx" + ], + "tx.hash": [ + "C9D123E2CF19B9F0EC3CA1F64CD3BF0735397C84778B40B3EB5C49A752D53BF4" + ], + "tx.height": [ + "24" + ] + }, + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_3.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_3.json new file mode 100644 index 000000000..8f0c0a1f4 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_3.json @@ -0,0 +1,68 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/Tx", + "value": { + "TxResult": { + "height": "25", + "result": { + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgz" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ] + }, + "tx": "dHgzPXZhbHVl" + } + } + }, + "events": { + "app.creator": [ + "Cosmoshi Netowoko" + ], + "app.index_key": [ + "index is working" + ], + "app.key": [ + "tx3" + ], + "app.noindex_key": [ + "index is working" + ], + "tm.event": [ + "Tx" + ], + "tx.hash": [ + "73117D6A783E4A37C1D9AD48744AD9FCC0D094C48AB8322FA11CD901C5174CFD" + ], + "tx.height": [ + "25" + ] + }, + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_4.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_4.json new file mode 100644 index 000000000..0803dd4d5 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_4.json @@ -0,0 +1,68 @@ +{ + "id": "4ce9362f-4166-4557-a8dd-4b6b5a5ace50", + "jsonrpc": "2.0", + "result": { + "data": { + "type": "tendermint/event/Tx", + "value": { + "TxResult": { + "height": "26", + "result": { + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHg0" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ] + }, + "tx": "dHg0PXZhbHVl" + } + } + }, + "events": { + "app.creator": [ + "Cosmoshi Netowoko" + ], + "app.index_key": [ + "index is working" + ], + "app.key": [ + "tx4" + ], + "app.noindex_key": [ + "index is working" + ], + "tm.event": [ + "Tx" + ], + "tx.hash": [ + "C349F213F04B4E8E749C6656E4C299E3BF22F4FAF141291A5C083336AD1A413B" + ], + "tx.height": [ + "26" + ] + }, + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_0.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_0.json new file mode 100644 index 000000000..10ad1d267 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_0.json @@ -0,0 +1,11 @@ +{ + "id": "ba50ea50-9d3f-4f77-b04d-4450f406b998", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "FCB86F71C4EFF43E13C51FA12791F6DD1DDB8600A51131BE2289614D6882F6BE", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_1.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_1.json new file mode 100644 index 000000000..6945a4dd1 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_1.json @@ -0,0 +1,11 @@ +{ + "id": "251f4042-77c5-4152-a98f-d21a0b8c2d4d", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "9F424A8E634AAF63CFA61151A306AA788C9CC792F16B370F7867ED0BD972476C", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_2.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_2.json new file mode 100644 index 000000000..88a8f64fd --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_2.json @@ -0,0 +1,11 @@ +{ + "id": "26d89226-c90b-49b3-b764-b24a79d73d3d", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "C9D123E2CF19B9F0EC3CA1F64CD3BF0735397C84778B40B3EB5C49A752D53BF4", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_3.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_3.json new file mode 100644 index 000000000..902bc09ae --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_3.json @@ -0,0 +1,11 @@ +{ + "id": "29965dd5-cccf-43c0-bbb8-65ae6671163c", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "73117D6A783E4A37C1D9AD48744AD9FCC0D094C48AB8322FA11CD901C5174CFD", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_4.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_4.json new file mode 100644 index 000000000..7c20e810e --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_4.json @@ -0,0 +1,11 @@ +{ + "id": "71a6cab9-62d5-4c41-a404-5f90f36ed77a", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "C349F213F04B4E8E749C6656E4C299E3BF22F4FAF141291A5C083336AD1A413B", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_5.json b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_5.json new file mode 100644 index 000000000..990d5a661 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/subscribe_txs_broadcast_tx_5.json @@ -0,0 +1,11 @@ +{ + "id": "ac35b95a-c8f3-4a2a-9466-159552d83e23", + "jsonrpc": "2.0", + "result": { + "code": 0, + "codespace": "", + "data": "", + "hash": "CC4AC5C231481DD2ED2EA15789483B94565BF41612B6FEDE5BE7694F882CC202", + "log": "" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/tx_search_no_prove.json b/rpc/tests/kvstore_fixtures/incoming/tx_search_no_prove.json new file mode 100644 index 000000000..ac64b61a4 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/tx_search_no_prove.json @@ -0,0 +1,345 @@ +{ + "id": "68c7ee1b-a94b-4762-ba46-b42f5a82fa68", + "jsonrpc": "2.0", + "result": { + "total_count": "8", + "txs": [ + { + "hash": "9F28904F9C0F3AB74A81CBA48E39124DA1C680B47FBFCBA0126870DB722BCC30", + "height": "16", + "index": 0, + "tx": "YXN5bmMta2V5PXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "YXN5bmMta2V5" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "57018296EE0919C9D351F2FFEA82A8D28DE223724D79965FC8D00A7477ED48BC", + "height": "16", + "index": 1, + "tx": "c3luYy1rZXk9dmFsdWU=", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "c3luYy1rZXk=" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "D63F9C23791E610410B576D8C27BB5AEAC93CC1A58522428A7B32A1276085860", + "height": "16", + "index": 2, + "tx": "Y29tbWl0LWtleT12YWx1ZQ==", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "Y29tbWl0LWtleQ==" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "FCB86F71C4EFF43E13C51FA12791F6DD1DDB8600A51131BE2289614D6882F6BE", + "height": "23", + "index": 0, + "tx": "dHgwPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgw" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "9F424A8E634AAF63CFA61151A306AA788C9CC792F16B370F7867ED0BD972476C", + "height": "24", + "index": 0, + "tx": "dHgxPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgx" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "C9D123E2CF19B9F0EC3CA1F64CD3BF0735397C84778B40B3EB5C49A752D53BF4", + "height": "24", + "index": 1, + "tx": "dHgyPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgy" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "73117D6A783E4A37C1D9AD48744AD9FCC0D094C48AB8322FA11CD901C5174CFD", + "height": "25", + "index": 0, + "tx": "dHgzPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgz" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "C349F213F04B4E8E749C6656E4C299E3BF22F4FAF141291A5C083336AD1A413B", + "height": "26", + "index": 0, + "tx": "dHg0PXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHg0" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + } + ] + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/incoming/tx_search_with_prove.json b/rpc/tests/kvstore_fixtures/incoming/tx_search_with_prove.json new file mode 100644 index 000000000..2b0ed9bc4 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/incoming/tx_search_with_prove.json @@ -0,0 +1,437 @@ +{ + "id": "8784e541-4cdc-4b8e-a5f4-d445e21f9a32", + "jsonrpc": "2.0", + "result": { + "total_count": "8", + "txs": [ + { + "hash": "9F28904F9C0F3AB74A81CBA48E39124DA1C680B47FBFCBA0126870DB722BCC30", + "height": "16", + "index": 0, + "proof": { + "data": "YXN5bmMta2V5PXZhbHVl", + "proof": { + "aunts": [ + "oL+OYRo6LtD+lKo0W5A2kcPlbt4Of3c/VN57Ag54iEk=", + "wq4Wy/oF+/0xsH+eJq1SqY2BgYS2FVXbLAXNcCLkB74=" + ], + "index": "0", + "leaf_hash": "MIH5kVBA0TizrX+JVzLSdnwp6Ful2EOI0E4XpdgmK3o=", + "total": "3" + }, + "root_hash": "F54643B0051065C87DA31A654531B65F9B57380F9BF3332FF5BCA7584567268C" + }, + "tx": "YXN5bmMta2V5PXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "YXN5bmMta2V5" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "57018296EE0919C9D351F2FFEA82A8D28DE223724D79965FC8D00A7477ED48BC", + "height": "16", + "index": 1, + "proof": { + "data": "c3luYy1rZXk9dmFsdWU=", + "proof": { + "aunts": [ + "MIH5kVBA0TizrX+JVzLSdnwp6Ful2EOI0E4XpdgmK3o=", + "wq4Wy/oF+/0xsH+eJq1SqY2BgYS2FVXbLAXNcCLkB74=" + ], + "index": "1", + "leaf_hash": "oL+OYRo6LtD+lKo0W5A2kcPlbt4Of3c/VN57Ag54iEk=", + "total": "3" + }, + "root_hash": "F54643B0051065C87DA31A654531B65F9B57380F9BF3332FF5BCA7584567268C" + }, + "tx": "c3luYy1rZXk9dmFsdWU=", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "c3luYy1rZXk=" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "D63F9C23791E610410B576D8C27BB5AEAC93CC1A58522428A7B32A1276085860", + "height": "16", + "index": 2, + "proof": { + "data": "Y29tbWl0LWtleT12YWx1ZQ==", + "proof": { + "aunts": [ + "RaZ3Z52YXK7Rahqt14/2jlvLxqDpG0rmHt9ETIABLus=" + ], + "index": "2", + "leaf_hash": "wq4Wy/oF+/0xsH+eJq1SqY2BgYS2FVXbLAXNcCLkB74=", + "total": "3" + }, + "root_hash": "F54643B0051065C87DA31A654531B65F9B57380F9BF3332FF5BCA7584567268C" + }, + "tx": "Y29tbWl0LWtleT12YWx1ZQ==", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "Y29tbWl0LWtleQ==" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "FCB86F71C4EFF43E13C51FA12791F6DD1DDB8600A51131BE2289614D6882F6BE", + "height": "23", + "index": 0, + "proof": { + "data": "dHgwPXZhbHVl", + "proof": { + "aunts": [], + "index": "0", + "leaf_hash": "3UnhxGnCw+sKtov5uD2YZbCP79vHFwLMc1ZPTaVocKQ=", + "total": "1" + }, + "root_hash": "DD49E1C469C2C3EB0AB68BF9B83D9865B08FEFDBC71702CC73564F4DA56870A4" + }, + "tx": "dHgwPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgw" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "9F424A8E634AAF63CFA61151A306AA788C9CC792F16B370F7867ED0BD972476C", + "height": "24", + "index": 0, + "proof": { + "data": "dHgxPXZhbHVl", + "proof": { + "aunts": [ + "0eF/BEMF82Y/mIMIM0HX/isU2jI44Z2rAor5MA0PrKM=" + ], + "index": "0", + "leaf_hash": "QnwQk7ERU9NjeD1GlLa4H8lscIRFD3evj6SZulKp3T8=", + "total": "2" + }, + "root_hash": "05E17857792BBFE205D9F8C2498F6C05A3603D046EDF57C50D037D36804F35D1" + }, + "tx": "dHgxPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgx" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "C9D123E2CF19B9F0EC3CA1F64CD3BF0735397C84778B40B3EB5C49A752D53BF4", + "height": "24", + "index": 1, + "proof": { + "data": "dHgyPXZhbHVl", + "proof": { + "aunts": [ + "QnwQk7ERU9NjeD1GlLa4H8lscIRFD3evj6SZulKp3T8=" + ], + "index": "1", + "leaf_hash": "0eF/BEMF82Y/mIMIM0HX/isU2jI44Z2rAor5MA0PrKM=", + "total": "2" + }, + "root_hash": "05E17857792BBFE205D9F8C2498F6C05A3603D046EDF57C50D037D36804F35D1" + }, + "tx": "dHgyPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgy" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "73117D6A783E4A37C1D9AD48744AD9FCC0D094C48AB8322FA11CD901C5174CFD", + "height": "25", + "index": 0, + "proof": { + "data": "dHgzPXZhbHVl", + "proof": { + "aunts": [], + "index": "0", + "leaf_hash": "jt+3kmBnxAUZK7c0gytFbKegUaR38TB3aAlKsIZ0RNU=", + "total": "1" + }, + "root_hash": "8EDFB7926067C405192BB734832B456CA7A051A477F1307768094AB0867444D5" + }, + "tx": "dHgzPXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHgz" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + }, + { + "hash": "C349F213F04B4E8E749C6656E4C299E3BF22F4FAF141291A5C083336AD1A413B", + "height": "26", + "index": 0, + "proof": { + "data": "dHg0PXZhbHVl", + "proof": { + "aunts": [], + "index": "0", + "leaf_hash": "oZPOdbpVGhDcNY2OaPjybbnfL2SMaDmXm9ufOgruPCA=", + "total": "1" + }, + "root_hash": "A193CE75BA551A10DC358D8E68F8F26DB9DF2F648C6839979BDB9F3A0AEE3C20" + }, + "tx": "dHg0PXZhbHVl", + "tx_result": { + "code": 0, + "codespace": "", + "data": null, + "events": [ + { + "attributes": [ + { + "index": true, + "key": "Y3JlYXRvcg==", + "value": "Q29zbW9zaGkgTmV0b3dva28=" + }, + { + "index": true, + "key": "a2V5", + "value": "dHg0" + }, + { + "index": true, + "key": "aW5kZXhfa2V5", + "value": "aW5kZXggaXMgd29ya2luZw==" + }, + { + "index": false, + "key": "bm9pbmRleF9rZXk=", + "value": "aW5kZXggaXMgd29ya2luZw==" + } + ], + "type": "app" + } + ], + "gas_used": "0", + "gas_wanted": "0", + "info": "", + "log": "" + } + } + ] + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/abci_info.json b/rpc/tests/kvstore_fixtures/outgoing/abci_info.json new file mode 100644 index 000000000..1890d0c7d --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/abci_info.json @@ -0,0 +1,6 @@ +{ + "id": "8a289a02-d7e4-45ed-a0db-97445ff3825a", + "jsonrpc": "2.0", + "method": "abci_info", + "params": null +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_existing_key.json b/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_existing_key.json new file mode 100644 index 000000000..cabc1c8ee --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_existing_key.json @@ -0,0 +1,8 @@ +{ + "id": "6e4d4855-631f-4cf9-b341-d6460eab88a3", + "jsonrpc": "2.0", + "method": "abci_query", + "params": { + "data": "747830" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_non_existent_key.json b/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_non_existent_key.json new file mode 100644 index 000000000..f8fa593cd --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/abci_query_with_non_existent_key.json @@ -0,0 +1,8 @@ +{ + "id": "fbd10e8a-a975-4e47-8f9a-97646da4cb38", + "jsonrpc": "2.0", + "method": "abci_query", + "params": { + "data": "6e6f6e5f6578697374656e745f6b6579" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/block_at_height_0.json b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_0.json new file mode 100644 index 000000000..8386cea70 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_0.json @@ -0,0 +1,8 @@ +{ + "id": "8becc1c0-0c44-4b0d-bb95-8f3ff2f9893e", + "jsonrpc": "2.0", + "method": "block", + "params": { + "height": "0" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/block_at_height_1.json b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_1.json new file mode 100644 index 000000000..397285336 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_1.json @@ -0,0 +1,8 @@ +{ + "id": "5be87751-4f5a-4e31-b4db-91a2562a92ea", + "jsonrpc": "2.0", + "method": "block", + "params": { + "height": "1" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/block_at_height_10.json b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_10.json new file mode 100644 index 000000000..0098c80d0 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/block_at_height_10.json @@ -0,0 +1,8 @@ +{ + "id": "9428b752-8b5a-4dc6-b751-0ab12e3bc4f6", + "jsonrpc": "2.0", + "method": "block", + "params": { + "height": "10" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/block_results_at_height_10.json b/rpc/tests/kvstore_fixtures/outgoing/block_results_at_height_10.json new file mode 100644 index 000000000..5d9e40125 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/block_results_at_height_10.json @@ -0,0 +1,8 @@ +{ + "id": "c8effc20-13ec-4724-b788-ac8994b21f5c", + "jsonrpc": "2.0", + "method": "block_results", + "params": { + "height": "10" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/blockchain_from_1_to_10.json b/rpc/tests/kvstore_fixtures/outgoing/blockchain_from_1_to_10.json new file mode 100644 index 000000000..cf8478b0a --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/blockchain_from_1_to_10.json @@ -0,0 +1,9 @@ +{ + "id": "5566a2c8-97d5-46fc-86b8-ebe77071b499", + "jsonrpc": "2.0", + "method": "blockchain", + "params": { + "maxHeight": "10", + "minHeight": "1" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_async.json b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_async.json new file mode 100644 index 000000000..df006de89 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_async.json @@ -0,0 +1,8 @@ +{ + "id": "712dcbed-2068-4471-b68e-12427d3fb93a", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "YXN5bmMta2V5PXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_commit.json b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_commit.json new file mode 100644 index 000000000..025dbb734 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_commit.json @@ -0,0 +1,8 @@ +{ + "id": "6eaad3fa-2aa7-4c41-99e1-33e76acd1353", + "jsonrpc": "2.0", + "method": "broadcast_tx_commit", + "params": { + "tx": "Y29tbWl0LWtleT12YWx1ZQ==" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_sync.json b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_sync.json new file mode 100644 index 000000000..a6c036cfa --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/broadcast_tx_sync.json @@ -0,0 +1,8 @@ +{ + "id": "8e851ab5-3182-4518-ab31-799b80c612ce", + "jsonrpc": "2.0", + "method": "broadcast_tx_sync", + "params": { + "tx": "c3luYy1rZXk9dmFsdWU=" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/commit_at_height_10.json b/rpc/tests/kvstore_fixtures/outgoing/commit_at_height_10.json new file mode 100644 index 000000000..38d087f24 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/commit_at_height_10.json @@ -0,0 +1,8 @@ +{ + "id": "51a22a83-7fa7-4363-81ff-9be5666c2406", + "jsonrpc": "2.0", + "method": "commit", + "params": { + "height": "10" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/consensus_state.json b/rpc/tests/kvstore_fixtures/outgoing/consensus_state.json new file mode 100644 index 000000000..63b1b54df --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/consensus_state.json @@ -0,0 +1,6 @@ +{ + "id": "a5cbed41-8e85-4d22-92c5-db28d88646a2", + "jsonrpc": "2.0", + "method": "consensus_state", + "params": null +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/genesis.json b/rpc/tests/kvstore_fixtures/outgoing/genesis.json new file mode 100644 index 000000000..382594b73 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/genesis.json @@ -0,0 +1,6 @@ +{ + "id": "c6ca9b93-048b-479e-b44a-a21b92d584a8", + "jsonrpc": "2.0", + "method": "genesis", + "params": null +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/net_info.json b/rpc/tests/kvstore_fixtures/outgoing/net_info.json new file mode 100644 index 000000000..3b3b20844 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/net_info.json @@ -0,0 +1,6 @@ +{ + "id": "b1d19ed4-397b-42a0-8cfc-e261826dc66a", + "jsonrpc": "2.0", + "method": "net_info", + "params": null +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/status.json b/rpc/tests/kvstore_fixtures/outgoing/status.json new file mode 100644 index 000000000..9c56942eb --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/status.json @@ -0,0 +1,6 @@ +{ + "id": "371b107e-adb7-42b5-9f9a-15577c560290", + "jsonrpc": "2.0", + "method": "status", + "params": null +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_malformed.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_malformed.json new file mode 100644 index 000000000..b7e94600a --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_malformed.json @@ -0,0 +1,8 @@ +{ + "id": "99d7825c-2069-420e-88ab-c8c400500522", + "jsonrpc": "2.0", + "method": "subscribe", + "params": { + "query": "malformed query" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_newblock.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_newblock.json new file mode 100644 index 000000000..befe82f0f --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_newblock.json @@ -0,0 +1,8 @@ +{ + "id": "b02501eb-7a5e-4217-a5de-fba6bf5deb39", + "jsonrpc": "2.0", + "method": "subscribe", + "params": { + "query": "tm.event = 'NewBlock'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs.json new file mode 100644 index 000000000..af897e03d --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs.json @@ -0,0 +1,8 @@ +{ + "id": "f273d8cf-1cc4-44fc-a64a-8a89bd4deae6", + "jsonrpc": "2.0", + "method": "subscribe", + "params": { + "query": "tm.event = 'Tx'" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_0.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_0.json new file mode 100644 index 000000000..451dd5e3c --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_0.json @@ -0,0 +1,8 @@ +{ + "id": "ba50ea50-9d3f-4f77-b04d-4450f406b998", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHgwPXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_1.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_1.json new file mode 100644 index 000000000..84ad3be74 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_1.json @@ -0,0 +1,8 @@ +{ + "id": "251f4042-77c5-4152-a98f-d21a0b8c2d4d", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHgxPXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_2.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_2.json new file mode 100644 index 000000000..27dc85cbf --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_2.json @@ -0,0 +1,8 @@ +{ + "id": "26d89226-c90b-49b3-b764-b24a79d73d3d", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHgyPXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_3.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_3.json new file mode 100644 index 000000000..9954cab77 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_3.json @@ -0,0 +1,8 @@ +{ + "id": "29965dd5-cccf-43c0-bbb8-65ae6671163c", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHgzPXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_4.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_4.json new file mode 100644 index 000000000..cd5246053 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_4.json @@ -0,0 +1,8 @@ +{ + "id": "71a6cab9-62d5-4c41-a404-5f90f36ed77a", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHg0PXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_5.json b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_5.json new file mode 100644 index 000000000..95c0b831a --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/subscribe_txs_broadcast_tx_5.json @@ -0,0 +1,8 @@ +{ + "id": "ac35b95a-c8f3-4a2a-9466-159552d83e23", + "jsonrpc": "2.0", + "method": "broadcast_tx_async", + "params": { + "tx": "dHg1PXZhbHVl" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/tx_search_no_prove.json b/rpc/tests/kvstore_fixtures/outgoing/tx_search_no_prove.json new file mode 100644 index 000000000..24e25fd56 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/tx_search_no_prove.json @@ -0,0 +1,12 @@ +{ + "id": "68c7ee1b-a94b-4762-ba46-b42f5a82fa68", + "jsonrpc": "2.0", + "method": "tx_search", + "params": { + "order_by": "asc", + "page": "1", + "per_page": "10", + "prove": false, + "query": "tx.height > 1" + } +} \ No newline at end of file diff --git a/rpc/tests/kvstore_fixtures/outgoing/tx_search_with_prove.json b/rpc/tests/kvstore_fixtures/outgoing/tx_search_with_prove.json new file mode 100644 index 000000000..d151befc7 --- /dev/null +++ b/rpc/tests/kvstore_fixtures/outgoing/tx_search_with_prove.json @@ -0,0 +1,12 @@ +{ + "id": "8784e541-4cdc-4b8e-a5f4-d445e21f9a32", + "jsonrpc": "2.0", + "method": "tx_search", + "params": { + "order_by": "asc", + "page": "1", + "per_page": "10", + "prove": true, + "query": "tx.height > 1" + } +} \ No newline at end of file diff --git a/tendermint/src/abci/transaction/hash.rs b/tendermint/src/abci/transaction/hash.rs index e1232b05a..a4f946c42 100644 --- a/tendermint/src/abci/transaction/hash.rs +++ b/tendermint/src/abci/transaction/hash.rs @@ -13,7 +13,7 @@ use subtle_encoding::hex; pub const LENGTH: usize = 32; /// Trannsaction hashes -#[derive(Copy, Clone, Hash)] +#[derive(Copy, Clone, Hash, PartialEq)] pub struct Hash([u8; LENGTH]); impl Hash { diff --git a/tools/Cargo.toml b/tools/Cargo.toml index f7f1b5f6d..b8740eeae 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ - "kvstore-test" + "kvstore-test", + "rpc-probe" ] diff --git a/rpc-probe/Cargo.toml b/tools/rpc-probe/Cargo.toml similarity index 100% rename from rpc-probe/Cargo.toml rename to tools/rpc-probe/Cargo.toml diff --git a/tools/rpc-probe/Makefile.toml b/tools/rpc-probe/Makefile.toml new file mode 100644 index 000000000..f1eb9b284 --- /dev/null +++ b/tools/rpc-probe/Makefile.toml @@ -0,0 +1,39 @@ +[env] +CONTAINER_NAME = "kvstore-rpc-probe" +DOCKER_IMAGE = "informaldev/tendermint:0.34.0" +HOST_RPC_PORT = 26657 +CARGO_MAKE_WAIT_MILLISECONDS = 3500 + +[tasks.default] +clear = true +dependencies = [ "docker-up", "wait", "run", "docker-down" ] + +[tasks.run] +command = "cargo" +args = ["run"] + +[tasks.docker-down] +dependencies = [ "docker-stop", "docker-rm" ] + +[tasks.docker-up] +command = "docker" +args = ["run", "--name", "${CONTAINER_NAME}", "--rm", "--publish", "26657:${HOST_RPC_PORT}", "--detach", "${DOCKER_IMAGE}"] +dependencies = ["docker-up-stop-old", "docker-up-rm-old"] + +[tasks.docker-stop] +command = "docker" +args = ["stop", "${CONTAINER_NAME}"] +ignore_errors = true +private = true + +[tasks.docker-rm] +command = "docker" +args = ["rm", "--force", "${CONTAINER_NAME}"] +ignore_errors = true +private = true + +[tasks.docker-up-stop-old] +alias = "docker-stop" + +[tasks.docker-up-rm-old] +alias = "docker-rm" diff --git a/rpc-probe/README.md b/tools/rpc-probe/README.md similarity index 88% rename from rpc-probe/README.md rename to tools/rpc-probe/README.md index dd132d67b..c7687d7b1 100644 --- a/rpc-probe/README.md +++ b/tools/rpc-probe/README.md @@ -12,15 +12,16 @@ can be used in testing in other crates. To run this probe locally, you will need: * The Rust toolchain (latest stable) + * Additionally: `cargo-make` * Docker ## Usage (with Docker) -From the root of the tendermint.rs repository: +From the root of the tools folder: ```bash cd rpc-probe -./run-with-docker.sh +cargo make ``` This will: @@ -36,7 +37,7 @@ This will: To run a specific version of Tendermint, simply: ```bash -TENDERMINT_TAG="v0.33.8" ./run-with-docker.sh +DOCKER_IMAGE="informaldev/tendermint:v0.34.0" cargo make ``` ## Usage (without Docker) @@ -67,9 +68,9 @@ 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. +folder called `kvstore-fixtures` in the `rpc/tests` directory. -For example, the `probe-results/incoming/abci_info.json` file (returned by the +For example, the `rpc/tests/incoming/abci_info.json` file (returned by the [`abci_info`] RPC request) could look something like: ```json diff --git a/rpc-probe/src/client.rs b/tools/rpc-probe/src/client.rs similarity index 100% rename from rpc-probe/src/client.rs rename to tools/rpc-probe/src/client.rs diff --git a/rpc-probe/src/error.rs b/tools/rpc-probe/src/error.rs similarity index 100% rename from rpc-probe/src/error.rs rename to tools/rpc-probe/src/error.rs diff --git a/rpc-probe/src/kvstore.rs b/tools/rpc-probe/src/kvstore.rs similarity index 90% rename from rpc-probe/src/kvstore.rs rename to tools/rpc-probe/src/kvstore.rs index 82c4ba482..e9cad455b 100644 --- a/rpc-probe/src/kvstore.rs +++ b/tools/rpc-probe/src/kvstore.rs @@ -7,7 +7,7 @@ use crate::utils::{encode_kvpair, hex_string}; use serde_json::json; pub fn abci_info() -> PlannedInteraction { - Request::new("abci_info", json!({})).into() + Request::new("abci_info", json!(null)).into() } pub fn abci_query(key: &str) -> PlannedInteraction { @@ -72,19 +72,19 @@ pub fn commit(height: u64) -> PlannedInteraction { } pub fn consensus_state() -> PlannedInteraction { - Request::new("consensus_state", json!({})).into() + Request::new("consensus_state", json!(null)).into() } pub fn genesis() -> PlannedInteraction { - Request::new("genesis", json!({})).into() + Request::new("genesis", json!(null)).into() } pub fn net_info() -> PlannedInteraction { - Request::new("net_info", json!({})).into() + Request::new("net_info", json!(null)).into() } pub fn status() -> PlannedInteraction { - Request::new("status", json!({})).into() + Request::new("status", json!(null)).into() } pub fn subscribe(query: &str) -> PlannedInteraction { diff --git a/rpc-probe/src/main.rs b/tools/rpc-probe/src/main.rs similarity index 63% rename from rpc-probe/src/main.rs rename to tools/rpc-probe/src/main.rs index bc69fb84a..0e4973114 100644 --- a/rpc-probe/src/main.rs +++ b/tools/rpc-probe/src/main.rs @@ -11,9 +11,38 @@ use crate::quick::quick_probe_plan; use log::LevelFilter; use simple_logger::SimpleLogger; use std::path::PathBuf; +use std::str::FromStr; use structopt::StructOpt; use tokio::time::Duration; +// Set default value of `--output` to rpc crate test folder +#[derive(Debug)] +struct OutputPathBuf(pub PathBuf); +impl Default for OutputPathBuf { + fn default() -> Self { + Self( + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + .join("..") + .join("..") + .join("rpc") + .join("tests") + .join("kvstore_fixtures"), + ) + } +} +impl FromStr for OutputPathBuf { + type Err = structopt::clap::Error; + + fn from_str(s: &str) -> Result { + Ok(Self(PathBuf::from(s))) + } +} +impl ToString for OutputPathBuf { + fn to_string(&self) -> String { + self.0.to_str().unwrap_or("").to_string() + } +} + #[derive(Debug, StructOpt)] /// A utility application that primarily aims to assist in testing /// compatibility between tendermint.rs (https://github.com/informalsystems/tendermint-rs) @@ -28,8 +57,8 @@ struct Opts { pub addr: String, /// The output path in which to store the received responses. - #[structopt(default_value = "probe-results", parse(from_os_str), short, long)] - pub output: PathBuf, + #[structopt(default_value, short, long)] + pub output: OutputPathBuf, /// How long to wait between requests, in milliseconds. #[structopt(default_value = "1000", long)] @@ -50,7 +79,7 @@ async fn main() -> Result<(), Box> { }; SimpleLogger::new().with_level(log_level).init().unwrap(); - quick_probe_plan(&opts.output, Duration::from_millis(opts.request_wait))? + quick_probe_plan(&opts.output.0, Duration::from_millis(opts.request_wait))? .execute(&opts.addr) .await?; Ok(()) diff --git a/rpc-probe/src/plan.rs b/tools/rpc-probe/src/plan.rs similarity index 100% rename from rpc-probe/src/plan.rs rename to tools/rpc-probe/src/plan.rs diff --git a/rpc-probe/src/quick.rs b/tools/rpc-probe/src/quick.rs similarity index 100% rename from rpc-probe/src/quick.rs rename to tools/rpc-probe/src/quick.rs diff --git a/rpc-probe/src/request.rs b/tools/rpc-probe/src/request.rs similarity index 100% rename from rpc-probe/src/request.rs rename to tools/rpc-probe/src/request.rs diff --git a/rpc-probe/src/subscription.rs b/tools/rpc-probe/src/subscription.rs similarity index 100% rename from rpc-probe/src/subscription.rs rename to tools/rpc-probe/src/subscription.rs diff --git a/rpc-probe/src/utils.rs b/tools/rpc-probe/src/utils.rs similarity index 100% rename from rpc-probe/src/utils.rs rename to tools/rpc-probe/src/utils.rs