tests(rpc): add snapshot tests for rpc methods responses (#4352)

* add snapshot tests for rpc methods responses

* change snapshots format to json

* change snapshot file name format

* fix(rpc): fixes for RPC snapshot tests (#4384)

* Create the snapshot settings once

* Snapshot testnet state, RPCs, and transparent addresses

* Tweak header comment

* Ignore some duplicated dependencies we don't control

* fix texts

Co-authored-by: Marek <mail@marek.onl>

* Redact 1.5 kB of block data in snapshots

* Fix docs

* Explain snapshot redaction better

* Make redaction substitution consistent

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>

* Update redacted snapshots

* Make formatting consistent

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Marek <mail@marek.onl>
This commit is contained in:
Alfredo Garcia 2022-05-15 23:33:46 -03:00 committed by GitHub
parent 94ba4b46a2
commit 128c9cbfd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 768 additions and 20 deletions

165
Cargo.lock generated
View File

@ -65,7 +65,7 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877"
dependencies = [
"generic-array",
"generic-array 0.14.5",
]
[[package]]
@ -78,7 +78,7 @@ dependencies = [
"cipher",
"cpufeatures",
"ctr",
"opaque-debug",
"opaque-debug 0.3.0",
]
[[package]]
@ -534,14 +534,26 @@ dependencies = [
"syn 1.0.92",
]
[[package]]
name = "block-buffer"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
dependencies = [
"block-padding 0.1.5",
"byte-tools",
"byteorder",
"generic-array 0.12.4",
]
[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"block-padding",
"generic-array",
"block-padding 0.2.1",
"generic-array 0.14.5",
]
[[package]]
@ -550,7 +562,7 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
dependencies = [
"generic-array",
"generic-array 0.14.5",
]
[[package]]
@ -559,10 +571,19 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e"
dependencies = [
"block-padding",
"block-padding 0.2.1",
"cipher",
]
[[package]]
name = "block-padding"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [
"byte-tools",
]
[[package]]
name = "block-padding"
version = "0.2.1"
@ -615,6 +636,12 @@ version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "bytemuck"
version = "1.8.0"
@ -740,7 +767,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
dependencies = [
"generic-array",
"generic-array 0.14.5",
]
[[package]]
@ -1029,7 +1056,7 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83bd3bb4314701c568e340cd8cf78c975aa0ca79e03d3f6d1677d5b0c9c0c03"
dependencies = [
"generic-array",
"generic-array 0.14.5",
"rand_core 0.6.3",
"subtle",
]
@ -1040,7 +1067,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
dependencies = [
"generic-array",
"generic-array 0.14.5",
"typenum",
]
@ -1050,7 +1077,7 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714"
dependencies = [
"generic-array",
"generic-array 0.14.5",
"subtle",
]
@ -1278,13 +1305,22 @@ dependencies = [
"syn 1.0.92",
]
[[package]]
name = "digest"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array 0.12.4",
]
[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array",
"generic-array 0.14.5",
]
[[package]]
@ -1504,6 +1540,12 @@ dependencies = [
"once_cell",
]
[[package]]
name = "fake-simd"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "fallible-iterator"
version = "0.2.0"
@ -1713,6 +1755,15 @@ dependencies = [
"cfg-if 0.1.10",
]
[[package]]
name = "generic-array"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
[[package]]
name = "generic-array"
version = "0.14.5"
@ -2180,6 +2231,8 @@ checksum = "689960f187c43c01650c805fb6bc6f55ab944499d86d4ffe9474ad78991d8e94"
dependencies = [
"console",
"once_cell",
"pest",
"pest_derive",
"ron",
"serde",
"serde_json",
@ -2451,6 +2504,12 @@ dependencies = [
"libc",
]
[[package]]
name = "maplit"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "match_cfg"
version = "0.1.0"
@ -2841,6 +2900,12 @@ version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "opaque-debug"
version = "0.3.0"
@ -3061,6 +3126,49 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pest"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
dependencies = [
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
dependencies = [
"pest",
"pest_generator",
]
[[package]]
name = "pest_generator"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 1.0.36",
"quote 1.0.15",
"syn 1.0.92",
]
[[package]]
name = "pest_meta"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
dependencies = [
"maplit",
"pest",
"sha-1 0.8.2",
]
[[package]]
name = "petgraph"
version = "0.6.0"
@ -3232,7 +3340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede"
dependencies = [
"cpufeatures",
"opaque-debug",
"opaque-debug 0.3.0",
"universal-hash",
]
@ -4222,6 +4330,18 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "sha-1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
"opaque-debug 0.2.3",
]
[[package]]
name = "sha-1"
version = "0.9.8"
@ -4232,7 +4352,7 @@ dependencies = [
"cfg-if 1.0.0",
"cpufeatures",
"digest 0.9.0",
"opaque-debug",
"opaque-debug 0.3.0",
]
[[package]]
@ -4245,7 +4365,7 @@ dependencies = [
"cfg-if 1.0.0",
"cpufeatures",
"digest 0.9.0",
"opaque-debug",
"opaque-debug 0.3.0",
]
[[package]]
@ -4257,7 +4377,7 @@ dependencies = [
"block-buffer 0.9.0",
"digest 0.9.0",
"keccak",
"opaque-debug",
"opaque-debug 0.3.0",
]
[[package]]
@ -4825,7 +4945,7 @@ dependencies = [
"arrayref",
"bytes",
"crypto-mac",
"generic-array",
"generic-array 0.14.5",
"getrandom 0.2.5",
"signature",
"thiserror",
@ -5062,7 +5182,7 @@ dependencies = [
"rand_core 0.6.3",
"rsa",
"serde",
"sha-1",
"sha-1 0.9.8",
"sha2",
"sha3",
"signature",
@ -5146,7 +5266,7 @@ dependencies = [
"crypto-mac",
"digest 0.9.0",
"futures",
"generic-array",
"generic-array 0.14.5",
"hkdf",
"hmac",
"rand 0.8.5",
@ -5469,6 +5589,12 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "ucd-trie"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
name = "uint"
version = "0.9.1"
@ -5544,7 +5670,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05"
dependencies = [
"generic-array",
"generic-array 0.14.5",
"subtle",
]
@ -6264,6 +6390,7 @@ dependencies = [
"hex",
"hyper",
"indexmap",
"insta",
"jsonrpc-core",
"jsonrpc-derive",
"jsonrpc-http-server",

View File

@ -57,9 +57,13 @@ skip-tree = [
# wait for halo2 to upgrade
{ name = "blake2b_simd", version = "=0.5.11" },
# wait for zcash_primitives to remove duplicated dependency
# wait for zcash_primitives to remove duplicated dependencies
{ name = "block-buffer", version = "=0.7.3" },
{ name = "block-buffer", version = "=0.9.0" },
# wait for insta to remove duplicated dependencies
{ name = "sha-1", version = "=0.8.2" },
# wait for orchard -> bigint to upgrade
{ name = "crunchy", version = "=0.1.6" },

View File

@ -43,6 +43,7 @@ proptest = { version = "0.10.1", optional = true }
proptest-derive = { version = "0.3.0", optional = true }
[dev-dependencies]
insta = { version = "1.14.0", features = ["redactions"] }
proptest = "0.10.1"
proptest-derive = "0.3.0"
serde_json = "1.0.81"

View File

@ -1,4 +1,5 @@
//! Test code for RPC methods
mod prop;
mod snapshot;
mod vectors;

View File

@ -0,0 +1,240 @@
//! Snapshot tests for Zebra JSON-RPC responses.
use std::sync::Arc;
use insta::dynamic_redaction;
use zebra_chain::{
block::Block,
parameters::Network::{Mainnet, Testnet},
serialization::ZcashDeserializeInto,
};
use zebra_network::constants::USER_AGENT;
use zebra_node_services::BoxError;
use zebra_test::mock_service::MockService;
use super::super::*;
/// Snapshot test for RPC methods responses.
///
/// TODO:
/// - Add a `z_gettreestate` test when #3990 is merged.
#[tokio::test]
async fn test_rpc_response_data() {
zebra_test::init();
test_rpc_response_data_for_network(Mainnet).await;
test_rpc_response_data_for_network(Testnet).await;
}
async fn test_rpc_response_data_for_network(network: Network) {
// Create a continuous chain of mainnet and testnet blocks from genesis
let block_data = match network {
Mainnet => &*zebra_test::vectors::CONTINUOUS_MAINNET_BLOCKS,
Testnet => &*zebra_test::vectors::CONTINUOUS_TESTNET_BLOCKS,
};
let blocks: Vec<Arc<Block>> = block_data
.iter()
.map(|(_height, block_bytes)| block_bytes.zcash_deserialize_into().unwrap())
.collect();
let mut mempool: MockService<_, _, _, BoxError> = MockService::build().for_unit_tests();
// Create a populated state service
let (_state, read_state, latest_chain_tip, _chain_tip_change) =
zebra_state::populated_state(blocks.clone(), network).await;
// Init RPC
let (rpc, _rpc_tx_queue_task_handle) = RpcImpl::new(
"RPC test",
Buffer::new(mempool.clone(), 1),
read_state,
latest_chain_tip,
network,
);
// Start snapshots of RPC responses.
let mut settings = insta::Settings::clone_current();
settings.set_snapshot_suffix(format!("{}_{}", network_string(network), blocks.len() - 1));
// `getinfo`
let get_info = rpc.get_info().expect("We should have a GetInfo struct");
snapshot_rpc_getinfo(get_info, &settings);
// `getblockchaininfo`
let get_blockchain_info = rpc
.get_blockchain_info()
.expect("We should have a GetBlockChainInfo struct");
snapshot_rpc_getblockchaininfo(get_blockchain_info, &settings);
// get the first transaction of the first block which is not the genesis
let first_block_first_transaction = &blocks[1].transactions[0];
// build addresses
let address = &first_block_first_transaction.outputs()[1]
.address(network)
.unwrap();
let addresses = vec![address.to_string()];
// `getaddressbalance`
let get_address_balance = rpc
.get_address_balance(AddressStrings {
addresses: addresses.clone(),
})
.await
.expect("We should have an AddressBalance struct");
snapshot_rpc_getaddressbalance(get_address_balance, &settings);
// `getblock`
const BLOCK_HEIGHT: u32 = 1;
let get_block = rpc
.get_block(BLOCK_HEIGHT.to_string(), 0u8)
.await
.expect("We should have a GetBlock struct");
snapshot_rpc_getblock(get_block, block_data.get(&BLOCK_HEIGHT).unwrap(), &settings);
// `getbestblockhash`
let get_best_block_hash = rpc
.get_best_block_hash()
.expect("We should have a GetBestBlockHash struct");
snapshot_rpc_getbestblockhash(get_best_block_hash, &settings);
// `getrawmempool`
//
// - a request to get all mempool transactions will be made by `getrawmempool` behind the scenes.
// - as we have the mempool mocked we need to expect a request and wait for a response,
// which will be an empty mempool in this case.
let mempool_req = mempool
.expect_request_that(|_request| true)
.map(|responder| {
responder.respond(mempool::Response::TransactionIds(
std::collections::HashSet::new(),
));
});
// make the api call
let get_raw_mempool = rpc.get_raw_mempool();
let (response, _) = futures::join!(get_raw_mempool, mempool_req);
let get_raw_mempool = response.expect("We should have a GetRawTransaction struct");
snapshot_rpc_getrawmempool(get_raw_mempool, &settings);
// `getrawtransaction`
//
// - similar to `getrawmempool` described above, a mempool request will be made to get the requested
// transaction from the mempoo, response will be empty as we have this transaction in state
let mempool_req = mempool
.expect_request_that(|_request| true)
.map(|responder| {
responder.respond(mempool::Response::Transactions(vec![]));
});
// make the api call
let get_raw_transaction =
rpc.get_raw_transaction(first_block_first_transaction.hash().encode_hex(), 0u8);
let (response, _) = futures::join!(get_raw_transaction, mempool_req);
let get_raw_transaction = response.expect("We should have a GetRawTransaction struct");
snapshot_rpc_getrawtransaction(get_raw_transaction, &settings);
// `getaddresstxids`
let get_address_tx_ids = rpc
.get_address_tx_ids(GetAddressTxIdsRequest {
addresses: addresses.clone(),
start: 1,
end: 10,
})
.await
.expect("We should have a vector of strings");
snapshot_rpc_getaddresstxids(get_address_tx_ids, &settings);
// `getaddressutxos`
let get_address_utxos = rpc
.get_address_utxos(AddressStrings { addresses })
.await
.expect("We should have a vector of strings");
snapshot_rpc_getaddressutxos(get_address_utxos, &settings);
}
/// Snapshot `getinfo` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getinfo(info: GetInfo, settings: &insta::Settings) {
settings.bind(|| {
insta::assert_json_snapshot!("get_info", info, {
".subversion" => dynamic_redaction(|value, _path| {
// assert that the subversion value is user agent
assert_eq!(value.as_str().unwrap(), USER_AGENT);
// replace with:
"[SubVersion]"
}),
})
});
}
/// Snapshot `getblockchaininfo` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getblockchaininfo(info: GetBlockChainInfo, settings: &insta::Settings) {
settings.bind(|| {
insta::assert_json_snapshot!("get_blockchain_info", info, {
".estimatedheight" => dynamic_redaction(|value, _path| {
// assert that the value looks like a valid height here
assert!(u32::try_from(value.as_u64().unwrap()).unwrap() < Height::MAX_AS_U32);
// replace with:
"[Height]"
}),
})
});
}
/// Snapshot `getaddressbalance` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getaddressbalance(address_balance: AddressBalance, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_address_balance", address_balance));
}
/// Check `getblock` response, using `cargo insta`, JSON serialization, and block test vectors.
///
/// The snapshot file does not contain any data, but it does enforce the response format.
fn snapshot_rpc_getblock(block: GetBlock, block_data: &[u8], settings: &insta::Settings) {
let block_data = hex::encode(block_data);
settings.bind(|| {
insta::assert_json_snapshot!("get_block", block, {
"." => dynamic_redaction(move |value, _path| {
// assert that the block data matches, without creating a 1.5 kB snapshot file
assert_eq!(value.as_str().unwrap(), block_data);
// replace with:
"[BlockData]"
}),
})
});
}
/// Snapshot `getbestblockhash` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getbestblockhash(tip_hash: GetBestBlockHash, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_best_block_hash", tip_hash));
}
/// Snapshot `getrawmempool` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getrawmempool(raw_mempool: Vec<String>, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_raw_mempool", raw_mempool));
}
/// Snapshot `getrawtransaction` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getrawtransaction(raw_transaction: GetRawTransaction, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_raw_transaction", raw_transaction));
}
/// Snapshot `getaddressbalance` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getaddresstxids(transactions: Vec<String>, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_address_tx_ids", transactions));
}
/// Snapshot `getaddressutxos` response, using `cargo insta` and JSON serialization.
fn snapshot_rpc_getaddressutxos(utxos: Vec<GetAddressUtxos>, settings: &insta::Settings) {
settings.bind(|| insta::assert_json_snapshot!("get_address_utxos", utxos));
}
/// Utility function to convert a `Network` to a lowercase string.
fn network_string(network: Network) -> String {
let mut net_suffix = network.to_string();
net_suffix.make_ascii_lowercase();
net_suffix
}

