From f5da2ecbeb7da3a598e6d2e26722de91d2c056c5 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 13 Jul 2021 22:01:36 +0200 Subject: [PATCH] Upgrade remote-externalities to use jsonrpsee v0.3 (#9342) --- substrate/Cargo.lock | 77 +++++++++++++++---- .../frame/remote-externalities/Cargo.toml | 4 +- .../frame/remote-externalities/src/lib.rs | 4 +- .../frame/remote-externalities/src/rpc_api.rs | 9 ++- 4 files changed, 76 insertions(+), 18 deletions(-) diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 8acb97b85b..b552ac3f92 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -445,6 +445,19 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "bae" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec107f431ee3d8a8e45e6dd117adab769556ef463959e77bf6a4888d5fd500cf" +dependencies = [ + "heck", + "proc-macro-error 0.4.12", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "base-x" version = "0.2.8" @@ -2981,11 +2994,12 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c85cfa6767333f3e5f3b2f2f765dad2727b0033ee270ae07c599bf43ed5ae" +checksum = "f37924e16300e249a52a22cabb5632f846dc9760b39355f5e8bc70cd23dc6300" dependencies = [ "Inflector", + "bae", "proc-macro-crate 1.0.0", "proc-macro2", "quote", @@ -2994,9 +3008,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cf7bd4e93b3b56e59131de7f24afbea871faf914e97bcdd942c86927ab0172" +checksum = "d67724d368c59e08b557a516cf8fcc51100e7a708850f502e1044b151fe89788" dependencies = [ "async-trait", "beef", @@ -3006,15 +3020,15 @@ dependencies = [ "log", "serde", "serde_json", - "soketto 0.5.0", + "soketto 0.6.0", "thiserror", ] [[package]] name = "jsonrpsee-ws-client" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ec51150965544e1a4468f372bdab8545243a1b045d4ab272023aac74c60de32" +checksum = "8e2834b6e7f57ce9a4412ed4d6dc95125d2c8612e68f86b9d9a07369164e4198" dependencies = [ "async-trait", "fnv", @@ -3026,7 +3040,7 @@ dependencies = [ "rustls-native-certs 0.5.0", "serde", "serde_json", - "soketto 0.5.0", + "soketto 0.6.0", "thiserror", "tokio 0.2.25", "tokio-rustls 0.15.0", @@ -3991,7 +4005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85ee3c48cb9d9b275ad967a0e96715badc13c6029adb92f34fa17b9ff28fd81f" dependencies = [ "proc-macro-crate 0.1.5", - "proc-macro-error", + "proc-macro-error 1.0.4", "proc-macro2", "quote", "syn", @@ -6279,19 +6293,45 @@ dependencies = [ "toml", ] +[[package]] +name = "proc-macro-error" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +dependencies = [ + "proc-macro-error-attr 0.4.12", + "proc-macro2", + "quote", + "syn", + "version_check", +] + [[package]] name = "proc-macro-error" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ - "proc-macro-error-attr", + "proc-macro-error-attr 1.0.4", "proc-macro2", "quote", "syn", "version_check", ] +[[package]] +name = "proc-macro-error-attr" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "syn-mid", + "version_check", +] + [[package]] name = "proc-macro-error-attr" version = "1.0.4" @@ -8626,9 +8666,9 @@ dependencies = [ [[package]] name = "soketto" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4919971d141dbadaa0e82b5d369e2d7666c98e4625046140615ca363e50d4daa" +checksum = "a74e48087dbeed4833785c2f3352b59140095dc192dce966a3bfc155020a439f" dependencies = [ "base64 0.13.0", "bytes 1.0.1", @@ -9522,7 +9562,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" dependencies = [ "heck", - "proc-macro-error", + "proc-macro-error 1.0.4", "proc-macro2", "quote", "syn", @@ -9842,6 +9882,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn-mid" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa8e7560a164edb1621a55d18a0c59abf49d360f47aa7b821061dd7eea7fac9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "synstructure" version = "0.12.4" diff --git a/substrate/utils/frame/remote-externalities/Cargo.toml b/substrate/utils/frame/remote-externalities/Cargo.toml index 392eccf64b..705ba2ed02 100644 --- a/substrate/utils/frame/remote-externalities/Cargo.toml +++ b/substrate/utils/frame/remote-externalities/Cargo.toml @@ -13,8 +13,8 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee-ws-client = { version = "0.2.0", default-features = false, features = ["tokio02"] } -jsonrpsee-proc-macros = "0.2.0" +jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = ["tokio02"] } +jsonrpsee-proc-macros = "0.3.0" hex = "0.4.0" env_logger = "0.8.2" diff --git a/substrate/utils/frame/remote-externalities/src/lib.rs b/substrate/utils/frame/remote-externalities/src/lib.rs index 4b6738f3b9..4c1aeccf50 100644 --- a/substrate/utils/frame/remote-externalities/src/lib.rs +++ b/substrate/utils/frame/remote-externalities/src/lib.rs @@ -34,7 +34,7 @@ use sp_core::{ use codec::{Encode, Decode}; use sp_runtime::traits::Block as BlockT; use jsonrpsee_ws_client::{ - WsClientBuilder, WsClient, v2::params::JsonRpcParams, + WsClientBuilder, WsClient, types::v2::params::JsonRpcParams, }; pub mod rpc_api; @@ -275,7 +275,7 @@ impl Builder { prefix: StorageKey, at: B::Hash, ) -> Result, &'static str> { - use jsonrpsee_ws_client::traits::Client; + use jsonrpsee_ws_client::types::traits::Client; use serde_json::to_value; let keys = self.get_keys_paged(prefix, at).await?; let keys_count = keys.len(); diff --git a/substrate/utils/frame/remote-externalities/src/rpc_api.rs b/substrate/utils/frame/remote-externalities/src/rpc_api.rs index 6773bfd54b..59d6bba8dd 100644 --- a/substrate/utils/frame/remote-externalities/src/rpc_api.rs +++ b/substrate/utils/frame/remote-externalities/src/rpc_api.rs @@ -19,7 +19,14 @@ // TODO: Consolidate one off RPC calls https://github.com/paritytech/substrate/issues/8988 use sp_runtime::{generic::SignedBlock, traits::{Block as BlockT, Header as HeaderT}}; -use jsonrpsee_ws_client::{WsClientBuilder, WsClient, v2::params::JsonRpcParams, traits::Client}; +use jsonrpsee_ws_client::{ + WsClientBuilder, + WsClient, + types::{ + v2::params::JsonRpcParams, + traits::Client + }, +}; /// Get the header of the block identified by `at` pub async fn get_header(from: S, at: Block::Hash) -> Result