mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ sp-consensus-pow = { version = "0.10.0-dev", path = "../../../primitives/consens
|
||||
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
|
||||
sc-consensus = { version = "0.10.0-dev", path = "../../../client/consensus/common" }
|
||||
log = "0.4.8"
|
||||
futures = { version = "0.3.1", features = ["compat"] }
|
||||
futures = "0.3.16"
|
||||
futures-timer = "3.0.1"
|
||||
parking_lot = "0.11.1"
|
||||
derive_more = "0.99.2"
|
||||
|
||||
Reference in New Issue
Block a user