View File

@ -0,0 +1,8 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 192
expression: address_balance
---
{
"balance": 687500
}

View File

@ -0,0 +1,8 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 192
expression: address_balance
---
{
"balance": 687500
}

View File

@ -0,0 +1,17 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 227
expression: transactions
---
[
"851bf6fbf7a976327817c738c489d7fa657752445430922d94c983c0b9ed4609",
"8974d08d1c5f9c860d8b629d582a56659a4a1dcb2b5f98a25a5afcc2a784b0f4",
"4e3670eae21d0c7225716abacb3a95c203a75d7601594afddb07d175c3babe83",
"781bb9b0168831054c1ed3afd8bf153f3fc848e102cea86977545c86f6e2446e",
"9a4adaf3953818eb1634407032db0e00ef2441c49c1364161411d0743ec1a939",
"1dd2064423542cfee7ca4ec565acb37e1ad217035b6119668352165b20006fe1",
"26b813b0743f015e6b41519d4ca78ee7b5c76cbac5c8b8ac0ec6b9cf88b8328d",
"7a772e6fe8e6bbfc34f0a61ba472d9f9dfe3a5539adfdac2f3c6ae659d44de03",
"ff24ab621bf3e46ad195b47dca7f11fb376f53e23b2e14a6e9b6a1907cc27cdc",
"5f2702708af1d8727ad3f0da3ba74de14019232499c0324ddce236cf97e32548"
]

