Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test description and comments #510

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions pallets/subtensor/tests/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,3 +546,41 @@ fn test_dissolve_network_does_not_exist_err() {
);
});
}

#[test]
fn test_swap_hotkey_ok() {
new_test_ext(1).execute_with(|| {
// init params.
let hotkey1 = U256::from(0);
let coldkey = U256::from(1);
let hotkey2 = U256::from(2);

// Register subnet.
SubtensorModule::add_balance_to_coldkey_account(&coldkey, 200_000_000_000); // 200 TAO.
assert_ok!(SubtensorModule::register_network(
<<Test as Config>::RuntimeOrigin>::signed(coldkey),
hotkey1
));

// Swap the hotkey
assert_ok!(SubtensorModule::swap_hotkey(
<<Test as Config>::RuntimeOrigin>::signed(coldkey),
hotkey1,
hotkey2,
));

// Check that SubnetCreator didn't change because it is set forever

// Check that account got created (Owner record was added)

// Keys - old removed, new created
// Uids - old removed, new created
// IsNetworkMember - old removed, new created

// Stake variables - old removed, new added
// TotalHotkeySubStake
// SubStake
// Staker

})
}