@@ -2463,29 +2463,32 @@ fn test_max_amount_add_dynamic() {
2463
2463
#[ test]
2464
2464
fn test_max_amount_remove_root ( ) {
2465
2465
new_test_ext ( 0 ) . execute_with ( || {
2466
- // 0 price on root => max is 0
2467
- assert_eq ! ( SubtensorModule :: get_max_amount_remove( 0 , 0 ) , 0 ) ;
2468
-
2469
- // 0.999999... price on root => max is 0
2470
- assert_eq ! ( SubtensorModule :: get_max_amount_remove( 0 , 999_999_999 ) , 0 ) ;
2466
+ // 0 price on root => max is u64::MAX
2467
+ assert_eq ! ( SubtensorModule :: get_max_amount_remove( 0 , 0 ) , u64 :: MAX ) ;
2471
2468
2472
- // 1.0 price on root => max is u64::MAX
2469
+ // 0.5 price on root => max is u64::MAX
2473
2470
assert_eq ! (
2474
- SubtensorModule :: get_max_amount_remove( 0 , 1_000_000_000 ) ,
2471
+ SubtensorModule :: get_max_amount_remove( 0 , 500_000_000 ) ,
2475
2472
u64 :: MAX
2476
2473
) ;
2477
2474
2478
- // 1.000 ...001 price on root => max is u64::MAX
2475
+ // 0.999999 ... price on root => max is u64::MAX
2479
2476
assert_eq ! (
2480
- SubtensorModule :: get_max_amount_remove( 0 , 1_000_000_001 ) ,
2477
+ SubtensorModule :: get_max_amount_remove( 0 , 999_999_999 ) ,
2481
2478
u64 :: MAX
2482
2479
) ;
2483
2480
2484
- // 2 .0 price on root => max is u64::MAX
2481
+ // 1 .0 price on root => max is u64::MAX
2485
2482
assert_eq ! (
2486
- SubtensorModule :: get_max_amount_remove( 0 , 2_000_000_000 ) ,
2483
+ SubtensorModule :: get_max_amount_remove( 0 , 1_000_000_000 ) ,
2487
2484
u64 :: MAX
2488
2485
) ;
2486
+
2487
+ // 1.000...001 price on root => max is 0
2488
+ assert_eq ! ( SubtensorModule :: get_max_amount_remove( 0 , 1_000_000_001 ) , 0 ) ;
2489
+
2490
+ // 2.0 price on root => max is 0
2491
+ assert_eq ! ( SubtensorModule :: get_max_amount_remove( 0 , 2_000_000_000 ) , 0 ) ;
2489
2492
} ) ;
2490
2493
}
2491
2494
@@ -2495,13 +2498,13 @@ fn test_max_amount_remove_stable() {
2495
2498
let netuid: u16 = 1 ;
2496
2499
add_network ( netuid, 1 , 0 ) ;
2497
2500
2498
- // 0 price => max is 0
2499
- assert_eq ! ( SubtensorModule :: get_max_amount_remove( netuid, 0 ) , 0 ) ;
2501
+ // 0 price => max is u64::MAX
2502
+ assert_eq ! ( SubtensorModule :: get_max_amount_remove( netuid, 0 ) , u64 :: MAX ) ;
2500
2503
2501
- // 0.999999... price => max is 0
2504
+ // 0.999999... price => max is u64::MAX
2502
2505
assert_eq ! (
2503
2506
SubtensorModule :: get_max_amount_remove( netuid, 999_999_999 ) ,
2504
- 0
2507
+ u64 :: MAX
2505
2508
) ;
2506
2509
2507
2510
// 1.0 price => max is u64::MAX
@@ -2510,16 +2513,16 @@ fn test_max_amount_remove_stable() {
2510
2513
u64 :: MAX
2511
2514
) ;
2512
2515
2513
- // 1.000...001 price => max is u64::MAX
2516
+ // 1.000...001 price => max is 0
2514
2517
assert_eq ! (
2515
2518
SubtensorModule :: get_max_amount_remove( netuid, 1_000_000_001 ) ,
2516
- u64 :: MAX
2519
+ 0
2517
2520
) ;
2518
2521
2519
- // 2.0 price => max is u64::MAX
2522
+ // 2.0 price => max is 0
2520
2523
assert_eq ! (
2521
2524
SubtensorModule :: get_max_amount_remove( netuid, 2_000_000_000 ) ,
2522
- u64 :: MAX
2525
+ 0
2523
2526
) ;
2524
2527
} ) ;
2525
2528
}
0 commit comments