@@ -51,8 +51,7 @@ impl<T: Config> Pallet<T> {
5151 Self :: emission_to_subnet ( * netuid_i, block_emission, total_moving_prices) ;
5252 }
5353
54- // --- 8. Drain pending emission through the subnet based on tempo.
55- // Run the epoch for *all* subnets, even if we don't emit anything.
54+ // Run crv3 and epoch for *all* subnets, even if we don't emit anything.
5655 for & netuid in subnets. iter ( ) {
5756 // Reveal matured weights.
5857 if let Err ( e) = Self :: reveal_crv3_commits ( netuid) {
@@ -117,26 +116,35 @@ impl<T: Config> Pallet<T> {
117116 SubnetAlphaIn :: < T > :: mutate ( netuid, |total| {
118117 * total = total. saturating_add ( alpha_in_currency) ;
119118 } ) ;
119+ log:: debug!( "Add {alpha_in_currency} into SubnetAlphaInEmission in subnet {netuid:?}" ) ;
120120
121121 // Injection Alpha out.
122122 let alpha_out_currency = AlphaCurrency :: from ( tou64 ! ( alpha_out_value) ) ;
123123 SubnetAlphaOutEmission :: < T > :: insert ( netuid, alpha_out_currency) ;
124124 SubnetAlphaOut :: < T > :: mutate ( netuid, |total| {
125125 * total = total. saturating_add ( alpha_out_currency) ;
126126 } ) ;
127+ log:: debug!( "Add {alpha_out_currency} into SubnetAlphaOutEmission in subnet {netuid:?}" ) ;
127128
128129 // Inject TAO in.
129130 let tao_in_currency: TaoCurrency = tou64 ! ( tao_in_value) . into ( ) ;
130131 SubnetTaoInEmission :: < T > :: insert ( netuid, TaoCurrency :: from ( tao_in_currency) ) ;
131132 SubnetTAO :: < T > :: mutate ( netuid, |total| {
132133 * total = total. saturating_add ( tao_in_currency. into ( ) ) ;
133134 } ) ;
135+ log:: debug!( "Add {tao_in_currency} into SubnetTaoInEmission in subnet {netuid:?}" ) ;
136+
137+ // Update total stake.
134138 TotalStake :: < T > :: mutate ( |total| {
135139 * total = total. saturating_add ( tao_in_currency. into ( ) ) ;
136140 } ) ;
141+ log:: debug!( "Add {tao_in_currency} into TotalStake in subnet {netuid:?}" ) ;
142+
143+ // Update total issuance.
137144 TotalIssuance :: < T > :: mutate ( |total| {
138145 * total = total. saturating_add ( tao_in_currency. into ( ) ) ;
139146 } ) ;
147+ log:: debug!( "Add {tao_in_currency} into TotalIssuance in subnet {netuid:?}" ) ;
140148
141149 // Adjust protocol liquidity based on new reserves
142150 T :: SwapInterface :: adjust_protocol_liquidity ( netuid, tao_in_currency, alpha_in_currency) ;
@@ -146,12 +154,11 @@ impl<T: Config> Pallet<T> {
146154 Self :: split_alpha_out ( netuid, alpha_out_value, is_subsidized) ;
147155 }
148156
149- // --- 7. Update moving prices after using them in the emission calculation.
150- // Update moving prices after using them above.
157+ // Update moving prices after using them in the emission calculation.
151158 Self :: update_moving_price ( netuid) ;
152159 }
153160
154- /// Splits the alpha output for a subnet into owner cuts and root dividends .
161+ /// Splits the alpha output for a subnet into owner cuts, validators, and miners .
155162 ///
156163 /// # Arguments
157164 /// * `netuid` - The subnet ID to split alpha for
@@ -161,7 +168,7 @@ impl<T: Config> Pallet<T> {
161168 /// This function:
162169 /// 1. Takes a cut of alpha for the subnet owner based on owner_cut percentage
163170 /// 2. Calculates root dividends based on TAO weight and alpha issuance
164- /// 3. Splits remaining alpha between root validators and subnet
171+ /// 3. Splits remaining alpha between root validators and miners
165172 pub fn split_alpha_out ( netuid : NetUid , alpha_out_value : U96F32 , is_subsidized : bool ) {
166173 let mut alpha_out_value = alpha_out_value;
167174 let cut_percent: U96F32 = Self :: get_float_subnet_owner_cut ( ) ;
@@ -221,18 +228,25 @@ impl<T: Config> Pallet<T> {
221228 PendingRootDivs :: < T > :: mutate ( netuid, |total| {
222229 * total = total. saturating_add ( root_tao) ;
223230 } ) ;
231+ log:: debug!(
232+ "Swapped {root_tao} TAO and added into PendingRootDivs in subnet {netuid:?}"
233+ ) ;
224234 }
225235 }
226236
227237 // Accumulate alpha emission in pending.
238+ let root_alpha_u64 = tou64 ! ( root_alpha) ;
228239 PendingAlphaSwapped :: < T > :: mutate ( netuid, |total| {
229- * total = total. saturating_add ( tou64 ! ( root_alpha ) . into ( ) ) ;
240+ * total = total. saturating_add ( root_alpha_u64 . into ( ) ) ;
230241 } ) ;
242+ log:: debug!( "Add {root_alpha_u64} into PendingAlphaSwapped in subnet {netuid:?}" ) ;
231243
232244 // Accumulate alpha emission in pending.
245+ let pending_alpha_u64 = tou64 ! ( pending_alpha) ;
233246 PendingEmission :: < T > :: mutate ( netuid, |total| {
234- * total = total. saturating_add ( tou64 ! ( pending_alpha ) . into ( ) ) ;
247+ * total = total. saturating_add ( pending_alpha_u64 . into ( ) ) ;
235248 } ) ;
249+ log:: debug!( "Add {pending_alpha_u64} into PendingEmission in subnet {netuid:?}" ) ;
236250 }
237251
238252 /// Calculates the injection of TAO and Alpha into the subnet.
0 commit comments