@@ -99,7 +99,8 @@ fn test_coinbase_tao_issuance_base() {
9999 let subnet_owner_hk = U256 :: from ( 1002 ) ;
100100 let netuid = add_dynamic_network ( & subnet_owner_hk, & subnet_owner_ck) ;
101101 let total_issuance_before = TotalIssuance :: < Test > :: get ( ) ;
102- SubnetMovingPrice :: < Test > :: insert ( netuid, I96F32 :: from ( 3141 ) / I96F32 :: from ( 1000 ) ) ;
102+ // Set subnet TAO flow to non-zero
103+ SubnetTaoFlow :: < Test > :: insert ( netuid, 1234567_i64 ) ;
103104 let tao_in_before = SubnetTAO :: < Test > :: get ( netuid) ;
104105 let total_stake_before = TotalStake :: < Test > :: get ( ) ;
105106 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
@@ -120,6 +121,8 @@ fn test_coinbase_tao_issuance_base_low() {
120121 let emission = TaoCurrency :: from ( 1 ) ;
121122 add_network ( netuid, 1 , 0 ) ;
122123 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid) , TaoCurrency :: ZERO ) ;
124+ // Set subnet flow to non-zero
125+ SubnetTaoFlow :: < Test > :: insert ( netuid, 33433_i64 ) ;
123126 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
124127 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid) , emission) ;
125128 assert_eq ! ( TotalIssuance :: <Test >:: get( ) , emission) ;
@@ -171,6 +174,10 @@ fn test_coinbase_tao_issuance_multiple() {
171174 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid1) , TaoCurrency :: ZERO ) ;
172175 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid2) , TaoCurrency :: ZERO ) ;
173176 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid3) , TaoCurrency :: ZERO ) ;
177+ // Set Tao flows to equal and non-zero
178+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
179+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 100_000_000_i64 ) ;
180+ SubnetTaoFlow :: < Test > :: insert ( netuid3, 100_000_000_i64 ) ;
174181 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
175182 assert_abs_diff_eq ! (
176183 SubnetTAO :: <Test >:: get( netuid1) ,
@@ -234,9 +241,10 @@ fn test_coinbase_tao_issuance_different_prices() {
234241 SubnetMechanism :: < Test > :: insert ( netuid1, 1 ) ;
235242 SubnetMechanism :: < Test > :: insert ( netuid2, 1 ) ;
236243
237- // Set subnet prices.
238- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
239- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
244+ // Set subnet flows
245+ // Subnet 2 has twice the flow of subnet 1.
246+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
247+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
240248
241249 // Assert initial TAO reserves.
242250 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid1) , initial_tao. into( ) ) ;
@@ -483,8 +491,9 @@ fn test_coinbase_alpha_issuance_base() {
483491 SubnetAlphaIn :: < Test > :: insert ( netuid1, AlphaCurrency :: from ( initial) ) ;
484492 SubnetTAO :: < Test > :: insert ( netuid2, TaoCurrency :: from ( initial) ) ;
485493 SubnetAlphaIn :: < Test > :: insert ( netuid2, AlphaCurrency :: from ( initial) ) ;
486- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from ( 1 ) ) ;
487- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from ( 1 ) ) ;
494+ // Equal flow
495+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
496+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 100_000_000_i64 ) ;
488497 // Check initial
489498 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
490499 // tao_in = 500_000
@@ -523,9 +532,9 @@ fn test_coinbase_alpha_issuance_different() {
523532 SubnetAlphaIn :: < Test > :: insert ( netuid1, AlphaCurrency :: from ( initial) ) ;
524533 SubnetTAO :: < Test > :: insert ( netuid2, TaoCurrency :: from ( 2 * initial) ) ;
525534 SubnetAlphaIn :: < Test > :: insert ( netuid2, AlphaCurrency :: from ( initial) ) ;
526- // Set subnet ema prices to 1 and 2
527- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
528- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
535+ // Set subnet TAO flows to non-zero and 1:2 ratio
536+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
537+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
529538 // Do NOT Set tao flow, let it initialize
530539 // Run coinbase
531540 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
@@ -602,8 +611,9 @@ fn test_coinbase_alpha_issuance_with_cap_trigger_and_block_emission() {
602611 // Enable emission
603612 FirstEmissionBlockNumber :: < Test > :: insert ( netuid1, 0 ) ;
604613 FirstEmissionBlockNumber :: < Test > :: insert ( netuid2, 0 ) ;
605- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
606- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
614+ // Set subnet TAO flows to non-zero and 1:2 ratio
615+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
616+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
607617
608618 // Force the swap to initialize
609619 SubtensorModule :: swap_tao_for_alpha (
@@ -2750,8 +2760,9 @@ fn test_coinbase_v3_liquidity_update() {
27502760
27512761 // Enable emissions and run coinbase (which will increase position liquidity)
27522762 let emission: u64 = 1_234_567 ;
2763+ // Set the TAO flow to non-zero
2764+ SubnetTaoFlow :: < Test > :: insert ( netuid, 8348383_i64 ) ;
27532765 FirstEmissionBlockNumber :: < Test > :: insert ( netuid, 0 ) ;
2754- SubnetMovingPrice :: < Test > :: insert ( netuid, I96F32 :: from_num ( 0.5 ) ) ;
27552766 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
27562767
27572768 let position_after = pallet_subtensor_swap:: Positions :: < Test > :: get ( (
0 commit comments