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