rpc: bump jsonrpsee v0.22 and fix race in rpc v2 chain_head (#3230)

Close #2992 

Breaking changes:
- rpc server grafana metric `substrate_rpc_requests_started` is removed
(not possible to implement anymore)
- rpc server grafana metric `substrate_rpc_requests_finished` is removed
(not possible to implement anymore)
- rpc server ws ping/pong not ACK:ed within 30 seconds more than three
times then the connection will be closed

Added
- rpc server grafana metric `substrate_rpc_sessions_time` is added to
get the duration for each websocket session
This commit is contained in:
Niklas Adolfsson
2024-02-14 23:18:22 +01:00
committed by GitHub
parent 7e7c488ba8
commit c7c4fe0184
53 changed files with 777 additions and 468 deletions
@@ -22,5 +22,5 @@ sc-client-api = { path = "../../../substrate/client/api" }
futures = "0.3.28"
async-trait = "0.1.74"
thiserror = "1.0.48"
jsonrpsee-core = "0.20.3"
jsonrpsee-core = "0.22"
parity-scale-codec = "3.6.4"
@@ -22,7 +22,7 @@ use sc_client_api::StorageProof;
use futures::Stream;
use async_trait::async_trait;
use jsonrpsee_core::Error as JsonRpcError;
use jsonrpsee_core::ClientError as JsonRpcError;
use parity_scale_codec::Error as CodecError;
use sp_api::ApiError;
@@ -33,7 +33,7 @@ tokio-util = { version = "0.7.8", features = ["compat"] }
futures = "0.3.28"
futures-timer = "3.0.2"
parity-scale-codec = "3.6.4"
jsonrpsee = { version = "0.20.3", features = ["ws-client"] }
jsonrpsee = { version = "0.22", features = ["ws-client"] }
tracing = "0.1.37"
async-trait = "0.1.74"
url = "2.4.0"
@@ -19,12 +19,9 @@
//! we treat the light-client as a normal JsonRPC target.
use futures::{channel::mpsc::Sender, prelude::*, stream::FuturesUnordered};
use jsonrpsee::core::{
client::{
Client as JsonRpseeClient, ClientBuilder, ClientT, ReceivedMessage, TransportReceiverT,
TransportSenderT,
},
Error,
use jsonrpsee::core::client::{
Client as JsonRpseeClient, ClientBuilder, ClientT, Error, ReceivedMessage, TransportReceiverT,
TransportSenderT,
};
use smoldot_light::{ChainId, Client as SmoldotClient, JsonRpcResponses};
use std::{num::NonZeroU32, sync::Arc};
@@ -27,7 +27,7 @@ use jsonrpsee::{
core::{
client::{Client as JsonRpcClient, ClientT, Subscription},
params::ArrayParams,
Error as JsonRpseeError, JsonValue,
ClientError as JsonRpseeError, JsonValue,
},
ws_client::WsClientBuilder,
};
@@ -19,7 +19,7 @@ use futures::channel::{
oneshot::Sender as OneshotSender,
};
use jsonrpsee::{
core::{params::ArrayParams, Error as JsonRpseeError},
core::{params::ArrayParams, ClientError as JsonRpseeError},
rpc_params,
};
use serde::de::DeserializeOwned;
+1 -1
View File
@@ -18,7 +18,7 @@ clap = { version = "4.4.18", features = ["derive"] }
log = { workspace = true, default-features = true }
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.195", features = ["derive"] }
jsonrpsee = { version = "0.20.3", features = ["server"] }
jsonrpsee = { version = "0.22", features = ["server"] }
futures = "0.3.28"
serde_json = "1.0.111"
+1 -1
View File
@@ -38,7 +38,7 @@ coretime-rococo-runtime = { path = "../parachains/runtimes/coretime/coretime-roc
coretime-westend-runtime = { path = "../parachains/runtimes/coretime/coretime-westend" }
bridge-hub-westend-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-westend" }
penpal-runtime = { path = "../parachains/runtimes/testing/penpal" }
jsonrpsee = { version = "0.20.3", features = ["server"] }
jsonrpsee = { version = "0.22", features = ["server"] }
people-rococo-runtime = { path = "../parachains/runtimes/people/people-rococo" }
people-westend-runtime = { path = "../parachains/runtimes/people/people-westend" }
parachains-common = { path = "../parachains/common" }
+1 -1
View File
@@ -17,7 +17,7 @@ async-trait = "0.1.74"
clap = { version = "4.4.18", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
criterion = { version = "0.5.1", features = ["async_tokio"] }
jsonrpsee = { version = "0.20.3", features = ["server"] }
jsonrpsee = { version = "0.22", features = ["server"] }
rand = "0.8.5"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"