Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Dare committed Jul 5, 2024
1 parent 94b0954 commit 5a26348
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 2 additions & 3 deletions pallets/subtensor/src/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,6 @@ impl<T: Config> Pallet<T> {
current_coldkey: T::AccountId,
new_coldkey: T::AccountId,
) -> DispatchResult {

// Ensure the new coldkey is different from the current one
ensure!(current_coldkey != new_coldkey, Error::<T>::SameColdkey);

Expand All @@ -885,7 +884,8 @@ impl<T: Config> Pallet<T> {
);

// Get the current stake
let current_stake: u64 = Self::get_stake_for_coldkey_and_hotkey(&current_coldkey, &next_hotkey);
let current_stake: u64 =
Self::get_stake_for_coldkey_and_hotkey(&current_coldkey, &next_hotkey);

// Unstake all balance if there's any stake
if current_stake > 0 {
Expand All @@ -895,7 +895,6 @@ impl<T: Config> Pallet<T> {
current_stake,
)?;
}

}

let total_balance = Self::get_coldkey_balance(&current_coldkey);
Expand Down
7 changes: 2 additions & 5 deletions pallets/subtensor/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3181,11 +3181,10 @@ fn test_do_unstake_all_and_transfer_to_new_coldkey_success() {
});
}


#[test]
fn test_do_unstake_all_and_transfer_to_new_coldkey_same_coldkey() {
new_test_ext(1).execute_with(|| {
let (current_coldkey, hotkey, _) = setup_test_environment();
let (current_coldkey, _hotkey, _) = setup_test_environment();

assert_noop!(
SubtensorModule::do_unstake_all_and_transfer_to_new_coldkey(
Expand Down Expand Up @@ -3373,11 +3372,9 @@ fn test_do_unstake_all_and_transfer_to_new_coldkey_with_multiple_stakes() {
});
}


#[test]
fn test_do_unstake_all_and_transfer_to_new_coldkey_with_multiple_stakes_multiple() {
new_test_ext(1).execute_with(|| {

// Register the neuron to a new network
let netuid = 1;
let hotkey0 = U256::from(1);
Expand Down Expand Up @@ -3415,4 +3412,4 @@ fn test_do_unstake_all_and_transfer_to_new_coldkey_with_multiple_stakes_multiple
.into(),
);
});
}
}

0 comments on commit 5a26348

Please sign in to comment.