diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 56646f857..f789d8191 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -234,6 +234,11 @@ pub mod pallet { } #[pallet::type_value] /// Default value for zero. + pub fn DefaultZeroU128() -> u128 { + 0 + } + #[pallet::type_value] + /// Default value for zero. pub fn DefaultZeroU16() -> u16 { 0 } @@ -907,7 +912,7 @@ pub mod pallet { pub type DynamicBlock = StorageValue<_, u64, ValueQuery>; #[pallet::storage] // --- MAP ( netuid ) --> total_volume | The total amount of TAO bought and sold since the start of the network. pub type SubnetVolume = - StorageMap<_, Identity, u16, u64, ValueQuery, DefaultZeroU64>; + StorageMap<_, Identity, u16, u128, ValueQuery, DefaultZeroU128>; #[pallet::storage] // --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. pub type SubnetTAO = StorageMap<_, Identity, u16, u64, ValueQuery, DefaultZeroU64>; diff --git a/pallets/subtensor/src/rpc_info/dynamic_info.rs b/pallets/subtensor/src/rpc_info/dynamic_info.rs index bbee27c55..27d10dc2d 100644 --- a/pallets/subtensor/src/rpc_info/dynamic_info.rs +++ b/pallets/subtensor/src/rpc_info/dynamic_info.rs @@ -4,7 +4,7 @@ use codec::Compact; use frame_support::pallet_prelude::{Decode, Encode}; use subtensor_macros::freeze_struct; -#[freeze_struct("1be5a1e26a82082f")] +#[freeze_struct("a5cdc80d655398e9")] #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)] pub struct DynamicInfo { netuid: Compact, @@ -24,7 +24,7 @@ pub struct DynamicInfo { tao_in_emission: Compact, pending_alpha_emission: Compact, pending_root_emission: Compact, - subnet_volume: Compact, + subnet_volume: Compact, network_registered_at: Compact, subnet_identity: Option, } diff --git a/pallets/subtensor/src/rpc_info/metagraph.rs b/pallets/subtensor/src/rpc_info/metagraph.rs index ee3864932..267af1d05 100644 --- a/pallets/subtensor/src/rpc_info/metagraph.rs +++ b/pallets/subtensor/src/rpc_info/metagraph.rs @@ -6,7 +6,7 @@ use frame_support::pallet_prelude::{Decode, Encode}; use substrate_fixed::types::I64F64; use subtensor_macros::freeze_struct; -#[freeze_struct("fa24d156067e5eb9")] +#[freeze_struct("7c5fe907490c5d5e")] #[derive(Decode, Encode, PartialEq, Eq, Clone, Debug)] pub struct Metagraph { // Subnet index @@ -38,7 +38,7 @@ pub struct Metagraph { tao_in_emission: Compact, // amount of tao injected per block pending_alpha_emission: Compact, // pending alpha to be distributed pending_root_emission: Compact, // panding tao for root divs to be distributed - subnet_volume: Compact, // volume of the subnet in TAO + subnet_volume: Compact, // volume of the subnet in TAO // Hparams for epoch rho: Compact, // subnet rho param diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index 4c446947f..147490dd8 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -557,9 +557,9 @@ impl Pallet { TotalStake::::mutate(|total| { *total = total.saturating_add(tao); }); - // Step 8. Decrease Alpha reserves. + // Step 8. Increase total subnet TAO volume. SubnetVolume::::mutate(netuid, |total| { - *total = total.saturating_add(tao); + *total = total.saturating_add(tao.into()); }); // Step 9. Return the alpha received. alpha @@ -589,9 +589,9 @@ impl Pallet { TotalStake::::mutate(|total| { *total = total.saturating_sub(tao); }); - // Step 8. Decrease Alpha reserves. + // Step 8. Increase total subnet TAO volume. SubnetVolume::::mutate(netuid, |total| { - *total = total.saturating_add(tao); + *total = total.saturating_add(tao.into()); }); // Step 9. Return the tao received. tao