Skip to content

Commit 12f483c

Browse files
committed
remove subnet_info_v3
1 parent a7232b0 commit 12f483c

File tree

4 files changed

+3
-116
lines changed

4 files changed

+3
-116
lines changed

pallets/subtensor/rpc/src/lib.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ pub trait SubtensorCustomApi<BlockHash> {
4949
fn get_subnet_info_v2(&self, netuid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
5050
#[method(name = "subnetInfo_getSubnetsInf_v2")]
5151
fn get_subnets_info_v2(&self, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
52-
#[method(name = "subnetInfo_getSubnetInfo_v3")]
53-
fn get_subnet_info_v3(&self, netuid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
54-
#[method(name = "subnetInfo_getSubnetsInf_v3")]
55-
fn get_subnets_info_v3(&self, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
5652
#[method(name = "subnetInfo_getSubnetHyperparams")]
5753
fn get_subnet_hyperparams(&self, netuid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
5854
#[method(name = "subnetInfo_getAllDynamicInfo")]
@@ -302,26 +298,6 @@ where
302298
.map_err(|e| Error::RuntimeError(format!("Unable to get subnets info: {:?}", e)).into())
303299
}
304300

305-
fn get_subnet_info_v3(
306-
&self,
307-
netuid: u16,
308-
at: Option<<Block as BlockT>::Hash>,
309-
) -> RpcResult<Vec<u8>> {
310-
let api = self.client.runtime_api();
311-
let at = at.unwrap_or_else(|| self.client.info().best_hash);
312-
313-
api.get_subnet_info_v3(at, netuid)
314-
.map_err(|e| Error::RuntimeError(format!("Unable to get subnet info: {:?}", e)).into())
315-
}
316-
317-
fn get_subnets_info_v3(&self, at: Option<<Block as BlockT>::Hash>) -> RpcResult<Vec<u8>> {
318-
let api = self.client.runtime_api();
319-
let at = at.unwrap_or_else(|| self.client.info().best_hash);
320-
321-
api.get_subnets_info_v3(at)
322-
.map_err(|e| Error::RuntimeError(format!("Unable to get subnets info: {:?}", e)).into())
323-
}
324-
325301
fn get_network_lock_cost(&self, at: Option<<Block as BlockT>::Hash>) -> RpcResult<u64> {
326302
let api = self.client.runtime_api();
327303
let at = at.unwrap_or_else(|| self.client.info().best_hash);

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ sp_api::decl_runtime_apis! {
2323
fn get_subnets_info() -> Vec<u8>;
2424
fn get_subnet_info_v2(netuid: u16) -> Vec<u8>;
2525
fn get_subnets_info_v2() -> Vec<u8>;
26-
fn get_subnet_info_v3(netuid: u16) -> Vec<u8>;
27-
fn get_subnets_info_v3()-> Vec<u8>;
2826
fn get_subnet_hyperparams(netuid: u16) -> Vec<u8>;
2927
fn get_all_dynamic_info() -> Vec<u8>;
3028
fn get_all_metagraphs() -> Vec<u8>;

pallets/subtensor/src/rpc_info/subnet_info.rs

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct SubnetInfo<T: Config> {
2727
owner: T::AccountId,
2828
}
2929

30-
#[freeze_struct("65f931972fa13222")]
30+
#[freeze_struct("c46dc4e2d4d9f8a3")]
3131
#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)]
3232
pub struct SubnetInfov2<T: Config> {
3333
netuid: Compact<u16>,
@@ -48,7 +48,7 @@ pub struct SubnetInfov2<T: Config> {
4848
emission_values: Compact<u64>,
4949
burn: Compact<u64>,
5050
owner: T::AccountId,
51-
identity: Option<SubnetIdentity>,
51+
identity: Option<SubnetIdentityV2>,
5252
}
5353

5454
#[freeze_struct("dd91200554b75bc4")]
@@ -198,7 +198,7 @@ impl<T: Config> Pallet<T> {
198198
let network_modality = <NetworkModality<T>>::get(netuid);
199199
let emission_values = Self::get_emission_value(netuid);
200200
let burn: Compact<u64> = Self::get_burn_as_u64(netuid).into();
201-
let identity: Option<SubnetIdentity> = SubnetIdentities::<T>::get(netuid);
201+
let identity: Option<SubnetIdentityV2> = SubnetIdentitiesV2::<T>::get(netuid);
202202

203203
// DEPRECATED
204204
let network_connect: Vec<[u16; 2]> = Vec::<[u16; 2]>::new();
@@ -250,78 +250,6 @@ impl<T: Config> Pallet<T> {
250250
subnets_info
251251
}
252252

253-
pub fn get_subnet_info_v3(netuid: u16) -> Option<SubnetInfov3<T>> {
254-
if !Self::if_subnet_exist(netuid) {
255-
return None;
256-
}
257-
258-
let rho = Self::get_rho(netuid);
259-
let kappa = Self::get_kappa(netuid);
260-
let difficulty: Compact<u64> = Self::get_difficulty_as_u64(netuid).into();
261-
let immunity_period = Self::get_immunity_period(netuid);
262-
let max_allowed_validators = Self::get_max_allowed_validators(netuid);
263-
let min_allowed_weights = Self::get_min_allowed_weights(netuid);
264-
let max_weights_limit = Self::get_max_weight_limit(netuid);
265-
let scaling_law_power = Self::get_scaling_law_power(netuid);
266-
let subnetwork_n = Self::get_subnetwork_n(netuid);
267-
let max_allowed_uids = Self::get_max_allowed_uids(netuid);
268-
let blocks_since_last_step = Self::get_blocks_since_last_step(netuid);
269-
let tempo = Self::get_tempo(netuid);
270-
let network_modality = <NetworkModality<T>>::get(netuid);
271-
let emission_values = Self::get_emission_value(netuid);
272-
let burn: Compact<u64> = Self::get_burn_as_u64(netuid).into();
273-
let identity: Option<SubnetIdentityV2> = SubnetIdentitiesV2::<T>::get(netuid);
274-
275-
// DEPRECATED
276-
let network_connect: Vec<[u16; 2]> = Vec::<[u16; 2]>::new();
277-
// DEPRECATED for ( _netuid_, con_req) in < NetworkConnect<T> as IterableStorageDoubleMap<u16, u16, u16> >::iter_prefix(netuid) {
278-
// network_connect.push([_netuid_, con_req]);
279-
// }
280-
281-
Some(SubnetInfov3 {
282-
rho: rho.into(),
283-
kappa: kappa.into(),
284-
difficulty,
285-
immunity_period: immunity_period.into(),
286-
netuid: netuid.into(),
287-
max_allowed_validators: max_allowed_validators.into(),
288-
min_allowed_weights: min_allowed_weights.into(),
289-
max_weights_limit: max_weights_limit.into(),
290-
scaling_law_power: scaling_law_power.into(),
291-
subnetwork_n: subnetwork_n.into(),
292-
max_allowed_uids: max_allowed_uids.into(),
293-
blocks_since_last_step: blocks_since_last_step.into(),
294-
tempo: tempo.into(),
295-
network_modality: network_modality.into(),
296-
network_connect,
297-
emission_values: emission_values.into(),
298-
burn,
299-
owner: Self::get_subnet_owner(netuid),
300-
identity,
301-
})
302-
}
303-
304-
pub fn get_subnets_info_v3() -> Vec<Option<SubnetInfov3<T>>> {
305-
let mut subnet_netuids = Vec::<u16>::new();
306-
let mut max_netuid: u16 = 0;
307-
for (netuid, added) in <NetworksAdded<T> as IterableStorageMap<u16, bool>>::iter() {
308-
if added {
309-
subnet_netuids.push(netuid);
310-
if netuid > max_netuid {
311-
max_netuid = netuid;
312-
}
313-
}
314-
}
315-
316-
let mut subnets_info = Vec::<Option<SubnetInfov3<T>>>::new();
317-
for netuid_ in 0..=max_netuid {
318-
if subnet_netuids.contains(&netuid_) {
319-
subnets_info.push(Self::get_subnet_info_v3(netuid_));
320-
}
321-
}
322-
323-
subnets_info
324-
}
325253
pub fn get_subnet_hyperparams(netuid: u16) -> Option<SubnetHyperparams> {
326254
if !Self::if_subnet_exist(netuid) {
327255
return None;

runtime/src/lib.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,21 +2096,6 @@ impl_runtime_apis! {
20962096
result.encode()
20972097
}
20982098

2099-
fn get_subnet_info_v3(netuid: u16) -> Vec<u8> {
2100-
let _result = SubtensorModule::get_subnet_info_v3(netuid);
2101-
if _result.is_some() {
2102-
let result = _result.expect("Could not get SubnetInfo");
2103-
result.encode()
2104-
} else {
2105-
vec![]
2106-
}
2107-
}
2108-
2109-
fn get_subnets_info_v3() -> Vec<u8> {
2110-
let result = SubtensorModule::get_subnets_info_v3();
2111-
result.encode()
2112-
}
2113-
21142099
fn get_subnet_hyperparams(netuid: u16) -> Vec<u8> {
21152100
let _result = SubtensorModule::get_subnet_hyperparams(netuid);
21162101
if _result.is_some() {

0 commit comments

Comments
 (0)