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 Vasile
2022-05-20 22:16:35 +03:00
committed by GitHub
parent 4a71017dd3
commit 87de1e7e0d
8 changed files with 163 additions and 222 deletions
+6 -6
View File
@@ -26,24 +26,24 @@ pub mod error;
#[rpc(client, server)]
pub trait ChainApi<Number, Hash, Header, SignedBlock> {
/// Get header.
#[method(name = "chain_getHeader")]
async fn header(&self, hash: Option<Hash>) -> RpcResult<Option<Header>>;
#[method(name = "chain_getHeader", blocking)]
fn header(&self, hash: Option<Hash>) -> RpcResult<Option<Header>>;
/// Get header and body of a relay chain block.
#[method(name = "chain_getBlock")]
async fn block(&self, hash: Option<Hash>) -> RpcResult<Option<SignedBlock>>;
#[method(name = "chain_getBlock", blocking)]
fn block(&self, hash: Option<Hash>) -> RpcResult<Option<SignedBlock>>;
/// Get hash of the n-th block in the canon chain.
///
/// By default returns latest block hash.
#[method(name = "chain_getBlockHash", aliases = ["chain_getHead"])]
#[method(name = "chain_getBlockHash", aliases = ["chain_getHead"], blocking)]
fn block_hash(
&self,
hash: Option<ListOrValue<NumberOrHex>>,
) -> RpcResult<ListOrValue<Option<Hash>>>;
/// Get hash of the last finalized block in the canon chain.
#[method(name = "chain_getFinalizedHead", aliases = ["chain_getFinalisedHead"])]
#[method(name = "chain_getFinalizedHead", aliases = ["chain_getFinalisedHead"], blocking)]
fn finalized_head(&self) -> RpcResult<Hash>;
/// All head subscription.