@@ -70,31 +70,6 @@ impl<T: Config> Pallet<T> {
70
70
false
71
71
}
72
72
73
- /// Sets the emission values for each netuid
74
- ///
75
- pub fn set_emission_values ( netuids : & [ u16 ] , emission : Vec < u64 > ) -> Result < ( ) , & ' static str > {
76
- log:: debug!(
77
- "set_emission_values: netuids: {:?} emission:{:?}" ,
78
- netuids,
79
- emission
80
- ) ;
81
-
82
- // Be careful this function can fail.
83
- if Self :: contains_invalid_root_uids ( netuids) {
84
- log:: error!( "set_emission_values: contains_invalid_root_uids" ) ;
85
- return Err ( "Invalid netuids" ) ;
86
- }
87
- if netuids. len ( ) != emission. len ( ) {
88
- log:: error!( "set_emission_values: netuids.len() != emission.len()" ) ;
89
- return Err ( "netuids and emission must have the same length" ) ;
90
- }
91
- for ( netuid_i, emission_i) in netuids. iter ( ) . zip ( emission) {
92
- log:: debug!( "set netuid:{:?} emission:{:?}" , netuid_i, emission_i) ;
93
- EmissionValues :: < T > :: insert ( * netuid_i, emission_i) ;
94
- }
95
- Ok ( ( ) )
96
- }
97
-
98
73
/// Retrieves weight matrix associated with the root network.
99
74
/// Weights represent the preferences for each subnetwork.
100
75
///
@@ -577,7 +552,6 @@ impl<T: Config> Pallet<T> {
577
552
MaxAllowedUids :: < T > :: remove ( netuid) ;
578
553
ImmunityPeriod :: < T > :: remove ( netuid) ;
579
554
ActivityCutoff :: < T > :: remove ( netuid) ;
580
- EmissionValues :: < T > :: remove ( netuid) ;
581
555
MaxWeightsLimit :: < T > :: remove ( netuid) ;
582
556
MinAllowedWeights :: < T > :: remove ( netuid) ;
583
557
RegistrationsThisInterval :: < T > :: remove ( netuid) ;
@@ -647,55 +621,6 @@ impl<T: Config> Pallet<T> {
647
621
lock_cost
648
622
}
649
623
650
- /// This function is used to determine which subnet to prune when the total number of networks has reached the limit.
651
- /// It iterates over all the networks and finds the oldest subnet with the minimum emission value that is not in the immunity period.
652
- ///
653
- /// # Returns:
654
- /// * 'u16':
655
- /// - The uid of the network to be pruned.
656
- ///
657
- pub fn get_subnet_to_prune ( ) -> u16 {
658
- let mut netuids: Vec < u16 > = vec ! [ ] ;
659
- let current_block = Self :: get_current_block_as_u64 ( ) ;
660
-
661
- // Even if we don't have a root subnet, this still works
662
- for netuid in NetworksAdded :: < T > :: iter_keys_from ( NetworksAdded :: < T > :: hashed_key_for ( 0 ) ) {
663
- if current_block. saturating_sub ( Self :: get_network_registered_block ( netuid) )
664
- < Self :: get_network_immunity_period ( )
665
- {
666
- continue ;
667
- }
668
-
669
- // This iterator seems to return them in order anyways, so no need to sort by key
670
- netuids. push ( netuid) ;
671
- }
672
-
673
- // Now we sort by emission, and then by subnet creation time.
674
- netuids. sort_by ( |a, b| {
675
- use sp_std:: cmp:: Ordering ;
676
-
677
- match Self :: get_emission_value ( * b) . cmp ( & Self :: get_emission_value ( * a) ) {
678
- Ordering :: Equal => {
679
- if Self :: get_network_registered_block ( * b)
680
- < Self :: get_network_registered_block ( * a)
681
- {
682
- Ordering :: Less
683
- } else {
684
- Ordering :: Equal
685
- }
686
- }
687
- v => v,
688
- }
689
- } ) ;
690
-
691
- log:: debug!( "Netuids Order: {:?}" , netuids) ;
692
-
693
- match netuids. last ( ) {
694
- Some ( netuid) => * netuid,
695
- None => 0 ,
696
- }
697
- }
698
-
699
624
pub fn get_network_registered_block ( netuid : u16 ) -> u64 {
700
625
NetworkRegisteredAt :: < T > :: get ( netuid)
701
626
}
0 commit comments