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