View File

@ -0,0 +1,17 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 227
expression: transactions
---
[
"f37e9f691fffb635de0999491d906ee85ba40cd36dae9f6e5911a8277d7c5f75",
"5822c0532da8a008259ac39933d3210e508c17e3ba21d2b2c428785efdccb3d5",
"4a3bf3f814a3aef93423890c8afa9709229aaf3daf4da98c70d810253d3b9550",
"3373ed6deb1130f310d8788db5dfdb92e52980b34ca02ea124ced11aa247f80b",
"476480f7c2580a9e39b9d78892fea996c389e6627c8962700563c19b68cc7bee",
"23daf8408d825feb09dfeaaceccf1307ed1008265c7145573374872b332c57ab",
"47aebd007159819c19519a31bb87b8b40b9b09701fcc0e40bc61c98d283117f2",
"29f8982be208c9d8737200f0ecfd3f42c175b7dd67a0aba85812283fc443a443",
"9eec40dcf5f72aa0619472cbc3c336229fce2ff983b47ebccc7bf8800759781c",
"3887181b326c25e1ea1b6885c9b437280ca3372dc5b67af72423c88c18a1da2e"
]

View File

@ -0,0 +1,87 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 234
expression: utxos
---
[
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "851bf6fbf7a976327817c738c489d7fa657752445430922d94c983c0b9ed4609",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 12500,
"height": 1
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "8974d08d1c5f9c860d8b629d582a56659a4a1dcb2b5f98a25a5afcc2a784b0f4",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 25000,
"height": 2
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "4e3670eae21d0c7225716abacb3a95c203a75d7601594afddb07d175c3babe83",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 37500,
"height": 3
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "781bb9b0168831054c1ed3afd8bf153f3fc848e102cea86977545c86f6e2446e",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 50000,
"height": 4
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "9a4adaf3953818eb1634407032db0e00ef2441c49c1364161411d0743ec1a939",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 62500,
"height": 5
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "1dd2064423542cfee7ca4ec565acb37e1ad217035b6119668352165b20006fe1",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 75000,
"height": 6
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "26b813b0743f015e6b41519d4ca78ee7b5c76cbac5c8b8ac0ec6b9cf88b8328d",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 87500,
"height": 7
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "7a772e6fe8e6bbfc34f0a61ba472d9f9dfe3a5539adfdac2f3c6ae659d44de03",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 100000,
"height": 8
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "ff24ab621bf3e46ad195b47dca7f11fb376f53e23b2e14a6e9b6a1907cc27cdc",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 112500,
"height": 9
},
{
"address": "t3Vz22vK5z2LcKEdg16Yv4FFneEL1zg9ojd",
"txid": "5f2702708af1d8727ad3f0da3ba74de14019232499c0324ddce236cf97e32548",
"outputIndex": 1,
"script": "a9147d46a730d31f97b1930d3368a967c309bd4d136a87",
"satoshis": 125000,
"height": 10
}
]

