Skip to content

Commit

Permalink
chainHead: Stabilize chainHead to version 1 (#4168)
Browse files Browse the repository at this point in the history
This PR stabilizes the chainHead API to version 1.

Needs:
- #3667

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv authored Apr 18, 2024
1 parent c891fda commit 88a2f36
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 143 deletions.
8 changes: 8 additions & 0 deletions prdoc/pr_4168.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Stabilize chianHead RPC class to version 1

doc:
- audience: Node Dev
description: |
The chainHead RPC API is stabilized to version 1.

crates: [ ]
26 changes: 13 additions & 13 deletions substrate/client/rpc-spec-v2/src/chain_head/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ pub trait ChainHeadApi<Hash> {
///
/// This method is unstable and subject to change in the future.
#[subscription(
name = "chainHead_unstable_follow" => "chainHead_unstable_followEvent",
unsubscribe = "chainHead_unstable_unfollow",
name = "chainHead_v1_follow" => "chainHead_v1_followEvent",
unsubscribe = "chainHead_v1_unfollow",
item = FollowEvent<Hash>,
)]
fn chain_head_unstable_follow(&self, with_runtime: bool);

/// Retrieves the body (list of transactions) of a pinned block.
///
/// This method should be seen as a complement to `chainHead_unstable_follow`,
/// This method should be seen as a complement to `chainHead_v1_follow`,
/// allowing the JSON-RPC client to retrieve more information about a block
/// that has been reported.
///
Expand All @@ -54,7 +54,7 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_body", raw_method)]
#[method(name = "chainHead_v1_body", raw_method)]
async fn chain_head_unstable_body(
&self,
follow_subscription: String,
Expand All @@ -63,7 +63,7 @@ pub trait ChainHeadApi<Hash> {

/// Retrieves the header of a pinned block.
///
/// This method should be seen as a complement to `chainHead_unstable_follow`,
/// This method should be seen as a complement to `chainHead_v1_follow`,
/// allowing the JSON-RPC client to retrieve more information about a block
/// that has been reported.
///
Expand All @@ -73,7 +73,7 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_header", raw_method)]
#[method(name = "chainHead_v1_header", raw_method)]
async fn chain_head_unstable_header(
&self,
follow_subscription: String,
Expand All @@ -85,7 +85,7 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_storage", raw_method)]
#[method(name = "chainHead_v1_storage", raw_method)]
async fn chain_head_unstable_storage(
&self,
follow_subscription: String,
Expand All @@ -99,7 +99,7 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_call", raw_method)]
#[method(name = "chainHead_v1_call", raw_method)]
async fn chain_head_unstable_call(
&self,
follow_subscription: String,
Expand All @@ -118,7 +118,7 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_unpin", raw_method)]
#[method(name = "chainHead_v1_unpin", raw_method)]
async fn chain_head_unstable_unpin(
&self,
follow_subscription: String,
Expand All @@ -131,21 +131,21 @@ pub trait ChainHeadApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_continue", raw_method)]
#[method(name = "chainHead_v1_continue", raw_method)]
async fn chain_head_unstable_continue(
&self,
follow_subscription: String,
operation_id: String,
) -> Result<(), Error>;

/// Stops an operation started with chainHead_unstable_body, chainHead_unstable_call, or
/// chainHead_unstable_storage. If the operation was still in progress, this interrupts it. If
/// Stops an operation started with chainHead_v1_body, chainHead_v1_call, or
/// chainHead_v1_storage. If the operation was still in progress, this interrupts it. If
/// the operation was already finished, this call has no effect.
///
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "chainHead_unstable_stopOperation", raw_method)]
#[method(name = "chainHead_v1_stopOperation", raw_method)]
async fn chain_head_unstable_stop_operation(
&self,
follow_subscription: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl OperationState {
/// Stops the operation if `waitingForContinue` event was emitted for the associated
/// operation ID.
///
/// Returns nothing in accordance with `chainHead_unstable_stopOperation`.
/// Returns nothing in accordance with `chainHead_v1_stopOperation`.
pub fn stop_operation(&self) {
// `waitingForContinue` not generated.
if !self.shared_state.requested_continue.load(std::sync::atomic::Ordering::Acquire) {
Expand Down
Loading

0 comments on commit 88a2f36

Please sign in to comment.