@@ -27,9 +27,9 @@ impl<T: Config> Pallet<T> {
2727 Ok ( ( ) )
2828 }
2929
30- // Helper function which returns the number of blocks remaining before we will run the epoch on this
31- // network. Networks run their epoch when (block_number + netuid + 1 ) % (tempo + 1) = 0
32- //
30+ /// Helper function which returns the number of blocks remaining before we will run the epoch on this
31+ /// network. Networks run their epoch when (block_number + netuid + 1 ) % (tempo + 1) = 0
32+ ///
3333 pub fn blocks_until_next_epoch ( netuid : u16 , tempo : u16 , block_number : u64 ) -> u64 {
3434 // tempo | netuid | # first epoch block
3535 // 1 0 0
@@ -45,9 +45,9 @@ impl<T: Config> Pallet<T> {
4545 tempo as u64 - ( block_number + netuid as u64 + 1 ) % ( tempo as u64 + 1 )
4646 }
4747
48- // Helper function returns the number of tuples to drain on a particular step based on
49- // the remaining tuples to sink and the block number
50- //
48+ /// Helper function returns the number of tuples to drain on a particular step based on
49+ /// the remaining tuples to sink and the block number
50+ ///
5151 pub fn tuples_to_drain_this_block (
5252 netuid : u16 ,
5353 tempo : u16 ,
@@ -78,9 +78,9 @@ impl<T: Config> Pallet<T> {
7878 LoadedEmission :: < T > :: get ( netuid)
7979 }
8080
81- // Reads from the loaded emission storage which contains lists of pending emission tuples ( hotkey, amount )
82- // and distributes small chunks of them at a time.
83- //
81+ /// Reads from the loaded emission storage which contains lists of pending emission tuples ( hotkey, amount )
82+ /// and distributes small chunks of them at a time.
83+ ///
8484 pub fn drain_emission ( _: u64 ) {
8585 // --- 1. We iterate across each network.
8686 for ( netuid, _) in <Tempo < T > as IterableStorageMap < u16 , u16 > >:: iter ( ) {
@@ -102,10 +102,10 @@ impl<T: Config> Pallet<T> {
102102 }
103103 }
104104
105- // Iterates through networks queues more emission onto their pending storage.
106- // If a network has no blocks left until tempo, we run the epoch function and generate
107- // more token emission tuples for later draining onto accounts.
108- //
105+ /// Iterates through networks queues more emission onto their pending storage.
106+ /// If a network has no blocks left until tempo, we run the epoch function and generate
107+ /// more token emission tuples for later draining onto accounts.
108+ ///
109109 pub fn generate_emission ( block_number : u64 ) {
110110 // --- 1. Iterate across each network and add pending emission into stash.
111111 for ( netuid, tempo) in <Tempo < T > as IterableStorageMap < u16 , u16 > >:: iter ( ) {
@@ -200,10 +200,10 @@ impl<T: Config> Pallet<T> {
200200 Self :: set_last_mechanism_step_block ( netuid, block_number) ;
201201 }
202202 }
203- // Distributes token inflation through the hotkey based on emission. The call ensures that the inflation
204- // is distributed onto the accounts in proportion of the stake delegated minus the take. This function
205- // is called after an epoch to distribute the newly minted stake according to delegation.
206- //
203+ /// Distributes token inflation through the hotkey based on emission. The call ensures that the inflation
204+ /// is distributed onto the accounts in proportion of the stake delegated minus the take. This function
205+ /// is called after an epoch to distribute the newly minted stake according to delegation.
206+ ///
207207 pub fn emit_inflation_through_hotkey_account (
208208 hotkey : & T :: AccountId ,
209209 server_emission : u64 ,
@@ -264,9 +264,9 @@ impl<T: Config> Pallet<T> {
264264 Self :: increase_stake_on_hotkey_account ( hotkey, server_emission) ;
265265 }
266266
267- // Increases the stake on the cold - hot pairing by increment while also incrementing other counters.
268- // This function should be called rather than set_stake under account.
269- //
267+ /// Increases the stake on the cold - hot pairing by increment while also incrementing other counters.
268+ /// This function should be called rather than set_stake under account.
269+ ///
270270 pub fn block_step_increase_stake_on_coldkey_hotkey_account (
271271 coldkey : & T :: AccountId ,
272272 hotkey : & T :: AccountId ,
@@ -285,8 +285,8 @@ impl<T: Config> Pallet<T> {
285285 TotalStake :: < T > :: put ( TotalStake :: < T > :: get ( ) . saturating_add ( increment) ) ;
286286 }
287287
288- // Decreases the stake on the cold - hot pairing by the decrement while decreasing other counters.
289- //
288+ /// Decreases the stake on the cold - hot pairing by the decrement while decreasing other counters.
289+ ///
290290 pub fn block_step_decrease_stake_on_coldkey_hotkey_account (
291291 coldkey : & T :: AccountId ,
292292 hotkey : & T :: AccountId ,
@@ -305,8 +305,8 @@ impl<T: Config> Pallet<T> {
305305 TotalStake :: < T > :: put ( TotalStake :: < T > :: get ( ) . saturating_sub ( decrement) ) ;
306306 }
307307
308- // Returns emission awarded to a hotkey as a function of its proportion of the total stake.
309- //
308+ /// Returns emission awarded to a hotkey as a function of its proportion of the total stake.
309+ ///
310310 pub fn calculate_stake_proportional_emission (
311311 stake : u64 ,
312312 total_stake : u64 ,
@@ -320,8 +320,8 @@ impl<T: Config> Pallet<T> {
320320 proportional_emission. to_num :: < u64 > ( )
321321 }
322322
323- // Returns the delegated stake 'take' assigned to this key. (If exists, otherwise 0)
324- //
323+ /// Returns the delegated stake 'take' assigned to this key. (If exists, otherwise 0)
324+ ///
325325 pub fn calculate_delegate_proportional_take ( hotkey : & T :: AccountId , emission : u64 ) -> u64 {
326326 if Self :: hotkey_is_delegate ( hotkey) {
327327 let take_proportion: I64F64 =
@@ -333,8 +333,8 @@ impl<T: Config> Pallet<T> {
333333 }
334334 }
335335
336- // Adjusts the network difficulties/burns of every active network. Resetting state parameters.
337- //
336+ /// Adjusts the network difficulties/burns of every active network. Resetting state parameters.
337+ ///
338338 pub fn adjust_registration_terms_for_networks ( ) {
339339 log:: debug!( "adjust_registration_terms_for_networks" ) ;
340340
@@ -490,9 +490,9 @@ impl<T: Config> Pallet<T> {
490490 }
491491 }
492492
493- // Calculates the upgraded difficulty by multiplying the current difficulty by the ratio ( reg_actual + reg_target / reg_target + reg_target )
494- // We use I110F18 to avoid any overflows on u64. Also min_difficulty and max_difficulty bound the range.
495- //
493+ /// Calculates the upgraded difficulty by multiplying the current difficulty by the ratio ( reg_actual + reg_target / reg_target + reg_target )
494+ /// We use I110F18 to avoid any overflows on u64. Also min_difficulty and max_difficulty bound the range.
495+ ///
496496 pub fn upgraded_difficulty (
497497 netuid : u16 ,
498498 current_difficulty : u64 ,
@@ -517,9 +517,9 @@ impl<T: Config> Pallet<T> {
517517 }
518518 }
519519
520- // Calculates the upgraded burn by multiplying the current burn by the ratio ( reg_actual + reg_target / reg_target + reg_target )
521- // We use I110F18 to avoid any overflows on u64. Also min_burn and max_burn bound the range.
522- //
520+ /// Calculates the upgraded burn by multiplying the current burn by the ratio ( reg_actual + reg_target / reg_target + reg_target )
521+ /// We use I110F18 to avoid any overflows on u64. Also min_burn and max_burn bound the range.
522+ ///
523523 pub fn upgraded_burn (
524524 netuid : u16 ,
525525 current_burn : u64 ,
0 commit comments