Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions prdoc/pr_8104.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Stabilize RPC `archive` methods to V1

doc:
- audience: Node Dev
description: |
This PR renames the V2 `archive_unstable_*` RPC calls to be `archive_v1_*`, signalling
that they have been stabilized.

crates:
- name: sc-rpc-spec-v2
bump: major
36 changes: 18 additions & 18 deletions substrate/client/rpc-spec-v2/src/archive/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub trait ArchiveApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_body")]
fn archive_unstable_body(&self, hash: Hash) -> RpcResult<Option<Vec<String>>>;
#[method(name = "archive_v1_body")]
fn archive_v1_body(&self, hash: Hash) -> RpcResult<Option<Vec<String>>>;

/// Get the chain's genesis hash.
///
Expand All @@ -46,8 +46,8 @@ pub trait ArchiveApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_genesisHash")]
fn archive_unstable_genesis_hash(&self) -> RpcResult<String>;
#[method(name = "archive_v1_genesisHash")]
fn archive_v1_genesis_hash(&self) -> RpcResult<String>;

/// Get the block's header.
///
Expand All @@ -57,8 +57,8 @@ pub trait ArchiveApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_header")]
fn archive_unstable_header(&self, hash: Hash) -> RpcResult<Option<String>>;
#[method(name = "archive_v1_header")]
fn archive_v1_header(&self, hash: Hash) -> RpcResult<Option<String>>;

/// Get the height of the current finalized block.
///
Expand All @@ -67,8 +67,8 @@ pub trait ArchiveApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_finalizedHeight")]
fn archive_unstable_finalized_height(&self) -> RpcResult<u64>;
#[method(name = "archive_v1_finalizedHeight")]
fn archive_v1_finalized_height(&self) -> RpcResult<u64>;

/// Get the hashes of blocks from the given height.
///
Expand All @@ -78,16 +78,16 @@ pub trait ArchiveApi<Hash> {
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_hashByHeight")]
fn archive_unstable_hash_by_height(&self, height: u64) -> RpcResult<Vec<String>>;
#[method(name = "archive_v1_hashByHeight")]
fn archive_v1_hash_by_height(&self, height: u64) -> RpcResult<Vec<String>>;

/// Call into the Runtime API at a specified block's state.
///
/// # Unstable
///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_call")]
fn archive_unstable_call(
#[method(name = "archive_v1_call")]
fn archive_v1_call(
&self,
hash: Hash,
function: String,
Expand All @@ -100,11 +100,11 @@ pub trait ArchiveApi<Hash> {
///
/// This method is unstable and subject to change in the future.
#[subscription(
name = "archive_unstable_storage" => "archive_unstable_storageEvent",
unsubscribe = "archive_unstable_stopStorage",
name = "archive_v1_storage" => "archive_v1_storageEvent",
unsubscribe = "archive_v1_stopStorage",
item = ArchiveStorageEvent,
)]
fn archive_unstable_storage(
fn archive_v1_storage(
&self,
hash: Hash,
items: Vec<StorageQuery<String>>,
Expand All @@ -117,11 +117,11 @@ pub trait ArchiveApi<Hash> {
///
/// This method is unstable and can change in minor or patch releases.
#[subscription(
name = "archive_unstable_storageDiff" => "archive_unstable_storageDiffEvent",
unsubscribe = "archive_unstable_storageDiff_stopStorageDiff",
name = "archive_v1_storageDiff" => "archive_v1_storageDiffEvent",
unsubscribe = "archive_v1_storageDiff_stopStorageDiff",
item = ArchiveStorageDiffEvent,
)]
fn archive_unstable_storage_diff(
fn archive_v1_storage_diff(
&self,
hash: Hash,
items: Vec<ArchiveStorageDiffItem<String>>,
Expand Down
16 changes: 8 additions & 8 deletions substrate/client/rpc-spec-v2/src/archive/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
+ StorageProvider<Block, BE>
+ 'static,
{
fn archive_unstable_body(&self, hash: Block::Hash) -> RpcResult<Option<Vec<String>>> {
fn archive_v1_body(&self, hash: Block::Hash) -> RpcResult<Option<Vec<String>>> {
let Ok(Some(signed_block)) = self.client.block(hash) else { return Ok(None) };

let extrinsics = signed_block
Expand All @@ -130,21 +130,21 @@ where
Ok(Some(extrinsics))
}

fn archive_unstable_genesis_hash(&self) -> RpcResult<String> {
fn archive_v1_genesis_hash(&self) -> RpcResult<String> {
Ok(self.genesis_hash.clone())
}

fn archive_unstable_header(&self, hash: Block::Hash) -> RpcResult<Option<String>> {
fn archive_v1_header(&self, hash: Block::Hash) -> RpcResult<Option<String>> {
let Ok(Some(header)) = self.client.header(hash) else { return Ok(None) };

Ok(Some(hex_string(&header.encode())))
}

fn archive_unstable_finalized_height(&self) -> RpcResult<u64> {
fn archive_v1_finalized_height(&self) -> RpcResult<u64> {
Ok(self.client.info().finalized_number.saturated_into())
}

fn archive_unstable_hash_by_height(&self, height: u64) -> RpcResult<Vec<String>> {
fn archive_v1_hash_by_height(&self, height: u64) -> RpcResult<Vec<String>> {
let height: NumberFor<Block> = U256::from(height)
.try_into()
.map_err(|_| ArchiveError::InvalidParam(format!("Invalid block height: {}", height)))?;
Expand Down Expand Up @@ -195,7 +195,7 @@ where
Ok(result)
}

fn archive_unstable_call(
fn archive_v1_call(
&self,
hash: Block::Hash,
function: String,
Expand All @@ -214,7 +214,7 @@ where
})
}

fn archive_unstable_storage(
fn archive_v1_storage(
&self,
pending: PendingSubscriptionSink,
hash: Block::Hash,
Expand Down Expand Up @@ -265,7 +265,7 @@ where
self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed());
}

fn archive_unstable_storage_diff(
fn archive_v1_storage_diff(
&self,
pending: PendingSubscriptionSink,
hash: Block::Hash,
Expand Down
Loading
Loading