From da18abc00773af43a6b5e050ed085178170c29fe Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 18:40:31 +0800 Subject: [PATCH 01/13] fix doc for storage --- pallets/subtensor/src/lib.rs | 118 +++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 39 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index ca55a0ab52..8277cda91d 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -898,9 +898,10 @@ pub mod pallet { 128 } - #[pallet::storage] - pub type MinActivityCutoff = - StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; + /// Global minimum activity cutoff, not used anymore. + // #[pallet::storage] + // pub type MinActivityCutoff = + // StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; #[pallet::storage] /// Global window (in blocks) at the end of each tempo where admin ops are disallowed @@ -913,14 +914,17 @@ pub mod pallet { StorageValue<_, u16, ValueQuery, DefaultOwnerHyperparamRateLimit>; #[pallet::storage] + /// Duration of coldkey swap schedule before execution pub type ColdkeySwapScheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultColdkeySwapScheduleDuration>; #[pallet::storage] + /// Duration of coldkey swap reschedule before execution pub type ColdkeySwapRescheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultColdkeySwapRescheduleDuration>; #[pallet::storage] + /// Duration of dissolve network schedule before execution pub type DissolveNetworkScheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultDissolveNetworkScheduleDuration>; @@ -1026,7 +1030,8 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] // --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. + #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. pub type AlphaDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1037,7 +1042,8 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] // --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. + #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. pub type TaoDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1081,52 +1087,68 @@ pub mod pallet { /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - #[pallet::storage] // --- ITEM ( maximum_number_of_networks ) + #[pallet::storage] + /// --- ITEM ( maximum_number_of_networks ) pub type SubnetLimit = StorageValue<_, u16, ValueQuery, DefaultSubnetLimit>; - #[pallet::storage] // --- ITEM ( total_issuance ) + #[pallet::storage] + /// --- ITEM ( total_issuance ) pub type TotalIssuance = StorageValue<_, TaoCurrency, ValueQuery, DefaultTotalIssuance>; - #[pallet::storage] // --- ITEM ( total_stake ) + #[pallet::storage] + /// --- ITEM ( total_stake ) pub type TotalStake = StorageValue<_, TaoCurrency, ValueQuery>; - #[pallet::storage] // --- ITEM ( moving_alpha ) -- subnet moving alpha. + #[pallet::storage] + /// --- ITEM ( moving_alpha ) -- subnet moving alpha. pub type SubnetMovingAlpha = StorageValue<_, I96F32, ValueQuery, DefaultMovingAlpha>; - #[pallet::storage] // --- MAP ( netuid ) --> moving_price | The subnet moving price. + #[pallet::storage] + /// --- MAP ( netuid ) --> moving_price | The subnet moving price. pub type SubnetMovingPrice = StorageMap<_, Identity, NetUid, I96F32, ValueQuery, DefaultMovingPrice>; - #[pallet::storage] // --- MAP ( netuid ) --> total_volume | The total amount of TAO bought and sold since the start of the network. + #[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, NetUid, u128, ValueQuery, DefaultZeroU128>; - #[pallet::storage] // --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. + #[pallet::storage] + /// --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. pub type SubnetTAO = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] // --- MAP ( netuid ) --> tao_in_user_subnet | Returns the amount of TAO in the subnet reserve provided by users as liquidity. + #[pallet::storage] + /// --- MAP ( netuid ) --> tao_in_user_subnet | Returns the amount of TAO in the subnet reserve provided by users as liquidity. pub type SubnetTaoProvided = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] // --- MAP ( netuid ) --> alpha_in_emission | Returns the amount of alph in emission into the pool per block. + #[pallet::storage] + /// --- MAP ( netuid ) --> alpha_in_emission | Returns the amount of alph in emission into the pool per block. pub type SubnetAlphaInEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] // --- MAP ( netuid ) --> alpha_out_emission | Returns the amount of alpha out emission into the network per block. + #[pallet::storage] + /// --- MAP ( netuid ) --> alpha_out_emission | Returns the amount of alpha out emission into the network per block. pub type SubnetAlphaOutEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] // --- MAP ( netuid ) --> tao_in_emission | Returns the amount of tao emitted into this subent on the last block. + #[pallet::storage] + /// --- MAP ( netuid ) --> tao_in_emission | Returns the amount of tao emitted into this subent on the last block. pub type SubnetTaoInEmission = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] // --- MAP ( netuid ) --> alpha_supply_in_pool | Returns the amount of alpha in the pool. + #[pallet::storage] + /// --- MAP ( netuid ) --> alpha_supply_in_pool | Returns the amount of alpha in the pool. pub type SubnetAlphaIn = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] // --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity. + #[pallet::storage] + /// --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity. pub type SubnetAlphaInProvided = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; #[pallet::storage] /// --- MAP ( netuid ) --> alpha_supply_in_subnet | Returns the amount of alpha in the subnet. pub type SubnetAlphaOut = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] // --- MAP ( cold ) --> Vec | Maps coldkey to hotkeys that stake to it + #[pallet::storage] + /// --- MAP ( cold ) --> Vec | Maps coldkey to hotkeys that stake to it pub type StakingHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; - #[pallet::storage] // --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. + #[pallet::storage] + /// --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. pub type OwnedHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; - #[pallet::storage] // --- DMAP ( cold, netuid )--> hot | Returns the hotkey a coldkey will autostake to with mining rewards. + #[pallet::storage] + /// --- DMAP ( cold, netuid )--> hot | Returns the hotkey a coldkey will autostake to with mining rewards. pub type AutoStakeDestination = StorageDoubleMap< _, Blake2_128Concat, @@ -1136,7 +1158,8 @@ pub mod pallet { T::AccountId, OptionQuery, >; - #[pallet::storage] // --- DMAP ( hot, netuid )--> Vec | Returns a list of coldkeys that are autostaking to a hotkey. + #[pallet::storage] + /// --- DMAP ( hot, netuid )--> Vec | Returns a list of coldkeys that are autostaking to a hotkey. pub type AutoStakeDestinationColdkeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1147,7 +1170,8 @@ pub mod pallet { ValueQuery, >; - #[pallet::storage] // --- DMAP ( cold ) --> (block_expected, new_coldkey) | Maps coldkey to the block to swap at and new coldkey. + #[pallet::storage] + /// --- DMAP ( cold ) --> (block_expected, new_coldkey) | Maps coldkey to the block to swap at and new coldkey. pub type ColdkeySwapScheduled = StorageMap< _, Blake2_128Concat, @@ -1157,7 +1181,8 @@ pub mod pallet { DefaultColdkeySwapScheduled, >; - #[pallet::storage] // --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owns. + #[pallet::storage] + /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owns. pub type TotalHotkeyAlpha = StorageDoubleMap< _, Blake2_128Concat, @@ -1168,7 +1193,8 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] // --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owned in the last epoch. + #[pallet::storage] + /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owned in the last epoch. pub type TotalHotkeyAlphaLastEpoch = StorageDoubleMap< _, Blake2_128Concat, @@ -1191,7 +1217,8 @@ pub mod pallet { ValueQuery, DefaultSharePoolZero, >; - #[pallet::storage] // --- NMAP ( hot, cold, netuid ) --> alpha | Returns the alpha shares for a hotkey, coldkey, netuid triplet. + #[pallet::storage] + /// --- NMAP ( hot, cold, netuid ) --> alpha | Returns the alpha shares for a hotkey, coldkey, netuid triplet. pub type Alpha = StorageNMap< _, ( @@ -1202,7 +1229,8 @@ pub mod pallet { U64F64, // Shares ValueQuery, >; - #[pallet::storage] // --- MAP ( netuid ) --> token_symbol | Returns the token symbol for a subnet. + #[pallet::storage] + /// --- MAP ( netuid ) --> token_symbol | Returns the token symbol for a subnet. pub type TokenSymbol = StorageMap<_, Identity, NetUid, Vec, ValueQuery, DefaultUnicodeVecU8>; @@ -1261,20 +1289,24 @@ pub mod pallet { /// ============================ /// ==== Subnet Locks ===== /// ============================ - #[pallet::storage] // --- MAP ( netuid ) --> transfer_toggle + #[pallet::storage] + /// --- MAP ( netuid ) --> transfer_toggle pub type TransferToggle = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultTrue>; - #[pallet::storage] // --- MAP ( netuid ) --> total_subnet_locked + #[pallet::storage] + /// --- MAP ( netuid ) --> total_subnet_locked pub type SubnetLocked = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] // --- MAP ( netuid ) --> largest_locked + #[pallet::storage] + /// --- MAP ( netuid ) --> largest_locked pub type LargestLocked = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultZeroU64>; /// ================= /// ==== Tempos ===== /// ================= - #[pallet::storage] // --- MAP ( netuid ) --> tempo + #[pallet::storage] + /// --- MAP ( netuid ) --> tempo pub type Tempo = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultTempo>; /// ============================ @@ -1553,7 +1585,8 @@ pub mod pallet { /// ======================================= /// ==== Subnetwork Consensus Storage ==== /// ======================================= - #[pallet::storage] // --- DMAP ( netuid ) --> stake_weight | weight for stake used in YC. + #[pallet::storage] + /// --- DMAP ( netuid ) --> stake_weight | weight for stake used in YC. pub type StakeWeight = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; #[pallet::storage] @@ -1688,30 +1721,36 @@ pub mod pallet { PrometheusInfoOf, OptionQuery, >; - #[pallet::storage] // --- MAP ( coldkey ) --> identity. (DEPRECATED for V2) + #[pallet::storage] + /// --- MAP ( coldkey ) --> identity. (DEPRECATED for V2) pub type Identities = StorageMap<_, Blake2_128Concat, T::AccountId, ChainIdentityOf, OptionQuery>; - #[pallet::storage] // --- MAP ( coldkey ) --> identity + #[pallet::storage] + /// --- MAP ( coldkey ) --> identity pub type IdentitiesV2 = StorageMap<_, Blake2_128Concat, T::AccountId, ChainIdentityOfV2, OptionQuery>; - #[pallet::storage] // --- MAP ( netuid ) --> identity. (DEPRECATED for V2) + #[pallet::storage] + /// --- MAP ( netuid ) --> identity. (DEPRECATED for V2) pub type SubnetIdentities = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOf, OptionQuery>; - #[pallet::storage] // --- MAP ( netuid ) --> identityV2 (DEPRECATED for V3) + #[pallet::storage] + /// --- MAP ( netuid ) --> identityV2 (DEPRECATED for V3) pub type SubnetIdentitiesV2 = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOfV2, OptionQuery>; - #[pallet::storage] // --- MAP ( netuid ) --> SubnetIdentityOfV3 + #[pallet::storage] + /// --- MAP ( netuid ) --> SubnetIdentityOfV3 pub type SubnetIdentitiesV3 = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOfV3, OptionQuery>; /// ================================= /// ==== Axon / Promo Endpoints ===== /// ================================= - #[pallet::storage] // --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. + #[pallet::storage] + /// --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. pub type TransactionKeyLastBlock = StorageNMap< _, ( @@ -1913,7 +1952,8 @@ pub mod pallet { /// ================== /// ==== Genesis ===== /// ================== - #[pallet::storage] // --- Storage for migration run status + #[pallet::storage] + /// --- Storage for migration run status pub type HasMigrationRun = StorageMap<_, Identity, Vec, bool, ValueQuery>; #[pallet::type_value] From 0ee6da16d5c43a2395bbd9f3aa9e19e4c734cc5b Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 19:05:56 +0800 Subject: [PATCH 02/13] fix all --- pallets/subtensor/src/lib.rs | 111 +++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 8277cda91d..39a5e8ab78 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -898,10 +898,10 @@ pub mod pallet { 128 } + #[pallet::storage] /// Global minimum activity cutoff, not used anymore. - // #[pallet::storage] - // pub type MinActivityCutoff = - // StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; + pub type MinActivityCutoff = + StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; #[pallet::storage] /// Global window (in blocks) at the end of each tempo where admin ops are disallowed @@ -957,34 +957,42 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - #[pallet::storage] /// --- ITEM --> Global weight - pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; #[pallet::storage] + pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; + /// --- ITEM --> CK burn - pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; #[pallet::storage] + pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; + /// --- ITEM ( default_delegate_take ) - pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; #[pallet::storage] + pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; + /// --- ITEM ( min_delegate_take ) - pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; #[pallet::storage] + pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; + /// --- ITEM ( default_childkey_take ) - pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; #[pallet::storage] + pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; + /// --- ITEM ( min_childkey_take ) + #[pallet::storage] pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; + + /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey. #[pallet::storage] - /// MAP ( hot ) --> cold | Returns the controlling coldkey for a hotkey. pub type Owner = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, ValueQuery, DefaultAccount>; + + /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation. #[pallet::storage] - /// MAP ( hot ) --> take | Returns the hotkey delegation take. And signals that this key is open for delegation. pub type Delegates = StorageMap<_, Blake2_128Concat, T::AccountId, u16, ValueQuery, DefaultDelegateTake>; + + /// DMAP ( hot, netuid ) --> take, Returns the hotkey childkey take for a specific subnet #[pallet::storage] - /// DMAP ( hot, netuid ) --> take | Returns the hotkey childkey take for a specific subnet pub type ChildkeyTake = StorageDoubleMap< _, Blake2_128Concat, @@ -994,8 +1002,9 @@ pub mod pallet { u16, // Value: take ValueQuery, >; - #[pallet::storage] + /// DMAP ( netuid, parent ) --> (Vec<(proportion,child)>, cool_down_block) + #[pallet::storage] pub type PendingChildKeys = StorageDoubleMap< _, Identity, @@ -1006,8 +1015,9 @@ pub mod pallet { ValueQuery, DefaultPendingChildkeys, >; - #[pallet::storage] + /// DMAP ( parent, netuid ) --> Vec<(proportion,child)> + #[pallet::storage] pub type ChildKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1018,8 +1028,9 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] + /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> + #[pallet::storage] pub type ParentKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1030,8 +1041,9 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. + #[pallet::storage] pub type AlphaDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1042,8 +1054,9 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. + #[pallet::storage] pub type TaoDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1058,11 +1071,13 @@ pub mod pallet { /// ================== /// ==== Coinbase ==== /// ================== - #[pallet::storage] + /// --- ITEM ( global_block_emission ) - pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; #[pallet::storage] + pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; + /// --- DMap ( hot, netuid ) --> emission | last hotkey emission on network. + #[pallet::storage] pub type LastHotkeyEmissionOnNetuid = StorageDoubleMap< _, Blake2_128Concat, @@ -1089,66 +1104,83 @@ pub mod pallet { #[pallet::storage] /// --- ITEM ( maximum_number_of_networks ) + pub type SubnetLimit = StorageValue<_, u16, ValueQuery, DefaultSubnetLimit>; + #[pallet::storage] /// --- ITEM ( total_issuance ) pub type TotalIssuance = StorageValue<_, TaoCurrency, ValueQuery, DefaultTotalIssuance>; + #[pallet::storage] /// --- ITEM ( total_stake ) - pub type TotalStake = StorageValue<_, TaoCurrency, ValueQuery>; + pub type TotalStake = StorageValue<_, TaoCurrency, ValueQuery, DefaultZeroTao>; + #[pallet::storage] - /// --- ITEM ( moving_alpha ) -- subnet moving alpha. + /// --- ITEM ( moving_alpha ) -- subnet moving alpha. pub type SubnetMovingAlpha = StorageValue<_, I96F32, ValueQuery, DefaultMovingAlpha>; + #[pallet::storage] /// --- MAP ( netuid ) --> moving_price | The subnet moving price. pub type SubnetMovingPrice = StorageMap<_, Identity, NetUid, I96F32, ValueQuery, DefaultMovingPrice>; + #[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, NetUid, u128, ValueQuery, DefaultZeroU128>; + #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. + /// --- MAP ( netuid ) --> tao_in_subnet, Returns the amount of TAO in the subnet. pub type SubnetTAO = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; + #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_user_subnet | Returns the amount of TAO in the subnet reserve provided by users as liquidity. + /// --- MAP ( netuid ) --> tao_in_user_subnet, Returns the amount of TAO in the subnet reserve provided by users as liquidity. pub type SubnetTaoProvided = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; + #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_in_emission | Returns the amount of alph in emission into the pool per block. + /// --- MAP ( netuid ) --> alpha_in_emission, Returns the amount of alph in emission into the pool per block. pub type SubnetAlphaInEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; + #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_out_emission | Returns the amount of alpha out emission into the network per block. + /// --- MAP ( netuid ) --> alpha_out_emission, Returns the amount of alpha out emission into the network per block. pub type SubnetAlphaOutEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; + #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_emission | Returns the amount of tao emitted into this subent on the last block. + /// --- MAP ( netuid ) --> tao_in_emission, Returns the amount of tao emitted into this subent on the last block. pub type SubnetTaoInEmission = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; + #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_in_pool | Returns the amount of alpha in the pool. + /// --- MAP ( netuid ) --> alpha_supply_in_pool, Returns the amount of alpha in the pool. pub type SubnetAlphaIn = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; + #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity. + /// --- MAP ( netuid ) --> alpha_supply_user_in_pool, Returns the amount of alpha in the pool provided by users as liquidity. pub type SubnetAlphaInProvided = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; + #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_in_subnet | Returns the amount of alpha in the subnet. + /// --- MAP ( netuid ) --> alpha_supply_in_subnet, Returns the amount of alpha in the subnet. pub type SubnetAlphaOut = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; + #[pallet::storage] /// --- MAP ( cold ) --> Vec | Maps coldkey to hotkeys that stake to it pub type StakingHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; + #[pallet::storage] - /// --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. + /// --- MAP ( cold ) --> Vec, Returns the vector of hotkeys controlled by this coldkey. pub type OwnedHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; + #[pallet::storage] - /// --- DMAP ( cold, netuid )--> hot | Returns the hotkey a coldkey will autostake to with mining rewards. + /// --- DMAP ( cold, netuid )--> hot, Returns the hotkey a coldkey will autostake to with mining rewards. pub type AutoStakeDestination = StorageDoubleMap< _, Blake2_128Concat, @@ -1158,8 +1190,9 @@ pub mod pallet { T::AccountId, OptionQuery, >; + #[pallet::storage] - /// --- DMAP ( hot, netuid )--> Vec | Returns a list of coldkeys that are autostaking to a hotkey. + /// --- DMAP ( hot, netuid )--> Vec, Returns a list of coldkeys that are autostaking to a hotkey pub type AutoStakeDestinationColdkeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1171,7 +1204,7 @@ pub mod pallet { >; #[pallet::storage] - /// --- DMAP ( cold ) --> (block_expected, new_coldkey) | Maps coldkey to the block to swap at and new coldkey. + /// --- DMAP ( cold ) --> (block_expected, new_coldkey), Maps coldkey to the block to swap at and new coldkey. pub type ColdkeySwapScheduled = StorageMap< _, Blake2_128Concat, @@ -1182,7 +1215,7 @@ pub mod pallet { >; #[pallet::storage] - /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owns. + /// --- DMAP ( hot, netuid ) --> alpha, Returns the total amount of alpha a hotkey owns. pub type TotalHotkeyAlpha = StorageDoubleMap< _, Blake2_128Concat, @@ -1194,7 +1227,7 @@ pub mod pallet { DefaultZeroAlpha, >; #[pallet::storage] - /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owned in the last epoch. + /// --- DMAP ( hot, netuid ) --> alpha, Returns the total amount of alpha a hotkey owned in the last epoch. pub type TotalHotkeyAlphaLastEpoch = StorageDoubleMap< _, Blake2_128Concat, @@ -1206,7 +1239,7 @@ pub mod pallet { DefaultZeroAlpha, >; #[pallet::storage] - /// DMAP ( hot, netuid ) --> total_alpha_shares | Returns the number of alpha shares for a hotkey on a subnet. + /// DMAP ( hot, netuid ) --> total_alpha_shares, Returns the number of alpha shares for a hotkey on a subnet. pub type TotalHotkeyShares = StorageDoubleMap< _, Blake2_128Concat, @@ -1218,7 +1251,7 @@ pub mod pallet { DefaultSharePoolZero, >; #[pallet::storage] - /// --- NMAP ( hot, cold, netuid ) --> alpha | Returns the alpha shares for a hotkey, coldkey, netuid triplet. + /// --- NMAP ( hot, cold, netuid ) --> alpha, Returns the alpha shares for a hotkey, coldkey, netuid triplet. pub type Alpha = StorageNMap< _, ( @@ -1230,7 +1263,7 @@ pub mod pallet { ValueQuery, >; #[pallet::storage] - /// --- MAP ( netuid ) --> token_symbol | Returns the token symbol for a subnet. + /// --- MAP ( netuid ) --> token_symbol, Returns the token symbol for a subnet. pub type TokenSymbol = StorageMap<_, Identity, NetUid, Vec, ValueQuery, DefaultUnicodeVecU8>; @@ -1750,7 +1783,7 @@ pub mod pallet { /// ==== Axon / Promo Endpoints ===== /// ================================= #[pallet::storage] - /// --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. + /// --- NMAP ( hot, netuid, name ) --> last_block, Returns the last block of a transaction for a given key, netuid, and name. pub type TransactionKeyLastBlock = StorageNMap< _, ( From 0d204411a085a45f1bb953d49d7b2c00abd82e31 Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 20:32:16 +0800 Subject: [PATCH 03/13] fix doc --- pallets/subtensor/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 39a5e8ab78..a943892d7f 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -1071,7 +1071,6 @@ pub mod pallet { /// ================== /// ==== Coinbase ==== /// ================== - /// --- ITEM ( global_block_emission ) #[pallet::storage] pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; @@ -1101,10 +1100,8 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - #[pallet::storage] /// --- ITEM ( maximum_number_of_networks ) - pub type SubnetLimit = StorageValue<_, u16, ValueQuery, DefaultSubnetLimit>; #[pallet::storage] From ff549c8354e3d1deffb0ca11b076e8e9a1051af6 Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 20:54:23 +0800 Subject: [PATCH 04/13] unify doc placement --- pallets/subtensor/src/lib.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index a943892d7f..bfd321d09c 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -957,42 +957,42 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - /// --- ITEM --> Global weight #[pallet::storage] + /// --- ITEM --> Global weight pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; - /// --- ITEM --> CK burn #[pallet::storage] + /// --- ITEM --> CK burn pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; - /// --- ITEM ( default_delegate_take ) #[pallet::storage] + /// --- ITEM ( default_delegate_take ) pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; - /// --- ITEM ( min_delegate_take ) #[pallet::storage] + /// --- ITEM ( min_delegate_take ) pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; - /// --- ITEM ( default_childkey_take ) #[pallet::storage] + /// --- ITEM ( default_childkey_take ) pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; - /// --- ITEM ( min_childkey_take ) #[pallet::storage] + /// --- ITEM ( min_childkey_take ) pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; - /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey. #[pallet::storage] + /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey. Default is empty account. pub type Owner = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, ValueQuery, DefaultAccount>; - /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation. #[pallet::storage] + /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation. Default is 0. pub type Delegates = StorageMap<_, Blake2_128Concat, T::AccountId, u16, ValueQuery, DefaultDelegateTake>; - /// DMAP ( hot, netuid ) --> take, Returns the hotkey childkey take for a specific subnet #[pallet::storage] + /// DMAP ( hot, netuid ) --> take, Returns the hotkey childkey take for a specific subnet pub type ChildkeyTake = StorageDoubleMap< _, Blake2_128Concat, @@ -1003,8 +1003,8 @@ pub mod pallet { ValueQuery, >; - /// DMAP ( netuid, parent ) --> (Vec<(proportion,child)>, cool_down_block) #[pallet::storage] + /// DMAP ( netuid, parent ) --> (Vec<(proportion,child)>, cool_down_block) pub type PendingChildKeys = StorageDoubleMap< _, Identity, @@ -1016,8 +1016,8 @@ pub mod pallet { DefaultPendingChildkeys, >; - /// DMAP ( parent, netuid ) --> Vec<(proportion,child)> #[pallet::storage] + /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> Default is empty Vec. pub type ChildKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1029,8 +1029,8 @@ pub mod pallet { DefaultAccountLinkage, >; - /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> #[pallet::storage] + /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> pub type ParentKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1042,8 +1042,8 @@ pub mod pallet { DefaultAccountLinkage, >; - /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. pub type AlphaDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1055,8 +1055,8 @@ pub mod pallet { DefaultZeroAlpha, >; - /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. pub type TaoDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1075,8 +1075,8 @@ pub mod pallet { #[pallet::storage] pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; - /// --- DMap ( hot, netuid ) --> emission | last hotkey emission on network. #[pallet::storage] + /// --- DMap ( hot, netuid ) --> emission | last hotkey emission on network. pub type LastHotkeyEmissionOnNetuid = StorageDoubleMap< _, Blake2_128Concat, From 7c285bbe50fe5a4e5b7323fe563aa7285ba31371 Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 21:02:15 +0800 Subject: [PATCH 05/13] revert unnecessary changes --- pallets/subtensor/src/lib.rs | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index bfd321d09c..e2d12acb5e 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -960,37 +960,29 @@ pub mod pallet { #[pallet::storage] /// --- ITEM --> Global weight pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; - #[pallet::storage] /// --- ITEM --> CK burn pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; - #[pallet::storage] /// --- ITEM ( default_delegate_take ) pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; - #[pallet::storage] /// --- ITEM ( min_delegate_take ) pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; - #[pallet::storage] /// --- ITEM ( default_childkey_take ) pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; - #[pallet::storage] /// --- ITEM ( min_childkey_take ) pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; - #[pallet::storage] - /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey. Default is empty account. + /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey pub type Owner = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, ValueQuery, DefaultAccount>; - #[pallet::storage] - /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation. Default is 0. + /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation pub type Delegates = StorageMap<_, Blake2_128Concat, T::AccountId, u16, ValueQuery, DefaultDelegateTake>; - #[pallet::storage] /// DMAP ( hot, netuid ) --> take, Returns the hotkey childkey take for a specific subnet pub type ChildkeyTake = StorageDoubleMap< @@ -1002,7 +994,6 @@ pub mod pallet { u16, // Value: take ValueQuery, >; - #[pallet::storage] /// DMAP ( netuid, parent ) --> (Vec<(proportion,child)>, cool_down_block) pub type PendingChildKeys = StorageDoubleMap< @@ -1015,9 +1006,8 @@ pub mod pallet { ValueQuery, DefaultPendingChildkeys, >; - #[pallet::storage] - /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> Default is empty Vec. + /// DMAP ( parent, netuid ) --> Vec<(proportion,child)> pub type ChildKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1028,7 +1018,6 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> pub type ParentKeys = StorageDoubleMap< @@ -1041,7 +1030,6 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. pub type AlphaDividendsPerSubnet = StorageDoubleMap< @@ -1054,7 +1042,6 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. pub type TaoDividendsPerSubnet = StorageDoubleMap< @@ -1071,10 +1058,9 @@ pub mod pallet { /// ================== /// ==== Coinbase ==== /// ================== - /// --- ITEM ( global_block_emission ) #[pallet::storage] + /// --- ITEM ( global_block_emission ) pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; - #[pallet::storage] /// --- DMap ( hot, netuid ) --> emission | last hotkey emission on network. pub type LastHotkeyEmissionOnNetuid = StorageDoubleMap< @@ -1087,7 +1073,6 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - /// ========================== /// ==== Staking Counters ==== /// ========================== From 81d2713420627ae729d1e6a7d592b600288abf41 Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 21:33:20 +0800 Subject: [PATCH 06/13] fix doc --- pallets/subtensor/src/lib.rs | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index e2d12acb5e..0e9eeeef3a 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -976,15 +976,15 @@ pub mod pallet { /// --- ITEM ( min_childkey_take ) pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; #[pallet::storage] - /// MAP ( hot ) --> cold, Returns the controlling coldkey for a hotkey + /// MAP ( hot ) --> cold | Returns the controlling coldkey for a hotkey pub type Owner = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, ValueQuery, DefaultAccount>; #[pallet::storage] - /// MAP ( hot ) --> take, Returns the hotkey delegation take. And signals that this key is open for delegation + /// MAP ( hot ) --> take | Returns the hotkey delegation take. And signals that this key is open for delegation pub type Delegates = StorageMap<_, Blake2_128Concat, T::AccountId, u16, ValueQuery, DefaultDelegateTake>; #[pallet::storage] - /// DMAP ( hot, netuid ) --> take, Returns the hotkey childkey take for a specific subnet + /// DMAP ( hot, netuid ) --> take | Returns the hotkey childkey take for a specific subnet pub type ChildkeyTake = StorageDoubleMap< _, Blake2_128Concat, @@ -1112,42 +1112,42 @@ pub mod pallet { StorageMap<_, Identity, NetUid, u128, ValueQuery, DefaultZeroU128>; #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_subnet, Returns the amount of TAO in the subnet. + /// --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. pub type SubnetTAO = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_user_subnet, Returns the amount of TAO in the subnet reserve provided by users as liquidity. + /// --- MAP ( netuid ) --> tao_in_user_subnet | Returns the amount of TAO in the subnet reserve provided by users as liquidity. pub type SubnetTaoProvided = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_in_emission, Returns the amount of alph in emission into the pool per block. + /// --- MAP ( netuid ) --> alpha_in_emission | Returns the amount of alph in emission into the pool per block. pub type SubnetAlphaInEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_out_emission, Returns the amount of alpha out emission into the network per block. + /// --- MAP ( netuid ) --> alpha_out_emission | Returns the amount of alpha out emission into the network per block. pub type SubnetAlphaOutEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; #[pallet::storage] - /// --- MAP ( netuid ) --> tao_in_emission, Returns the amount of tao emitted into this subent on the last block. + /// --- MAP ( netuid ) --> tao_in_emission | Returns the amount of tao emitted into this subent on the last block. pub type SubnetTaoInEmission = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_in_pool, Returns the amount of alpha in the pool. + /// --- MAP ( netuid ) --> alpha_supply_in_pool | Returns the amount of alpha in the pool. pub type SubnetAlphaIn = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_user_in_pool, Returns the amount of alpha in the pool provided by users as liquidity. + /// --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity. pub type SubnetAlphaInProvided = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; #[pallet::storage] - /// --- MAP ( netuid ) --> alpha_supply_in_subnet, Returns the amount of alpha in the subnet. + /// --- MAP ( netuid ) --> alpha_supply_in_subnet | Returns the amount of alpha in the subnet. pub type SubnetAlphaOut = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; @@ -1157,12 +1157,12 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; #[pallet::storage] - /// --- MAP ( cold ) --> Vec, Returns the vector of hotkeys controlled by this coldkey. + /// --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. pub type OwnedHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; #[pallet::storage] - /// --- DMAP ( cold, netuid )--> hot, Returns the hotkey a coldkey will autostake to with mining rewards. + /// --- DMAP ( cold, netuid )--> hot | Returns the hotkey a coldkey will autostake to with mining rewards. pub type AutoStakeDestination = StorageDoubleMap< _, Blake2_128Concat, @@ -1174,7 +1174,7 @@ pub mod pallet { >; #[pallet::storage] - /// --- DMAP ( hot, netuid )--> Vec, Returns a list of coldkeys that are autostaking to a hotkey + /// --- DMAP ( hot, netuid )--> Vec | Returns a list of coldkeys that are autostaking to a hotkey pub type AutoStakeDestinationColdkeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1197,7 +1197,7 @@ pub mod pallet { >; #[pallet::storage] - /// --- DMAP ( hot, netuid ) --> alpha, Returns the total amount of alpha a hotkey owns. + /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owns. pub type TotalHotkeyAlpha = StorageDoubleMap< _, Blake2_128Concat, @@ -1209,7 +1209,7 @@ pub mod pallet { DefaultZeroAlpha, >; #[pallet::storage] - /// --- DMAP ( hot, netuid ) --> alpha, Returns the total amount of alpha a hotkey owned in the last epoch. + /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owned in the last epoch. pub type TotalHotkeyAlphaLastEpoch = StorageDoubleMap< _, Blake2_128Concat, @@ -1221,7 +1221,7 @@ pub mod pallet { DefaultZeroAlpha, >; #[pallet::storage] - /// DMAP ( hot, netuid ) --> total_alpha_shares, Returns the number of alpha shares for a hotkey on a subnet. + /// DMAP ( hot, netuid ) --> total_alpha_shares | Returns the number of alpha shares for a hotkey on a subnet. pub type TotalHotkeyShares = StorageDoubleMap< _, Blake2_128Concat, @@ -1233,7 +1233,7 @@ pub mod pallet { DefaultSharePoolZero, >; #[pallet::storage] - /// --- NMAP ( hot, cold, netuid ) --> alpha, Returns the alpha shares for a hotkey, coldkey, netuid triplet. + /// --- NMAP ( hot, cold, netuid ) --> alpha | Returns the alpha shares for a hotkey, coldkey, netuid triplet. pub type Alpha = StorageNMap< _, ( @@ -1245,7 +1245,7 @@ pub mod pallet { ValueQuery, >; #[pallet::storage] - /// --- MAP ( netuid ) --> token_symbol, Returns the token symbol for a subnet. + /// --- MAP ( netuid ) --> token_symbol | Returns the token symbol for a subnet. pub type TokenSymbol = StorageMap<_, Identity, NetUid, Vec, ValueQuery, DefaultUnicodeVecU8>; @@ -1765,7 +1765,7 @@ pub mod pallet { /// ==== Axon / Promo Endpoints ===== /// ================================= #[pallet::storage] - /// --- NMAP ( hot, netuid, name ) --> last_block, Returns the last block of a transaction for a given key, netuid, and name. + /// --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. pub type TransactionKeyLastBlock = StorageNMap< _, ( @@ -1909,7 +1909,7 @@ pub mod pallet { StorageDoubleMap<_, Twox64Concat, LeaseId, Identity, T::AccountId, U64F64, ValueQuery>; #[pallet::storage] - // --- MAP ( netuid ) --> lease_id | The lease id for a given netuid. + /// --- MAP ( netuid ) --> lease_id | The lease id for a given netuid. pub type SubnetUidToLeaseId = StorageMap<_, Twox64Concat, NetUid, LeaseId, OptionQuery>; From 7ea940ef8e912603628d884fc23581f66b4e518c Mon Sep 17 00:00:00 2001 From: open-junius Date: Mon, 20 Oct 2025 21:53:50 +0800 Subject: [PATCH 07/13] bump version --- pallets/subtensor/src/lib.rs | 2 +- runtime/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 0e9eeeef3a..aa9785ce19 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -899,7 +899,7 @@ pub mod pallet { } #[pallet::storage] - /// Global minimum activity cutoff, not used anymore. + /// Global minimum activity cutoff value pub type MinActivityCutoff = StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index b19b7ddf6f..286c3312b6 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 330, + spec_version: 331, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 78359ccebab02edf76505f25e73e6c49e580d867 Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 21 Oct 2025 18:43:20 +0800 Subject: [PATCH 08/13] update add doc with correct position --- pallets/subtensor/src/lib.rs | 770 ++++++++++++++++++++++------------- 1 file changed, 496 insertions(+), 274 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index aa9785ce19..9d554f9866 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -314,102 +314,116 @@ pub mod pallet { /// ==== Staking + Accounts ==== /// ============================ - #[pallet::type_value] /// Default value for zero. + #[pallet::type_value] pub fn DefaultZeroU64() -> u64 { 0 } + /// Default value for Alpha currency. #[pallet::type_value] pub fn DefaultZeroAlpha() -> AlphaCurrency { AlphaCurrency::ZERO } + /// Default value for Tao currency. #[pallet::type_value] pub fn DefaultZeroTao() -> TaoCurrency { TaoCurrency::ZERO } - #[pallet::type_value] + /// Default value for zero. + #[pallet::type_value] pub fn DefaultZeroU128() -> u128 { 0 } - #[pallet::type_value] + /// Default value for zero. + #[pallet::type_value] pub fn DefaultZeroU16() -> u16 { 0 } - #[pallet::type_value] + /// Default value for false. + #[pallet::type_value] pub fn DefaultFalse() -> bool { false } - #[pallet::type_value] + /// Default value for false. + #[pallet::type_value] pub fn DefaultTrue() -> bool { true } - #[pallet::type_value] + /// Total Rao in circulation. + #[pallet::type_value] pub fn TotalSupply() -> u64 { 21_000_000_000_000_000 } - #[pallet::type_value] + /// Default Delegate Take. + #[pallet::type_value] pub fn DefaultDelegateTake() -> u16 { T::InitialDefaultDelegateTake::get() } - #[pallet::type_value] /// Default childkey take. + #[pallet::type_value] pub fn DefaultChildKeyTake() -> u16 { T::InitialDefaultChildKeyTake::get() } - #[pallet::type_value] + /// Default minimum delegate take. + #[pallet::type_value] pub fn DefaultMinDelegateTake() -> u16 { T::InitialMinDelegateTake::get() } - #[pallet::type_value] /// Default minimum childkey take. + #[pallet::type_value] pub fn DefaultMinChildKeyTake() -> u16 { T::InitialMinChildKeyTake::get() } - #[pallet::type_value] /// Default maximum childkey take. + #[pallet::type_value] pub fn DefaultMaxChildKeyTake() -> u16 { T::InitialMaxChildKeyTake::get() } - #[pallet::type_value] /// Default account take. + #[pallet::type_value] pub fn DefaultAccountTake() -> u64 { 0 } - #[pallet::type_value] + /// Default value for global weight. + #[pallet::type_value] pub fn DefaultTaoWeight() -> u64 { T::InitialTaoWeight::get() } - #[pallet::type_value] + /// Default emission per block. + #[pallet::type_value] pub fn DefaultBlockEmission() -> u64 { 1_000_000_000 } - #[pallet::type_value] + /// Default allowed delegation. + #[pallet::type_value] pub fn DefaultAllowsDelegation() -> bool { false } - #[pallet::type_value] + /// Default total issuance. + #[pallet::type_value] pub fn DefaultTotalIssuance() -> TaoCurrency { T::InitialIssuance::get().into() } - #[pallet::type_value] + /// Default account, derived from zero trailing bytes. + #[pallet::type_value] pub fn DefaultAccount() -> T::AccountId { #[allow(clippy::expect_used)] T::AccountId::decode(&mut TrailingZeroInput::zeroes()) @@ -418,329 +432,391 @@ pub mod pallet { // pub fn DefaultStakeInterval() -> u64 { // 360 // } (DEPRECATED) - #[pallet::type_value] + /// Default account linkage + #[pallet::type_value] pub fn DefaultAccountLinkage() -> Vec<(u64, T::AccountId)> { vec![] } - #[pallet::type_value] + /// Default pending childkeys + #[pallet::type_value] pub fn DefaultPendingChildkeys() -> (Vec<(u64, T::AccountId)>, u64) { (vec![], 0) } - #[pallet::type_value] + /// Default account linkage + #[pallet::type_value] pub fn DefaultProportion() -> u64 { 0 } - #[pallet::type_value] + /// Default accumulated emission for a hotkey + #[pallet::type_value] pub fn DefaultAccumulatedEmission() -> u64 { 0 } - #[pallet::type_value] + /// Default last adjustment block. + #[pallet::type_value] pub fn DefaultLastAdjustmentBlock() -> u64 { 0 } - #[pallet::type_value] + /// Default last adjustment block. + #[pallet::type_value] pub fn DefaultRegistrationsThisBlock() -> u16 { 0 } - #[pallet::type_value] + /// Default EMA price halving blocks + #[pallet::type_value] pub fn DefaultEMAPriceMovingBlocks() -> u64 { T::InitialEmaPriceHalvingPeriod::get() } - #[pallet::type_value] + /// Default registrations this block. + #[pallet::type_value] pub fn DefaultBurn() -> TaoCurrency { T::InitialBurn::get().into() } - #[pallet::type_value] /// Default burn token. + #[pallet::type_value] pub fn DefaultMinBurn() -> TaoCurrency { T::InitialMinBurn::get().into() } - #[pallet::type_value] + /// Default min burn token. + #[pallet::type_value] pub fn DefaultMaxBurn() -> TaoCurrency { T::InitialMaxBurn::get().into() } - #[pallet::type_value] + /// Default max burn token. + #[pallet::type_value] pub fn DefaultDifficulty() -> u64 { T::InitialDifficulty::get() } - #[pallet::type_value] + /// Default difficulty value. + #[pallet::type_value] pub fn DefaultMinDifficulty() -> u64 { T::InitialMinDifficulty::get() } - #[pallet::type_value] + /// Default min difficulty value. + #[pallet::type_value] pub fn DefaultMaxDifficulty() -> u64 { T::InitialMaxDifficulty::get() } - #[pallet::type_value] + /// Default max difficulty value. + #[pallet::type_value] pub fn DefaultMaxRegistrationsPerBlock() -> u16 { T::InitialMaxRegistrationsPerBlock::get() } - #[pallet::type_value] + /// Default max registrations per block. + #[pallet::type_value] pub fn DefaultRAORecycledForRegistration() -> TaoCurrency { T::InitialRAORecycledForRegistration::get().into() } - #[pallet::type_value] + /// Default number of networks. + #[pallet::type_value] pub fn DefaultN() -> u16 { 0 } - #[pallet::type_value] + /// Default value for hotkeys. + #[pallet::type_value] pub fn DefaultHotkeys() -> Vec { vec![] } - #[pallet::type_value] + /// Default value if network is added. + #[pallet::type_value] pub fn DefaultNeworksAdded() -> bool { false } - #[pallet::type_value] + /// Default value for network member. + #[pallet::type_value] pub fn DefaultIsNetworkMember() -> bool { false } - #[pallet::type_value] + /// Default value for registration allowed. + #[pallet::type_value] pub fn DefaultRegistrationAllowed() -> bool { true } - #[pallet::type_value] + /// Default value for network registered at. + #[pallet::type_value] pub fn DefaultNetworkRegisteredAt() -> u64 { 0 } - #[pallet::type_value] + /// Default value for network immunity period. + #[pallet::type_value] pub fn DefaultNetworkImmunityPeriod() -> u64 { T::InitialNetworkImmunityPeriod::get() } - #[pallet::type_value] + /// Default value for network min lock cost. + #[pallet::type_value] pub fn DefaultNetworkMinLockCost() -> TaoCurrency { T::InitialNetworkMinLockCost::get().into() } - #[pallet::type_value] + /// Default value for network lock reduction interval. + #[pallet::type_value] pub fn DefaultNetworkLockReductionInterval() -> u64 { T::InitialNetworkLockReductionInterval::get() } - #[pallet::type_value] + /// Default value for subnet owner cut. + #[pallet::type_value] pub fn DefaultSubnetOwnerCut() -> u16 { T::InitialSubnetOwnerCut::get() } - #[pallet::type_value] + /// Default value for recycle or burn. + #[pallet::type_value] pub fn DefaultRecycleOrBurn() -> RecycleOrBurnEnum { RecycleOrBurnEnum::Burn // default to burn } - #[pallet::type_value] + /// Default value for network rate limit. + #[pallet::type_value] pub fn DefaultNetworkRateLimit() -> u64 { if cfg!(feature = "pow-faucet") { return 0; } T::InitialNetworkRateLimit::get() } - #[pallet::type_value] + /// Default value for network rate limit. + #[pallet::type_value] pub fn DefaultNetworkRegistrationStartBlock() -> u64 { 0 } - #[pallet::type_value] + /// Default value for weights version key rate limit. /// In units of tempos. + #[pallet::type_value] pub fn DefaultWeightsVersionKeyRateLimit() -> u64 { 5 // 5 tempos } - #[pallet::type_value] + /// Default value for pending emission. + #[pallet::type_value] pub fn DefaultPendingEmission() -> AlphaCurrency { 0.into() } - #[pallet::type_value] + /// Default value for blocks since last step. + #[pallet::type_value] pub fn DefaultBlocksSinceLastStep() -> u64 { 0 } - #[pallet::type_value] + /// Default value for last mechanism step block. + #[pallet::type_value] pub fn DefaultLastMechanismStepBlock() -> u64 { 0 } - #[pallet::type_value] + /// Default value for subnet owner. + #[pallet::type_value] pub fn DefaultSubnetOwner() -> T::AccountId { #[allow(clippy::expect_used)] T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) .expect("trailing zeroes always produce a valid account ID; qed") } - #[pallet::type_value] + /// Default value for subnet locked. + #[pallet::type_value] pub fn DefaultSubnetLocked() -> u64 { 0 } - #[pallet::type_value] + /// Default value for network tempo + #[pallet::type_value] pub fn DefaultTempo() -> u16 { T::InitialTempo::get() } - #[pallet::type_value] + /// Default value for weights set rate limit. + #[pallet::type_value] pub fn DefaultWeightsSetRateLimit() -> u64 { 100 } - #[pallet::type_value] + /// Default block number at registration. + #[pallet::type_value] pub fn DefaultBlockAtRegistration() -> u64 { 0 } - #[pallet::type_value] + /// Default value for rho parameter. + #[pallet::type_value] pub fn DefaultRho() -> u16 { T::InitialRho::get() } - #[pallet::type_value] + /// Default value for alpha sigmoid steepness. + #[pallet::type_value] pub fn DefaultAlphaSigmoidSteepness() -> i16 { T::InitialAlphaSigmoidSteepness::get() } - #[pallet::type_value] + /// Default value for kappa parameter. + #[pallet::type_value] pub fn DefaultKappa() -> u16 { T::InitialKappa::get() } - #[pallet::type_value] + /// Default value for network min allowed UIDs. + #[pallet::type_value] pub fn DefaultMinAllowedUids() -> u16 { T::InitialMinAllowedUids::get() } - #[pallet::type_value] + /// Default maximum allowed UIDs. + #[pallet::type_value] pub fn DefaultMaxAllowedUids() -> u16 { T::InitialMaxAllowedUids::get() } - #[pallet::type_value] + /// -- Rate limit for set max allowed UIDs + #[pallet::type_value] pub fn MaxUidsTrimmingRateLimit() -> u64 { prod_or_fast!(30 * 7200, 1) } - #[pallet::type_value] + /// Default immunity period. + #[pallet::type_value] pub fn DefaultImmunityPeriod() -> u16 { T::InitialImmunityPeriod::get() } - #[pallet::type_value] + /// Default activity cutoff. + #[pallet::type_value] pub fn DefaultActivityCutoff() -> u16 { T::InitialActivityCutoff::get() } - #[pallet::type_value] + /// Default weights version key. + #[pallet::type_value] pub fn DefaultWeightsVersionKey() -> u64 { T::InitialWeightsVersionKey::get() } - #[pallet::type_value] + /// Default minimum allowed weights. + #[pallet::type_value] pub fn DefaultMinAllowedWeights() -> u16 { T::InitialMinAllowedWeights::get() } - #[pallet::type_value] /// Default maximum allowed validators. + #[pallet::type_value] pub fn DefaultMaxAllowedValidators() -> u16 { T::InitialMaxAllowedValidators::get() } - #[pallet::type_value] + /// Default adjustment interval. + #[pallet::type_value] pub fn DefaultAdjustmentInterval() -> u16 { T::InitialAdjustmentInterval::get() } - #[pallet::type_value] + /// Default bonds moving average. + #[pallet::type_value] pub fn DefaultBondsMovingAverage() -> u64 { T::InitialBondsMovingAverage::get() } + /// Default bonds penalty. #[pallet::type_value] pub fn DefaultBondsPenalty() -> u16 { T::InitialBondsPenalty::get() } + /// Default value for bonds reset - will not reset bonds #[pallet::type_value] pub fn DefaultBondsResetOn() -> bool { T::InitialBondsResetOn::get() } + /// Default validator prune length. #[pallet::type_value] pub fn DefaultValidatorPruneLen() -> u64 { T::InitialValidatorPruneLen::get() } - #[pallet::type_value] + /// Default scaling law power. + #[pallet::type_value] pub fn DefaultScalingLawPower() -> u16 { T::InitialScalingLawPower::get() } - #[pallet::type_value] + /// Default target registrations per interval. + #[pallet::type_value] pub fn DefaultTargetRegistrationsPerInterval() -> u16 { T::InitialTargetRegistrationsPerInterval::get() } - #[pallet::type_value] + /// Default adjustment alpha. + #[pallet::type_value] pub fn DefaultAdjustmentAlpha() -> u64 { T::InitialAdjustmentAlpha::get() } - #[pallet::type_value] + /// Default minimum stake for weights. + #[pallet::type_value] pub fn DefaultStakeThreshold() -> u64 { 0 } - #[pallet::type_value] + /// Default Reveal Period Epochs + #[pallet::type_value] pub fn DefaultRevealPeriodEpochs() -> u64 { 1 } - #[pallet::type_value] + /// Value definition for vector of u16. + #[pallet::type_value] pub fn EmptyU16Vec() -> Vec { vec![] } - #[pallet::type_value] + /// Value definition for vector of u64. + #[pallet::type_value] pub fn EmptyU64Vec() -> Vec { vec![] } - #[pallet::type_value] + /// Value definition for vector of bool. + #[pallet::type_value] pub fn EmptyBoolVec() -> Vec { vec![] } - #[pallet::type_value] + /// Value definition for bonds with type vector of (u16, u16). + #[pallet::type_value] pub fn DefaultBonds() -> Vec<(u16, u16)> { vec![] } - #[pallet::type_value] + /// Value definition for weights with vector of (u16, u16). + #[pallet::type_value] pub fn DefaultWeights() -> Vec<(u16, u16)> { vec![] } - #[pallet::type_value] + /// Default value for key with type T::AccountId derived from trailing zeroes. + #[pallet::type_value] pub fn DefaultKey() -> T::AccountId { #[allow(clippy::expect_used)] T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) @@ -749,118 +825,131 @@ pub mod pallet { // pub fn DefaultHotkeyEmissionTempo() -> u64 { // T::InitialHotkeyEmissionTempo::get() // } (DEPRECATED) - #[pallet::type_value] + /// Default value for rate limiting + #[pallet::type_value] pub fn DefaultTxRateLimit() -> u64 { T::InitialTxRateLimit::get() } - #[pallet::type_value] + /// Default value for delegate take rate limiting + #[pallet::type_value] pub fn DefaultTxDelegateTakeRateLimit() -> u64 { T::InitialTxDelegateTakeRateLimit::get() } - #[pallet::type_value] + /// Default value for chidlkey take rate limiting + #[pallet::type_value] pub fn DefaultTxChildKeyTakeRateLimit() -> u64 { T::InitialTxChildKeyTakeRateLimit::get() } - #[pallet::type_value] + /// Default value for last extrinsic block. + #[pallet::type_value] pub fn DefaultLastTxBlock() -> u64 { 0 } - #[pallet::type_value] + /// Default value for serving rate limit. + #[pallet::type_value] pub fn DefaultServingRateLimit() -> u64 { T::InitialServingRateLimit::get() } - #[pallet::type_value] + /// Default value for weight commit/reveal enabled. + #[pallet::type_value] pub fn DefaultCommitRevealWeightsEnabled() -> bool { true } - #[pallet::type_value] + /// Default value for weight commit/reveal version. + #[pallet::type_value] pub fn DefaultCommitRevealWeightsVersion() -> u16 { 4 } - #[pallet::type_value] + /// -- ITEM (switches liquid alpha on) + #[pallet::type_value] pub fn DefaultLiquidAlpha() -> bool { false } - #[pallet::type_value] + /// -- ITEM (switches liquid alpha on) + #[pallet::type_value] pub fn DefaultYuma3() -> bool { false } - #[pallet::type_value] + /// (alpha_low: 0.7, alpha_high: 0.9) + #[pallet::type_value] pub fn DefaultAlphaValues() -> (u16, u16) { (45875, 58982) } - #[pallet::type_value] + /// Default value for coldkey swap schedule duration + #[pallet::type_value] pub fn DefaultColdkeySwapScheduleDuration() -> BlockNumberFor { T::InitialColdkeySwapScheduleDuration::get() } - #[pallet::type_value] /// Default value for coldkey swap reschedule duration + #[pallet::type_value] pub fn DefaultColdkeySwapRescheduleDuration() -> BlockNumberFor { T::InitialColdkeySwapRescheduleDuration::get() } - #[pallet::type_value] /// Default value for applying pending items (e.g. childkeys). + #[pallet::type_value] pub fn DefaultPendingCooldown() -> u64 { prod_or_fast!(7_200, 15) } - #[pallet::type_value] /// Default minimum stake. + #[pallet::type_value] pub fn DefaultMinStake() -> TaoCurrency { 2_000_000.into() } - #[pallet::type_value] /// Default unicode vector for tau symbol. + #[pallet::type_value] pub fn DefaultUnicodeVecU8() -> Vec { b"\xF0\x9D\x9C\x8F".to_vec() // Unicode for tau (𝜏) } - #[pallet::type_value] /// Default value for dissolve network schedule duration + #[pallet::type_value] pub fn DefaultDissolveNetworkScheduleDuration() -> BlockNumberFor { T::InitialDissolveNetworkScheduleDuration::get() } - #[pallet::type_value] /// Default moving alpha for the moving price. + #[pallet::type_value] pub fn DefaultMovingAlpha() -> I96F32 { // Moving average take 30 days to reach 50% of the price // and 3.5 months to reach 90%. I96F32::saturating_from_num(0.000003) } - #[pallet::type_value] + /// Default subnet moving price. + #[pallet::type_value] pub fn DefaultMovingPrice() -> I96F32 { I96F32::saturating_from_num(0.0) } - #[pallet::type_value] + /// Default value for Share Pool variables + #[pallet::type_value] pub fn DefaultSharePoolZero() -> U64F64 { U64F64::saturating_from_num(0) } - #[pallet::type_value] /// Default value for minimum activity cutoff + #[pallet::type_value] pub fn DefaultMinActivityCutoff() -> u16 { 360 } - #[pallet::type_value] /// Default value for coldkey swap scheduled + #[pallet::type_value] pub fn DefaultColdkeySwapScheduled() -> (BlockNumberFor, T::AccountId) { #[allow(clippy::expect_used)] let default_account = T::AccountId::decode(&mut TrailingZeroInput::zeroes()) @@ -868,68 +957,68 @@ pub mod pallet { (BlockNumberFor::::from(0_u32), default_account) } - #[pallet::type_value] /// Default value for setting subnet owner hotkey rate limit + #[pallet::type_value] pub fn DefaultSetSNOwnerHotkeyRateLimit() -> u64 { 50400 } - #[pallet::type_value] /// Default number of terminal blocks in a tempo during which admin operations are prohibited + #[pallet::type_value] pub fn DefaultAdminFreezeWindow() -> u16 { 10 } - #[pallet::type_value] /// Default number of tempos for owner hyperparameter update rate limit + #[pallet::type_value] pub fn DefaultOwnerHyperparamRateLimit() -> u16 { 2 } - #[pallet::type_value] /// Default value for ck burn, 18%. + #[pallet::type_value] pub fn DefaultCKBurn() -> u64 { 0 } - #[pallet::type_value] /// Default value for subnet limit. + #[pallet::type_value] pub fn DefaultSubnetLimit() -> u16 { 128 } - #[pallet::storage] /// Global minimum activity cutoff value + #[pallet::storage] pub type MinActivityCutoff = StorageValue<_, u16, ValueQuery, DefaultMinActivityCutoff>; - #[pallet::storage] /// Global window (in blocks) at the end of each tempo where admin ops are disallowed + #[pallet::storage] pub type AdminFreezeWindow = StorageValue<_, u16, ValueQuery, DefaultAdminFreezeWindow>; - #[pallet::storage] /// Global number of epochs used to rate limit subnet owner hyperparameter updates + #[pallet::storage] pub type OwnerHyperparamRateLimit = StorageValue<_, u16, ValueQuery, DefaultOwnerHyperparamRateLimit>; - #[pallet::storage] /// Duration of coldkey swap schedule before execution + #[pallet::storage] pub type ColdkeySwapScheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultColdkeySwapScheduleDuration>; - #[pallet::storage] /// Duration of coldkey swap reschedule before execution + #[pallet::storage] pub type ColdkeySwapRescheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultColdkeySwapRescheduleDuration>; - #[pallet::storage] /// Duration of dissolve network schedule before execution + #[pallet::storage] pub type DissolveNetworkScheduleDuration = StorageValue<_, BlockNumberFor, ValueQuery, DefaultDissolveNetworkScheduleDuration>; - #[pallet::storage] /// --- DMap ( netuid, coldkey ) --> blocknumber | last hotkey swap on network. + #[pallet::storage] pub type LastHotkeySwapOnNetuid = StorageDoubleMap< _, Identity, @@ -941,8 +1030,8 @@ pub mod pallet { DefaultZeroU64, >; - #[pallet::storage] /// Ensures unique IDs for StakeJobs storage map + #[pallet::storage] pub type NextStakeJobId = StorageValue<_, u64, ValueQuery, DefaultZeroU64>; /// ============================ @@ -957,34 +1046,43 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - #[pallet::storage] + /// --- ITEM --> Global weight - pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; #[pallet::storage] + pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; + /// --- ITEM --> CK burn - pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; #[pallet::storage] + pub type CKBurn = StorageValue<_, u64, ValueQuery, DefaultCKBurn>; + /// --- ITEM ( default_delegate_take ) - pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; #[pallet::storage] + pub type MaxDelegateTake = StorageValue<_, u16, ValueQuery, DefaultDelegateTake>; + /// --- ITEM ( min_delegate_take ) - pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; #[pallet::storage] + pub type MinDelegateTake = StorageValue<_, u16, ValueQuery, DefaultMinDelegateTake>; + /// --- ITEM ( default_childkey_take ) - pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; #[pallet::storage] + pub type MaxChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMaxChildKeyTake>; + /// --- ITEM ( min_childkey_take ) - pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; #[pallet::storage] + pub type MinChildkeyTake = StorageValue<_, u16, ValueQuery, DefaultMinChildKeyTake>; + /// MAP ( hot ) --> cold | Returns the controlling coldkey for a hotkey + #[pallet::storage] pub type Owner = StorageMap<_, Blake2_128Concat, T::AccountId, T::AccountId, ValueQuery, DefaultAccount>; - #[pallet::storage] + /// MAP ( hot ) --> take | Returns the hotkey delegation take. And signals that this key is open for delegation + #[pallet::storage] pub type Delegates = StorageMap<_, Blake2_128Concat, T::AccountId, u16, ValueQuery, DefaultDelegateTake>; - #[pallet::storage] + /// DMAP ( hot, netuid ) --> take | Returns the hotkey childkey take for a specific subnet + #[pallet::storage] pub type ChildkeyTake = StorageDoubleMap< _, Blake2_128Concat, @@ -994,8 +1092,9 @@ pub mod pallet { u16, // Value: take ValueQuery, >; - #[pallet::storage] + /// DMAP ( netuid, parent ) --> (Vec<(proportion,child)>, cool_down_block) + #[pallet::storage] pub type PendingChildKeys = StorageDoubleMap< _, Identity, @@ -1006,8 +1105,9 @@ pub mod pallet { ValueQuery, DefaultPendingChildkeys, >; - #[pallet::storage] + /// DMAP ( parent, netuid ) --> Vec<(proportion,child)> + #[pallet::storage] pub type ChildKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1018,8 +1118,9 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] + /// DMAP ( child, netuid ) --> Vec<(proportion,parent)> + #[pallet::storage] pub type ParentKeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1030,8 +1131,9 @@ pub mod pallet { ValueQuery, DefaultAccountLinkage, >; - #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total dividend this hotkey got on tempo. + #[pallet::storage] pub type AlphaDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1042,8 +1144,9 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. + #[pallet::storage] pub type TaoDividendsPerSubnet = StorageDoubleMap< _, Identity, @@ -1058,11 +1161,13 @@ pub mod pallet { /// ================== /// ==== Coinbase ==== /// ================== - #[pallet::storage] + /// --- ITEM ( global_block_emission ) - pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; #[pallet::storage] + pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; + /// --- DMap ( hot, netuid ) --> emission | last hotkey emission on network. + #[pallet::storage] pub type LastHotkeyEmissionOnNetuid = StorageDoubleMap< _, Blake2_128Concat, @@ -1085,84 +1190,85 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - #[pallet::storage] + /// --- ITEM ( maximum_number_of_networks ) + #[pallet::storage] pub type SubnetLimit = StorageValue<_, u16, ValueQuery, DefaultSubnetLimit>; - #[pallet::storage] /// --- ITEM ( total_issuance ) + #[pallet::storage] pub type TotalIssuance = StorageValue<_, TaoCurrency, ValueQuery, DefaultTotalIssuance>; - #[pallet::storage] /// --- ITEM ( total_stake ) + #[pallet::storage] pub type TotalStake = StorageValue<_, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] /// --- ITEM ( moving_alpha ) -- subnet moving alpha. + #[pallet::storage] pub type SubnetMovingAlpha = StorageValue<_, I96F32, ValueQuery, DefaultMovingAlpha>; - #[pallet::storage] /// --- MAP ( netuid ) --> moving_price | The subnet moving price. + #[pallet::storage] pub type SubnetMovingPrice = StorageMap<_, Identity, NetUid, I96F32, ValueQuery, DefaultMovingPrice>; - #[pallet::storage] /// --- MAP ( netuid ) --> total_volume | The total amount of TAO bought and sold since the start of the network. + #[pallet::storage] pub type SubnetVolume = StorageMap<_, Identity, NetUid, u128, ValueQuery, DefaultZeroU128>; - #[pallet::storage] /// --- MAP ( netuid ) --> tao_in_subnet | Returns the amount of TAO in the subnet. + #[pallet::storage] pub type SubnetTAO = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] /// --- MAP ( netuid ) --> tao_in_user_subnet | Returns the amount of TAO in the subnet reserve provided by users as liquidity. + #[pallet::storage] pub type SubnetTaoProvided = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] /// --- MAP ( netuid ) --> alpha_in_emission | Returns the amount of alph in emission into the pool per block. + #[pallet::storage] pub type SubnetAlphaInEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- MAP ( netuid ) --> alpha_out_emission | Returns the amount of alpha out emission into the network per block. + #[pallet::storage] pub type SubnetAlphaOutEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- MAP ( netuid ) --> tao_in_emission | Returns the amount of tao emitted into this subent on the last block. + #[pallet::storage] pub type SubnetTaoInEmission = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] /// --- MAP ( netuid ) --> alpha_supply_in_pool | Returns the amount of alpha in the pool. + #[pallet::storage] pub type SubnetAlphaIn = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- MAP ( netuid ) --> alpha_supply_user_in_pool | Returns the amount of alpha in the pool provided by users as liquidity. + #[pallet::storage] pub type SubnetAlphaInProvided = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- MAP ( netuid ) --> alpha_supply_in_subnet | Returns the amount of alpha in the subnet. + #[pallet::storage] pub type SubnetAlphaOut = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- MAP ( cold ) --> Vec | Maps coldkey to hotkeys that stake to it + #[pallet::storage] pub type StakingHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; - #[pallet::storage] /// --- MAP ( cold ) --> Vec | Returns the vector of hotkeys controlled by this coldkey. + #[pallet::storage] pub type OwnedHotkeys = StorageMap<_, Blake2_128Concat, T::AccountId, Vec, ValueQuery>; - #[pallet::storage] /// --- DMAP ( cold, netuid )--> hot | Returns the hotkey a coldkey will autostake to with mining rewards. + #[pallet::storage] pub type AutoStakeDestination = StorageDoubleMap< _, Blake2_128Concat, @@ -1173,8 +1279,8 @@ pub mod pallet { OptionQuery, >; - #[pallet::storage] /// --- DMAP ( hot, netuid )--> Vec | Returns a list of coldkeys that are autostaking to a hotkey + #[pallet::storage] pub type AutoStakeDestinationColdkeys = StorageDoubleMap< _, Blake2_128Concat, @@ -1185,8 +1291,8 @@ pub mod pallet { ValueQuery, >; - #[pallet::storage] /// --- DMAP ( cold ) --> (block_expected, new_coldkey), Maps coldkey to the block to swap at and new coldkey. + #[pallet::storage] pub type ColdkeySwapScheduled = StorageMap< _, Blake2_128Concat, @@ -1196,8 +1302,8 @@ pub mod pallet { DefaultColdkeySwapScheduled, >; - #[pallet::storage] /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owns. + #[pallet::storage] pub type TotalHotkeyAlpha = StorageDoubleMap< _, Blake2_128Concat, @@ -1208,8 +1314,9 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] + /// --- DMAP ( hot, netuid ) --> alpha | Returns the total amount of alpha a hotkey owned in the last epoch. + #[pallet::storage] pub type TotalHotkeyAlphaLastEpoch = StorageDoubleMap< _, Blake2_128Concat, @@ -1220,8 +1327,9 @@ pub mod pallet { ValueQuery, DefaultZeroAlpha, >; - #[pallet::storage] + /// DMAP ( hot, netuid ) --> total_alpha_shares | Returns the number of alpha shares for a hotkey on a subnet. + #[pallet::storage] pub type TotalHotkeyShares = StorageDoubleMap< _, Blake2_128Concat, @@ -1232,8 +1340,9 @@ pub mod pallet { ValueQuery, DefaultSharePoolZero, >; - #[pallet::storage] + /// --- NMAP ( hot, cold, netuid ) --> alpha | Returns the alpha shares for a hotkey, coldkey, netuid triplet. + #[pallet::storage] pub type Alpha = StorageNMap< _, ( @@ -1244,51 +1353,63 @@ pub mod pallet { U64F64, // Shares ValueQuery, >; - #[pallet::storage] + /// --- MAP ( netuid ) --> token_symbol | Returns the token symbol for a subnet. + #[pallet::storage] pub type TokenSymbol = StorageMap<_, Identity, NetUid, Vec, ValueQuery, DefaultUnicodeVecU8>; /// ============================ /// ==== Global Parameters ===== /// ============================ - #[pallet::storage] + /// --- StorageItem Global Used Work. - pub type UsedWork = StorageMap<_, Identity, Vec, u64, ValueQuery>; #[pallet::storage] + pub type UsedWork = StorageMap<_, Identity, Vec, u64, ValueQuery>; + /// --- ITEM( global_max_registrations_per_block ) + #[pallet::storage] pub type MaxRegistrationsPerBlock = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMaxRegistrationsPerBlock>; - #[pallet::storage] + /// --- ITEM( total_number_of_existing_networks ) - pub type TotalNetworks = StorageValue<_, u16, ValueQuery>; #[pallet::storage] + pub type TotalNetworks = StorageValue<_, u16, ValueQuery>; + /// ITEM( network_immunity_period ) + #[pallet::storage] pub type NetworkImmunityPeriod = StorageValue<_, u64, ValueQuery, DefaultNetworkImmunityPeriod>; - #[pallet::storage] + /// ITEM( min_network_lock_cost ) + #[pallet::storage] pub type NetworkMinLockCost = StorageValue<_, TaoCurrency, ValueQuery, DefaultNetworkMinLockCost>; - #[pallet::storage] + /// ITEM( last_network_lock_cost ) + #[pallet::storage] pub type NetworkLastLockCost = StorageValue<_, TaoCurrency, ValueQuery, DefaultNetworkMinLockCost>; - #[pallet::storage] + /// ITEM( network_lock_reduction_interval ) + #[pallet::storage] pub type NetworkLockReductionInterval = StorageValue<_, u64, ValueQuery, DefaultNetworkLockReductionInterval>; - #[pallet::storage] + /// ITEM( subnet_owner_cut ) - pub type SubnetOwnerCut = StorageValue<_, u16, ValueQuery, DefaultSubnetOwnerCut>; #[pallet::storage] + pub type SubnetOwnerCut = StorageValue<_, u16, ValueQuery, DefaultSubnetOwnerCut>; + /// ITEM( network_rate_limit ) - pub type NetworkRateLimit = StorageValue<_, u64, ValueQuery, DefaultNetworkRateLimit>; #[pallet::storage] + pub type NetworkRateLimit = StorageValue<_, u64, ValueQuery, DefaultNetworkRateLimit>; + /// --- ITEM( nominator_min_required_stake ) --- Factor of DefaultMinStake in per-mill format. - pub type NominatorMinRequiredStake = StorageValue<_, u64, ValueQuery, DefaultZeroU64>; #[pallet::storage] + pub type NominatorMinRequiredStake = StorageValue<_, u64, ValueQuery, DefaultZeroU64>; + /// ITEM( weights_version_key_rate_limit ) --- Rate limit in tempos. + #[pallet::storage] pub type WeightsVersionKeyRateLimit = StorageValue<_, u64, ValueQuery, DefaultWeightsVersionKeyRateLimit>; @@ -1296,54 +1417,63 @@ pub mod pallet { /// ==== Rate Limiting ===== /// ============================ - #[pallet::storage] /// --- MAP ( RateLimitKey ) --> Block number in which the last rate limited operation occured + #[pallet::storage] pub type LastRateLimitedBlock = StorageMap<_, Identity, RateLimitKey, u64, ValueQuery, DefaultZeroU64>; /// ============================ /// ==== Subnet Locks ===== /// ============================ - #[pallet::storage] + /// --- MAP ( netuid ) --> transfer_toggle + #[pallet::storage] pub type TransferToggle = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultTrue>; - #[pallet::storage] + /// --- MAP ( netuid ) --> total_subnet_locked + #[pallet::storage] pub type SubnetLocked = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] + /// --- MAP ( netuid ) --> largest_locked + #[pallet::storage] pub type LargestLocked = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultZeroU64>; /// ================= /// ==== Tempos ===== /// ================= - #[pallet::storage] + /// --- MAP ( netuid ) --> tempo + #[pallet::storage] pub type Tempo = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultTempo>; /// ============================ /// ==== Subnet Parameters ===== /// ============================ + /// --- MAP ( netuid ) --> block number of first emission #[pallet::storage] pub type FirstEmissionBlockNumber = StorageMap<_, Identity, NetUid, u64, OptionQuery>; + /// --- MAP ( netuid ) --> subnet mechanism #[pallet::storage] pub type SubnetMechanism = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultZeroU16>; - #[pallet::storage] + /// --- MAP ( netuid ) --> subnetwork_n (Number of UIDs in the network). - pub type SubnetworkN = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultN>; #[pallet::storage] + pub type SubnetworkN = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultN>; + /// --- MAP ( netuid ) --> network_is_added + #[pallet::storage] pub type NetworksAdded = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultNeworksAdded>; - #[pallet::storage] + /// --- DMAP ( hotkey, netuid ) --> bool + #[pallet::storage] pub type IsNetworkMember = StorageDoubleMap< _, Blake2_128Concat, @@ -1354,94 +1484,117 @@ pub mod pallet { ValueQuery, DefaultIsNetworkMember, >; - #[pallet::storage] + /// --- MAP ( netuid ) --> network_registration_allowed + #[pallet::storage] pub type NetworkRegistrationAllowed = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultRegistrationAllowed>; - #[pallet::storage] + /// --- MAP ( netuid ) --> network_pow_allowed + #[pallet::storage] pub type NetworkPowRegistrationAllowed = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultRegistrationAllowed>; - #[pallet::storage] + /// --- MAP ( netuid ) --> block_created + #[pallet::storage] pub type NetworkRegisteredAt = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultNetworkRegisteredAt>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pending_emission + #[pallet::storage] pub type PendingEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultPendingEmission>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pending_root_emission + #[pallet::storage] pub type PendingRootDivs = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pending_alpha_swapped + #[pallet::storage] pub type PendingAlphaSwapped = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pending_owner_cut + #[pallet::storage] pub type PendingOwnerCut = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] + /// --- MAP ( netuid ) --> blocks_since_last_step + #[pallet::storage] pub type BlocksSinceLastStep = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultBlocksSinceLastStep>; - #[pallet::storage] + /// --- MAP ( netuid ) --> last_mechanism_step_block + #[pallet::storage] pub type LastMechansimStepBlock = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultLastMechanismStepBlock>; - #[pallet::storage] + /// --- MAP ( netuid ) --> subnet_owner + #[pallet::storage] pub type SubnetOwner = StorageMap<_, Identity, NetUid, T::AccountId, ValueQuery, DefaultSubnetOwner>; - #[pallet::storage] + /// --- MAP ( netuid ) --> subnet_owner_hotkey + #[pallet::storage] pub type SubnetOwnerHotkey = StorageMap<_, Identity, NetUid, T::AccountId, ValueQuery, DefaultSubnetOwner>; - #[pallet::storage] + /// --- MAP ( netuid ) --> recycle_or_burn + #[pallet::storage] pub type RecycleOrBurn = StorageMap<_, Identity, NetUid, RecycleOrBurnEnum, ValueQuery, DefaultRecycleOrBurn>; - #[pallet::storage] + /// --- MAP ( netuid ) --> serving_rate_limit + #[pallet::storage] pub type ServingRateLimit = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultServingRateLimit>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Rho - pub type Rho = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultRho>; #[pallet::storage] + pub type Rho = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultRho>; + /// --- MAP ( netuid ) --> AlphaSigmoidSteepness + #[pallet::storage] pub type AlphaSigmoidSteepness = StorageMap<_, Identity, NetUid, i16, ValueQuery, DefaultAlphaSigmoidSteepness>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Kappa - pub type Kappa = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultKappa>; #[pallet::storage] + pub type Kappa = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultKappa>; + /// --- MAP ( netuid ) --> registrations_this_interval + #[pallet::storage] pub type RegistrationsThisInterval = StorageMap<_, Identity, NetUid, u16, ValueQuery>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pow_registrations_this_interval + #[pallet::storage] pub type POWRegistrationsThisInterval = StorageMap<_, Identity, NetUid, u16, ValueQuery>; - #[pallet::storage] + /// --- MAP ( netuid ) --> burn_registrations_this_interval + #[pallet::storage] pub type BurnRegistrationsThisInterval = StorageMap<_, Identity, NetUid, u16, ValueQuery>; - #[pallet::storage] + /// --- MAP ( netuid ) --> min_allowed_uids + #[pallet::storage] pub type MinAllowedUids = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMinAllowedUids>; - #[pallet::storage] + /// --- MAP ( netuid ) --> max_allowed_uids + #[pallet::storage] pub type MaxAllowedUids = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMaxAllowedUids>; - #[pallet::storage] + /// --- MAP ( netuid ) --> immunity_period + #[pallet::storage] pub type ImmunityPeriod = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultImmunityPeriod>; - #[pallet::storage] + /// --- MAP ( netuid ) --> activity_cutoff + #[pallet::storage] pub type ActivityCutoff = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultActivityCutoff>; #[pallet::type_value] @@ -1449,98 +1602,122 @@ pub mod pallet { pub fn DefaultMaxWeightsLimit() -> u16 { u16::MAX } - #[pallet::storage] + /// --- MAP ( netuid ) --> max_weight_limit + #[pallet::storage] pub type MaxWeightsLimit = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMaxWeightsLimit>; - #[pallet::storage] + /// --- MAP ( netuid ) --> weights_version_key + #[pallet::storage] pub type WeightsVersionKey = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultWeightsVersionKey>; - #[pallet::storage] + /// --- MAP ( netuid ) --> min_allowed_weights + #[pallet::storage] pub type MinAllowedWeights = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMinAllowedWeights>; - #[pallet::storage] + /// --- MAP ( netuid ) --> max_allowed_validators + #[pallet::storage] pub type MaxAllowedValidators = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultMaxAllowedValidators>; - #[pallet::storage] + /// --- MAP ( netuid ) --> adjustment_interval + #[pallet::storage] pub type AdjustmentInterval = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultAdjustmentInterval>; - #[pallet::storage] + /// --- MAP ( netuid ) --> bonds_moving_average + #[pallet::storage] pub type BondsMovingAverage = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultBondsMovingAverage>; - #[pallet::storage] + /// --- MAP ( netuid ) --> bonds_penalty + #[pallet::storage] pub type BondsPenalty = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultBondsPenalty>; - #[pallet::storage] + /// --- MAP ( netuid ) --> bonds_reset + #[pallet::storage] pub type BondsResetOn = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultBondsResetOn>; + /// --- MAP ( netuid ) --> weights_set_rate_limit #[pallet::storage] pub type WeightsSetRateLimit = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultWeightsSetRateLimit>; - #[pallet::storage] + /// --- MAP ( netuid ) --> validator_prune_len + #[pallet::storage] pub type ValidatorPruneLen = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultValidatorPruneLen>; - #[pallet::storage] + /// --- MAP ( netuid ) --> scaling_law_power + #[pallet::storage] pub type ScalingLawPower = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultScalingLawPower>; - #[pallet::storage] + /// --- MAP ( netuid ) --> target_registrations_this_interval + #[pallet::storage] pub type TargetRegistrationsPerInterval = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultTargetRegistrationsPerInterval>; - #[pallet::storage] + /// --- MAP ( netuid ) --> adjustment_alpha + #[pallet::storage] pub type AdjustmentAlpha = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultAdjustmentAlpha>; - #[pallet::storage] + /// --- MAP ( netuid ) --> commit reveal v2 weights are enabled + #[pallet::storage] pub type CommitRevealWeightsEnabled = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultCommitRevealWeightsEnabled>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Burn - pub type Burn = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultBurn>; #[pallet::storage] + pub type Burn = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultBurn>; + /// --- MAP ( netuid ) --> Difficulty - pub type Difficulty = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultDifficulty>; #[pallet::storage] + pub type Difficulty = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultDifficulty>; + /// --- MAP ( netuid ) --> MinBurn + #[pallet::storage] pub type MinBurn = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultMinBurn>; - #[pallet::storage] + /// --- MAP ( netuid ) --> MaxBurn + #[pallet::storage] pub type MaxBurn = StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultMaxBurn>; - #[pallet::storage] + /// --- MAP ( netuid ) --> MinDifficulty + #[pallet::storage] pub type MinDifficulty = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultMinDifficulty>; - #[pallet::storage] + /// --- MAP ( netuid ) --> MaxDifficulty + #[pallet::storage] pub type MaxDifficulty = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultMaxDifficulty>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Block at last adjustment. + #[pallet::storage] pub type LastAdjustmentBlock = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultLastAdjustmentBlock>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Registrations of this Block. + #[pallet::storage] pub type RegistrationsThisBlock = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultRegistrationsThisBlock>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Halving time of average moving price. + #[pallet::storage] pub type EMAPriceHalvingBlocks = StorageMap<_, Identity, NetUid, u64, ValueQuery, DefaultEMAPriceMovingBlocks>; - #[pallet::storage] + /// --- MAP ( netuid ) --> global_RAO_recycled_for_registration + #[pallet::storage] pub type RAORecycledForRegistration = StorageMap< _, Identity, @@ -1549,31 +1726,38 @@ pub mod pallet { ValueQuery, DefaultRAORecycledForRegistration, >; - #[pallet::storage] + /// --- ITEM ( tx_rate_limit ) - pub type TxRateLimit = StorageValue<_, u64, ValueQuery, DefaultTxRateLimit>; #[pallet::storage] + pub type TxRateLimit = StorageValue<_, u64, ValueQuery, DefaultTxRateLimit>; + /// --- ITEM ( tx_delegate_take_rate_limit ) + #[pallet::storage] pub type TxDelegateTakeRateLimit = StorageValue<_, u64, ValueQuery, DefaultTxDelegateTakeRateLimit>; - #[pallet::storage] + /// --- ITEM ( tx_childkey_take_rate_limit ) + #[pallet::storage] pub type TxChildkeyTakeRateLimit = StorageValue<_, u64, ValueQuery, DefaultTxChildKeyTakeRateLimit>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Whether or not Liquid Alpha is enabled + #[pallet::storage] pub type LiquidAlphaOn = StorageMap<_, Blake2_128Concat, NetUid, bool, ValueQuery, DefaultLiquidAlpha>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Whether or not Yuma3 is enabled + #[pallet::storage] pub type Yuma3On = StorageMap<_, Blake2_128Concat, NetUid, bool, ValueQuery, DefaultYuma3>; - #[pallet::storage] + /// MAP ( netuid ) --> (alpha_low, alpha_high) + #[pallet::storage] pub type AlphaValues = StorageMap<_, Identity, NetUid, (u16, u16), ValueQuery, DefaultAlphaValues>; - #[pallet::storage] + /// --- MAP ( netuid ) --> If subtoken trading enabled + #[pallet::storage] pub type SubtokenEnabled = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultFalse>; @@ -1592,24 +1776,28 @@ pub mod pallet { pub fn MinImmuneOwnerUidsLimit() -> u16 { 1 } - #[pallet::storage] + /// --- MAP ( netuid ) --> Burn key limit + #[pallet::storage] pub type ImmuneOwnerUidsLimit = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultImmuneOwnerUidsLimit>; /// ======================================= /// ==== Subnetwork Consensus Storage ==== /// ======================================= - #[pallet::storage] + /// --- DMAP ( netuid ) --> stake_weight | weight for stake used in YC. + #[pallet::storage] pub type StakeWeight = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- DMAP ( netuid, hotkey ) --> uid + #[pallet::storage] pub type Uids = StorageDoubleMap<_, Identity, NetUid, Blake2_128Concat, T::AccountId, u16, OptionQuery>; - #[pallet::storage] + /// --- DMAP ( netuid, uid ) --> hotkey + #[pallet::storage] pub type Keys = StorageDoubleMap< _, Identity, @@ -1620,55 +1808,68 @@ pub mod pallet { ValueQuery, DefaultKey, >; - #[pallet::storage] + /// --- MAP ( netuid ) --> (hotkey, se, ve) + #[pallet::storage] pub type LoadedEmission = StorageMap<_, Identity, NetUid, Vec<(T::AccountId, u64, u64)>, OptionQuery>; - #[pallet::storage] + /// --- MAP ( netuid ) --> active + #[pallet::storage] pub type Active = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyBoolVec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> rank + #[pallet::storage] pub type Rank = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> trust + #[pallet::storage] pub type Trust = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> consensus + #[pallet::storage] pub type Consensus = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> incentive + #[pallet::storage] pub type Incentive = StorageMap<_, Identity, NetUidStorageIndex, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> dividends + #[pallet::storage] pub type Dividends = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> emission - pub type Emission = StorageMap<_, Identity, NetUid, Vec, ValueQuery>; #[pallet::storage] + pub type Emission = StorageMap<_, Identity, NetUid, Vec, ValueQuery>; + /// --- MAP ( netuid ) --> last_update + #[pallet::storage] pub type LastUpdate = StorageMap<_, Identity, NetUidStorageIndex, Vec, ValueQuery, EmptyU64Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> validator_trust + #[pallet::storage] pub type ValidatorTrust = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> pruning_scores + #[pallet::storage] pub type PruningScores = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyU16Vec>; - #[pallet::storage] + /// --- MAP ( netuid ) --> validator_permit + #[pallet::storage] pub type ValidatorPermit = StorageMap<_, Identity, NetUid, Vec, ValueQuery, EmptyBoolVec>; - #[pallet::storage] + /// --- DMAP ( netuid, uid ) --> weights + #[pallet::storage] pub type Weights = StorageDoubleMap< _, Identity, @@ -1679,8 +1880,9 @@ pub mod pallet { ValueQuery, DefaultWeights, >; - #[pallet::storage] + /// --- DMAP ( netuid, uid ) --> bonds + #[pallet::storage] pub type Bonds = StorageDoubleMap< _, Identity, @@ -1691,8 +1893,9 @@ pub mod pallet { ValueQuery, DefaultBonds, >; - #[pallet::storage] + /// --- DMAP ( netuid, uid ) --> block_at_registration + #[pallet::storage] pub type BlockAtRegistration = StorageDoubleMap< _, Identity, @@ -1703,8 +1906,9 @@ pub mod pallet { ValueQuery, DefaultBlockAtRegistration, >; - #[pallet::storage] + /// --- MAP ( netuid, hotkey ) --> axon_info + #[pallet::storage] pub type Axons = StorageDoubleMap< _, Identity, @@ -1714,6 +1918,7 @@ pub mod pallet { AxonInfoOf, OptionQuery, >; + /// --- MAP ( netuid, hotkey ) --> certificate #[pallet::storage] pub type NeuronCertificates = StorageDoubleMap< @@ -1725,8 +1930,9 @@ pub mod pallet { NeuronCertificateOf, OptionQuery, >; - #[pallet::storage] + /// --- MAP ( netuid, hotkey ) --> prometheus_info + #[pallet::storage] pub type Prometheus = StorageDoubleMap< _, Identity, @@ -1736,36 +1942,38 @@ pub mod pallet { PrometheusInfoOf, OptionQuery, >; - #[pallet::storage] + /// --- MAP ( coldkey ) --> identity. (DEPRECATED for V2) + #[pallet::storage] pub type Identities = StorageMap<_, Blake2_128Concat, T::AccountId, ChainIdentityOf, OptionQuery>; - #[pallet::storage] /// --- MAP ( coldkey ) --> identity + #[pallet::storage] pub type IdentitiesV2 = StorageMap<_, Blake2_128Concat, T::AccountId, ChainIdentityOfV2, OptionQuery>; - #[pallet::storage] /// --- MAP ( netuid ) --> identity. (DEPRECATED for V2) + #[pallet::storage] pub type SubnetIdentities = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOf, OptionQuery>; - #[pallet::storage] /// --- MAP ( netuid ) --> identityV2 (DEPRECATED for V3) + #[pallet::storage] pub type SubnetIdentitiesV2 = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOfV2, OptionQuery>; - #[pallet::storage] /// --- MAP ( netuid ) --> SubnetIdentityOfV3 + #[pallet::storage] pub type SubnetIdentitiesV3 = StorageMap<_, Blake2_128Concat, NetUid, SubnetIdentityOfV3, OptionQuery>; /// ================================= /// ==== Axon / Promo Endpoints ===== /// ================================= - #[pallet::storage] + /// --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. + #[pallet::storage] pub type TransactionKeyLastBlock = StorageNMap< _, ( @@ -1776,27 +1984,32 @@ pub mod pallet { u64, ValueQuery, >; + + /// --- MAP ( key ) --> last_block #[deprecated] #[pallet::storage] - /// --- MAP ( key ) --> last_block pub type LastTxBlock = StorageMap<_, Identity, T::AccountId, u64, ValueQuery, DefaultLastTxBlock>; + + /// --- MAP ( key ) --> last_tx_block_childkey_take #[deprecated] #[pallet::storage] - /// --- MAP ( key ) --> last_tx_block_childkey_take pub type LastTxBlockChildKeyTake = StorageMap<_, Identity, T::AccountId, u64, ValueQuery, DefaultLastTxBlock>; + + /// --- MAP ( key ) --> last_tx_block_delegate_take #[deprecated] #[pallet::storage] - /// --- MAP ( key ) --> last_tx_block_delegate_take pub type LastTxBlockDelegateTake = StorageMap<_, Identity, T::AccountId, u64, ValueQuery, DefaultLastTxBlock>; + + /// ITEM( weights_min_stake ) // FIXME: this storage is used interchangably for alpha/tao #[pallet::storage] - /// ITEM( weights_min_stake ) pub type StakeThreshold = StorageValue<_, u64, ValueQuery, DefaultStakeThreshold>; - #[pallet::storage] + /// --- MAP (netuid, who) --> VecDeque<(hash, commit_block, first_reveal_block, last_reveal_block)> | Stores a queue of commits for an account on a given netuid. + #[pallet::storage] pub type WeightCommits = StorageDoubleMap< _, Twox64Concat, @@ -1806,9 +2019,10 @@ pub mod pallet { VecDeque<(H256, u64, u64, u64)>, OptionQuery, >; - #[pallet::storage] + /// MAP (netuid, epoch) → VecDeque<(who, commit_block, ciphertext, reveal_round)> /// Stores a queue of weight commits for an account on a given subnet. + #[pallet::storage] pub type TimelockedWeightCommits = StorageDoubleMap< _, Twox64Concat, @@ -1823,9 +2037,10 @@ pub mod pallet { )>, ValueQuery, >; - #[pallet::storage] + /// MAP (netuid, epoch) → VecDeque<(who, ciphertext, reveal_round)> /// DEPRECATED for CRV3WeightCommitsV2 + #[pallet::storage] pub type CRV3WeightCommits = StorageDoubleMap< _, Twox64Concat, @@ -1839,9 +2054,10 @@ pub mod pallet { )>, ValueQuery, >; - #[pallet::storage] + /// MAP (netuid, epoch) → VecDeque<(who, commit_block, ciphertext, reveal_round)> /// DEPRECATED for TimelockedWeightCommits + #[pallet::storage] pub type CRV3WeightCommitsV2 = StorageDoubleMap< _, Twox64Concat, @@ -1856,13 +2072,14 @@ pub mod pallet { )>, ValueQuery, >; - #[pallet::storage] + /// --- Map (netuid) --> Number of epochs allowed for commit reveal periods + #[pallet::storage] pub type RevealPeriodEpochs = StorageMap<_, Twox64Concat, NetUid, u64, ValueQuery, DefaultRevealPeriodEpochs>; - #[pallet::storage] /// --- Map (coldkey, hotkey) --> u64 the last block at which stake was added/removed. + #[pallet::storage] pub type LastColdkeyHotkeyStakeBlock = StorageDoubleMap< _, Twox64Concat, @@ -1873,9 +2090,9 @@ pub mod pallet { OptionQuery, >; - #[pallet::storage] /// DMAP ( hot, cold, netuid ) --> rate limits for staking operations /// Value contains just a marker: we use this map as a set. + #[pallet::storage] pub type StakingOperationRateLimiter = StorageNMap< _, ( @@ -1890,45 +2107,47 @@ pub mod pallet { /// ============================= /// ==== EVM related storage ==== /// ============================= - #[pallet::storage] + /// --- DMAP (netuid, uid) --> (H160, last_block_where_ownership_was_proven) + #[pallet::storage] pub type AssociatedEvmAddress = StorageDoubleMap<_, Twox64Concat, NetUid, Twox64Concat, u16, (H160, u64), OptionQuery>; /// ======================== /// ==== Subnet Leasing ==== /// ======================== - #[pallet::storage] + /// --- MAP ( lease_id ) --> subnet lease | The subnet lease for a given lease id. + #[pallet::storage] pub type SubnetLeases = StorageMap<_, Twox64Concat, LeaseId, SubnetLeaseOf, OptionQuery>; - #[pallet::storage] /// --- DMAP ( lease_id, contributor ) --> shares | The shares of a contributor for a given lease. + #[pallet::storage] pub type SubnetLeaseShares = StorageDoubleMap<_, Twox64Concat, LeaseId, Identity, T::AccountId, U64F64, ValueQuery>; - #[pallet::storage] /// --- MAP ( netuid ) --> lease_id | The lease id for a given netuid. + #[pallet::storage] pub type SubnetUidToLeaseId = StorageMap<_, Twox64Concat, NetUid, LeaseId, OptionQuery>; - #[pallet::storage] /// --- ITEM ( next_lease_id ) | The next lease id. + #[pallet::storage] pub type NextSubnetLeaseId = StorageValue<_, LeaseId, ValueQuery, ConstU32<0>>; - #[pallet::storage] /// --- MAP ( lease_id ) --> accumulated_dividends | The accumulated dividends for a given lease that needs to be distributed. + #[pallet::storage] pub type AccumulatedLeaseDividends = StorageMap<_, Twox64Concat, LeaseId, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - #[pallet::storage] /// --- ITEM ( CommitRevealWeightsVersion ) + #[pallet::storage] pub type CommitRevealWeightsVersion = StorageValue<_, u16, ValueQuery, DefaultCommitRevealWeightsVersion>; - #[pallet::storage] /// ITEM( NetworkRegistrationStartBlock ) + #[pallet::storage] pub type NetworkRegistrationStartBlock = StorageValue<_, u64, ValueQuery, DefaultNetworkRegistrationStartBlock>; @@ -1955,20 +2174,23 @@ pub mod pallet { pub fn MechanismEmissionRateLimit() -> u64 { prod_or_fast!(7_200, 1) } - #[pallet::storage] + /// --- MAP ( netuid ) --> Current number of subnet mechanisms + #[pallet::storage] pub type MechanismCountCurrent = StorageMap<_, Twox64Concat, NetUid, MechId, ValueQuery, DefaultMechanismCount>; - #[pallet::storage] + /// --- MAP ( netuid ) --> Normalized vector of emission split proportion between subnet mechanisms + #[pallet::storage] pub type MechanismEmissionSplit = StorageMap<_, Twox64Concat, NetUid, Vec, OptionQuery>; /// ================== /// ==== Genesis ===== /// ================== - #[pallet::storage] + /// --- Storage for migration run status + #[pallet::storage] pub type HasMigrationRun = StorageMap<_, Identity, Vec, bool, ValueQuery>; #[pallet::type_value] @@ -1977,8 +2199,8 @@ pub mod pallet { 0 } - #[pallet::storage] /// Storage value for pending childkey cooldown, settable by root. + #[pallet::storage] pub type PendingChildKeyCooldown = StorageValue<_, u64, ValueQuery, DefaultPendingChildKeyCooldown>; From b7f776b3c9be9445b58a1f46d9579e48f649ea1c Mon Sep 17 00:00:00 2001 From: open-junius Date: Tue, 21 Oct 2025 20:06:11 +0800 Subject: [PATCH 09/13] manually update sth missed --- pallets/subtensor/src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 9d554f9866..916ce48b18 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -480,6 +480,7 @@ pub mod pallet { pub fn DefaultBurn() -> TaoCurrency { T::InitialBurn::get().into() } + /// Default burn token. #[pallet::type_value] pub fn DefaultMinBurn() -> TaoCurrency { @@ -1761,18 +1762,19 @@ pub mod pallet { pub type SubtokenEnabled = StorageMap<_, Identity, NetUid, bool, ValueQuery, DefaultFalse>; - #[pallet::type_value] /// Default value for burn keys limit + #[pallet::type_value] pub fn DefaultImmuneOwnerUidsLimit() -> u16 { 1 } - #[pallet::type_value] + /// Maximum value for burn keys limit pub fn MaxImmuneOwnerUidsLimit() -> u16 { 10 } - #[pallet::type_value] + /// Minimum value for burn keys limit + #[pallet::type_value] pub fn MinImmuneOwnerUidsLimit() -> u16 { 1 } @@ -2193,8 +2195,8 @@ pub mod pallet { #[pallet::storage] pub type HasMigrationRun = StorageMap<_, Identity, Vec, bool, ValueQuery>; - #[pallet::type_value] /// Default value for pending childkey cooldown (settable by root, default 0) + #[pallet::type_value] pub fn DefaultPendingChildKeyCooldown() -> u64 { 0 } From 891a788346e331a31c9a6d05a13d510bdf09b8d3 Mon Sep 17 00:00:00 2001 From: open-junius Date: Wed, 22 Oct 2025 13:47:27 +0800 Subject: [PATCH 10/13] fix format --- pallets/subtensor/src/lib.rs | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 65f4b4ad9a..94568988f1 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -313,7 +313,6 @@ pub mod pallet { /// ============================ /// ==== Staking + Accounts ==== /// ============================ - /// Default value for zero. #[pallet::type_value] pub fn DefaultZeroU64() -> u64 { @@ -1047,7 +1046,6 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - /// --- ITEM --> Global weight #[pallet::storage] pub type TaoWeight = StorageValue<_, u64, ValueQuery, DefaultTaoWeight>; @@ -1162,7 +1160,6 @@ pub mod pallet { /// ================== /// ==== Coinbase ==== /// ================== - /// --- ITEM ( global_block_emission ) #[pallet::storage] pub type BlockEmission = StorageValue<_, u64, ValueQuery, DefaultBlockEmission>; @@ -1191,7 +1188,6 @@ pub mod pallet { /// /// Eventually, Bittensor should migrate to using Holds afterwhich time we will not require this /// separate accounting. - /// --- ITEM ( maximum_number_of_networks ) #[pallet::storage] pub type SubnetLimit = StorageValue<_, u16, ValueQuery, DefaultSubnetLimit>; @@ -1363,7 +1359,6 @@ pub mod pallet { /// ============================ /// ==== Global Parameters ===== /// ============================ - /// --- StorageItem Global Used Work. #[pallet::storage] pub type UsedWork = StorageMap<_, Identity, Vec, u64, ValueQuery>; @@ -1417,7 +1412,6 @@ pub mod pallet { /// ============================ /// ==== Rate Limiting ===== /// ============================ - /// --- MAP ( RateLimitKey ) --> Block number in which the last rate limited operation occured #[pallet::storage] pub type LastRateLimitedBlock = @@ -1426,7 +1420,6 @@ pub mod pallet { /// ============================ /// ==== Subnet Locks ===== /// ============================ - /// --- MAP ( netuid ) --> transfer_toggle #[pallet::storage] pub type TransferToggle = @@ -1445,7 +1438,6 @@ pub mod pallet { /// ================= /// ==== Tempos ===== /// ================= - /// --- MAP ( netuid ) --> tempo #[pallet::storage] pub type Tempo = StorageMap<_, Identity, NetUid, u16, ValueQuery, DefaultTempo>; @@ -1453,7 +1445,6 @@ pub mod pallet { /// ============================ /// ==== Subnet Parameters ===== /// ============================ - /// --- MAP ( netuid ) --> block number of first emission #[pallet::storage] pub type FirstEmissionBlockNumber = @@ -1769,6 +1760,7 @@ pub mod pallet { } /// Maximum value for burn keys limit + #[pallet::type_value] pub fn MaxImmuneOwnerUidsLimit() -> u16 { 10 } @@ -1787,7 +1779,6 @@ pub mod pallet { /// ======================================= /// ==== Subnetwork Consensus Storage ==== /// ======================================= - /// --- DMAP ( netuid ) --> stake_weight | weight for stake used in YC. #[pallet::storage] pub type StakeWeight = @@ -1973,7 +1964,6 @@ pub mod pallet { /// ================================= /// ==== Axon / Promo Endpoints ===== /// ================================= - /// --- NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name. #[pallet::storage] pub type TransactionKeyLastBlock = StorageNMap< @@ -2109,7 +2099,6 @@ pub mod pallet { /// ============================= /// ==== EVM related storage ==== /// ============================= - /// --- DMAP (netuid, uid) --> (H160, last_block_where_ownership_was_proven) #[pallet::storage] pub type AssociatedEvmAddress = @@ -2118,7 +2107,6 @@ pub mod pallet { /// ======================== /// ==== Subnet Leasing ==== /// ======================== - /// --- MAP ( lease_id ) --> subnet lease | The subnet lease for a given lease id. #[pallet::storage] pub type SubnetLeases = @@ -2156,23 +2144,26 @@ pub mod pallet { /// ============================ /// ==== Subnet Mechanisms ===== /// ============================ - #[pallet::type_value] /// -- ITEM (Default number of sub-subnets) + #[pallet::type_value] pub fn DefaultMechanismCount() -> MechId { MechId::from(1) } - #[pallet::type_value] + /// -- ITEM (Maximum number of sub-subnets) + #[pallet::type_value] pub fn MaxMechanismCount() -> MechId { MechId::from(2) } - #[pallet::type_value] + /// -- ITEM (Rate limit for mechanism count updates) + #[pallet::type_value] pub fn MechanismCountSetRateLimit() -> u64 { prod_or_fast!(7_200, 1) } - #[pallet::type_value] + /// -- ITEM (Rate limit for mechanism emission distribution updates) + #[pallet::type_value] pub fn MechanismEmissionRateLimit() -> u64 { prod_or_fast!(7_200, 1) } @@ -2190,7 +2181,6 @@ pub mod pallet { /// ================== /// ==== Genesis ===== /// ================== - /// --- Storage for migration run status #[pallet::storage] pub type HasMigrationRun = StorageMap<_, Identity, Vec, bool, ValueQuery>; From 72f052b2dd2d64526d7dda3d58f944d13e81da4d Mon Sep 17 00:00:00 2001 From: open-junius Date: Thu, 30 Oct 2025 15:40:02 +0800 Subject: [PATCH 11/13] commit Cargo.lock --- pallets/subtensor/src/lib.rs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 4d4cf33584..2bd4240636 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -1627,16 +1627,6 @@ pub mod pallet { pub type PendingEmission = StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultPendingEmission>; - /// --- MAP ( netuid ) --> pending_root_emission - #[pallet::storage] - pub type PendingRootDivs = - StorageMap<_, Identity, NetUid, TaoCurrency, ValueQuery, DefaultZeroTao>; - - /// --- MAP ( netuid ) --> pending_alpha_swapped - #[pallet::storage] - pub type PendingAlphaSwapped = - StorageMap<_, Identity, NetUid, AlphaCurrency, ValueQuery, DefaultZeroAlpha>; - /// --- MAP ( netuid ) --> pending_root_alpha_emission #[pallet::storage] pub type PendingRootAlphaDivs = From 426d4321266669dc6bd05abe76799c4452967d33 Mon Sep 17 00:00:00 2001 From: open-junius Date: Thu, 30 Oct 2025 15:42:18 +0800 Subject: [PATCH 12/13] remove obsolete storage --- pallets/subtensor/src/lib.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 2bd4240636..62641c0a94 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -1220,19 +1220,6 @@ pub mod pallet { DefaultZeroAlpha, >; - /// --- DMAP ( netuid, hotkey ) --> u64 | Last total root dividend paid to this hotkey on this subnet. - #[pallet::storage] - pub type TaoDividendsPerSubnet = StorageDoubleMap< - _, - Identity, - NetUid, - Blake2_128Concat, - T::AccountId, - TaoCurrency, - ValueQuery, - DefaultZeroTao, - >; - /// ================== /// ==== Coinbase ==== /// ================== From ab5b272a303d45454457ff264fba6074e64bcaca Mon Sep 17 00:00:00 2001 From: open-junius Date: Thu, 30 Oct 2025 15:50:30 +0800 Subject: [PATCH 13/13] bump version --- runtime/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index a4ee4a3b93..d8277164e2 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 333, + spec_version: 334, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,