@@ -813,6 +813,7 @@ fn test_do_transfer_success() {
813
813
let subnet_owner_coldkey = U256 :: from ( 1001 ) ;
814
814
let subnet_owner_hotkey = U256 :: from ( 1002 ) ;
815
815
let netuid = add_dynamic_network ( & subnet_owner_hotkey, & subnet_owner_coldkey) ;
816
+ let fee = DefaultMinStake :: < Test > :: get ( ) ;
816
817
817
818
// 2. Define the origin coldkey, destination coldkey, and hotkey to be used.
818
819
let origin_coldkey = U256 :: from ( 1 ) ;
@@ -823,7 +824,7 @@ fn test_do_transfer_success() {
823
824
// 3. Set up initial stake: (origin_coldkey, hotkey) on netuid.
824
825
SubtensorModule :: create_account_if_non_existent ( & origin_coldkey, & hotkey) ;
825
826
SubtensorModule :: create_account_if_non_existent ( & destination_coldkey, & hotkey) ;
826
- SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount) ;
827
+ SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount, 0 ) ;
827
828
let alpha = SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet (
828
829
& hotkey,
829
830
& origin_coldkey,
@@ -855,7 +856,7 @@ fn test_do_transfer_success() {
855
856
& destination_coldkey,
856
857
netuid
857
858
) ,
858
- stake_amount,
859
+ stake_amount - fee ,
859
860
epsilon = stake_amount / 1000
860
861
) ;
861
862
} ) ;
@@ -922,7 +923,7 @@ fn test_do_transfer_insufficient_stake() {
922
923
let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
923
924
924
925
SubtensorModule :: create_account_if_non_existent ( & origin_coldkey, & hotkey) ;
925
- SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount) ;
926
+ SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount, 0 ) ;
926
927
927
928
let alpha = stake_amount * 2 ;
928
929
assert_noop ! (
@@ -950,11 +951,12 @@ fn test_do_transfer_wrong_origin() {
950
951
let wrong_coldkey = U256 :: from ( 9999 ) ;
951
952
let destination_coldkey = U256 :: from ( 2 ) ;
952
953
let hotkey = U256 :: from ( 3 ) ;
953
- let stake_amount = 100_000 ;
954
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
955
+ let fee = DefaultMinStake :: < Test > :: get ( ) ;
954
956
955
957
SubtensorModule :: create_account_if_non_existent ( & origin_coldkey, & hotkey) ;
956
- SubtensorModule :: add_balance_to_coldkey_account ( & origin_coldkey, 1_000_000_000 ) ;
957
- SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount) ;
958
+ SubtensorModule :: add_balance_to_coldkey_account ( & origin_coldkey, stake_amount + fee ) ;
959
+ SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount, fee ) ;
958
960
959
961
assert_noop ! (
960
962
SubtensorModule :: do_transfer_stake(
@@ -983,7 +985,7 @@ fn test_do_transfer_minimum_stake_check() {
983
985
984
986
let stake_amount = DefaultMinStake :: < Test > :: get ( ) ;
985
987
SubtensorModule :: create_account_if_non_existent ( & origin_coldkey, & hotkey) ;
986
- SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount) ;
988
+ SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, netuid, stake_amount, 0 ) ;
987
989
988
990
assert_err ! (
989
991
SubtensorModule :: do_transfer_stake(
@@ -1013,6 +1015,7 @@ fn test_do_transfer_different_subnets() {
1013
1015
let destination_coldkey = U256 :: from ( 2 ) ;
1014
1016
let hotkey = U256 :: from ( 3 ) ;
1015
1017
let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
1018
+ let fee = DefaultMinStake :: < Test > :: get ( ) ;
1016
1019
1017
1020
// 3. Create accounts if needed.
1018
1021
SubtensorModule :: create_account_if_non_existent ( & origin_coldkey, & hotkey) ;
@@ -1022,7 +1025,13 @@ fn test_do_transfer_different_subnets() {
1022
1025
SubtensorModule :: add_balance_to_coldkey_account ( & origin_coldkey, 1_000_000_000 ) ;
1023
1026
1024
1027
// 5. Stake into the origin subnet.
1025
- SubtensorModule :: stake_into_subnet ( & hotkey, & origin_coldkey, origin_netuid, stake_amount) ;
1028
+ SubtensorModule :: stake_into_subnet (
1029
+ & hotkey,
1030
+ & origin_coldkey,
1031
+ origin_netuid,
1032
+ stake_amount,
1033
+ 0 ,
1034
+ ) ;
1026
1035
1027
1036
// 6. Transfer entire stake from origin_netuid -> destination_netuid.
1028
1037
let alpha = SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet (
@@ -1055,6 +1064,10 @@ fn test_do_transfer_different_subnets() {
1055
1064
& destination_coldkey,
1056
1065
destination_netuid,
1057
1066
) ;
1058
- assert_abs_diff_eq ! ( dest_stake, stake_amount, epsilon = stake_amount / 1000 ) ;
1067
+ assert_abs_diff_eq ! (
1068
+ dest_stake,
1069
+ stake_amount - fee,
1070
+ epsilon = stake_amount / 1000
1071
+ ) ;
1059
1072
} ) ;
1060
1073
}
0 commit comments