Skip to content

Commit 3e8afeb

Browse files
Merge pull request #627 from opentensor/fix/remove_childkey_rpcs
chore: remove coldkey swap rpc
2 parents 0efeaf3 + 0abfb9b commit 3e8afeb

File tree

6 files changed

+1
-268
lines changed

6 files changed

+1
-268
lines changed

node/src/rpc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ where
6060
C::Api: subtensor_custom_rpc_runtime_api::NeuronInfoRuntimeApi<Block>,
6161
C::Api: subtensor_custom_rpc_runtime_api::SubnetInfoRuntimeApi<Block>,
6262
C::Api: subtensor_custom_rpc_runtime_api::SubnetRegistrationRuntimeApi<Block>,
63-
C::Api: subtensor_custom_rpc_runtime_api::ColdkeySwapRuntimeApi<Block>,
6463
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
6564
P: TransactionPool + 'static,
6665
{

pallets/subtensor/rpc/src/lib.rs

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::sync::Arc;
1212
use sp_api::ProvideRuntimeApi;
1313

1414
pub use subtensor_custom_rpc_runtime_api::{
15-
ColdkeySwapRuntimeApi, DelegateInfoRuntimeApi, NeuronInfoRuntimeApi, SubnetInfoRuntimeApi,
15+
DelegateInfoRuntimeApi, NeuronInfoRuntimeApi, SubnetInfoRuntimeApi,
1616
SubnetRegistrationRuntimeApi,
1717
};
1818

@@ -51,24 +51,6 @@ pub trait SubtensorCustomApi<BlockHash> {
5151

5252
#[method(name = "subnetInfo_getLockCost")]
5353
fn get_network_lock_cost(&self, at: Option<BlockHash>) -> RpcResult<u64>;
54-
#[method(name = "coldkeySwap_getScheduledColdkeySwap")]
55-
fn get_scheduled_coldkey_swap(
56-
&self,
57-
coldkey_account_vec: Vec<u8>,
58-
at: Option<BlockHash>,
59-
) -> RpcResult<Vec<u8>>;
60-
#[method(name = "coldkeySwap_getRemainingArbitrationPeriod")]
61-
fn get_remaining_arbitration_period(
62-
&self,
63-
coldkey_account_vec: Vec<u8>,
64-
at: Option<BlockHash>,
65-
) -> RpcResult<Vec<u8>>;
66-
#[method(name = "coldkeySwap_getColdkeySwapDestinations")]
67-
fn get_coldkey_swap_destinations(
68-
&self,
69-
coldkey_account_vec: Vec<u8>,
70-
at: Option<BlockHash>,
71-
) -> RpcResult<Vec<u8>>;
7254
}
7355

7456
pub struct SubtensorCustom<C, P> {
@@ -117,7 +99,6 @@ where
11799
C::Api: NeuronInfoRuntimeApi<Block>,
118100
C::Api: SubnetInfoRuntimeApi<Block>,
119101
C::Api: SubnetRegistrationRuntimeApi<Block>,
120-
C::Api: ColdkeySwapRuntimeApi<Block>,
121102
{
122103
fn get_delegates(&self, at: Option<<Block as BlockT>::Hash>) -> RpcResult<Vec<u8>> {
123104
let api = self.client.runtime_api();
@@ -242,51 +223,4 @@ where
242223
Error::RuntimeError(format!("Unable to get subnet lock cost: {:?}", e)).into()
243224
})
244225
}
245-
246-
fn get_scheduled_coldkey_swap(
247-
&self,
248-
coldkey_account_vec: Vec<u8>,
249-
at: Option<<Block as BlockT>::Hash>,
250-
) -> RpcResult<Vec<u8>> {
251-
let api = self.client.runtime_api();
252-
let at = at.unwrap_or_else(|| self.client.info().best_hash);
253-
254-
api.get_scheduled_coldkey_swap(at, coldkey_account_vec)
255-
.map_err(|e| {
256-
Error::RuntimeError(format!("Unable to get scheduled coldkey swap: {:?}", e)).into()
257-
})
258-
}
259-
260-
fn get_remaining_arbitration_period(
261-
&self,
262-
coldkey_account_vec: Vec<u8>,
263-
at: Option<<Block as BlockT>::Hash>,
264-
) -> RpcResult<Vec<u8>> {
265-
let api = self.client.runtime_api();
266-
let at = at.unwrap_or_else(|| self.client.info().best_hash);
267-
268-
api.get_remaining_arbitration_period(at, coldkey_account_vec)
269-
.map_err(|e| {
270-
Error::RuntimeError(format!(
271-
"Unable to get remaining arbitration period: {:?}",
272-
e
273-
))
274-
.into()
275-
})
276-
}
277-
278-
fn get_coldkey_swap_destinations(
279-
&self,
280-
coldkey_account_vec: Vec<u8>,
281-
at: Option<<Block as BlockT>::Hash>,
282-
) -> RpcResult<Vec<u8>> {
283-
let api = self.client.runtime_api();
284-
let at = at.unwrap_or_else(|| self.client.info().best_hash);
285-
286-
api.get_coldkey_swap_destinations(at, coldkey_account_vec)
287-
.map_err(|e| {
288-
Error::RuntimeError(format!("Unable to get coldkey swap destinations: {:?}", e))
289-
.into()
290-
})
291-
}
292226
}

pallets/subtensor/runtime-api/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,4 @@ sp_api::decl_runtime_apis! {
3232
pub trait SubnetRegistrationRuntimeApi {
3333
fn get_network_registration_cost() -> u64;
3434
}
35-
36-
pub trait ColdkeySwapRuntimeApi {
37-
fn get_scheduled_coldkey_swap( coldkey_account_vec: Vec<u8> ) -> Vec<u8>;
38-
fn get_remaining_arbitration_period( coldkey_account_vec: Vec<u8> ) -> Vec<u8>;
39-
fn get_coldkey_swap_destinations( coldkey_account_vec: Vec<u8> ) -> Vec<u8>;
40-
}
4135
}

pallets/subtensor/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ mod weights;
5151

5252
pub mod delegate_info;
5353
pub mod neuron_info;
54-
pub mod schedule_coldkey_swap_info;
5554
pub mod stake_info;
5655
pub mod subnet_info;
5756

pallets/subtensor/src/schedule_coldkey_swap_info.rs

Lines changed: 0 additions & 176 deletions
This file was deleted.

runtime/src/lib.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,23 +1664,6 @@ impl_runtime_apis! {
16641664
SubtensorModule::get_network_lock_cost()
16651665
}
16661666
}
1667-
1668-
impl subtensor_custom_rpc_runtime_api::ColdkeySwapRuntimeApi<Block> for Runtime {
1669-
fn get_scheduled_coldkey_swap( coldkey_account_vec: Vec<u8> ) -> Vec<u8> {
1670-
let result = SubtensorModule::get_scheduled_coldkey_swap( coldkey_account_vec );
1671-
result.encode()
1672-
}
1673-
1674-
fn get_remaining_arbitration_period( coldkey_account_vec: Vec<u8> ) -> Vec<u8> {
1675-
let result = SubtensorModule::get_remaining_arbitration_period( coldkey_account_vec );
1676-
result.encode()
1677-
}
1678-
1679-
fn get_coldkey_swap_destinations( coldkey_account_vec: Vec<u8> ) -> Vec<u8> {
1680-
let result = SubtensorModule::get_coldkey_swap_destinations( coldkey_account_vec );
1681-
result.encode()
1682-
}
1683-
}
16841667
}
16851668

16861669
// #[cfg(test)]

0 commit comments

Comments
 (0)