@@ -747,9 +747,9 @@ fn test_drain_base_with_subnet_with_single_staker_not_registered() {
747747 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
748748 SubtensorModule :: distribute_emission (
749749 netuid,
750- pending_alpha. into ( ) ,
750+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
751+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
751752 AlphaCurrency :: ZERO ,
752- pending_alpha. into ( ) ,
753753 AlphaCurrency :: ZERO ,
754754 ) ;
755755 let stake_after =
@@ -777,9 +777,9 @@ fn test_drain_base_with_subnet_with_single_staker_registered() {
777777 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
778778 SubtensorModule :: distribute_emission (
779779 netuid,
780- pending_alpha,
780+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
781+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
781782 AlphaCurrency :: ZERO ,
782- pending_alpha,
783783 AlphaCurrency :: ZERO ,
784784 ) ;
785785 let stake_after =
@@ -822,9 +822,9 @@ fn test_drain_base_with_subnet_with_single_staker_registered_root_weight() {
822822 assert_eq ! ( SubnetTAO :: <Test >:: get( NetUid :: ROOT ) , TaoCurrency :: ZERO ) ;
823823 SubtensorModule :: distribute_emission (
824824 netuid,
825- pending_alpha,
825+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
826+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
826827 pending_root_alpha,
827- pending_alpha. saturating_add ( pending_root_alpha) ,
828828 AlphaCurrency :: ZERO ,
829829 ) ;
830830 let stake_after =
@@ -870,9 +870,9 @@ fn test_drain_base_with_subnet_with_two_stakers_registered() {
870870 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
871871 SubtensorModule :: distribute_emission (
872872 netuid,
873- pending_alpha,
873+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
874+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
874875 AlphaCurrency :: ZERO ,
875- pending_alpha,
876876 AlphaCurrency :: ZERO ,
877877 ) ;
878878 let stake_after1 =
@@ -936,9 +936,9 @@ fn test_drain_base_with_subnet_with_two_stakers_registered_and_root() {
936936 assert_eq ! ( SubnetTAO :: <Test >:: get( NetUid :: ROOT ) , TaoCurrency :: ZERO ) ;
937937 SubtensorModule :: distribute_emission (
938938 netuid,
939- pending_alpha,
939+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
940+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
940941 AlphaCurrency :: ZERO ,
941- pending_alpha,
942942 AlphaCurrency :: ZERO ,
943943 ) ;
944944 let stake_after1 =
@@ -1012,10 +1012,10 @@ fn test_drain_base_with_subnet_with_two_stakers_registered_and_root_different_am
10121012 assert_eq ! ( SubnetTAO :: <Test >:: get( NetUid :: ROOT ) , TaoCurrency :: ZERO ) ;
10131013 SubtensorModule :: distribute_emission (
10141014 netuid,
1015- pending_alpha,
1015+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1016+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1017+ AlphaCurrency :: ZERO ,
10161018 AlphaCurrency :: ZERO ,
1017- pending_alpha,
1018- 0 . into ( ) ,
10191019 ) ;
10201020 let stake_after1 =
10211021 SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet ( & hotkey1, & coldkey, netuid) ;
@@ -1093,9 +1093,9 @@ fn test_drain_base_with_subnet_with_two_stakers_registered_and_root_different_am
10931093 assert_eq ! ( SubnetTAO :: <Test >:: get( NetUid :: ROOT ) , TaoCurrency :: ZERO ) ;
10941094 SubtensorModule :: distribute_emission (
10951095 netuid,
1096- pending_alpha,
1096+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1097+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
10971098 AlphaCurrency :: ZERO ,
1098- pending_alpha,
10991099 AlphaCurrency :: ZERO ,
11001100 ) ;
11011101 let stake_after1 =
@@ -1155,9 +1155,9 @@ fn test_drain_alpha_childkey_parentkey() {
11551155 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
11561156 SubtensorModule :: distribute_emission (
11571157 netuid,
1158- pending_alpha,
1158+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1159+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
11591160 AlphaCurrency :: ZERO ,
1160- pending_alpha,
11611161 AlphaCurrency :: ZERO ,
11621162 ) ;
11631163 let parent_stake_after = SubtensorModule :: get_stake_for_hotkey_on_subnet ( & parent, netuid) ;
@@ -1381,9 +1381,9 @@ fn test_get_root_children_drain() {
13811381 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
13821382 SubtensorModule :: distribute_emission (
13831383 alpha,
1384- pending_alpha,
1384+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1385+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
13851386 AlphaCurrency :: ZERO ,
1386- pending_alpha,
13871387 AlphaCurrency :: ZERO ,
13881388 ) ;
13891389
@@ -1405,9 +1405,9 @@ fn test_get_root_children_drain() {
14051405 let pending_root1 = TaoCurrency :: from ( 1_000_000_000 ) ;
14061406 SubtensorModule :: distribute_emission (
14071407 alpha,
1408- pending_alpha,
1408+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1409+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
14091410 AlphaCurrency :: ZERO ,
1410- pending_alpha,
14111411 AlphaCurrency :: ZERO ,
14121412 ) ;
14131413
@@ -1429,9 +1429,9 @@ fn test_get_root_children_drain() {
14291429 let pending_root2 = TaoCurrency :: from ( 1_000_000_000 ) ;
14301430 SubtensorModule :: distribute_emission (
14311431 alpha,
1432- pending_alpha,
1432+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1433+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
14331434 AlphaCurrency :: ZERO ,
1434- pending_alpha,
14351435 AlphaCurrency :: ZERO ,
14361436 ) ;
14371437
@@ -1518,9 +1518,9 @@ fn test_get_root_children_drain_half_proportion() {
15181518 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
15191519 SubtensorModule :: distribute_emission (
15201520 alpha,
1521- pending_alpha,
1521+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1522+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
15221523 AlphaCurrency :: ZERO ,
1523- pending_alpha,
15241524 AlphaCurrency :: ZERO ,
15251525 ) ;
15261526
@@ -1605,9 +1605,9 @@ fn test_get_root_children_drain_with_take() {
16051605 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
16061606 SubtensorModule :: distribute_emission (
16071607 alpha,
1608- pending_alpha,
1608+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1609+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
16091610 AlphaCurrency :: ZERO ,
1610- pending_alpha,
16111611 AlphaCurrency :: ZERO ,
16121612 ) ;
16131613
@@ -1693,9 +1693,9 @@ fn test_get_root_children_drain_with_half_take() {
16931693 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
16941694 SubtensorModule :: distribute_emission (
16951695 alpha,
1696- pending_alpha,
1696+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
1697+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
16971698 AlphaCurrency :: ZERO ,
1698- pending_alpha,
16991699 AlphaCurrency :: ZERO ,
17001700 ) ;
17011701
@@ -2409,9 +2409,9 @@ fn test_distribute_emission_no_miners_all_drained() {
24092409 // Run drain pending without any miners.
24102410 SubtensorModule :: distribute_emission (
24112411 netuid,
2412- emission,
2412+ emission. saturating_div ( 2 . into ( ) ) . into ( ) ,
2413+ emission. saturating_div ( 2 . into ( ) ) . into ( ) ,
24132414 AlphaCurrency :: ZERO ,
2414- emission,
24152415 AlphaCurrency :: ZERO ,
24162416 ) ;
24172417
@@ -2776,9 +2776,9 @@ fn test_drain_alpha_childkey_parentkey_with_burn() {
27762776 let pending_alpha = AlphaCurrency :: from ( 1_000_000_000 ) ;
27772777 SubtensorModule :: distribute_emission (
27782778 netuid,
2779- pending_alpha,
2779+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
2780+ pending_alpha. saturating_div ( 2 . into ( ) ) . into ( ) ,
27802781 AlphaCurrency :: ZERO ,
2781- pending_alpha,
27822782 AlphaCurrency :: ZERO ,
27832783 ) ;
27842784 let parent_stake_after = SubtensorModule :: get_stake_for_hotkey_on_subnet ( & parent, netuid) ;
0 commit comments