@@ -115,28 +115,28 @@ fn test_coinbase_tao_issuance_base_low() {
115115}
116116
117117// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::coinbase::test_coinbase_tao_issuance_base_low_flow --exact --show-output --nocapture
118- #[ test]
119- fn test_coinbase_tao_issuance_base_low_flow ( ) {
120- new_test_ext ( 1 ) . execute_with ( || {
121- let emission = TaoCurrency :: from ( 1_234_567 ) ;
122- let subnet_owner_ck = U256 :: from ( 1001 ) ;
123- let subnet_owner_hk = U256 :: from ( 1002 ) ;
124- let netuid = add_dynamic_network ( & subnet_owner_hk, & subnet_owner_ck) ;
125- let emission = TaoCurrency :: from ( 1 ) ;
126-
127- // 100% tao flow method
128- let block_num = FlowHalfLife :: < Test > :: get ( ) ;
129- SubnetEmaTaoFlow :: < Test > :: insert ( netuid, ( block_num, I64F64 :: from_num ( 1_000_000_000 ) ) ) ;
130- System :: set_block_number ( block_num) ;
131-
132- let tao_in_before = SubnetTAO :: < Test > :: get ( netuid) ;
133- let total_stake_before = TotalStake :: < Test > :: get ( ) ;
134- SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
135- assert_eq ! ( SubnetTAO :: <Test >:: get( netuid) , tao_in_before + emission) ;
136- assert_eq ! ( TotalIssuance :: <Test >:: get( ) , emission) ;
137- assert_eq ! ( TotalStake :: <Test >:: get( ) , total_stake_before + emission) ;
138- } ) ;
139- }
118+ // #[test]
119+ // fn test_coinbase_tao_issuance_base_low_flow() {
120+ // new_test_ext(1).execute_with(|| {
121+ // let emission = TaoCurrency::from(1_234_567);
122+ // let subnet_owner_ck = U256::from(1001);
123+ // let subnet_owner_hk = U256::from(1002);
124+ // let netuid = add_dynamic_network(&subnet_owner_hk, &subnet_owner_ck);
125+ // let emission = TaoCurrency::from(1);
126+
127+ // // 100% tao flow method
128+ // let block_num = FlowHalfLife::<Test>::get();
129+ // SubnetEmaTaoFlow::<Test>::insert(netuid, (block_num, I64F64::from_num(1_000_000_000)));
130+ // System::set_block_number(block_num);
131+
132+ // let tao_in_before = SubnetTAO::<Test>::get(netuid);
133+ // let total_stake_before = TotalStake::<Test>::get();
134+ // SubtensorModule::run_coinbase(U96F32::from_num(emission));
135+ // assert_eq!(SubnetTAO::<Test>::get(netuid), tao_in_before + emission);
136+ // assert_eq!(TotalIssuance::<Test>::get(), emission);
137+ // assert_eq!(TotalStake::<Test>::get(), total_stake_before + emission);
138+ // });
139+ // }
140140
141141// Test emission distribution across multiple subnets.
142142// This test verifies that:
@@ -260,85 +260,85 @@ fn test_coinbase_tao_issuance_different_prices() {
260260}
261261
262262// SKIP_WASM_BUILD=1 RUST_LOG=debug cargo test --package pallet-subtensor --lib -- tests::coinbase::test_coinbase_tao_issuance_different_flows --exact --show-output --nocapture
263- #[ test]
264- fn test_coinbase_tao_issuance_different_flows ( ) {
265- new_test_ext ( 1 ) . execute_with ( || {
266- let subnet_owner_ck = U256 :: from ( 1001 ) ;
267- let subnet_owner_hk = U256 :: from ( 1002 ) ;
268- let netuid1 = add_dynamic_network ( & subnet_owner_hk, & subnet_owner_ck) ;
269- let netuid2 = add_dynamic_network ( & subnet_owner_hk, & subnet_owner_ck) ;
270- let emission = 100_000_000 ;
271-
272- // Setup prices 0.1 and 0.2
273- let initial_tao: u64 = 100_000_u64 ;
274- let initial_alpha1: u64 = initial_tao * 10 ;
275- let initial_alpha2: u64 = initial_tao * 5 ;
276- mock:: setup_reserves ( netuid1, initial_tao. into ( ) , initial_alpha1. into ( ) ) ;
277- mock:: setup_reserves ( netuid2, initial_tao. into ( ) , initial_alpha2. into ( ) ) ;
278-
279- // Force the swap to initialize
280- SubtensorModule :: swap_tao_for_alpha (
281- netuid1,
282- TaoCurrency :: ZERO ,
283- 1_000_000_000_000 . into ( ) ,
284- false ,
285- )
286- . unwrap ( ) ;
287- SubtensorModule :: swap_tao_for_alpha (
288- netuid2,
289- TaoCurrency :: ZERO ,
290- 1_000_000_000_000 . into ( ) ,
291- false ,
292- )
293- . unwrap ( ) ;
294-
295- // Set subnet prices to reversed proportion to ensure they don't affect emissions.
296- SubnetMovingPrice :: < Test > :: insert ( netuid1, I96F32 :: from_num ( 2 ) ) ;
297- SubnetMovingPrice :: < Test > :: insert ( netuid2, I96F32 :: from_num ( 1 ) ) ;
298-
299- // Set subnet tao flow ema.
300- let block_num = FlowHalfLife :: < Test > :: get ( ) ;
301- SubnetEmaTaoFlow :: < Test > :: insert ( netuid1, ( block_num, I64F64 :: from_num ( 1 ) ) ) ;
302- SubnetEmaTaoFlow :: < Test > :: insert ( netuid2, ( block_num, I64F64 :: from_num ( 2 ) ) ) ;
303- System :: set_block_number ( block_num) ;
304-
305- // Set normalization exponent to 1 for simplicity
306- FlowNormExponent :: < Test > :: set ( U64F64 :: from ( 1_u64 ) ) ;
307-
308- // Assert initial TAO reserves.
309- assert_eq ! ( SubnetTAO :: <Test >:: get( netuid1) , initial_tao. into( ) ) ;
310- assert_eq ! ( SubnetTAO :: <Test >:: get( netuid2) , initial_tao. into( ) ) ;
311- let total_stake_before = TotalStake :: < Test > :: get ( ) ;
312-
313- // Run the coinbase with the emission amount.
314- SubtensorModule :: run_coinbase ( U96F32 :: from_num ( emission) ) ;
315-
316- // Assert tao emission is split evenly.
317- assert_abs_diff_eq ! (
318- SubnetTAO :: <Test >:: get( netuid1) ,
319- TaoCurrency :: from( initial_tao + emission / 3 ) ,
320- epsilon = 10 . into( ) ,
321- ) ;
322- assert_abs_diff_eq ! (
323- SubnetTAO :: <Test >:: get( netuid2) ,
324- TaoCurrency :: from( initial_tao + 2 * emission / 3 ) ,
325- epsilon = 10 . into( ) ,
326- ) ;
263+ // #[test]
264+ // fn test_coinbase_tao_issuance_different_flows() {
265+ // new_test_ext(1).execute_with(|| {
266+ // let subnet_owner_ck = U256::from(1001);
267+ // let subnet_owner_hk = U256::from(1002);
268+ // let netuid1 = add_dynamic_network(&subnet_owner_hk, &subnet_owner_ck);
269+ // let netuid2 = add_dynamic_network(&subnet_owner_hk, &subnet_owner_ck);
270+ // let emission = 100_000_000;
271+
272+ // // Setup prices 0.1 and 0.2
273+ // let initial_tao: u64 = 100_000_u64;
274+ // let initial_alpha1: u64 = initial_tao * 10;
275+ // let initial_alpha2: u64 = initial_tao * 5;
276+ // mock::setup_reserves(netuid1, initial_tao.into(), initial_alpha1.into());
277+ // mock::setup_reserves(netuid2, initial_tao.into(), initial_alpha2.into());
278+
279+ // // Force the swap to initialize
280+ // SubtensorModule::swap_tao_for_alpha(
281+ // netuid1,
282+ // TaoCurrency::ZERO,
283+ // 1_000_000_000_000.into(),
284+ // false,
285+ // )
286+ // .unwrap();
287+ // SubtensorModule::swap_tao_for_alpha(
288+ // netuid2,
289+ // TaoCurrency::ZERO,
290+ // 1_000_000_000_000.into(),
291+ // false,
292+ // )
293+ // .unwrap();
294+
295+ // // Set subnet prices to reversed proportion to ensure they don't affect emissions.
296+ // SubnetMovingPrice::<Test>::insert(netuid1, I96F32::from_num(2));
297+ // SubnetMovingPrice::<Test>::insert(netuid2, I96F32::from_num(1));
298+
299+ // // Set subnet tao flow ema.
300+ // let block_num = FlowHalfLife::<Test>::get();
301+ // SubnetEmaTaoFlow::<Test>::insert(netuid1, (block_num, I64F64::from_num(1)));
302+ // SubnetEmaTaoFlow::<Test>::insert(netuid2, (block_num, I64F64::from_num(2)));
303+ // System::set_block_number(block_num);
304+
305+ // // Set normalization exponent to 1 for simplicity
306+ // FlowNormExponent::<Test>::set(U64F64::from(1_u64));
307+
308+ // // Assert initial TAO reserves.
309+ // assert_eq!(SubnetTAO::<Test>::get(netuid1), initial_tao.into());
310+ // assert_eq!(SubnetTAO::<Test>::get(netuid2), initial_tao.into());
311+ // let total_stake_before = TotalStake::<Test>::get();
312+
313+ // // Run the coinbase with the emission amount.
314+ // SubtensorModule::run_coinbase(U96F32::from_num(emission));
315+
316+ // // Assert tao emission is split evenly.
317+ // assert_abs_diff_eq!(
318+ // SubnetTAO::<Test>::get(netuid1),
319+ // TaoCurrency::from(initial_tao + emission / 3),
320+ // epsilon = 10.into(),
321+ // );
322+ // assert_abs_diff_eq!(
323+ // SubnetTAO::<Test>::get(netuid2),
324+ // TaoCurrency::from(initial_tao + 2 * emission / 3),
325+ // epsilon = 10.into(),
326+ // );
327327
328- // Prices are low => we limit tao issued (buy alpha with it)
329- let tao_issued = TaoCurrency :: from ( ( ( 0.1 + 0.2 ) * emission as f64 ) as u64 ) ;
330- assert_abs_diff_eq ! (
331- TotalIssuance :: <Test >:: get( ) ,
332- tao_issued,
333- epsilon = 10 . into( )
334- ) ;
335- assert_abs_diff_eq ! (
336- TotalStake :: <Test >:: get( ) ,
337- total_stake_before + emission. into( ) ,
338- epsilon = 10 . into( )
339- ) ;
340- } ) ;
341- }
328+ // // Prices are low => we limit tao issued (buy alpha with it)
329+ // let tao_issued = TaoCurrency::from(((0.1 + 0.2) * emission as f64) as u64);
330+ // assert_abs_diff_eq!(
331+ // TotalIssuance::<Test>::get(),
332+ // tao_issued,
333+ // epsilon = 10.into()
334+ // );
335+ // assert_abs_diff_eq!(
336+ // TotalStake::<Test>::get(),
337+ // total_stake_before + emission.into(),
338+ // epsilon = 10.into()
339+ // );
340+ // });
341+ // }
342342
343343// Test moving price updates with different alpha values.
344344// This test verifies that:
0 commit comments