Skip to content

Commit 28321a1

Browse files
authored
Merge pull request #1210 from opentensor/feat/add-subnet-volume-to-runtime-apis
[RAO] add subnet volume to runtimeAPIs
2 parents 628e38a + 2bf5854 commit 28321a1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pallets/subtensor/src/rpc_info/dynamic_info.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use codec::Compact;
44
use frame_support::pallet_prelude::{Decode, Encode};
55
use subtensor_macros::freeze_struct;
66

7-
#[freeze_struct("44fd17b240416875")]
7+
#[freeze_struct("1be5a1e26a82082f")]
88
#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)]
99
pub struct DynamicInfo<T: Config> {
1010
netuid: Compact<u16>,
@@ -24,6 +24,7 @@ pub struct DynamicInfo<T: Config> {
2424
tao_in_emission: Compact<u64>,
2525
pending_alpha_emission: Compact<u64>,
2626
pending_root_emission: Compact<u64>,
27+
subnet_volume: Compact<u64>,
2728
network_registered_at: Compact<u64>,
2829
subnet_identity: Option<SubnetIdentity>,
2930
}
@@ -60,6 +61,7 @@ impl<T: Config> Pallet<T> {
6061
tao_in_emission: SubnetTaoInEmission::<T>::get(netuid).into(),
6162
pending_alpha_emission: PendingEmission::<T>::get(netuid).into(),
6263
pending_root_emission: PendingRootDivs::<T>::get(netuid).into(),
64+
subnet_volume: SubnetVolume::<T>::get(netuid).into(),
6365
network_registered_at: NetworkRegisteredAt::<T>::get(netuid).into(),
6466
subnet_identity: SubnetIdentities::<T>::get(netuid),
6567
})

pallets/subtensor/src/rpc_info/metagraph.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use frame_support::pallet_prelude::{Decode, Encode};
66
use substrate_fixed::types::I64F64;
77
use subtensor_macros::freeze_struct;
88

9-
#[freeze_struct("bce2310daa502e48")]
9+
#[freeze_struct("fa24d156067e5eb9")]
1010
#[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)]
1111
pub struct Metagraph<T: Config> {
1212
// Subnet index
@@ -38,6 +38,7 @@ pub struct Metagraph<T: Config> {
3838
tao_in_emission: Compact<u64>, // amount of tao injected per block
3939
pending_alpha_emission: Compact<u64>, // pending alpha to be distributed
4040
pending_root_emission: Compact<u64>, // panding tao for root divs to be distributed
41+
subnet_volume: Compact<u64>, // volume of the subnet in TAO
4142

4243
// Hparams for epoch
4344
rho: Compact<u16>, // subnet rho param
@@ -141,6 +142,8 @@ impl<T: Config> Pallet<T> {
141142
Vec<I64F64>,
142143
Vec<I64F64>,
143144
) = Self::get_stake_weights_for_network(netuid);
145+
146+
let subnet_volume = SubnetVolume::<T>::get(netuid);
144147
Some(Metagraph {
145148
// Subnet index
146149
netuid: netuid.into(), // subnet index.
@@ -177,6 +180,7 @@ impl<T: Config> Pallet<T> {
177180
tao_in_emission: SubnetTaoInEmission::<T>::get(netuid).into(), // amount of tao injected per block
178181
pending_alpha_emission: PendingEmission::<T>::get(netuid).into(), // pending alpha to be distributed
179182
pending_root_emission: PendingRootDivs::<T>::get(netuid).into(), // panding tao for root divs to be distributed
183+
subnet_volume: subnet_volume.into(),
180184

181185
// Hparams for epoch
182186
rho: Self::get_rho(netuid).into(), // subnet rho param

0 commit comments

Comments
 (0)