Upgrade jsonrpc to 0.18.0 (#9547)

* Upgrade jsonrpc to 0.18.0

I think this says all :P

* 🤦

* Fmt etc

* Fix tests

* Fix tests again...

* Better impl

* Revert "Tell dependabot to ignore jsonrpc-* updates (#9518)"

This reverts commit 6e0cd5587d.
This commit is contained in:
Bastian Köcher
2021-08-13 08:46:07 +02:00
committed by GitHub
parent 199b2883af
commit c44aba89e6
65 changed files with 1422 additions and 1291 deletions
@@ -15,15 +15,15 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
sc-consensus-babe = { version = "0.10.0-dev", path = "../" }
sc-rpc-api = { version = "0.10.0-dev", path = "../../../rpc-api" }
jsonrpc-core = "15.1.0"
jsonrpc-core-client = "15.1.0"
jsonrpc-derive = "15.1.0"
jsonrpc-core = "18.0.0"
jsonrpc-core-client = "18.0.0"
jsonrpc-derive = "18.0.0"
sp-consensus-babe = { version = "0.10.0-dev", path = "../../../../primitives/consensus/babe" }
serde = { version = "1.0.126", features=["derive"] }
sp-blockchain = { version = "4.0.0-dev", path = "../../../../primitives/blockchain" }
sp-runtime = { version = "4.0.0-dev", path = "../../../../primitives/runtime" }
sc-consensus-epochs = { version = "0.10.0-dev", path = "../../epochs" }
futures = { version = "0.3.4", features = ["compat"] }
futures = "0.3.16"
derive_more = "0.99.2"
sp-api = { version = "4.0.0-dev", path = "../../../../primitives/api" }
sp-consensus = { version = "0.10.0-dev", path = "../../../../primitives/consensus/common" }
@@ -18,8 +18,8 @@
//! RPC api for babe.
use futures::{FutureExt as _, TryFutureExt as _};
use jsonrpc_core::{futures::future as rpc_future, Error as RpcError};
use futures::{FutureExt, TryFutureExt};
use jsonrpc_core::Error as RpcError;
use jsonrpc_derive::rpc;
use sc_consensus_babe::{authorship, Config, Epoch};
use sc_consensus_epochs::{descendent_query, Epoch as EpochT, SharedEpochChanges};
@@ -35,7 +35,7 @@ use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
use sp_runtime::traits::{Block as BlockT, Header as _};
use std::{collections::HashMap, sync::Arc};
type FutureResult<T> = Box<dyn rpc_future::Future<Item = T, Error = RpcError> + Send>;
type FutureResult<T> = jsonrpc_core::BoxFuture<Result<T, RpcError>>;
/// Provides rpc methods for interacting with Babe.
#[rpc]
@@ -88,7 +88,7 @@ where
{
fn epoch_authorship(&self) -> FutureResult<HashMap<AuthorityId, EpochAuthorship>> {
if let Err(err) = self.deny_unsafe.check_if_safe() {
return Box::new(rpc_future::err(err.into()))
return async move { Err(err.into()) }.boxed()
}
let (babe_config, keystore, shared_epoch, client, select_chain) = (
@@ -98,7 +98,8 @@ where
self.client.clone(),
self.select_chain.clone(),
);
let future = async move {
async move {
let header = select_chain.best_chain().map_err(Error::Consensus).await?;
let epoch_start = client
.runtime_api()
@@ -149,9 +150,7 @@ where
Ok(claims)
}
.boxed();
Box::new(future.compat())
.boxed()
}
}