View File

@ -0,0 +1,86 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
expression: utxos
---
[
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "f37e9f691fffb635de0999491d906ee85ba40cd36dae9f6e5911a8277d7c5f75",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 12500,
"height": 1
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "5822c0532da8a008259ac39933d3210e508c17e3ba21d2b2c428785efdccb3d5",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 25000,
"height": 2
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "4a3bf3f814a3aef93423890c8afa9709229aaf3daf4da98c70d810253d3b9550",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 37500,
"height": 3
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "3373ed6deb1130f310d8788db5dfdb92e52980b34ca02ea124ced11aa247f80b",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 50000,
"height": 4
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "476480f7c2580a9e39b9d78892fea996c389e6627c8962700563c19b68cc7bee",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 62500,
"height": 5
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "23daf8408d825feb09dfeaaceccf1307ed1008265c7145573374872b332c57ab",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 75000,
"height": 6
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "47aebd007159819c19519a31bb87b8b40b9b09701fcc0e40bc61c98d283117f2",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 87500,
"height": 7
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "29f8982be208c9d8737200f0ecfd3f42c175b7dd67a0aba85812283fc443a443",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 100000,
"height": 8
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "9eec40dcf5f72aa0619472cbc3c336229fce2ff983b47ebccc7bf8800759781c",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 112500,
"height": 9
},
{
"address": "t2UNzUUx8mWBCRYPRezvA363EYXyEpHokyi",
"txid": "3887181b326c25e1ea1b6885c9b437280ca3372dc5b67af72423c88c18a1da2e",
"outputIndex": 1,
"script": "a914ef775f1f997f122a062fff1a2d7443abd1f9c64287",
"satoshis": 125000,
"height": 10
}
]

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 206
expression: tip_hash
---
"00074c46a4aa8172df8ae2ad1848a2e084e1b6989b7d9e6132adc938bf835b36"

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 206
expression: tip_hash
---
"079f4c752729be63e6341ee9bce42fbbe37236aba22e3deb82405f3c2805c112"

