Skip to content

Commit f3eefc9

Browse files
dvdplmsvyatonik
authored andcommitted
Upgrade jsonrpsee to v0.3 (#1051)
* Upgrade `jsonrpsee` to v0.3 * whitespace * fmt Co-authored-by: Svyatoslav Nikolsky <[email protected]>
1 parent 84258f5 commit f3eefc9

File tree

9 files changed

+32
-23
lines changed

9 files changed

+32
-23
lines changed

bridges/modules/ethereum/src/import.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ mod tests {
307307
)
308308
.unwrap();
309309
match i {
310-
2..=10 =>
311-
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))], "At {}", i,),
310+
2..=10 => {
311+
assert_eq!(finalized_blocks, vec![(parent_id, Some(100))], "At {}", i,)
312+
},
312313
_ => assert_eq!(finalized_blocks, vec![], "At {}", i),
313314
}
314315
latest_block_id = rolling_last_block_id;

bridges/relays/bin-ethereum/src/ethereum_deploy_contract.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,13 @@ async fn prepare_initial_header(
106106
sub_initial_header: Option<Vec<u8>>,
107107
) -> Result<(RialtoHeaderId, Vec<u8>), String> {
108108
match sub_initial_header {
109-
Some(raw_initial_header) =>
109+
Some(raw_initial_header) => {
110110
match rialto_runtime::Header::decode(&mut &raw_initial_header[..]) {
111111
Ok(initial_header) =>
112112
Ok((HeaderId(initial_header.number, initial_header.hash()), raw_initial_header)),
113113
Err(error) => Err(format!("Error decoding initial header: {}", error)),
114-
},
114+
}
115+
},
115116
None => {
116117
let initial_header = sub_client.header_by_number(Zero::zero()).await;
117118
initial_header

bridges/relays/client-ethereum/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ async-std = "1.6.5"
1010
bp-eth-poa = { path = "../../primitives/ethereum-poa" }
1111
headers-relay = { path = "../headers" }
1212
hex-literal = "0.3"
13-
jsonrpsee-proc-macros = "0.2"
14-
jsonrpsee-ws-client = "0.2"
13+
jsonrpsee-proc-macros = "0.3.1"
14+
jsonrpsee-ws-client = "0.3.1"
1515
libsecp256k1 = { version = "0.3.4", default-features = false, features = ["hmac"] }
1616
log = "0.4.11"
1717
relay-utils = { path = "../utils" }

bridges/relays/client-ethereum/src/error.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
use crate::types::U256;
2020

21-
use jsonrpsee_ws_client::Error as RpcError;
21+
use jsonrpsee_ws_client::types::Error as RpcError;
2222
use relay_utils::MaybeConnectionError;
2323

2424
/// Result type used by Ethereum client.
@@ -73,10 +73,12 @@ impl MaybeConnectionError for Error {
7373
fn is_connection_error(&self) -> bool {
7474
matches!(
7575
*self,
76-
Error::RpcError(RpcError::Transport(_)) |
77-
Error::RpcError(RpcError::Internal(_)) |
78-
Error::RpcError(RpcError::RestartNeeded(_)) |
79-
Error::ClientNotSynced(_),
76+
Error::RpcError(RpcError::Transport(_))
77+
// right now if connection to the ws server is dropped (after it is already established),
78+
// we're getting this error
79+
| Error::RpcError(RpcError::Internal(_))
80+
| Error::RpcError(RpcError::RestartNeeded(_))
81+
| Error::ClientNotSynced(_),
8082
)
8183
}
8284
}

bridges/relays/client-substrate/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
99
async-std = { version = "1.6.5", features = ["attributes"] }
1010
async-trait = "0.1.40"
1111
codec = { package = "parity-scale-codec", version = "2.2.0" }
12-
jsonrpsee-proc-macros = "0.2"
13-
jsonrpsee-types = "0.2"
14-
jsonrpsee-ws-client = "0.2"
12+
jsonrpsee-proc-macros = "0.3.1"
13+
jsonrpsee-ws-client = "0.3.1"
1514
log = "0.4.11"
1615
num-traits = "0.2"
1716
rand = "0.7"

bridges/relays/client-substrate/src/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use bp_runtime::{Chain as ChainBase, HashOf, TransactionEraOf};
1818
use codec::{Codec, Encode};
1919
use frame_support::weights::WeightToFeePolynomial;
20-
use jsonrpsee_ws_client::{DeserializeOwned, Serialize};
20+
use jsonrpsee_ws_client::types::{DeserializeOwned, Serialize};
2121
use num_traits::Zero;
2222
use sc_transaction_pool_api::TransactionStatus;
2323
use sp_core::{storage::StorageKey, Pair};

bridges/relays/client-substrate/src/client.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ use codec::{Decode, Encode};
2828
use frame_system::AccountInfo;
2929
use futures::{SinkExt, StreamExt};
3030
use jsonrpsee_ws_client::{
31-
traits::SubscriptionClient, v2::params::JsonRpcParams, DeserializeOwned, WsClient as RpcClient,
32-
WsClientBuilder as RpcClientBuilder,
31+
types::{
32+
self as jsonrpsee_types, traits::SubscriptionClient, v2::params::JsonRpcParams,
33+
DeserializeOwned,
34+
},
35+
WsClient as RpcClient, WsClientBuilder as RpcClientBuilder,
3336
};
3437
use num_traits::{Bounded, Zero};
3538
use pallet_balances::AccountData;

bridges/relays/client-substrate/src/error.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
//! Substrate node RPC errors.
1818
19-
use jsonrpsee_ws_client::Error as RpcError;
19+
use jsonrpsee_ws_client::types::Error as RpcError;
2020
use relay_utils::MaybeConnectionError;
2121
use sc_rpc_api::system::Health;
2222
use sp_runtime::transaction_validity::TransactionValidityError;
@@ -96,10 +96,12 @@ impl MaybeConnectionError for Error {
9696
fn is_connection_error(&self) -> bool {
9797
matches!(
9898
*self,
99-
Error::RpcError(RpcError::Transport(_)) |
100-
Error::RpcError(RpcError::Internal(_)) |
101-
Error::RpcError(RpcError::RestartNeeded(_)) |
102-
Error::ClientNotSynced(_),
99+
Error::RpcError(RpcError::Transport(_))
100+
// right now if connection to the ws server is dropped (after it is already established),
101+
// we're getting this error
102+
| Error::RpcError(RpcError::Internal(_))
103+
| Error::RpcError(RpcError::RestartNeeded(_))
104+
| Error::ClientNotSynced(_),
103105
)
104106
}
105107
}

bridges/relays/client-substrate/src/finality_source.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ where
151151
.await
152152
.map_err(|err| log_error(err.to_string()))
153153
.ok()??;
154+
154155
let decoded_justification =
155-
GrandpaJustification::<C::Header>::decode(&mut &next_justification.0[..]);
156+
GrandpaJustification::<C::Header>::decode(&mut &next_justification[..]);
156157

157158
let justification = match decoded_justification {
158159
Ok(j) => j,

0 commit comments

Comments
 (0)