Skip to content

Commit 0d421e5

Browse files
committed
Rename submetagraph to mechagraph in RPC calls
1 parent 7f40539 commit 0d421e5

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

pallets/subtensor/rpc/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ pub trait SubtensorCustomApi<BlockHash> {
7272
fn get_all_metagraphs(&self, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
7373
#[method(name = "subnetInfo_getMetagraph")]
7474
fn get_metagraph(&self, netuid: NetUid, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
75-
#[method(name = "subnetInfo_getAllSubMetagraphs")]
76-
fn get_all_submetagraphs(&self, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
77-
#[method(name = "subnetInfo_getSubMetagraph")]
78-
fn get_submetagraph(
75+
#[method(name = "subnetInfo_getAllMechagraphs")]
76+
fn get_all_mechagraphs(&self, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
77+
#[method(name = "subnetInfo_getMechagraph")]
78+
fn get_mechagraph(
7979
&self,
8080
netuid: NetUid,
8181
mecid: MechId,
@@ -92,8 +92,8 @@ pub trait SubtensorCustomApi<BlockHash> {
9292
metagraph_index: Vec<u16>,
9393
at: Option<BlockHash>,
9494
) -> RpcResult<Vec<u8>>;
95-
#[method(name = "subnetInfo_getSelectiveSubMetagraph")]
96-
fn get_selective_submetagraph(
95+
#[method(name = "subnetInfo_getSelectiveMechagraph")]
96+
fn get_selective_mechagraph(
9797
&self,
9898
netuid: NetUid,
9999
mecid: MechId,
@@ -336,11 +336,11 @@ where
336336
}
337337
}
338338

339-
fn get_all_submetagraphs(&self, at: Option<<Block as BlockT>::Hash>) -> RpcResult<Vec<u8>> {
339+
fn get_all_mechagraphs(&self, at: Option<<Block as BlockT>::Hash>) -> RpcResult<Vec<u8>> {
340340
let api = self.client.runtime_api();
341341
let at = at.unwrap_or_else(|| self.client.info().best_hash);
342342

343-
match api.get_all_submetagraphs(at) {
343+
match api.get_all_mechagraphs(at) {
344344
Ok(result) => Ok(result.encode()),
345345
Err(e) => Err(Error::RuntimeError(format!("Unable to get metagraps: {e:?}")).into()),
346346
}
@@ -379,15 +379,15 @@ where
379379
}
380380
}
381381

382-
fn get_submetagraph(
382+
fn get_mechagraph(
383383
&self,
384384
netuid: NetUid,
385385
mecid: MechId,
386386
at: Option<<Block as BlockT>::Hash>,
387387
) -> RpcResult<Vec<u8>> {
388388
let api = self.client.runtime_api();
389389
let at = at.unwrap_or_else(|| self.client.info().best_hash);
390-
match api.get_submetagraph(at, netuid, mecid) {
390+
match api.get_mechagraph(at, netuid, mecid) {
391391
Ok(result) => Ok(result.encode()),
392392
Err(e) => Err(Error::RuntimeError(format!(
393393
"Unable to get dynamic subnets info: {e:?}"
@@ -472,7 +472,7 @@ where
472472
}
473473
}
474474

475-
fn get_selective_submetagraph(
475+
fn get_selective_mechagraph(
476476
&self,
477477
netuid: NetUid,
478478
mecid: MechId,
@@ -482,7 +482,7 @@ where
482482
let api = self.client.runtime_api();
483483
let at = at.unwrap_or_else(|| self.client.info().best_hash);
484484

485-
match api.get_selective_submetagraph(at, netuid, mecid, metagraph_index) {
485+
match api.get_selective_mechagraph(at, netuid, mecid, metagraph_index) {
486486
Ok(result) => Ok(result.encode()),
487487
Err(e) => {
488488
Err(Error::RuntimeError(format!("Unable to get selective metagraph: {e:?}")).into())

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ sp_api::decl_runtime_apis! {
4040
fn get_all_dynamic_info() -> Vec<Option<DynamicInfo<AccountId32>>>;
4141
fn get_all_metagraphs() -> Vec<Option<Metagraph<AccountId32>>>;
4242
fn get_metagraph(netuid: NetUid) -> Option<Metagraph<AccountId32>>;
43-
fn get_all_submetagraphs() -> Vec<Option<Metagraph<AccountId32>>>;
44-
fn get_submetagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<AccountId32>>;
43+
fn get_all_mechagraphs() -> Vec<Option<Metagraph<AccountId32>>>;
44+
fn get_mechagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<AccountId32>>;
4545
fn get_dynamic_info(netuid: NetUid) -> Option<DynamicInfo<AccountId32>>;
4646
fn get_subnet_state(netuid: NetUid) -> Option<SubnetState<AccountId32>>;
4747
fn get_selective_metagraph(netuid: NetUid, metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>>;
48-
fn get_selective_submetagraph(netuid: NetUid, mecid: MechId, metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>>;
48+
fn get_selective_mechagraph(netuid: NetUid, mecid: MechId, metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>>;
4949
}
5050

5151
pub trait StakeInfoRuntimeApi {

pallets/subtensor/src/rpc_info/metagraph.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ impl<T: Config> Pallet<T> {
805805
metagraphs
806806
}
807807

808-
pub fn get_submetagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<T::AccountId>> {
808+
pub fn get_mechagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<T::AccountId>> {
809809
if Self::ensure_mechanism_exists(netuid, mecid).is_err() {
810810
return None;
811811
}
@@ -832,13 +832,13 @@ impl<T: Config> Pallet<T> {
832832
}
833833
}
834834

835-
pub fn get_all_submetagraphs() -> Vec<Option<Metagraph<T::AccountId>>> {
835+
pub fn get_all_mechagraphs() -> Vec<Option<Metagraph<T::AccountId>>> {
836836
let netuids = Self::get_all_subnet_netuids();
837837
let mut metagraphs = Vec::<Option<Metagraph<T::AccountId>>>::new();
838838
for netuid in netuids.clone().iter() {
839839
let mechanism_count = u8::from(MechanismCountCurrent::<T>::get(netuid));
840840
for mecid in 0..mechanism_count {
841-
metagraphs.push(Self::get_submetagraph(*netuid, MechId::from(mecid)));
841+
metagraphs.push(Self::get_mechagraph(*netuid, MechId::from(mecid)));
842842
}
843843
}
844844
metagraphs
@@ -860,7 +860,7 @@ impl<T: Config> Pallet<T> {
860860
}
861861
}
862862

863-
pub fn get_selective_submetagraph(
863+
pub fn get_selective_mechagraph(
864864
netuid: NetUid,
865865
mecid: MechId,
866866
metagraph_indexes: Vec<u16>,
@@ -870,7 +870,7 @@ impl<T: Config> Pallet<T> {
870870
} else {
871871
let mut result = SelectiveMetagraph::default();
872872
for index in metagraph_indexes.iter() {
873-
let value = Self::get_single_selective_submetagraph(netuid, mecid, *index);
873+
let value = Self::get_single_selective_mechagraph(netuid, mecid, *index);
874874
result.merge_value(&value, *index as usize);
875875
}
876876
Some(result)
@@ -1441,7 +1441,7 @@ impl<T: Config> Pallet<T> {
14411441
}
14421442
}
14431443

1444-
fn get_single_selective_submetagraph(
1444+
fn get_single_selective_mechagraph(
14451445
netuid: NetUid,
14461446
mecid: MechId,
14471447
metagraph_index: u16,

runtime/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,8 +2334,8 @@ impl_runtime_apis! {
23342334
SubtensorModule::get_metagraph(netuid)
23352335
}
23362336

2337-
fn get_submetagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<AccountId32>> {
2338-
SubtensorModule::get_submetagraph(netuid, mecid)
2337+
fn get_mechagraph(netuid: NetUid, mecid: MechId) -> Option<Metagraph<AccountId32>> {
2338+
SubtensorModule::get_mechagraph(netuid, mecid)
23392339
}
23402340

23412341
fn get_subnet_state(netuid: NetUid) -> Option<SubnetState<AccountId32>> {
@@ -2346,8 +2346,8 @@ impl_runtime_apis! {
23462346
SubtensorModule::get_all_metagraphs()
23472347
}
23482348

2349-
fn get_all_submetagraphs() -> Vec<Option<Metagraph<AccountId32>>> {
2350-
SubtensorModule::get_all_submetagraphs()
2349+
fn get_all_mechagraphs() -> Vec<Option<Metagraph<AccountId32>>> {
2350+
SubtensorModule::get_all_mechagraphs()
23512351
}
23522352

23532353
fn get_all_dynamic_info() -> Vec<Option<DynamicInfo<AccountId32>>> {
@@ -2358,8 +2358,8 @@ impl_runtime_apis! {
23582358
SubtensorModule::get_selective_metagraph(netuid, metagraph_indexes)
23592359
}
23602360

2361-
fn get_selective_submetagraph(netuid: NetUid, mecid: MechId, metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>> {
2362-
SubtensorModule::get_selective_submetagraph(netuid, mecid, metagraph_indexes)
2361+
fn get_selective_mechagraph(netuid: NetUid, mecid: MechId, metagraph_indexes: Vec<u16>) -> Option<SelectiveMetagraph<AccountId32>> {
2362+
SubtensorModule::get_selective_mechagraph(netuid, mecid, metagraph_indexes)
23632363
}
23642364
}
23652365

0 commit comments

Comments
 (0)