@@ -931,136 +931,6 @@ mod sudo_set_nominator_min_required_stake {
931
931
) ;
932
932
} ) ;
933
933
}
934
-
935
- #[ test]
936
- fn clears_staker_nominations_below_min ( ) {
937
- new_test_ext ( ) . execute_with ( || {
938
- System :: set_block_number ( 1 ) ;
939
-
940
- // Create accounts.
941
- let netuid = 1 ;
942
- let hot1 = U256 :: from ( 1 ) ;
943
- let hot2 = U256 :: from ( 2 ) ;
944
- let cold1 = U256 :: from ( 3 ) ;
945
- let cold2 = U256 :: from ( 4 ) ;
946
-
947
- // SubtensorModule::set_target_stakes_per_interval(10);
948
- // Register network.
949
- add_network ( netuid, 0 ) ;
950
-
951
- // Register hot1.
952
- register_ok_neuron ( netuid, hot1, cold1, 0 ) ;
953
- assert_eq ! ( SubtensorModule :: get_owning_coldkey_for_hotkey( & hot1) , cold1) ;
954
-
955
- // Register hot2.
956
- register_ok_neuron ( netuid, hot2, cold2, 0 ) ;
957
- assert_eq ! ( SubtensorModule :: get_owning_coldkey_for_hotkey( & hot2) , cold2) ;
958
-
959
- // Add stake cold1 --> hot1 (non delegation.)
960
- SubtensorModule :: add_balance_to_coldkey_account ( & cold1, 5 ) ;
961
- assert_ok ! ( SubtensorModule :: add_stake(
962
- <<Test as Config >:: RuntimeOrigin >:: signed( cold1) ,
963
- hot1,
964
- netuid,
965
- 1
966
- ) ) ;
967
- assert_eq ! (
968
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold1, netuid) ,
969
- 1
970
- ) ;
971
- assert_eq ! ( Balances :: free_balance( cold1) , 4 ) ;
972
-
973
- // Add stake cold2 --> hot1 (is delegation.)
974
- SubtensorModule :: add_balance_to_coldkey_account ( & cold2, 5 ) ;
975
- assert_ok ! ( SubtensorModule :: add_stake(
976
- <<Test as Config >:: RuntimeOrigin >:: signed( cold2) ,
977
- hot1,
978
- netuid,
979
- 1
980
- ) ) ;
981
- assert_eq ! (
982
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold2, netuid) ,
983
- 1
984
- ) ;
985
- assert_eq ! ( Balances :: free_balance( cold2) , 4 ) ;
986
-
987
- // Add stake cold1 --> hot2
988
- SubtensorModule :: add_balance_to_coldkey_account ( & cold1, 5 ) ;
989
- assert_ok ! ( SubtensorModule :: add_stake(
990
- <<Test as Config >:: RuntimeOrigin >:: signed( cold1) ,
991
- hot2,
992
- netuid,
993
- 1
994
- ) ) ;
995
- assert_eq ! (
996
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold1, netuid) ,
997
- 1
998
- ) ;
999
- assert_eq ! ( Balances :: free_balance( cold1) , 8 ) ;
1000
-
1001
- // Add stake cold2 --> hot2
1002
- SubtensorModule :: add_balance_to_coldkey_account ( & cold2, 5 ) ;
1003
- assert_ok ! ( SubtensorModule :: add_stake(
1004
- <<Test as Config >:: RuntimeOrigin >:: signed( cold2) ,
1005
- hot2,
1006
- netuid,
1007
- 1
1008
- ) ) ;
1009
- assert_eq ! (
1010
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold2, netuid) ,
1011
- 1
1012
- ) ;
1013
- assert_eq ! ( Balances :: free_balance( cold2) , 8 ) ;
1014
-
1015
- // Set min stake to 0 (noop)
1016
- assert_ok ! ( AdminUtils :: sudo_set_nominator_min_required_stake(
1017
- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1018
- 0u64
1019
- ) ) ;
1020
- assert_eq ! (
1021
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold1, netuid) ,
1022
- 1
1023
- ) ;
1024
- assert_eq ! (
1025
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold1, netuid) ,
1026
- 1
1027
- ) ;
1028
- assert_eq ! (
1029
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold2, netuid) ,
1030
- 1
1031
- ) ;
1032
- assert_eq ! (
1033
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold2, netuid) ,
1034
- 1
1035
- ) ;
1036
-
1037
- // Set min nomination to 10: should clear (cold2, hot1) and (cold1, hot2).
1038
- assert_ok ! ( AdminUtils :: sudo_set_nominator_min_required_stake(
1039
- <<Test as Config >:: RuntimeOrigin >:: root( ) ,
1040
- 10u64
1041
- ) ) ;
1042
- assert_eq ! (
1043
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold1, netuid) ,
1044
- 1
1045
- ) ;
1046
- assert_eq ! (
1047
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold1, netuid) ,
1048
- 0
1049
- ) ;
1050
- assert_eq ! (
1051
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot1, & cold2, netuid) ,
1052
- 0
1053
- ) ;
1054
- assert_eq ! (
1055
- SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hot2, & cold2, netuid) ,
1056
- 1
1057
- ) ;
1058
-
1059
- // Balances have been added back into accounts.
1060
- assert_eq ! ( Balances :: free_balance( cold1) , 9 ) ;
1061
- assert_eq ! ( Balances :: free_balance( cold2) , 9 ) ;
1062
- } ) ;
1063
- }
1064
934
}
1065
935
1066
936
#[ test]
0 commit comments