View File

@ -0,0 +1,5 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
expression: block
---
"[BlockData]"

View File

@ -0,0 +1,5 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
expression: block
---
"[BlockData]"

View File

@ -0,0 +1,42 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 177
expression: info
---
{
"chain": "main",
"blocks": 10,
"bestblockhash": "00074c46a4aa8172df8ae2ad1848a2e084e1b6989b7d9e6132adc938bf835b36",
"estimatedheight": "[Height]",
"upgrades": {
"5ba81b19": {
"name": "Overwinter",
"activationheight": 347500,
"status": "pending"
},
"76b809bb": {
"name": "Sapling",
"activationheight": 419200,
"status": "pending"
},
"2bb40e60": {
"name": "Blossom",
"activationheight": 653600,
"status": "pending"
},
"f5b9230b": {
"name": "Heartwood",
"activationheight": 903000,
"status": "pending"
},
"e9ff75a6": {
"name": "Canopy",
"activationheight": 1046400,
"status": "pending"
}
},
"consensus": {
"chaintip": "00000000",
"nextblock": "00000000"
}
}

View File

@ -0,0 +1,46 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
expression: info
---
{
"chain": "test",
"blocks": 10,
"bestblockhash": "079f4c752729be63e6341ee9bce42fbbe37236aba22e3deb82405f3c2805c112",
"estimatedheight": "[Height]",
"upgrades": {
"5ba81b19": {
"name": "Overwinter",
"activationheight": 207500,
"status": "pending"
},
"76b809bb": {
"name": "Sapling",
"activationheight": 280000,
"status": "pending"
},
"2bb40e60": {
"name": "Blossom",
"activationheight": 584000,
"status": "pending"
},
"f5b9230b": {
"name": "Heartwood",
"activationheight": 903800,
"status": "pending"
},
"e9ff75a6": {
"name": "Canopy",
"activationheight": 1028500,
"status": "pending"
},
"c2d6d0b4": {
"name": "Nu5",
"activationheight": 1842420,
"status": "pending"
}
},
"consensus": {
"chaintip": "00000000",
"nextblock": "00000000"
}
}

View File

@ -0,0 +1,9 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 161
expression: info
---
{
"build": "vRPC test",
"subversion": "[SubVersion]"
}

View File

@ -0,0 +1,9 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 161
expression: info
---
{
"build": "vRPC test",
"subversion": "[SubVersion]"
}

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 213
expression: raw_mempool
---
[]

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 213
expression: raw_mempool
---
[]

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 220
expression: raw_transaction
---
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff025100ffffffff0250c30000000000002321027a46eb513588b01b37ea24303f4b628afd12cc20df789fede0921e43cad3e875acd43000000000000017a9147d46a730d31f97b1930d3368a967c309bd4d136a8700000000"

View File

@ -0,0 +1,6 @@
---
source: zebra-rpc/src/methods/tests/snapshot.rs
assertion_line: 220
expression: raw_transaction
---
"01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0250c30000000000002321025229e1240a21004cf8338db05679fa34753706e84f6aebba086ba04317fd8f99acd43000000000000017a914ef775f1f997f122a062fff1a2d7443abd1f9c6428700000000"