mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-09 00:07:21 +00:00
chainHead: Produce method responses on chainHead_follow (#14692)
* chainHead/api: Make storage/body/call pure RPC methods Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Add mpsc channel between RPC methods Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/subscriptions: Extract mpsc::Sender via BlockGuard Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/subscriptions: Generate and provide the method operation ID Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Generate `chainHead_body` response Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Generate `chainHead_call` response Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Generate `chainHead_storage` responses Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Propagate responses of methods to chainHead_follow Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/tests: Adjust `chainHead_body` responses Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/tests: Adjust `chainHead_call` responses Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/tests: Adjust `chainHead_call` responses Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/tests: Ensure unique operation IDs across methods Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/events: Remove old method events Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Return `InvalidBlock` error if pinning fails Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead: Wrap subscription IDs Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * chainHead/tests: Ensure separate operation IDs across subscriptions Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
//! API trait of the chain head.
|
||||
use crate::chain_head::event::{ChainHeadEvent, FollowEvent, StorageQuery};
|
||||
use crate::chain_head::event::{FollowEvent, MethodResponse, StorageQuery};
|
||||
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
|
||||
|
||||
#[rpc(client, server)]
|
||||
@@ -47,12 +47,12 @@ pub trait ChainHeadApi<Hash> {
|
||||
/// # Unstable
|
||||
///
|
||||
/// This method is unstable and subject to change in the future.
|
||||
#[subscription(
|
||||
name = "chainHead_unstable_body",
|
||||
unsubscribe = "chainHead_unstable_stopBody",
|
||||
item = ChainHeadEvent<String>,
|
||||
)]
|
||||
fn chain_head_unstable_body(&self, follow_subscription: String, hash: Hash);
|
||||
#[method(name = "chainHead_unstable_body", blocking)]
|
||||
fn chain_head_unstable_body(
|
||||
&self,
|
||||
follow_subscription: String,
|
||||
hash: Hash,
|
||||
) -> RpcResult<MethodResponse>;
|
||||
|
||||
/// Retrieves the header of a pinned block.
|
||||
///
|
||||
@@ -86,36 +86,28 @@ pub trait ChainHeadApi<Hash> {
|
||||
/// # Unstable
|
||||
///
|
||||
/// This method is unstable and subject to change in the future.
|
||||
#[subscription(
|
||||
name = "chainHead_unstable_storage",
|
||||
unsubscribe = "chainHead_unstable_stopStorage",
|
||||
item = ChainHeadEvent<String>,
|
||||
)]
|
||||
#[method(name = "chainHead_unstable_storage", blocking)]
|
||||
fn chain_head_unstable_storage(
|
||||
&self,
|
||||
follow_subscription: String,
|
||||
hash: Hash,
|
||||
items: Vec<StorageQuery<String>>,
|
||||
child_trie: Option<String>,
|
||||
);
|
||||
) -> RpcResult<MethodResponse>;
|
||||
|
||||
/// Call into the Runtime API at a specified block's state.
|
||||
///
|
||||
/// # Unstable
|
||||
///
|
||||
/// This method is unstable and subject to change in the future.
|
||||
#[subscription(
|
||||
name = "chainHead_unstable_call",
|
||||
unsubscribe = "chainHead_unstable_stopCall",
|
||||
item = ChainHeadEvent<String>,
|
||||
)]
|
||||
#[method(name = "chainHead_unstable_call", blocking)]
|
||||
fn chain_head_unstable_call(
|
||||
&self,
|
||||
follow_subscription: String,
|
||||
hash: Hash,
|
||||
function: String,
|
||||
call_parameters: String,
|
||||
);
|
||||
) -> RpcResult<MethodResponse>;
|
||||
|
||||
/// Unpin a block reported by the `follow` method.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user