From cbc2f81507657f4a87b085687d083d3502fc9f50 Mon Sep 17 00:00:00 2001 From: Marek Date: Mon, 15 Jan 2024 19:27:21 +0100 Subject: [PATCH 1/2] Fix fetching the RPC tx fetching (#8157) We recently updated the `jsonrpc` dependency from 0.16 to 0.17. The former version used to implicitly send an array of params, even if a single param was passed to the request builder. The new version doesn't do that anymore, but Zebra expects an array, so this commit explicitly passes an array consisting of a single param to the request builder. --- .../src/bin/scanning-results-reader/main.rs | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/zebra-utils/src/bin/scanning-results-reader/main.rs b/zebra-utils/src/bin/scanning-results-reader/main.rs index 5e84978d595..b12892b7b9f 100644 --- a/zebra-utils/src/bin/scanning-results-reader/main.rs +++ b/zebra-utils/src/bin/scanning-results-reader/main.rs @@ -11,7 +11,6 @@ use hex::ToHex; use itertools::Itertools; use jsonrpc::simple_http::SimpleHttpTransport; use jsonrpc::Client; -use serde_json::value::RawValue; use zcash_client_backend::decrypt_transaction; use zcash_client_backend::keys::UnifiedFullViewingKey; @@ -65,7 +64,7 @@ pub fn main() { for txid in txids.iter() { let tx = Transaction::read( - &hex::decode(&get_tx_via_rpc(txid.encode_hex())) + &hex::decode(&fetch_tx_via_rpc(txid.encode_hex())) .expect("RPC response should be decodable from hex string to bytes")[..], BranchId::for_height(&network, height), ) @@ -98,21 +97,17 @@ fn memo_bytes_to_string(memo: &[u8; 512]) -> String { } /// Uses the `getrawtransaction` RPC to retrieve a transaction by its TXID. -fn get_tx_via_rpc(txid: String) -> String { - // Wrap the TXID with `"` so that [`RawValue::from_string`] eats it. - let txid = format!("\"{}\"", txid); - let transport = SimpleHttpTransport::builder() - .url("127.0.0.1:8232") - .expect("URL should be valid") - .build(); - let client = Client::with_transport(transport); - let params = RawValue::from_string(txid).expect("Provided TXID should be a valid JSON"); - let request = client.build_request("getrawtransaction", Some(¶ms)); - let response = client - .send_request(request) - .expect("Sending the `getrawtransaction` request should succeed"); +fn fetch_tx_via_rpc(txid: String) -> String { + let client = Client::with_transport( + SimpleHttpTransport::builder() + .url("127.0.0.1:8232") + .expect("Zebra's URL should be valid") + .build(), + ); - response + client + .send_request(client.build_request("getrawtransaction", Some(&jsonrpc::arg([txid])))) + .expect("Sending the `getrawtransaction` request should succeed") .result() .expect("Zebra's RPC response should contain a valid result") } From e7e3970bfd910827399ace72375f8b873873afa8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:27:00 +0000 Subject: [PATCH 2/2] build(deps): bump the prod group with 3 updates (#8158) Bumps the prod group with 3 updates: [clap](https://github.com/clap-rs/clap), [vergen](https://github.com/rustyhorde/vergen) and [zcash_address](https://github.com/zcash/librustzcash). Updates `clap` from 4.4.14 to 4.4.16 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/v4.4.14...v4.4.16) Updates `vergen` from 8.2.6 to 8.2.10 - [Release notes](https://github.com/rustyhorde/vergen/releases) - [Commits](https://github.com/rustyhorde/vergen/compare/8.2.6...8.2.10) Updates `zcash_address` from 0.3.0 to 0.3.1 - [Release notes](https://github.com/zcash/librustzcash/releases) - [Commits](https://github.com/zcash/librustzcash/compare/zcash_address-0.3.0...zcash_address-0.3.1) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod - dependency-name: vergen dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod - dependency-name: zcash_address dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prod ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Marek --- Cargo.lock | 60 +++++++++++++++++++++++++++++++++--------- zebra-chain/Cargo.toml | 2 +- zebra-rpc/Cargo.toml | 2 +- zebrad/Cargo.toml | 4 +-- 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 63d018c0ac5..4bc685c138d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,7 +12,7 @@ dependencies = [ "arc-swap", "backtrace", "canonical-path", - "clap 4.4.14", + "clap 4.4.16", "color-eyre", "fs-err", "once_cell", @@ -137,9 +137,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" dependencies = [ "anstyle", "anstyle-parse", @@ -611,12 +611,44 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + [[package]] name = "canonical-path" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e9e01327e6c86e92ec72b1c798d4a94810f147209bbe3ffab6a86954937a6f" +[[package]] +name = "cargo-platform" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.21", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cast" version = "0.3.0" @@ -766,9 +798,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.14" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e92c5c1a78c62968ec57dbc2440366a2d6e5a23faf829970ff1585dc6b18e2" +checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" dependencies = [ "clap_builder", "clap_derive", @@ -776,9 +808,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.14" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4323769dc8a61e2c39ad7dc26f6f2800524691a44d74fe3d1071a5c24db6370" +checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" dependencies = [ "anstream", "anstyle", @@ -953,7 +985,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.4.14", + "clap 4.4.16", "criterion-plot", "is-terminal", "itertools 0.10.5", @@ -5051,12 +5083,14 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "vergen" -version = "8.2.6" +version = "8.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1290fd64cc4e7d3c9b07d7f333ce0ce0007253e32870e632624835cc80b83939" +checksum = "1a78365c3f8ca9dc5428a9f5c6349558c3f9f3eeb65e3fc00b6a981379462947" dependencies = [ "anyhow", + "cargo_metadata", "git2", + "regex", "rustc_version 0.4.0", "rustversion", "time", @@ -5553,9 +5587,9 @@ dependencies = [ [[package]] name = "zcash_address" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8944af5c206cf2e37020ad54618e1825501b98548d35a638b73e0ec5762df8d5" +checksum = "bce173f1d9ed4f806e310bc3a873301531e7a6dc209928584d6404e3f8228ef4" dependencies = [ "bech32", "bs58", @@ -6062,7 +6096,7 @@ dependencies = [ "abscissa_core", "atty", "chrono", - "clap 4.4.14", + "clap 4.4.16", "color-eyre", "console-subscriber", "dirs", diff --git a/zebra-chain/Cargo.toml b/zebra-chain/Cargo.toml index 318c91dec63..cf114e15f3a 100644 --- a/zebra-chain/Cargo.toml +++ b/zebra-chain/Cargo.toml @@ -139,7 +139,7 @@ serde_json = { version = "1.0.111", optional = true } tokio = { version = "1.35.1", optional = true } # Experimental feature getblocktemplate-rpcs -zcash_address = { version = "0.3.0", optional = true } +zcash_address = { version = "0.3.1", optional = true } # Optional testing dependencies proptest = { version = "1.4.0", optional = true } diff --git a/zebra-rpc/Cargo.toml b/zebra-rpc/Cargo.toml index f233d7afc15..f15b183d3f1 100644 --- a/zebra-rpc/Cargo.toml +++ b/zebra-rpc/Cargo.toml @@ -67,7 +67,7 @@ serde = { version = "1.0.193", features = ["serde_derive"] } # Experimental feature getblocktemplate-rpcs rand = { version = "0.8.5", optional = true } # ECC deps used by getblocktemplate-rpcs feature -zcash_address = { version = "0.3.0", optional = true } +zcash_address = { version = "0.3.1", optional = true } # Test-only feature proptest-impl proptest = { version = "1.4.0", optional = true } diff --git a/zebrad/Cargo.toml b/zebrad/Cargo.toml index 1f2aa64b756..a0723027784 100644 --- a/zebrad/Cargo.toml +++ b/zebrad/Cargo.toml @@ -172,7 +172,7 @@ zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.1", optional = tru zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.32", optional = true } abscissa_core = "0.7.0" -clap = { version = "4.4.14", features = ["cargo"] } +clap = { version = "4.4.16", features = ["cargo"] } chrono = { version = "0.4.31", default-features = false, features = ["clock", "std"] } humantime-serde = "1.1.1" indexmap = "2.0.1" @@ -246,7 +246,7 @@ proptest-derive = { version = "0.4.0", optional = true } console-subscriber = { version = "0.2.0", optional = true } [build-dependencies] -vergen = { version = "8.2.6", default-features = false, features = ["cargo", "git", "git2", "rustc"] } +vergen = { version = "8.2.10", default-features = false, features = ["cargo", "git", "git2", "rustc"] } # test feature lightwalletd-grpc-tests tonic-build = { version = "0.10.2", optional = true }