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,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
derive_more = "0.99.2"
futures = "0.3.9"
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"
log = "0.4.8"
parking_lot = "0.11.1"
codec = { package = "parity-scale-codec", version = "2.0.0" }
@@ -30,7 +30,7 @@ use serde::{Deserialize, Serialize};
use sp_runtime::EncodedJustification;
/// Future's type for jsonrpc
type FutureResult<T> = Box<dyn jsonrpc_core::futures::Future<Item = T, Error = Error> + Send>;
type FutureResult<T> = jsonrpc_core::BoxFuture<Result<T, Error>>;
/// sender passed to the authorship task to report errors or successes.
pub type Sender<T> = Option<oneshot::Sender<std::result::Result<T, crate::Error>>>;
@@ -114,7 +114,7 @@ impl<Hash: Send + 'static> ManualSealApi<Hash> for ManualSeal<Hash> {
parent_hash: Option<Hash>,
) -> FutureResult<CreatedBlock<Hash>> {
let mut sink = self.import_block_channel.clone();
let future = async move {
async move {
let (sender, receiver) = oneshot::channel();
let command = EngineCommand::SealNewBlock {
create_empty,
@@ -125,9 +125,8 @@ impl<Hash: Send + 'static> ManualSealApi<Hash> for ManualSeal<Hash> {
sink.send(command).await?;
receiver.await?
}
.boxed();
Box::new(future.map_err(Error::from).compat())
.map_err(Error::from)
.boxed()
}
fn finalize_block(
@@ -136,15 +135,15 @@ impl<Hash: Send + 'static> ManualSealApi<Hash> for ManualSeal<Hash> {
justification: Option<EncodedJustification>,
) -> FutureResult<bool> {
let mut sink = self.import_block_channel.clone();
let future = async move {
async move {
let (sender, receiver) = oneshot::channel();
sink.send(EngineCommand::FinalizeBlock { hash, sender: Some(sender), justification })
.await?;
receiver.await?.map(|_| true)
};
Box::new(future.boxed().map_err(Error::from).compat())
}
.map_err(Error::from)
.boxed()
}
}