@@ -3287,3 +3287,49 @@ fn test_mining_emission_distribution_with_root_sell() {
32873287 ) ;
32883288 } ) ;
32893289}
3290+
3291+ #[ test]
3292+ fn test_coinbase_subnets_with_no_reg_get_no_emission ( ) {
3293+ new_test_ext ( 1 ) . execute_with ( || {
3294+ let zero = U96F32 :: saturating_from_num ( 0 ) ;
3295+ let netuid0 = add_dynamic_network ( & U256 :: from ( 1 ) , & U256 :: from ( 2 ) ) ;
3296+ let netuid1 = add_dynamic_network ( & U256 :: from ( 3 ) , & U256 :: from ( 4 ) ) ;
3297+
3298+ let subnet_emissions = BTreeMap :: from ( [
3299+ ( netuid0, U96F32 :: saturating_from_num ( 1 ) ) ,
3300+ ( netuid1, U96F32 :: saturating_from_num ( 1 ) ) ,
3301+ ] ) ;
3302+
3303+ let ( tao_in, alpha_in, alpha_out, subsidy_amount) =
3304+ SubtensorModule :: get_subnet_terms ( & subnet_emissions) ;
3305+ assert_eq ! ( tao_in. len( ) , 2 ) ;
3306+ assert_eq ! ( alpha_in. len( ) , 2 ) ;
3307+ assert_eq ! ( alpha_out. len( ) , 2 ) ;
3308+
3309+ assert ! ( tao_in[ & netuid0] > zero) ;
3310+ assert ! ( alpha_in[ & netuid0] > zero) ;
3311+ assert ! ( alpha_out[ & netuid0] > zero) ;
3312+
3313+ assert ! ( tao_in[ & netuid1] > zero) ;
3314+ assert ! ( alpha_in[ & netuid1] > zero) ;
3315+ assert ! ( alpha_out[ & netuid1] > zero) ;
3316+
3317+ // Disabled registration of both methods
3318+ NetworkRegistrationAllowed :: < Test > :: insert ( netuid0, false ) ;
3319+ NetworkPowRegistrationAllowed :: < Test > :: insert ( netuid0, false ) ;
3320+
3321+ let ( tao_in_2, alpha_in_2, alpha_out_2, subsidy_amount_2) =
3322+ SubtensorModule :: get_subnet_terms ( & subnet_emissions) ;
3323+ assert_eq ! ( tao_in_2. len( ) , 2 ) ;
3324+ assert_eq ! ( alpha_in_2. len( ) , 2 ) ;
3325+ assert_eq ! ( alpha_out_2. len( ) , 2 ) ;
3326+
3327+ assert ! ( tao_in_2[ & netuid0] == zero) ;
3328+ assert ! ( alpha_in_2[ & netuid0] == zero) ;
3329+ assert ! ( alpha_out_2[ & netuid0] == zero) ;
3330+
3331+ assert ! ( tao_in_2[ & netuid1] > zero) ;
3332+ assert ! ( alpha_in_2[ & netuid1] > zero) ;
3333+ assert ! ( alpha_out_2[ & netuid1] > zero) ;
3334+ } ) ;
3335+ }
0 commit comments