@@ -2315,11 +2315,11 @@ fn test_migrate_remove_zero_stakes() {
2315
2315
let hotkey1 = U256 :: from ( 3 ) ;
2316
2316
let hotkey2 = U256 :: from ( 4 ) ;
2317
2317
2318
- Stake :: < Test > :: insert ( & hotkey1, & coldkey1, 0 ) ;
2319
- Stake :: < Test > :: insert ( & hotkey2, & coldkey2, 100 ) ;
2318
+ Stake :: < Test > :: insert ( hotkey1, coldkey1, 0 ) ;
2319
+ Stake :: < Test > :: insert ( hotkey2, coldkey2, 100 ) ;
2320
2320
2321
- assert_eq ! ( Stake :: <Test >:: get( & hotkey1, & coldkey1) , 0 ) ;
2322
- assert_eq ! ( Stake :: <Test >:: get( & hotkey2, & coldkey2) , 100 ) ;
2321
+ assert_eq ! ( Stake :: <Test >:: get( hotkey1, coldkey1) , 0 ) ;
2322
+ assert_eq ! ( Stake :: <Test >:: get( hotkey2, coldkey2) , 100 ) ;
2323
2323
2324
2324
assert ! ( !HasMigrationRun :: <Test >:: get(
2325
2325
b"remove_zero_stakes_v1" . to_vec( )
@@ -2334,11 +2334,11 @@ fn test_migrate_remove_zero_stakes() {
2334
2334
b"remove_zero_stakes_v1" . to_vec( )
2335
2335
) ) ;
2336
2336
2337
- assert_eq ! ( Stake :: <Test >:: get( & hotkey1, & coldkey1) , 0 ) ; // Default is 0
2338
- assert ! ( !Stake :: <Test >:: contains_key( & hotkey1, & coldkey1) ) ;
2337
+ assert_eq ! ( Stake :: <Test >:: get( hotkey1, coldkey1) , 0 ) ; // Default is 0
2338
+ assert ! ( !Stake :: <Test >:: contains_key( hotkey1, coldkey1) ) ;
2339
2339
2340
- assert_eq ! ( Stake :: <Test >:: get( & hotkey2, & coldkey2) , 100 ) ;
2341
- assert ! ( Stake :: <Test >:: contains_key( & hotkey2, & coldkey2) ) ;
2340
+ assert_eq ! ( Stake :: <Test >:: get( hotkey2, coldkey2) , 100 ) ;
2341
+ assert ! ( Stake :: <Test >:: contains_key( hotkey2, coldkey2) ) ;
2342
2342
2343
2343
assert ! (
2344
2344
weight != Weight :: zero( ) ,
@@ -2353,16 +2353,16 @@ fn test_decrease_stake_non_zero_stake() {
2353
2353
let hotkey = U256 :: from ( 1 ) ;
2354
2354
let coldkey = U256 :: from ( 2 ) ;
2355
2355
2356
- TotalColdkeyStake :: < Test > :: insert ( & coldkey, 200 ) ;
2357
- TotalHotkeyStake :: < Test > :: insert ( & hotkey, 150 ) ;
2358
- Stake :: < Test > :: insert ( & hotkey, & coldkey, 100 ) ;
2356
+ TotalColdkeyStake :: < Test > :: insert ( coldkey, 200 ) ;
2357
+ TotalHotkeyStake :: < Test > :: insert ( hotkey, 150 ) ;
2358
+ Stake :: < Test > :: insert ( hotkey, coldkey, 100 ) ;
2359
2359
TotalStake :: < Test > :: put ( 300 ) ;
2360
2360
2361
2361
SubtensorModule :: decrease_stake_on_coldkey_hotkey_account ( & coldkey, & hotkey, 50 ) ;
2362
2362
2363
- assert_eq ! ( TotalColdkeyStake :: <Test >:: get( & coldkey) , 150 ) ;
2364
- assert_eq ! ( TotalHotkeyStake :: <Test >:: get( & hotkey) , 100 ) ;
2365
- assert_eq ! ( Stake :: <Test >:: get( & hotkey, & coldkey) , 50 ) ;
2363
+ assert_eq ! ( TotalColdkeyStake :: <Test >:: get( coldkey) , 150 ) ;
2364
+ assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey) , 100 ) ;
2365
+ assert_eq ! ( Stake :: <Test >:: get( hotkey, coldkey) , 50 ) ;
2366
2366
assert_eq ! ( TotalStake :: <Test >:: get( ) , 250 ) ;
2367
2367
} ) ;
2368
2368
}
@@ -2374,18 +2374,18 @@ fn test_decrease_stake_to_zero() {
2374
2374
let coldkey = U256 :: from ( 2 ) ;
2375
2375
2376
2376
// Insert initial stake
2377
- TotalColdkeyStake :: < Test > :: insert ( & coldkey, 150 ) ;
2378
- TotalHotkeyStake :: < Test > :: insert ( & hotkey, 100 ) ;
2379
- Stake :: < Test > :: insert ( & hotkey, & coldkey, 50 ) ;
2377
+ TotalColdkeyStake :: < Test > :: insert ( coldkey, 150 ) ;
2378
+ TotalHotkeyStake :: < Test > :: insert ( hotkey, 100 ) ;
2379
+ Stake :: < Test > :: insert ( hotkey, coldkey, 50 ) ;
2380
2380
TotalStake :: < Test > :: put ( 250 ) ;
2381
2381
2382
2382
// Decrease stake to zero
2383
2383
SubtensorModule :: decrease_stake_on_coldkey_hotkey_account ( & coldkey, & hotkey, 50 ) ;
2384
2384
2385
2385
// Check that the stake is removed
2386
- assert_eq ! ( TotalColdkeyStake :: <Test >:: get( & coldkey) , 100 ) ;
2387
- assert_eq ! ( TotalHotkeyStake :: <Test >:: get( & hotkey) , 50 ) ;
2388
- assert ! ( !Stake :: <Test >:: contains_key( & hotkey, & coldkey) ) ;
2386
+ assert_eq ! ( TotalColdkeyStake :: <Test >:: get( coldkey) , 100 ) ;
2387
+ assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey) , 50 ) ;
2388
+ assert ! ( !Stake :: <Test >:: contains_key( hotkey, coldkey) ) ;
2389
2389
assert_eq ! ( TotalStake :: <Test >:: get( ) , 200 ) ;
2390
2390
} ) ;
2391
2391
}
@@ -2397,18 +2397,18 @@ fn test_decrease_stake_more_than_available() {
2397
2397
let coldkey = U256 :: from ( 2 ) ;
2398
2398
2399
2399
// Insert initial stake
2400
- TotalColdkeyStake :: < Test > :: insert ( & coldkey, 80 ) ;
2401
- TotalHotkeyStake :: < Test > :: insert ( & hotkey, 70 ) ;
2402
- Stake :: < Test > :: insert ( & hotkey, & coldkey, 60 ) ;
2400
+ TotalColdkeyStake :: < Test > :: insert ( coldkey, 80 ) ;
2401
+ TotalHotkeyStake :: < Test > :: insert ( hotkey, 70 ) ;
2402
+ Stake :: < Test > :: insert ( hotkey, coldkey, 60 ) ;
2403
2403
TotalStake :: < Test > :: put ( 150 ) ;
2404
2404
2405
2405
// Decrease by more than available stake
2406
2406
SubtensorModule :: decrease_stake_on_coldkey_hotkey_account ( & coldkey, & hotkey, 100 ) ;
2407
2407
2408
2408
// Check that the stake is zero and removed
2409
- assert_eq ! ( TotalColdkeyStake :: <Test >:: get( & coldkey) , 0 ) ;
2410
- assert_eq ! ( TotalHotkeyStake :: <Test >:: get( & hotkey) , 0 ) ;
2411
- assert ! ( !Stake :: <Test >:: contains_key( & hotkey, & coldkey) ) ;
2409
+ assert_eq ! ( TotalColdkeyStake :: <Test >:: get( coldkey) , 0 ) ;
2410
+ assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey) , 0 ) ;
2411
+ assert ! ( !Stake :: <Test >:: contains_key( hotkey, coldkey) ) ;
2412
2412
assert_eq ! ( TotalStake :: <Test >:: get( ) , 50 ) ;
2413
2413
} ) ;
2414
2414
}
@@ -2420,18 +2420,18 @@ fn test_decrease_stake_no_existing_stake() {
2420
2420
let coldkey = U256 :: from ( 2 ) ;
2421
2421
2422
2422
// Insert zero stake for coldkey and hotkey
2423
- TotalColdkeyStake :: < Test > :: insert ( & coldkey, 0 ) ;
2424
- TotalHotkeyStake :: < Test > :: insert ( & hotkey, 0 ) ;
2425
- Stake :: < Test > :: remove ( & hotkey, & coldkey) ;
2423
+ TotalColdkeyStake :: < Test > :: insert ( coldkey, 0 ) ;
2424
+ TotalHotkeyStake :: < Test > :: insert ( hotkey, 0 ) ;
2425
+ Stake :: < Test > :: remove ( hotkey, coldkey) ;
2426
2426
TotalStake :: < Test > :: put ( 0 ) ;
2427
2427
2428
2428
// Try to decrease stake when no stake exists
2429
2429
SubtensorModule :: decrease_stake_on_coldkey_hotkey_account ( & coldkey, & hotkey, 10 ) ;
2430
2430
2431
2431
// Assert no changes were made
2432
- assert_eq ! ( TotalColdkeyStake :: <Test >:: get( & coldkey) , 0 ) ;
2433
- assert_eq ! ( TotalHotkeyStake :: <Test >:: get( & hotkey) , 0 ) ;
2434
- assert ! ( !Stake :: <Test >:: contains_key( & hotkey, & coldkey) ) ;
2432
+ assert_eq ! ( TotalColdkeyStake :: <Test >:: get( coldkey) , 0 ) ;
2433
+ assert_eq ! ( TotalHotkeyStake :: <Test >:: get( hotkey) , 0 ) ;
2434
+ assert ! ( !Stake :: <Test >:: contains_key( hotkey, coldkey) ) ;
2435
2435
assert_eq ! ( TotalStake :: <Test >:: get( ) , 0 ) ;
2436
2436
} ) ;
2437
2437
}
0 commit comments