From 3e58bb4f204b83119db220c95b28e00754675a8d Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 6 Apr 2022 11:22:38 +0200 Subject: [PATCH 1/5] fix(bin/node): remove unsed dep jsonrpsee --- bin/node/cli/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/node/cli/Cargo.toml b/bin/node/cli/Cargo.toml index d25c1b1f0bf81..4eb5983b6488e 100644 --- a/bin/node/cli/Cargo.toml +++ b/bin/node/cli/Cargo.toml @@ -127,7 +127,6 @@ async-std = { version = "1.10.0", features = ["attributes"] } soketto = "0.4.2" criterion = { version = "0.3.5", features = ["async_tokio"] } tokio = { version = "1.17.0", features = ["macros", "time", "parking_lot"] } -jsonrpsee-ws-client = "0.4.1" wait-timeout = "0.2" remote-externalities = { path = "../../../utils/frame/remote-externalities" } pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" } From 5848388813a3475980ca410fd0f1bdee22d07156 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 6 Apr 2022 11:23:21 +0200 Subject: [PATCH 2/5] chore(remote ext): update jsonrpsee v0.10.1 --- utils/frame/remote-externalities/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/frame/remote-externalities/Cargo.toml b/utils/frame/remote-externalities/Cargo.toml index fc44c63b8acd4..343dda6892759 100644 --- a/utils/frame/remote-externalities/Cargo.toml +++ b/utils/frame/remote-externalities/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -jsonrpsee = { version = "0.8", features = ["ws-client", "macros"] } +jsonrpsee = { version = "0.10.1", features = ["ws-client", "macros"] } env_logger = "0.9" frame-support = { path = "../../../frame/support", optional = true, version = "4.0.0-dev" } From f608078f8aa07cfdad744b864871fe59e8a9cbe1 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 6 Apr 2022 11:24:30 +0200 Subject: [PATCH 3/5] chore(try runtime): update jsonrpsee v0.10.1 --- Cargo.lock | 125 +++++------------- utils/frame/try-runtime/cli/Cargo.toml | 2 +- .../cli/src/commands/follow_chain.rs | 10 +- 3 files changed, 42 insertions(+), 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd6db80272113..0a1a1e0b17bec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2803,7 +2803,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util", + "tokio-util 0.6.7", "tracing", ] @@ -3404,7 +3404,7 @@ dependencies = [ "log 0.4.14", "tokio", "tokio-stream", - "tokio-util", + "tokio-util 0.6.7", "unicase 2.6.0", ] @@ -3425,53 +3425,42 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373a33d987866ccfe1af4bc11b089dce941764313f9fd8b7cf13fcb51b72dc5" -dependencies = [ - "jsonrpsee-types 0.4.1", - "jsonrpsee-utils", - "jsonrpsee-ws-client 0.4.1", -] - -[[package]] -name = "jsonrpsee" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05fd8cd6c6b1bbd06881d2cf88f1fc83cc36c98f2219090f839115fb4a956cb9" +checksum = "91dc760c341fa81173f9a434931aaf32baad5552b0230cc6c93e8fb7eaad4c19" dependencies = [ "jsonrpsee-core", "jsonrpsee-proc-macros", - "jsonrpsee-types 0.8.0", - "jsonrpsee-ws-client 0.8.0", + "jsonrpsee-types", + "jsonrpsee-ws-client", ] [[package]] name = "jsonrpsee-client-transport" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3303cdf246e6ab76e2866fb3d9acb6c76a068b1b28bd923a1b7a8122257ad7b5" +checksum = "765f7a36d5087f74e3b3b47805c2188fef8eb54afcb587b078d9f8ebfe9c7220" dependencies = [ "futures 0.3.21", "http", "jsonrpsee-core", - "jsonrpsee-types 0.8.0", + "jsonrpsee-types", "pin-project 1.0.10", "rustls-native-certs 0.6.1", "soketto 0.7.1", "thiserror", "tokio", "tokio-rustls 0.23.2", - "tokio-util", + "tokio-util 0.7.1", "tracing", "webpki-roots 0.22.2", ] [[package]] name = "jsonrpsee-core" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f220b5a238dc7992b90f1144fbf6eaa585872c9376afe6fe6863ffead6191bf3" +checksum = "82ef77ecd20c2254d54f5da8c0738eacca61e6b6511268a8f2753e3148c6c706" dependencies = [ "anyhow", "arrayvec 0.7.1", @@ -3480,7 +3469,7 @@ dependencies = [ "futures-channel", "futures-util", "hyper 0.14.16", - "jsonrpsee-types 0.8.0", + "jsonrpsee-types", "rustc-hash", "serde", "serde_json", @@ -3492,9 +3481,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4299ebf790ea9de1cb72e73ff2ae44c723ef264299e5e2d5ef46a371eb3ac3d8" +checksum = "b7291c72805bc7d413b457e50d8ef3e87aa554da65ecbbc278abb7dfc283e7f0" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -3504,28 +3493,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f778cf245158fbd8f5d50823a2e9e4c708a40be164766bd35e9fb1d86715b2" -dependencies = [ - "anyhow", - "async-trait", - "beef", - "futures-channel", - "futures-util", - "hyper 0.14.16", - "log 0.4.14", - "serde", - "serde_json", - "soketto 0.7.1", - "thiserror", -] - -[[package]] -name = "jsonrpsee-types" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b3f601bbbe45cd63f5407b6f7d7950e08a7d4f82aa699ff41a4a5e9e54df58" +checksum = "38b6aa52f322cbf20c762407629b8300f39bcc0cf0619840d9252a2f65fd2dd9" dependencies = [ "anyhow", "beef", @@ -3535,50 +3505,15 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-utils" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0109c4f972058f3b1925b73a17210aff7b63b65967264d0045d15ee88fe84f0c" -dependencies = [ - "arrayvec 0.7.1", - "beef", - "jsonrpsee-types 0.4.1", -] - -[[package]] -name = "jsonrpsee-ws-client" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559aa56fc402af206c00fc913dc2be1d9d788dcde045d14df141a535245d35ef" -dependencies = [ - "arrayvec 0.7.1", - "async-trait", - "fnv", - "futures 0.3.21", - "http", - "jsonrpsee-types 0.4.1", - "log 0.4.14", - "pin-project 1.0.10", - "rustls-native-certs 0.5.0", - "serde", - "serde_json", - "soketto 0.7.1", - "thiserror", - "tokio", - "tokio-rustls 0.22.0", - "tokio-util", -] - [[package]] name = "jsonrpsee-ws-client" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff425cee7c779e33920913bc695447416078ee6d119f443f3060feffa4e86b5" +checksum = "dd66d18bab78d956df24dd0d2e41e4c00afbb818fda94a98264bdd12ce8506ac" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", - "jsonrpsee-types 0.8.0", + "jsonrpsee-types", ] [[package]] @@ -4891,7 +4826,6 @@ dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.21", "hex-literal", - "jsonrpsee-ws-client 0.4.1", "log 0.4.14", "nix", "node-executor", @@ -7863,7 +7797,7 @@ version = "0.10.0-dev" dependencies = [ "env_logger 0.9.0", "frame-support", - "jsonrpsee 0.8.0", + "jsonrpsee", "log 0.4.14", "pallet-elections-phragmen", "parity-scale-codec", @@ -11317,13 +11251,26 @@ checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" dependencies = [ "bytes 1.1.0", "futures-core", - "futures-io", "futures-sink", "log 0.4.14", "pin-project-lite 0.2.6", "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +dependencies = [ + "bytes 1.1.0", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite 0.2.6", + "tokio", +] + [[package]] name = "toml" version = "0.5.8" @@ -11540,7 +11487,7 @@ name = "try-runtime-cli" version = "0.10.0-dev" dependencies = [ "clap 3.1.6", - "jsonrpsee 0.4.1", + "jsonrpsee", "log 0.4.14", "parity-scale-codec", "remote-externalities", diff --git a/utils/frame/try-runtime/cli/Cargo.toml b/utils/frame/try-runtime/cli/Cargo.toml index 6f72bd3b9d7f2..3f0ee257d9756 100644 --- a/utils/frame/try-runtime/cli/Cargo.toml +++ b/utils/frame/try-runtime/cli/Cargo.toml @@ -32,4 +32,4 @@ sp-externalities = { version = "0.12.0", path = "../../../../primitives/external sp-version = { version = "5.0.0", path = "../../../../primitives/version" } remote-externalities = { version = "0.10.0-dev", path = "../../remote-externalities" } -jsonrpsee = { version = "0.4.1", default-features = false, features = ["ws-client"] } +jsonrpsee = { version = "0.10.1", default-features = false, features = ["ws-client"] } diff --git a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs index 7400813b9175e..e5a00554dfceb 100644 --- a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs +++ b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs @@ -20,7 +20,7 @@ use crate::{ state_machine_call_with_proof, SharedParams, LOG_TARGET, }; use jsonrpsee::{ - types::{traits::SubscriptionClient, Subscription}, + core::client::{SubscriptionClientT, Subscription}, ws_client::WsClientBuilder, }; use parity_scale_codec::Decode; @@ -76,12 +76,12 @@ where loop { let header = match subscription.next().await { - Ok(Some(header)) => header, - Ok(None) => { - log::warn!("subscription returned `None`. Probably decoding has failed."); + Some(Ok(header)) => header, + None => { + log::warn!("subscription closed"); break }, - Err(why) => { + Some(Err(why)) => { log::warn!("subscription returned error: {:?}.", why); continue }, From 599e7a6a49ac1f3a4fb9e48d73a7913b04b373db Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 6 Apr 2022 11:34:41 +0200 Subject: [PATCH 4/5] Update utils/frame/try-runtime/cli/src/commands/follow_chain.rs --- utils/frame/try-runtime/cli/src/commands/follow_chain.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs index e5a00554dfceb..aacb491d155ae 100644 --- a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs +++ b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs @@ -82,7 +82,7 @@ where break }, Some(Err(why)) => { - log::warn!("subscription returned error: {:?}.", why); + log::warn!("subscription returned error: {:?}. Probably decoding has failed.", why); continue }, }; From dc1a9618197a4416a2d4e3f51b764ae1de80ce70 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 6 Apr 2022 11:37:12 +0200 Subject: [PATCH 5/5] cargo fmt --- client/informant/src/display.rs | 2 +- client/network/src/config.rs | 2 +- client/network/src/lib.rs | 4 ++-- client/peerset/src/lib.rs | 4 ++-- client/peerset/src/peersstate.rs | 8 ++++---- utils/frame/try-runtime/cli/src/commands/follow_chain.rs | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/informant/src/display.rs b/client/informant/src/display.rs index 77b28dec55651..446ddf47b4cab 100644 --- a/client/informant/src/display.rs +++ b/client/informant/src/display.rs @@ -30,7 +30,7 @@ use std::{fmt, time::Instant}; /// like: /// /// > Syncing 5.4 bps, target=#531028 (4 peers), best: #90683 (0x4ca8…51b8), -/// > finalized #360 (0x6f24…a38b), ⬇ 5.5kiB/s ⬆ 0.9kiB/s +/// > finalized #360 (0x6f24…a38b), ⬇ 5.5kiB/s ⬆ 0.9kiB/s /// /// # Usage /// diff --git a/client/network/src/config.rs b/client/network/src/config.rs index 7c2dfef7fe89c..40aefe9a3ec2d 100644 --- a/client/network/src/config.rs +++ b/client/network/src/config.rs @@ -579,7 +579,7 @@ pub struct NonDefaultSetConfig { /// considered established once this protocol is open. /// /// > **Note**: This field isn't present for the default set, as this is handled internally - /// > by the networking code. + /// > by the networking code. pub notifications_protocol: Cow<'static, str>, /// If the remote reports that it doesn't support the protocol indicated in the /// `notifications_protocol` field, then each of these fallback names will be tried one by diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 27e9a7547b44f..d9f5b3de1bb10 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -103,8 +103,8 @@ //! protocol ID. //! //! > **Note**: It is possible for the same connection to be used for multiple chains. For example, -//! > one can use both the `/dot/sync/2` and `/sub/sync/2` protocols on the same -//! > connection, provided that the remote supports them. +//! > one can use both the `/dot/sync/2` and `/sub/sync/2` protocols on the same +//! > connection, provided that the remote supports them. //! //! Substrate uses the following standard libp2p protocols: //! diff --git a/client/peerset/src/lib.rs b/client/peerset/src/lib.rs index c777cfec19d25..859319fab1320 100644 --- a/client/peerset/src/lib.rs +++ b/client/peerset/src/lib.rs @@ -129,7 +129,7 @@ impl PeersetHandle { /// Has no effect if the node was already a reserved peer. /// /// > **Note**: Keep in mind that the networking has to know an address for this node, - /// > otherwise it will not be able to connect to it. + /// > otherwise it will not be able to connect to it. pub fn add_reserved_peer(&self, set_id: SetId, peer_id: PeerId) { let _ = self.tx.unbounded_send(Action::AddReservedPeer(set_id, peer_id)); } @@ -232,7 +232,7 @@ pub struct SetConfig { /// List of bootstrap nodes to initialize the set with. /// /// > **Note**: Keep in mind that the networking has to know an address for these nodes, - /// > otherwise it will not be able to connect to them. + /// > otherwise it will not be able to connect to them. pub bootnodes: Vec, /// Lists of nodes we should always be connected to. diff --git a/client/peerset/src/peersstate.rs b/client/peerset/src/peersstate.rs index 272b903c1da2b..ca22cac324088 100644 --- a/client/peerset/src/peersstate.rs +++ b/client/peerset/src/peersstate.rs @@ -25,8 +25,8 @@ //! slots. //! //! > Note: This module is purely dedicated to managing slots and reputations. Features such as -//! > for example connecting to some nodes in priority should be added outside of this -//! > module, rather than inside. +//! > for example connecting to some nodes in priority should be added outside of this +//! > module, rather than inside. use libp2p::PeerId; use log::error; @@ -50,8 +50,8 @@ pub struct PeersState { /// List of nodes that we know about. /// /// > **Note**: This list should really be ordered by decreasing reputation, so that we can - /// easily select the best node to connect to. As a first draft, however, we don't - /// sort, to make the logic easier. + /// > easily select the best node to connect to. As a first draft, however, we don't sort, to + /// > make the logic easier. nodes: HashMap, /// Configuration of each set. The size of this `Vec` is never modified. diff --git a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs index e5a00554dfceb..c7ae103882052 100644 --- a/utils/frame/try-runtime/cli/src/commands/follow_chain.rs +++ b/utils/frame/try-runtime/cli/src/commands/follow_chain.rs @@ -20,7 +20,7 @@ use crate::{ state_machine_call_with_proof, SharedParams, LOG_TARGET, }; use jsonrpsee::{ - core::client::{SubscriptionClientT, Subscription}, + core::client::{Subscription, SubscriptionClientT}, ws_client::WsClientBuilder, }; use parity_scale_codec::Decode;