@@ -213,7 +213,7 @@ where
213
213
{
214
214
pub fn merge_value ( & mut self , other : & Self , metagraph_index : usize ) {
215
215
match SelectiveMetagraphIndex :: from_index ( metagraph_index) {
216
- // Name and symbol
216
+ Some ( SelectiveMetagraphIndex :: Netuid ) => self . netuid = other . netuid ,
217
217
Some ( SelectiveMetagraphIndex :: Name ) => self . name = other. name . clone ( ) ,
218
218
Some ( SelectiveMetagraphIndex :: Symbol ) => self . symbol = other. symbol . clone ( ) ,
219
219
Some ( SelectiveMetagraphIndex :: Identity ) => self . identity = other. identity . clone ( ) ,
@@ -450,6 +450,7 @@ where
450
450
}
451
451
452
452
pub enum SelectiveMetagraphIndex {
453
+ Netuid ,
453
454
Name ,
454
455
Symbol ,
455
456
Identity ,
@@ -526,77 +527,78 @@ pub enum SelectiveMetagraphIndex {
526
527
impl SelectiveMetagraphIndex {
527
528
fn from_index ( index : usize ) -> Option < Self > {
528
529
match index {
529
- 0 => Some ( SelectiveMetagraphIndex :: Name ) ,
530
- 1 => Some ( SelectiveMetagraphIndex :: Symbol ) ,
531
- 2 => Some ( SelectiveMetagraphIndex :: Identity ) ,
532
- 3 => Some ( SelectiveMetagraphIndex :: NetworkRegisteredAt ) ,
533
- 4 => Some ( SelectiveMetagraphIndex :: OwnerHotkey ) ,
534
- 5 => Some ( SelectiveMetagraphIndex :: OwnerColdkey ) ,
535
- 6 => Some ( SelectiveMetagraphIndex :: Block ) ,
536
- 7 => Some ( SelectiveMetagraphIndex :: Tempo ) ,
537
- 8 => Some ( SelectiveMetagraphIndex :: LastStep ) ,
538
- 9 => Some ( SelectiveMetagraphIndex :: BlocksSinceLastStep ) ,
539
- 10 => Some ( SelectiveMetagraphIndex :: SubnetEmission ) ,
540
- 11 => Some ( SelectiveMetagraphIndex :: AlphaIn ) ,
541
- 12 => Some ( SelectiveMetagraphIndex :: AlphaOut ) ,
542
- 13 => Some ( SelectiveMetagraphIndex :: TaoIn ) ,
543
- 14 => Some ( SelectiveMetagraphIndex :: AlphaOutEmission ) ,
544
- 15 => Some ( SelectiveMetagraphIndex :: AlphaInEmission ) ,
545
- 16 => Some ( SelectiveMetagraphIndex :: TaoInEmission ) ,
546
- 17 => Some ( SelectiveMetagraphIndex :: PendingAlphaEmission ) ,
547
- 18 => Some ( SelectiveMetagraphIndex :: PendingRootEmission ) ,
548
- 19 => Some ( SelectiveMetagraphIndex :: SubnetVolume ) ,
549
- 20 => Some ( SelectiveMetagraphIndex :: MovingPrice ) ,
550
- 21 => Some ( SelectiveMetagraphIndex :: Rho ) ,
551
- 22 => Some ( SelectiveMetagraphIndex :: Kappa ) ,
552
- 23 => Some ( SelectiveMetagraphIndex :: MinAllowedWeights ) ,
553
- 24 => Some ( SelectiveMetagraphIndex :: MaxWeightsLimit ) ,
554
- 25 => Some ( SelectiveMetagraphIndex :: WeightsVersion ) ,
555
- 26 => Some ( SelectiveMetagraphIndex :: WeightsRateLimit ) ,
556
- 27 => Some ( SelectiveMetagraphIndex :: ActivityCutoff ) ,
557
- 28 => Some ( SelectiveMetagraphIndex :: MaxValidators ) ,
558
- 29 => Some ( SelectiveMetagraphIndex :: NumUids ) ,
559
- 30 => Some ( SelectiveMetagraphIndex :: MaxUids ) ,
560
- 31 => Some ( SelectiveMetagraphIndex :: Burn ) ,
561
- 32 => Some ( SelectiveMetagraphIndex :: Difficulty ) ,
562
- 33 => Some ( SelectiveMetagraphIndex :: RegistrationAllowed ) ,
563
- 34 => Some ( SelectiveMetagraphIndex :: PowRegistrationAllowed ) ,
564
- 35 => Some ( SelectiveMetagraphIndex :: ImmunityPeriod ) ,
565
- 36 => Some ( SelectiveMetagraphIndex :: MinDifficulty ) ,
566
- 37 => Some ( SelectiveMetagraphIndex :: MaxDifficulty ) ,
567
- 38 => Some ( SelectiveMetagraphIndex :: MinBurn ) ,
568
- 39 => Some ( SelectiveMetagraphIndex :: MaxBurn ) ,
569
- 40 => Some ( SelectiveMetagraphIndex :: AdjustmentAlpha ) ,
570
- 41 => Some ( SelectiveMetagraphIndex :: AdjustmentInterval ) ,
571
- 42 => Some ( SelectiveMetagraphIndex :: TargetRegsPerInterval ) ,
572
- 43 => Some ( SelectiveMetagraphIndex :: MaxRegsPerBlock ) ,
573
- 44 => Some ( SelectiveMetagraphIndex :: ServingRateLimit ) ,
574
- 45 => Some ( SelectiveMetagraphIndex :: CommitRevealWeightsEnabled ) ,
575
- 46 => Some ( SelectiveMetagraphIndex :: CommitRevealPeriod ) ,
576
- 47 => Some ( SelectiveMetagraphIndex :: LiquidAlphaEnabled ) ,
577
- 48 => Some ( SelectiveMetagraphIndex :: AlphaHigh ) ,
578
- 49 => Some ( SelectiveMetagraphIndex :: AlphaLow ) ,
579
- 50 => Some ( SelectiveMetagraphIndex :: BondsMovingAvg ) ,
580
- 51 => Some ( SelectiveMetagraphIndex :: Hotkeys ) ,
581
- 52 => Some ( SelectiveMetagraphIndex :: Coldkeys ) ,
582
- 53 => Some ( SelectiveMetagraphIndex :: Identities ) ,
583
- 54 => Some ( SelectiveMetagraphIndex :: Axons ) ,
584
- 55 => Some ( SelectiveMetagraphIndex :: Active ) ,
585
- 56 => Some ( SelectiveMetagraphIndex :: ValidatorPermit ) ,
586
- 57 => Some ( SelectiveMetagraphIndex :: PruningScore ) ,
587
- 58 => Some ( SelectiveMetagraphIndex :: LastUpdate ) ,
588
- 59 => Some ( SelectiveMetagraphIndex :: Emission ) ,
589
- 60 => Some ( SelectiveMetagraphIndex :: Dividends ) ,
590
- 61 => Some ( SelectiveMetagraphIndex :: Incentives ) ,
591
- 62 => Some ( SelectiveMetagraphIndex :: Consensus ) ,
592
- 63 => Some ( SelectiveMetagraphIndex :: Trust ) ,
593
- 64 => Some ( SelectiveMetagraphIndex :: Rank ) ,
594
- 65 => Some ( SelectiveMetagraphIndex :: BlockAtRegistration ) ,
595
- 66 => Some ( SelectiveMetagraphIndex :: AlphaStake ) ,
596
- 67 => Some ( SelectiveMetagraphIndex :: TaoStake ) ,
597
- 68 => Some ( SelectiveMetagraphIndex :: TotalStake ) ,
598
- 69 => Some ( SelectiveMetagraphIndex :: TaoDividendsPerHotkey ) ,
599
- 70 => Some ( SelectiveMetagraphIndex :: AlphaDividendsPerHotkey ) ,
530
+ 0 => Some ( SelectiveMetagraphIndex :: Netuid ) ,
531
+ 1 => Some ( SelectiveMetagraphIndex :: Name ) ,
532
+ 2 => Some ( SelectiveMetagraphIndex :: Symbol ) ,
533
+ 3 => Some ( SelectiveMetagraphIndex :: Identity ) ,
534
+ 4 => Some ( SelectiveMetagraphIndex :: NetworkRegisteredAt ) ,
535
+ 5 => Some ( SelectiveMetagraphIndex :: OwnerHotkey ) ,
536
+ 6 => Some ( SelectiveMetagraphIndex :: OwnerColdkey ) ,
537
+ 7 => Some ( SelectiveMetagraphIndex :: Block ) ,
538
+ 8 => Some ( SelectiveMetagraphIndex :: Tempo ) ,
539
+ 9 => Some ( SelectiveMetagraphIndex :: LastStep ) ,
540
+ 10 => Some ( SelectiveMetagraphIndex :: BlocksSinceLastStep ) ,
541
+ 11 => Some ( SelectiveMetagraphIndex :: SubnetEmission ) ,
542
+ 12 => Some ( SelectiveMetagraphIndex :: AlphaIn ) ,
543
+ 13 => Some ( SelectiveMetagraphIndex :: AlphaOut ) ,
544
+ 14 => Some ( SelectiveMetagraphIndex :: TaoIn ) ,
545
+ 15 => Some ( SelectiveMetagraphIndex :: AlphaOutEmission ) ,
546
+ 16 => Some ( SelectiveMetagraphIndex :: AlphaInEmission ) ,
547
+ 17 => Some ( SelectiveMetagraphIndex :: TaoInEmission ) ,
548
+ 18 => Some ( SelectiveMetagraphIndex :: PendingAlphaEmission ) ,
549
+ 19 => Some ( SelectiveMetagraphIndex :: PendingRootEmission ) ,
550
+ 20 => Some ( SelectiveMetagraphIndex :: SubnetVolume ) ,
551
+ 21 => Some ( SelectiveMetagraphIndex :: MovingPrice ) ,
552
+ 22 => Some ( SelectiveMetagraphIndex :: Rho ) ,
553
+ 23 => Some ( SelectiveMetagraphIndex :: Kappa ) ,
554
+ 24 => Some ( SelectiveMetagraphIndex :: MinAllowedWeights ) ,
555
+ 25 => Some ( SelectiveMetagraphIndex :: MaxWeightsLimit ) ,
556
+ 26 => Some ( SelectiveMetagraphIndex :: WeightsVersion ) ,
557
+ 27 => Some ( SelectiveMetagraphIndex :: WeightsRateLimit ) ,
558
+ 28 => Some ( SelectiveMetagraphIndex :: ActivityCutoff ) ,
559
+ 29 => Some ( SelectiveMetagraphIndex :: MaxValidators ) ,
560
+ 30 => Some ( SelectiveMetagraphIndex :: NumUids ) ,
561
+ 31 => Some ( SelectiveMetagraphIndex :: MaxUids ) ,
562
+ 32 => Some ( SelectiveMetagraphIndex :: Burn ) ,
563
+ 33 => Some ( SelectiveMetagraphIndex :: Difficulty ) ,
564
+ 34 => Some ( SelectiveMetagraphIndex :: RegistrationAllowed ) ,
565
+ 35 => Some ( SelectiveMetagraphIndex :: PowRegistrationAllowed ) ,
566
+ 36 => Some ( SelectiveMetagraphIndex :: ImmunityPeriod ) ,
567
+ 37 => Some ( SelectiveMetagraphIndex :: MinDifficulty ) ,
568
+ 38 => Some ( SelectiveMetagraphIndex :: MaxDifficulty ) ,
569
+ 39 => Some ( SelectiveMetagraphIndex :: MinBurn ) ,
570
+ 40 => Some ( SelectiveMetagraphIndex :: MaxBurn ) ,
571
+ 41 => Some ( SelectiveMetagraphIndex :: AdjustmentAlpha ) ,
572
+ 42 => Some ( SelectiveMetagraphIndex :: AdjustmentInterval ) ,
573
+ 43 => Some ( SelectiveMetagraphIndex :: TargetRegsPerInterval ) ,
574
+ 44 => Some ( SelectiveMetagraphIndex :: MaxRegsPerBlock ) ,
575
+ 45 => Some ( SelectiveMetagraphIndex :: ServingRateLimit ) ,
576
+ 46 => Some ( SelectiveMetagraphIndex :: CommitRevealWeightsEnabled ) ,
577
+ 47 => Some ( SelectiveMetagraphIndex :: CommitRevealPeriod ) ,
578
+ 48 => Some ( SelectiveMetagraphIndex :: LiquidAlphaEnabled ) ,
579
+ 49 => Some ( SelectiveMetagraphIndex :: AlphaHigh ) ,
580
+ 50 => Some ( SelectiveMetagraphIndex :: AlphaLow ) ,
581
+ 51 => Some ( SelectiveMetagraphIndex :: BondsMovingAvg ) ,
582
+ 52 => Some ( SelectiveMetagraphIndex :: Hotkeys ) ,
583
+ 53 => Some ( SelectiveMetagraphIndex :: Coldkeys ) ,
584
+ 54 => Some ( SelectiveMetagraphIndex :: Identities ) ,
585
+ 55 => Some ( SelectiveMetagraphIndex :: Axons ) ,
586
+ 56 => Some ( SelectiveMetagraphIndex :: Active ) ,
587
+ 57 => Some ( SelectiveMetagraphIndex :: ValidatorPermit ) ,
588
+ 58 => Some ( SelectiveMetagraphIndex :: PruningScore ) ,
589
+ 59 => Some ( SelectiveMetagraphIndex :: LastUpdate ) ,
590
+ 60 => Some ( SelectiveMetagraphIndex :: Emission ) ,
591
+ 61 => Some ( SelectiveMetagraphIndex :: Dividends ) ,
592
+ 62 => Some ( SelectiveMetagraphIndex :: Incentives ) ,
593
+ 63 => Some ( SelectiveMetagraphIndex :: Consensus ) ,
594
+ 64 => Some ( SelectiveMetagraphIndex :: Trust ) ,
595
+ 65 => Some ( SelectiveMetagraphIndex :: Rank ) ,
596
+ 66 => Some ( SelectiveMetagraphIndex :: BlockAtRegistration ) ,
597
+ 67 => Some ( SelectiveMetagraphIndex :: AlphaStake ) ,
598
+ 68 => Some ( SelectiveMetagraphIndex :: TaoStake ) ,
599
+ 69 => Some ( SelectiveMetagraphIndex :: TotalStake ) ,
600
+ 70 => Some ( SelectiveMetagraphIndex :: TaoDividendsPerHotkey ) ,
601
+ 71 => Some ( SelectiveMetagraphIndex :: AlphaDividendsPerHotkey ) ,
600
602
_ => None ,
601
603
}
602
604
}
@@ -724,7 +726,7 @@ impl<T: Config> Pallet<T> {
724
726
coldkeys, // coldkey per UID
725
727
axons, // Axon information per UID.
726
728
identities,
727
- active : Active :: < T > :: get ( netuid) , // Avtive per UID
729
+ active : Active :: < T > :: get ( netuid) , // Active per UID
728
730
validator_permit : ValidatorPermit :: < T > :: get ( netuid) , // Val permit per UID
729
731
pruning_score : PruningScores :: < T > :: get ( netuid)
730
732
. into_iter ( )
@@ -808,6 +810,10 @@ impl<T: Config> Pallet<T> {
808
810
) -> SelectiveMetagraph < T :: AccountId > {
809
811
match SelectiveMetagraphIndex :: from_index ( metagraph_index as usize ) {
810
812
// Name and symbol
813
+ Some ( SelectiveMetagraphIndex :: Netuid ) => SelectiveMetagraph {
814
+ netuid : netuid. into ( ) ,
815
+ ..Default :: default ( )
816
+ } ,
811
817
Some ( SelectiveMetagraphIndex :: Name ) => SelectiveMetagraph {
812
818
netuid : netuid. into ( ) ,
813
819
name : Some (
@@ -1166,7 +1172,7 @@ impl<T: Config> Pallet<T> {
1166
1172
} ,
1167
1173
Some ( SelectiveMetagraphIndex :: ValidatorPermit ) => SelectiveMetagraph {
1168
1174
netuid : netuid. into ( ) ,
1169
- active : Some ( ValidatorPermit :: < T > :: get ( netuid) ) ,
1175
+ validator_permit : Some ( ValidatorPermit :: < T > :: get ( netuid) ) ,
1170
1176
..Default :: default ( )
1171
1177
} ,
1172
1178
@@ -1451,11 +1457,11 @@ fn test_selective_metagraph() {
1451
1457
metagraph. merge_value ( & metagraph_name, wrong_index) ;
1452
1458
assert ! ( metagraph. name. is_none( ) ) ;
1453
1459
1454
- let name_index: usize = 0 ;
1460
+ let name_index: usize = 1 ;
1455
1461
metagraph. merge_value ( & metagraph_name, name_index) ;
1456
1462
assert ! ( metagraph. name. is_some( ) ) ;
1457
1463
1458
- let alph_low_index: usize = 49 ;
1464
+ let alph_low_index: usize = 50 ;
1459
1465
let metagraph_alpha_low = SelectiveMetagraph :: < u32 > {
1460
1466
netuid : 0_u16 . into ( ) ,
1461
1467
alpha_low : Some ( 0_u16 . into ( ) ) ,
0 commit comments