Skip to content

Commit

Permalink
remove rpc call
Browse files Browse the repository at this point in the history
  • Loading branch information
andreea-popescu-reef committed Aug 31, 2024
1 parent dbbd79a commit 51df2e4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
21 changes: 0 additions & 21 deletions pallets/subtensor/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ pub trait SubtensorCustomApi<BlockHash> {
fn get_neurons(&self, netuid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
#[method(name = "neuronInfo_getNeuron")]
fn get_neuron(&self, netuid: u16, uid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
#[method(name = "neuronInfo_getNeuronCertificate")]
fn get_neuron_certificate(
&self,
netuid: u16,
uid: u16,
at: Option<BlockHash>,
) -> RpcResult<Vec<u8>>;
#[method(name = "subnetInfo_getSubnetInfo")]
fn get_subnet_info(&self, netuid: u16, at: Option<BlockHash>) -> RpcResult<Vec<u8>>;
#[method(name = "subnetInfo_getSubnetsInfo")]
Expand Down Expand Up @@ -193,20 +186,6 @@ where
.map_err(|e| Error::RuntimeError(format!("Unable to get neuron info: {:?}", e)).into())
}

fn get_neuron_certificate(
&self,
netuid: u16,
uid: u16,
at: Option<<Block as BlockT>::Hash>,
) -> RpcResult<Vec<u8>> {
let api = self.client.runtime_api();
let at = at.unwrap_or_else(|| self.client.info().best_hash);

api.get_neuron_certificate(at, netuid, uid).map_err(|e| {
Error::RuntimeError(format!("Unable to get neuron certificate: {:?}", e)).into()
})
}

fn get_subnet_info(
&self,
netuid: u16,
Expand Down
1 change: 0 additions & 1 deletion pallets/subtensor/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ sp_api::decl_runtime_apis! {
pub trait NeuronInfoRuntimeApi {
fn get_neurons(netuid: u16) -> Vec<u8>;
fn get_neuron(netuid: u16, uid: u16) -> Vec<u8>;
fn get_neuron_certificate(netuid: u16, uid: u16) -> Vec<u8>;
fn get_neurons_lite(netuid: u16) -> Vec<u8>;
fn get_neuron_lite(netuid: u16, uid: u16) -> Vec<u8>;
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/tests/serving.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn test_serving_ok() {

#[test]
fn test_serving_tls_ok() {
new_test_ext().execute_with(|| {
new_test_ext(1).execute_with(|| {
let hotkey_account_id = U256::from(1);
let uid: u16 = 0;
let netuid: u16 = 1;
Expand Down
4 changes: 0 additions & 4 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1390,10 +1390,6 @@ impl_runtime_apis! {
fn get_neuron(netuid: u16, uid: u16) -> Vec<u8> {
SubtensorModule::get_neuron(netuid, uid).map(|r| r.encode()).unwrap_or(vec![])
}

fn get_neuron_certificate(netuid: u16, uid: u16) -> Vec<u8> {
SubtensorModule::get_neuron_certificate(netuid, uid).map(|r| r.encode()).unwrap_or(vec![])
}
}

impl subtensor_custom_rpc_runtime_api::SubnetInfoRuntimeApi<Block> for Runtime {
Expand Down

0 comments on commit 51df2e4

Please sign in to comment.