Skip to content

Commit c6249dc

Browse files
authored
Stabilize V2 archive RPC methods (#8104)
# Description This PR Stabilizes the V2 archive RPCs, and should merge following the [correpsonding PR](paritytech/json-rpc-interface-spec#167) in the spec repository merging. ## Integration Downstream projects can now rely on the `archive_*` RPC methods on being stable. Anybody using the prior `archive_unstable_*` RPCs in recent times should be able to upgrade by simply renaming `archive_unstable` to `archive_v1` for any RPC calls, given that the actual interface hasn't changed since December 2024. <!-- * [ ] My PR follows the [labeling requirements]( https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/CONTRIBUTING.md#Process ) of this project (at minimum one label for `T` required) * External contributors: ask maintainers to put the right label on your PR. * [ ] I have made corresponding changes to the documentation (if applicable) * [ ] I have added tests that prove my fix is effective or that my feature works (if applicable) You can remove the "Checklist" section once all have been checked. Thank you for your contribution! -->
1 parent e7ba9a2 commit c6249dc

File tree

5 files changed

+69
-60
lines changed

5 files changed

+69
-60
lines changed

prdoc/pr_8104.prdoc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
2+
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json
3+
4+
title: Stabilize RPC `archive` methods to V1
5+
6+
doc:
7+
- audience: Node Dev
8+
description: |
9+
This PR renames the V2 `archive_unstable_*` RPC calls to be `archive_v1_*`, signalling
10+
that they have been stabilized.
11+
12+
crates:
13+
- name: sc-rpc-spec-v2
14+
bump: major

substrate/client/rpc-spec-v2/src/archive/api.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ pub trait ArchiveApi<Hash> {
3636
/// # Unstable
3737
///
3838
/// This method is unstable and subject to change in the future.
39-
#[method(name = "archive_unstable_body")]
40-
fn archive_unstable_body(&self, hash: Hash) -> RpcResult<Option<Vec<String>>>;
39+
#[method(name = "archive_v1_body")]
40+
fn archive_v1_body(&self, hash: Hash) -> RpcResult<Option<Vec<String>>>;
4141

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

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

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

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

8484
/// Call into the Runtime API at a specified block's state.
8585
///
8686
/// # Unstable
8787
///
8888
/// This method is unstable and subject to change in the future.
89-
#[method(name = "archive_unstable_call")]
90-
fn archive_unstable_call(
89+
#[method(name = "archive_v1_call")]
90+
fn archive_v1_call(
9191
&self,
9292
hash: Hash,
9393
function: String,
@@ -100,11 +100,11 @@ pub trait ArchiveApi<Hash> {
100100
///
101101
/// This method is unstable and subject to change in the future.
102102
#[subscription(
103-
name = "archive_unstable_storage" => "archive_unstable_storageEvent",
104-
unsubscribe = "archive_unstable_stopStorage",
103+
name = "archive_v1_storage" => "archive_v1_storageEvent",
104+
unsubscribe = "archive_v1_stopStorage",
105105
item = ArchiveStorageEvent,
106106
)]
107-
fn archive_unstable_storage(
107+
fn archive_v1_storage(
108108
&self,
109109
hash: Hash,
110110
items: Vec<StorageQuery<String>>,
@@ -117,11 +117,11 @@ pub trait ArchiveApi<Hash> {
117117
///
118118
/// This method is unstable and can change in minor or patch releases.
119119
#[subscription(
120-
name = "archive_unstable_storageDiff" => "archive_unstable_storageDiffEvent",
121-
unsubscribe = "archive_unstable_storageDiff_stopStorageDiff",
120+
name = "archive_v1_storageDiff" => "archive_v1_storageDiffEvent",
121+
unsubscribe = "archive_v1_storageDiff_stopStorageDiff",
122122
item = ArchiveStorageDiffEvent,
123123
)]
124-
fn archive_unstable_storage_diff(
124+
fn archive_v1_storage_diff(
125125
&self,
126126
hash: Hash,
127127
items: Vec<ArchiveStorageDiffItem<String>>,

substrate/client/rpc-spec-v2/src/archive/archive.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ where
117117
+ StorageProvider<Block, BE>
118118
+ 'static,
119119
{
120-
fn archive_unstable_body(&self, hash: Block::Hash) -> RpcResult<Option<Vec<String>>> {
120+
fn archive_v1_body(&self, hash: Block::Hash) -> RpcResult<Option<Vec<String>>> {
121121
let Ok(Some(signed_block)) = self.client.block(hash) else { return Ok(None) };
122122

123123
let extrinsics = signed_block
@@ -130,21 +130,21 @@ where
130130
Ok(Some(extrinsics))
131131
}
132132

133-
fn archive_unstable_genesis_hash(&self) -> RpcResult<String> {
133+
fn archive_v1_genesis_hash(&self) -> RpcResult<String> {
134134
Ok(self.genesis_hash.clone())
135135
}
136136

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

140140
Ok(Some(hex_string(&header.encode())))
141141
}
142142

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

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

198-
fn archive_unstable_call(
198+
fn archive_v1_call(
199199
&self,
200200
hash: Block::Hash,
201201
function: String,
@@ -214,7 +214,7 @@ where
214214
})
215215
}
216216

217-
fn archive_unstable_storage(
217+
fn archive_v1_storage(
218218
&self,
219219
pending: PendingSubscriptionSink,
220220
hash: Block::Hash,
@@ -265,7 +265,7 @@ where
265265
self.executor.spawn("substrate-rpc-subscription", Some("rpc"), fut.boxed());
266266
}
267267

268-
fn archive_unstable_storage_diff(
268+
fn archive_v1_storage_diff(
269269
&self,
270270
pending: PendingSubscriptionSink,
271271
hash: Block::Hash,

0 commit comments

Comments
 (0)