chainHead: Sync events with spec (#14654)

* chainHead/events: Remove network config

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

* chainHead/events: Add events for operations

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

* chainHead/tests: Test chainHead events serialize/deserialize

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

* chainHead/events: Remove generics from the storage event

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

* chainHead/events: Rename kebab-case to camelCase

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

* chainHead/events: Add methodResponse object

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

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2023-07-31 10:26:13 +03:00
committed by GitHub
parent 6da4e90e51
commit 6d5f0a1f1d
6 changed files with 328 additions and 124 deletions
@@ -19,7 +19,7 @@
#![allow(non_snake_case)]
//! API trait of the chain head.
use crate::chain_head::event::{ChainHeadEvent, FollowEvent, NetworkConfig, StorageQuery};
use crate::chain_head::event::{ChainHeadEvent, FollowEvent, StorageQuery};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
#[rpc(client, server)]
@@ -52,12 +52,7 @@ pub trait ChainHeadApi<Hash> {
unsubscribe = "chainHead_unstable_stopBody",
item = ChainHeadEvent<String>,
)]
fn chain_head_unstable_body(
&self,
follow_subscription: String,
hash: Hash,
network_config: Option<NetworkConfig>,
);
fn chain_head_unstable_body(&self, follow_subscription: String, hash: Hash);
/// Retrieves the header of a pinned block.
///
@@ -102,7 +97,6 @@ pub trait ChainHeadApi<Hash> {
hash: Hash,
items: Vec<StorageQuery<String>>,
child_trie: Option<String>,
network_config: Option<NetworkConfig>,
);
/// Call into the Runtime API at a specified block's state.
@@ -121,7 +115,6 @@ pub trait ChainHeadApi<Hash> {
hash: Hash,
function: String,
call_parameters: String,
network_config: Option<NetworkConfig>,
);
/// Unpin a block reported by the `follow` method.