mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 05:21: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:
@@ -561,6 +561,8 @@ where
|
||||
+ sp_session::SessionKeys<TBl>
|
||||
+ sp_api::ApiExt<TBl, StateBackend = TBackend::State>,
|
||||
TBl: BlockT,
|
||||
TBl::Hash: Unpin,
|
||||
TBl::Header: Unpin,
|
||||
TBackend: 'static + sc_client_api::backend::Backend<TBl> + Send,
|
||||
TExPool: MaintainedTransactionPool<Block = TBl, Hash = <TBl as BlockT>::Hash>
|
||||
+ MallocSizeOfWasm
|
||||
@@ -762,6 +764,8 @@ where
|
||||
TBackend: sc_client_api::backend::Backend<TBl> + 'static,
|
||||
TRpc: sc_rpc::RpcExtension<sc_rpc::Metadata>,
|
||||
<TCl as ProvideRuntimeApi<TBl>>::Api: sp_session::SessionKeys<TBl> + sp_api::Metadata<TBl>,
|
||||
TBl::Hash: Unpin,
|
||||
TBl::Header: Unpin,
|
||||
{
|
||||
use sc_rpc::{author, chain, offchain, state, system};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ mod task_manager;
|
||||
use std::{collections::HashMap, io, net::SocketAddr, pin::Pin, task::Poll};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use futures::{compat::*, stream, Future, FutureExt, Stream, StreamExt};
|
||||
use futures::{stream, Future, FutureExt, Stream, StreamExt};
|
||||
use log::{debug, error, warn};
|
||||
use parity_util_mem::MallocSizeOf;
|
||||
use sc_network::PeerId;
|
||||
@@ -112,11 +112,7 @@ impl RpcHandlers {
|
||||
mem: &RpcSession,
|
||||
request: &str,
|
||||
) -> Pin<Box<dyn Future<Output = Option<String>> + Send>> {
|
||||
self.0
|
||||
.handle_request(request, mem.metadata.clone())
|
||||
.compat()
|
||||
.map(|res| res.expect("this should never fail"))
|
||||
.boxed()
|
||||
self.0.handle_request(request, mem.metadata.clone()).boxed()
|
||||
}
|
||||
|
||||
/// Provides access to the underlying `MetaIoHandler`
|
||||
@@ -354,7 +350,7 @@ fn start_rpc_servers<
|
||||
config: &Configuration,
|
||||
mut gen_handler: H,
|
||||
rpc_metrics: sc_rpc_server::RpcMetrics,
|
||||
) -> Result<Box<dyn std::any::Any + Send + Sync>, Error> {
|
||||
) -> Result<Box<dyn std::any::Any + Send>, Error> {
|
||||
fn maybe_start_server<T, F>(
|
||||
address: Option<SocketAddr>,
|
||||
mut start: F,
|
||||
@@ -388,16 +384,20 @@ fn start_rpc_servers<
|
||||
}
|
||||
|
||||
Ok(Box::new((
|
||||
config.rpc_ipc.as_ref().map(|path| {
|
||||
sc_rpc_server::start_ipc(
|
||||
&*path,
|
||||
gen_handler(
|
||||
sc_rpc::DenyUnsafe::No,
|
||||
sc_rpc_server::RpcMiddleware::new(rpc_metrics.clone(), "ipc"),
|
||||
)?,
|
||||
)
|
||||
.map_err(Error::from)
|
||||
}),
|
||||
config
|
||||
.rpc_ipc
|
||||
.as_ref()
|
||||
.map(|path| {
|
||||
sc_rpc_server::start_ipc(
|
||||
&*path,
|
||||
gen_handler(
|
||||
sc_rpc::DenyUnsafe::No,
|
||||
sc_rpc_server::RpcMiddleware::new(rpc_metrics.clone(), "ipc"),
|
||||
)?,
|
||||
)
|
||||
.map_err(Error::from)
|
||||
})
|
||||
.transpose()?,
|
||||
maybe_start_server(config.rpc_http, |address| {
|
||||
sc_rpc_server::start_http(
|
||||
address,
|
||||
@@ -441,7 +441,7 @@ fn start_rpc_servers<
|
||||
_: &Configuration,
|
||||
_: H,
|
||||
_: sc_rpc_server::RpcMetrics,
|
||||
) -> Result<Box<dyn std::any::Any + Send + Sync>, error::Error> {
|
||||
) -> Result<Box<dyn std::any::Any + Send>, error::Error> {
|
||||
Ok(Box::new(()))
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ impl RpcSession {
|
||||
/// messages.
|
||||
///
|
||||
/// The `RpcSession` must be kept alive in order to receive messages on the sender.
|
||||
pub fn new(sender: futures01::sync::mpsc::Sender<String>) -> RpcSession {
|
||||
pub fn new(sender: futures::channel::mpsc::UnboundedSender<String>) -> RpcSession {
|
||||
RpcSession { metadata: sender.into() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ pub struct TaskManager {
|
||||
/// A receiver for spawned essential-tasks concluding.
|
||||
essential_failed_rx: TracingUnboundedReceiver<()>,
|
||||
/// Things to keep alive until the task manager is dropped.
|
||||
keep_alive: Box<dyn std::any::Any + Send + Sync>,
|
||||
keep_alive: Box<dyn std::any::Any + Send>,
|
||||
/// A sender to a stream of background tasks. This is used for the completion future.
|
||||
task_notifier: TracingUnboundedSender<JoinFuture>,
|
||||
/// This future will complete when all the tasks are joined and the stream is closed.
|
||||
@@ -359,7 +359,7 @@ impl TaskManager {
|
||||
}
|
||||
|
||||
/// Set what the task manager should keep alive, can be called multiple times.
|
||||
pub fn keep_alive<T: 'static + Send + Sync>(&mut self, to_keep_alive: T) {
|
||||
pub fn keep_alive<T: 'static + Send>(&mut self, to_keep_alive: T) {
|
||||
// allows this fn to safely called multiple times.
|
||||
use std::mem;
|
||||
let old = mem::replace(&mut self.keep_alive, Box::new(()));
|
||||
|
||||
Reference in New Issue
Block a user