mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 10:47:55 +00:00
Upgrade jsonrpsee to v0.3 (#1051)
* Upgrade `jsonrpsee` to v0.3 * whitespace * fmt Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
This commit is contained in:
@@ -307,8 +307,9 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
match i {
|
||||
2..=10 =>
|
||||
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))], "At {}", i,),
|
||||
2..=10 => {
|
||||
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))], "At {}", i,)
|
||||
},
|
||||
_ => assert_eq!(finalized_blocks, vec![], "At {}", i),
|
||||
}
|
||||
latest_block_id = rolling_last_block_id;
|
||||
|
||||
@@ -106,12 +106,13 @@ async fn prepare_initial_header(
|
||||
sub_initial_header: Option<Vec<u8>>,
|
||||
) -> Result<(RialtoHeaderId, Vec<u8>), String> {
|
||||
match sub_initial_header {
|
||||
Some(raw_initial_header) =>
|
||||
Some(raw_initial_header) => {
|
||||
match rialto_runtime::Header::decode(&mut &raw_initial_header[..]) {
|
||||
Ok(initial_header) =>
|
||||
Ok((HeaderId(initial_header.number, initial_header.hash()), raw_initial_header)),
|
||||
Err(error) => Err(format!("Error decoding initial header: {}", error)),
|
||||
},
|
||||
}
|
||||
},
|
||||
None => {
|
||||
let initial_header = sub_client.header_by_number(Zero::zero()).await;
|
||||
initial_header
|
||||
|
||||
@@ -10,8 +10,8 @@ async-std = "1.6.5"
|
||||
bp-eth-poa = { path = "../../primitives/ethereum-poa" }
|
||||
headers-relay = { path = "../headers" }
|
||||
hex-literal = "0.3"
|
||||
jsonrpsee-proc-macros = "0.2"
|
||||
jsonrpsee-ws-client = "0.2"
|
||||
jsonrpsee-proc-macros = "0.3.1"
|
||||
jsonrpsee-ws-client = "0.3.1"
|
||||
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] }
|
||||
log = "0.4.11"
|
||||
relay-utils = { path = "../utils" }
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::types::U256;
|
||||
|
||||
use jsonrpsee_ws_client::Error as RpcError;
|
||||
use jsonrpsee_ws_client::types::Error as RpcError;
|
||||
use relay_utils::MaybeConnectionError;
|
||||
|
||||
/// Result type used by Ethereum client.
|
||||
@@ -73,10 +73,12 @@ impl MaybeConnectionError for Error {
|
||||
fn is_connection_error(&self) -> bool {
|
||||
matches!(
|
||||
*self,
|
||||
Error::RpcError(RpcError::Transport(_)) |
|
||||
Error::RpcError(RpcError::Internal(_)) |
|
||||
Error::RpcError(RpcError::RestartNeeded(_)) |
|
||||
Error::ClientNotSynced(_),
|
||||
Error::RpcError(RpcError::Transport(_))
|
||||
// right now if connection to the ws server is dropped (after it is already established),
|
||||
// we're getting this error
|
||||
| Error::RpcError(RpcError::Internal(_))
|
||||
| Error::RpcError(RpcError::RestartNeeded(_))
|
||||
| Error::ClientNotSynced(_),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
|
||||
async-std = { version = "1.6.5", features = ["attributes"] }
|
||||
async-trait = "0.1.40"
|
||||
codec = { package = "parity-scale-codec", version = "2.2.0" }
|
||||
jsonrpsee-proc-macros = "0.2"
|
||||
jsonrpsee-types = "0.2"
|
||||
jsonrpsee-ws-client = "0.2"
|
||||
jsonrpsee-proc-macros = "0.3.1"
|
||||
jsonrpsee-ws-client = "0.3.1"
|
||||
log = "0.4.11"
|
||||
num-traits = "0.2"
|
||||
rand = "0.7"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use bp_runtime::{Chain as ChainBase, HashOf, TransactionEraOf};
|
||||
use codec::{Codec, Encode};
|
||||
use frame_support::weights::WeightToFeePolynomial;
|
||||
use jsonrpsee_ws_client::{DeserializeOwned, Serialize};
|
||||
use jsonrpsee_ws_client::types::{DeserializeOwned, Serialize};
|
||||
use num_traits::Zero;
|
||||
use sc_transaction_pool_api::TransactionStatus;
|
||||
use sp_core::{storage::StorageKey, Pair};
|
||||
|
||||
@@ -28,8 +28,11 @@ use codec::{Decode, Encode};
|
||||
use frame_system::AccountInfo;
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use jsonrpsee_ws_client::{
|
||||
traits::SubscriptionClient, v2::params::JsonRpcParams, DeserializeOwned, WsClient as RpcClient,
|
||||
WsClientBuilder as RpcClientBuilder,
|
||||
types::{
|
||||
self as jsonrpsee_types, traits::SubscriptionClient, v2::params::JsonRpcParams,
|
||||
DeserializeOwned,
|
||||
},
|
||||
WsClient as RpcClient, WsClientBuilder as RpcClientBuilder,
|
||||
};
|
||||
use num_traits::{Bounded, Zero};
|
||||
use pallet_balances::AccountData;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Substrate node RPC errors.
|
||||
|
||||
use jsonrpsee_ws_client::Error as RpcError;
|
||||
use jsonrpsee_ws_client::types::Error as RpcError;
|
||||
use relay_utils::MaybeConnectionError;
|
||||
use sc_rpc_api::system::Health;
|
||||
use sp_runtime::transaction_validity::TransactionValidityError;
|
||||
@@ -96,10 +96,12 @@ impl MaybeConnectionError for Error {
|
||||
fn is_connection_error(&self) -> bool {
|
||||
matches!(
|
||||
*self,
|
||||
Error::RpcError(RpcError::Transport(_)) |
|
||||
Error::RpcError(RpcError::Internal(_)) |
|
||||
Error::RpcError(RpcError::RestartNeeded(_)) |
|
||||
Error::ClientNotSynced(_),
|
||||
Error::RpcError(RpcError::Transport(_))
|
||||
// right now if connection to the ws server is dropped (after it is already established),
|
||||
// we're getting this error
|
||||
| Error::RpcError(RpcError::Internal(_))
|
||||
| Error::RpcError(RpcError::RestartNeeded(_))
|
||||
| Error::ClientNotSynced(_),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,9 @@ where
|
||||
.await
|
||||
.map_err(|err| log_error(err.to_string()))
|
||||
.ok()??;
|
||||
|
||||
let decoded_justification =
|
||||
GrandpaJustification::<C::Header>::decode(&mut &next_justification.0[..]);
|
||||
GrandpaJustification::<C::Header>::decode(&mut &next_justification[..]);
|
||||
|
||||
let justification = match decoded_justification {
|
||||
Ok(j) => j,
|
||||
|
||||
Reference in New Issue
Block a user