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
+4 -7
View File
@@ -21,10 +21,7 @@ use super::*;
use crate::testing::{test_executor, timeout_secs};
use assert_matches::assert_matches;
use codec::Encode;
use jsonrpsee::{
core::{EmptyServerParams as EmptyParams, Error as RpcError},
RpcModule,
};
use jsonrpsee::{core::EmptyServerParams as EmptyParams, MethodsError as RpcError, RpcModule};
use sc_transaction_pool::{BasicPool, FullChainApi};
use sc_transaction_pool_api::TransactionStatus;
use sp_core::{
@@ -103,7 +100,7 @@ async fn author_submit_transaction_should_not_cause_error() {
assert_matches!(
api.call::<_, H256>("author_submitExtrinsic", [xt]).await,
Err(RpcError::Call(err)) if err.message().contains("Already Imported") && err.code() == 1013
Err(RpcError::JsonRpc(err)) if err.message().contains("Already Imported") && err.code() == 1013
);
}
@@ -160,7 +157,7 @@ async fn author_should_return_watch_validation_error() {
assert_matches!(
failed_sub,
Err(RpcError::Call(err)) if err.message().contains("Invalid Transaction") && err.code() == 1010
Err(RpcError::JsonRpc(err)) if err.message().contains("Invalid Transaction") && err.code() == 1010
);
}
@@ -276,7 +273,7 @@ async fn author_has_session_keys() {
assert_matches!(
api.call::<_, bool>("author_hasSessionKeys", vec![Bytes::from(vec![1, 2, 3])]).await,
Err(RpcError::Call(err)) if err.message().contains("Session keys are not encoded correctly")
Err(RpcError::JsonRpc(err)) if err.message().contains("Session keys are not encoded correctly")
);
}