mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
rpc: Update jsonrpsee v0.15.1 (#11939)
* Bump jsonrpsee to v0.15.1 Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update cargo.lock Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc-servers: Adjust RpcMiddleware to WS and HTTP traits Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/author: Use `SubscriptionSink` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/chain: Use `SubscriptionSink` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/state: Use `SubscriptionSink` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/finality-grandpa: Use `SubscriptionSink` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/beefy: Use `SubscriptionSink` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * client: Extract RPC string result from queries Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Apply rust-fmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Fix warnings Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Fix testing Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/tests: Remove trailing comma Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Use `SubscriptionResult` for implementations Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Remove comment Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Delegate middleware calls to `RpcMiddleware` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Remove comment Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Revert Cargo.lock Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update Cargo.lock with minimal changes Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Update imports for `SubscriptionResult` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Apply cargo fmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc/tests: Submit raw json requests to validate DenyUnsafe Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -29,7 +29,8 @@ use crate::SubscriptionTaskExecutor;
|
||||
|
||||
use jsonrpsee::{
|
||||
core::{Error as JsonRpseeError, RpcResult},
|
||||
ws_server::PendingSubscription,
|
||||
types::SubscriptionResult,
|
||||
ws_server::SubscriptionSink,
|
||||
};
|
||||
|
||||
use sc_rpc_api::{state::ReadProof, DenyUnsafe};
|
||||
@@ -155,10 +156,10 @@ where
|
||||
) -> Result<sp_rpc::tracing::TraceBlockResponse, Error>;
|
||||
|
||||
/// New runtime version subscription
|
||||
fn subscribe_runtime_version(&self, sink: PendingSubscription);
|
||||
fn subscribe_runtime_version(&self, sink: SubscriptionSink);
|
||||
|
||||
/// New storage subscription
|
||||
fn subscribe_storage(&self, sink: PendingSubscription, keys: Option<Vec<StorageKey>>);
|
||||
fn subscribe_storage(&self, sink: SubscriptionSink, keys: Option<Vec<StorageKey>>);
|
||||
}
|
||||
|
||||
/// Create new state API that works on full node.
|
||||
@@ -318,19 +319,25 @@ where
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
fn subscribe_runtime_version(&self, sink: PendingSubscription) {
|
||||
self.backend.subscribe_runtime_version(sink)
|
||||
fn subscribe_runtime_version(&self, sink: SubscriptionSink) -> SubscriptionResult {
|
||||
self.backend.subscribe_runtime_version(sink);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn subscribe_storage(&self, sink: PendingSubscription, keys: Option<Vec<StorageKey>>) {
|
||||
fn subscribe_storage(
|
||||
&self,
|
||||
mut sink: SubscriptionSink,
|
||||
keys: Option<Vec<StorageKey>>,
|
||||
) -> SubscriptionResult {
|
||||
if keys.is_none() {
|
||||
if let Err(err) = self.deny_unsafe.check_if_safe() {
|
||||
let _ = sink.reject(JsonRpseeError::from(err));
|
||||
return
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
self.backend.subscribe_storage(sink, keys)
|
||||
self.backend.subscribe_storage(sink, keys);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user