@@ -2,7 +2,7 @@ use super::mock::*;
2
2
use crate :: * ;
3
3
use approx:: assert_abs_diff_eq;
4
4
use frame_support:: { assert_err, assert_noop, assert_ok} ;
5
- use sp_core:: U256 ;
5
+ use sp_core:: { Get , U256 } ;
6
6
7
7
// 1. test_do_move_success
8
8
// Description: Test a successful move of stake between two hotkeys in the same subnet
@@ -16,7 +16,7 @@ fn test_do_move_success() {
16
16
let coldkey = U256 :: from ( 1 ) ;
17
17
let origin_hotkey = U256 :: from ( 2 ) ;
18
18
let destination_hotkey = U256 :: from ( 3 ) ;
19
- let stake_amount = 1_000_000 ;
19
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
20
20
21
21
// Set up initial stake
22
22
SubtensorModule :: create_account_if_non_existent ( & coldkey, & origin_hotkey) ;
@@ -54,7 +54,7 @@ fn test_do_move_success() {
54
54
netuid
55
55
) ,
56
56
stake_amount,
57
- epsilon = 100
57
+ epsilon = stake_amount / 1000
58
58
) ;
59
59
} ) ;
60
60
}
@@ -72,7 +72,7 @@ fn test_do_move_different_subnets() {
72
72
let coldkey = U256 :: from ( 1 ) ;
73
73
let origin_hotkey = U256 :: from ( 2 ) ;
74
74
let destination_hotkey = U256 :: from ( 3 ) ;
75
- let stake_amount = 1_000_000 ;
75
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
76
76
77
77
// Set up initial stake and subnets
78
78
SubtensorModule :: create_account_if_non_existent ( & coldkey, & origin_hotkey) ;
@@ -110,7 +110,7 @@ fn test_do_move_different_subnets() {
110
110
destination_netuid
111
111
) ,
112
112
stake_amount,
113
- epsilon = 100
113
+ epsilon = stake_amount / 1000
114
114
) ;
115
115
} ) ;
116
116
}
@@ -271,7 +271,7 @@ fn test_do_move_all_stake() {
271
271
let coldkey = U256 :: from ( 1 ) ;
272
272
let origin_hotkey = U256 :: from ( 2 ) ;
273
273
let destination_hotkey = U256 :: from ( 3 ) ;
274
- let stake_amount = 1_000_000 ;
274
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
275
275
276
276
// Set up initial stake
277
277
SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, netuid, stake_amount) ;
@@ -309,7 +309,7 @@ fn test_do_move_all_stake() {
309
309
netuid
310
310
) ,
311
311
stake_amount,
312
- epsilon = 100
312
+ epsilon = stake_amount / 1000
313
313
) ;
314
314
} ) ;
315
315
}
@@ -323,7 +323,7 @@ fn test_do_move_half_stake() {
323
323
let coldkey = U256 :: from ( 1 ) ;
324
324
let origin_hotkey = U256 :: from ( 2 ) ;
325
325
let destination_hotkey = U256 :: from ( 3 ) ;
326
- let stake_amount = 1_000_000 ;
326
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
327
327
328
328
// Set up initial stake
329
329
SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, netuid, stake_amount) ;
@@ -353,7 +353,7 @@ fn test_do_move_half_stake() {
353
353
netuid
354
354
) ,
355
355
stake_amount / 2 ,
356
- epsilon = 100
356
+ epsilon = stake_amount / 1000
357
357
) ;
358
358
assert_abs_diff_eq ! (
359
359
SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet(
@@ -362,7 +362,7 @@ fn test_do_move_half_stake() {
362
362
netuid
363
363
) ,
364
364
stake_amount / 2 ,
365
- epsilon = 100
365
+ epsilon = stake_amount / 1000
366
366
) ;
367
367
} ) ;
368
368
}
@@ -379,7 +379,7 @@ fn test_do_move_partial_stake() {
379
379
let coldkey = U256 :: from ( 1 ) ;
380
380
let origin_hotkey = U256 :: from ( 2 ) ;
381
381
let destination_hotkey = U256 :: from ( 3 ) ;
382
- let total_stake = 1_000_000 ;
382
+ let total_stake = DefaultMinStake :: < Test > :: get ( ) * 10 ;
383
383
384
384
// Set up initial stake
385
385
SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, netuid, total_stake) ;
@@ -417,7 +417,7 @@ fn test_do_move_partial_stake() {
417
417
netuid
418
418
) ,
419
419
total_stake,
420
- epsilon = 100
420
+ epsilon = total_stake / 1000
421
421
) ;
422
422
} ) ;
423
423
}
@@ -434,7 +434,7 @@ fn test_do_move_multiple_times() {
434
434
let coldkey = U256 :: from ( 1 ) ;
435
435
let hotkey1 = U256 :: from ( 2 ) ;
436
436
let hotkey2 = U256 :: from ( 3 ) ;
437
- let initial_stake = 1_000_000 ;
437
+ let initial_stake = DefaultMinStake :: < Test > :: get ( ) * 10 ;
438
438
439
439
// Set up initial stake
440
440
SubtensorModule :: create_account_if_non_existent ( & coldkey, & hotkey1) ;
@@ -471,7 +471,7 @@ fn test_do_move_multiple_times() {
471
471
assert_abs_diff_eq ! (
472
472
SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hotkey1, & coldkey, netuid) ,
473
473
initial_stake,
474
- epsilon = 100
474
+ epsilon = initial_stake / 1000
475
475
) ;
476
476
assert_eq ! (
477
477
SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet( & hotkey2, & coldkey, netuid) ,
@@ -548,7 +548,7 @@ fn test_do_move_same_hotkey() {
548
548
let netuid = add_dynamic_network ( & subnet_owner_hotkey, & subnet_owner_coldkey) ;
549
549
let coldkey = U256 :: from ( 1 ) ;
550
550
let hotkey = U256 :: from ( 2 ) ;
551
- let stake_amount = 1_000_000 ;
551
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
552
552
553
553
// Set up initial stake
554
554
SubtensorModule :: create_account_if_non_existent ( & coldkey, & hotkey) ;
@@ -587,7 +587,7 @@ fn test_do_move_event_emission() {
587
587
let coldkey = U256 :: from ( 1 ) ;
588
588
let origin_hotkey = U256 :: from ( 2 ) ;
589
589
let destination_hotkey = U256 :: from ( 3 ) ;
590
- let stake_amount = 10_000 ;
590
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
591
591
592
592
// Set up initial stake
593
593
SubtensorModule :: create_account_if_non_existent ( & coldkey, & origin_hotkey) ;
@@ -618,7 +618,7 @@ fn test_do_move_event_emission() {
618
618
netuid,
619
619
destination_hotkey,
620
620
netuid,
621
- alpha ,
621
+ 19999999 , // Should be TAO equivalent
622
622
)
623
623
. into ( ) ,
624
624
) ;
@@ -638,7 +638,7 @@ fn test_do_move_storage_updates() {
638
638
let coldkey = U256 :: from ( 1 ) ;
639
639
let origin_hotkey = U256 :: from ( 2 ) ;
640
640
let destination_hotkey = U256 :: from ( 3 ) ;
641
- let stake_amount = 1_000_000 ;
641
+ let stake_amount = DefaultMinStake :: < Test > :: get ( ) * 10 ;
642
642
643
643
// Set up initial stake
644
644
SubtensorModule :: stake_into_subnet ( & origin_hotkey, & coldkey, origin_netuid, stake_amount) ;
@@ -743,7 +743,7 @@ fn test_moving_too_little_fails() {
743
743
new_test_ext ( 1 ) . execute_with ( || {
744
744
let hotkey_account_id = U256 :: from ( 533453 ) ;
745
745
let coldkey_account_id = U256 :: from ( 55453 ) ;
746
- let amount = 10_000 ;
746
+ let amount = DefaultMinStake :: < Test > :: get ( ) ;
747
747
748
748
//add network
749
749
let netuid: u16 = add_dynamic_network ( & hotkey_account_id, & coldkey_account_id) ;
0 commit comments