RPC: Mark storage methods as blocking (#11459)

* client/api: Make `storage_keys` blocking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client/api: Ensure `state_*` RPC methods are blocking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client/rpc: Ensure `childstate_*` RPC methods are blocking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client/rpc: `ChainApi` make RPC methods sync

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove unused async-traits

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* client/rpc-api: Make chain RPC methods blocking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Update client/rpc/src/state/state_full.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Add `blocking` to `state_getKeysPaged` RPC call

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Fix build and warning

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* Remove `async_trait` tidyup

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Alexandru VasileandBastian Köcher authored and GitHub committed 2022-05-20 19:16:35 +00:00
1 parent 4a71017dd3
commit 87de1e7e0d
8 files changed
+163 -222

No files matched your search

+3 -4
View File
@@ -26,7 +26,7 @@ use futures::{
future::{self, FutureExt},
stream::{self, Stream, StreamExt},
};
use jsonrpsee::{core::async_trait, PendingSubscription};
use jsonrpsee::PendingSubscription;
use sc_client_api::{BlockBackend, BlockchainEvents};
use sp_blockchain::HeaderBackend;
use sp_runtime::{
@@ -51,7 +51,6 @@ impl<Block: BlockT, Client> FullChain<Block, Client> {
}
}
#[async_trait]
impl<Block, Client> ChainBackend<Client, Block> for FullChain<Block, Client>
where
Block: BlockT + 'static,
@@ -62,11 +61,11 @@ where
&self.client
}
async fn header(&self, hash: Option<Block::Hash>) -> Result<Option<Block::Header>, Error> {
fn header(&self, hash: Option<Block::Hash>) -> Result<Option<Block::Header>, Error> {
self.client.header(BlockId::Hash(self.unwrap_or_best(hash))).map_err(client_err)
}
async fn block(&self, hash: Option<Block::Hash>) -> Result<Option<SignedBlock<Block>>, Error> {
fn block(&self, hash: Option<Block::Hash>) -> Result<Option<SignedBlock<Block>>, Error> {
self.client.block(&BlockId::Hash(self.unwrap_or_best(hash))).map_err(client_err)
}