@@ -90,7 +90,8 @@ fn test_coinbase_tao_issuance_base() {
9090 let subnet_owner_hk = U256 :: from ( 1002 ) ;
9191 let netuid = add_dynamic_network ( & subnet_owner_hk, & subnet_owner_ck) ;
9292 let total_issuance_before = TotalIssuance :: < Test > :: get ( ) ;
93- SubnetMovingPrice :: < Test > :: insert ( netuid, I96F32 :: from ( 3141 ) / I96F32 :: from ( 1000 ) ) ;
93+ // Set subnet TAO flow to non-zero
94+ SubnetTaoFlow :: < Test > :: insert ( netuid, 1234567_i64 ) ;
9495 let tao_in_before = SubnetTAO :: < Test > :: get ( netuid) ;
9596 let total_stake_before = TotalStake :: < Test > :: get ( ) ;
9697 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
@@ -111,6 +112,8 @@ fn test_coinbase_tao_issuance_base_low() {
111112 let emission = TaoCurrency :: from ( 1 ) ;
112113 add_network ( netuid, 1 , 0 ) ;
113114 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid) , TaoCurrency :: ZERO ) ;
115+ // Set subnet flow to non-zero
116+ SubnetTaoFlow :: < Test > :: insert ( netuid, 33433_i64 ) ;
114117 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
115118 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid) , emission) ;
116119 assert_eq ! ( TotalIssuance :: <Test >:: get( ) , emission) ;
@@ -162,6 +165,10 @@ fn test_coinbase_tao_issuance_multiple() {
162165 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid1) , TaoCurrency :: ZERO ) ;
163166 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid2) , TaoCurrency :: ZERO ) ;
164167 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid3) , TaoCurrency :: ZERO ) ;
168+ // Set Tao flows to equal and non-zero
169+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
170+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 100_000_000_i64 ) ;
171+ SubnetTaoFlow :: < Test > :: insert ( netuid3, 100_000_000_i64 ) ;
165172 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
166173 assert_abs_diff_eq ! (
167174 SubnetTAO :: <Test >:: get( netuid1) ,
@@ -225,9 +232,10 @@ fn test_coinbase_tao_issuance_different_prices() {
225232 SubnetMechanism :: < Test > :: insert ( netuid1, 1 ) ;
226233 SubnetMechanism :: < Test > :: insert ( netuid2, 1 ) ;
227234
228- // Set subnet prices.
229- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
230- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
235+ // Set subnet flows
236+ // Subnet 2 has twice the flow of subnet 1.
237+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
238+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
231239
232240 // Assert initial TAO reserves.
233241 assert_eq ! ( SubnetTAO :: <Test >:: get( netuid1) , initial_tao. into( ) ) ;
@@ -474,8 +482,9 @@ fn test_coinbase_alpha_issuance_base() {
474482 SubnetAlphaIn :: < Test > :: insert ( netuid1, AlphaCurrency :: from ( initial) ) ;
475483 SubnetTAO :: < Test > :: insert ( netuid2, TaoCurrency :: from ( initial) ) ;
476484 SubnetAlphaIn :: < Test > :: insert ( netuid2, AlphaCurrency :: from ( initial) ) ;
477- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from ( 1 ) ) ;
478- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from ( 1 ) ) ;
485+ // Equal flow
486+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
487+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 100_000_000_i64 ) ;
479488 // Check initial
480489 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
481490 // tao_in = 500_000
@@ -514,9 +523,9 @@ fn test_coinbase_alpha_issuance_different() {
514523 SubnetAlphaIn :: < Test > :: insert ( netuid1, AlphaCurrency :: from ( initial) ) ;
515524 SubnetTAO :: < Test > :: insert ( netuid2, TaoCurrency :: from ( 2 * initial) ) ;
516525 SubnetAlphaIn :: < Test > :: insert ( netuid2, AlphaCurrency :: from ( initial) ) ;
517- // Set subnet ema prices to 1 and 2
518- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
519- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
526+ // Set subnet TAO flows to non-zero and 1:2 ratio
527+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
528+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
520529 // Do NOT Set tao flow, let it initialize
521530 // Run coinbase
522531 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
@@ -593,8 +602,9 @@ fn test_coinbase_alpha_issuance_with_cap_trigger_and_block_emission() {
593602 // Enable emission
594603 FirstEmissionBlockNumber :: < Test > :: insert ( netuid1, 0 ) ;
595604 FirstEmissionBlockNumber :: < Test > :: insert ( netuid2, 0 ) ;
596- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 1 ) ) ;
597- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 2 ) ) ;
605+ // Set subnet TAO flows to non-zero and 1:2 ratio
606+ SubnetTaoFlow :: < Test > :: insert ( netuid1, 100_000_000_i64 ) ;
607+ SubnetTaoFlow :: < Test > :: insert ( netuid2, 200_000_000_i64 ) ;
598608
599609 // Force the swap to initialize
600610 SubtensorModule :: swap_tao_for_alpha (
@@ -2741,8 +2751,9 @@ fn test_coinbase_v3_liquidity_update() {
27412751
27422752 // Enable emissions and run coinbase (which will increase position liquidity)
27432753 let emission: u64 = 1_234_567 ;
2754+ // Set the TAO flow to non-zero
2755+ SubnetTaoFlow :: < Test > :: insert ( netuid, 8348383_i64 ) ;
27442756 FirstEmissionBlockNumber :: < Test > :: insert ( netuid, 0 ) ;
2745- SubnetMovingPrice :: < Test > :: insert ( netuid, I96F32 :: from_num ( 0.5 ) ) ;
27462757 SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
27472758
27482759 let position_after = pallet_subtensor_swap:: Positions :: < Test > :: get ( (
0 commit comments