Skip to content

Commit 5398a82

Browse files
committed
fix test_swap_hotkey_with_multiple_coldkeys test_swap_staking_hotkeys test_swap_staking_hotkeys_multiple_coldkeys
1 parent 60578d5 commit 5398a82

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pallets/subtensor/src/tests/swap_hotkey.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,11 @@ fn test_swap_staking_hotkeys() {
450450
let new_hotkey = U256::from(2);
451451
let coldkey = U256::from(3);
452452
let mut weight = Weight::zero();
453+
let netuid = 1;
453454

454455
Stake::<Test>::insert(old_hotkey, coldkey, 100);
455456
StakingHotkeys::<Test>::insert(coldkey, vec![old_hotkey]);
457+
Alpha::<Test>::insert((old_hotkey, coldkey, netuid), U64F64::from_num(100));
456458

457459
assert_ok!(SubtensorModule::perform_hotkey_swap(
458460
&old_hotkey,
@@ -476,12 +478,16 @@ fn test_swap_hotkey_with_multiple_coldkeys() {
476478
let coldkey1 = U256::from(3);
477479
let coldkey2 = U256::from(4);
478480
let mut weight = Weight::zero();
481+
let netuid = 1;
479482

480483
Stake::<Test>::insert(old_hotkey, coldkey1, 100);
481484
Stake::<Test>::insert(old_hotkey, coldkey2, 200);
482485
StakingHotkeys::<Test>::insert(coldkey1, vec![old_hotkey]);
483486
StakingHotkeys::<Test>::insert(coldkey2, vec![old_hotkey]);
484487

488+
Alpha::<Test>::insert((old_hotkey, coldkey1, netuid), U64F64::from_num(100));
489+
Alpha::<Test>::insert((old_hotkey, coldkey2, netuid), U64F64::from_num(200));
490+
485491
assert_ok!(SubtensorModule::perform_hotkey_swap(
486492
&old_hotkey,
487493
&new_hotkey,
@@ -558,10 +564,15 @@ fn test_swap_staking_hotkeys_multiple_coldkeys() {
558564
let coldkey1 = U256::from(3);
559565
let coldkey2 = U256::from(4);
560566
let mut weight = Weight::zero();
567+
let netuid = 1;
561568

562569
// Set up initial state
563570
Stake::<Test>::insert(old_hotkey, coldkey1, 100);
564571
Stake::<Test>::insert(old_hotkey, coldkey2, 200);
572+
573+
Alpha::<Test>::insert((old_hotkey, coldkey1, netuid), U64F64::from_num(100));
574+
Alpha::<Test>::insert((old_hotkey, coldkey2, netuid), U64F64::from_num(200));
575+
565576
StakingHotkeys::<Test>::insert(coldkey1, vec![old_hotkey]);
566577
StakingHotkeys::<Test>::insert(coldkey2, vec![old_hotkey, U256::from(5)]);
567578

0 commit comments

Comments
 (0)