@@ -21,12 +21,15 @@ impl<T: Config + pallet_drand::Config> Pallet<T> {
2121
2222 // --- 3. Reveal matured weights.
2323 Self :: reveal_crv3_commits ( ) ;
24+ // --- 4. Run emission through network.
2425 Self :: run_coinbase ( block_emission) ;
25- // --- 4. Set pending children on the epoch; but only after the coinbase has been run.
26+ // --- 5. Update moving prices AFTER using them for emissions.
27+ Self :: update_moving_prices ( ) ;
28+ // --- 6. Set pending children on the epoch; but only after the coinbase has been run.
2629 Self :: try_set_pending_children ( block_number) ;
27- // --- 5 . Run auto-claim root divs.
30+ // --- 7 . Run auto-claim root divs.
2831 Self :: run_auto_claim_root_divs ( last_block_hash) ;
29- // --- 6 . Populate root coldkey maps.
32+ // --- 8 . Populate root coldkey maps.
3033 Self :: populate_root_coldkey_staking_maps ( ) ;
3134
3235 // Return ok.
@@ -264,6 +267,16 @@ impl<T: Config + pallet_drand::Config> Pallet<T> {
264267 }
265268 }
266269
270+ pub fn update_moving_prices ( ) {
271+ let subnets_to_emit_to: Vec < NetUid > =
272+ Self :: get_subnets_to_emit_to ( & Self :: get_all_subnet_netuids ( ) ) ;
273+ // Only update price EMA for subnets that we emit to.
274+ for netuid_i in subnets_to_emit_to. iter ( ) {
275+ // Update moving prices after using them above.
276+ Self :: update_moving_price ( * netuid_i) ;
277+ }
278+ }
279+
267280 pub fn reveal_crv3_commits ( ) {
268281 let netuids: Vec < NetUid > = Self :: get_all_subnet_netuids ( ) ;
269282 for netuid in netuids. into_iter ( ) . filter ( |netuid| * netuid != NetUid :: ROOT ) {
0 commit comments