Skip to content

Commit

Permalink
fix clippy in test file
Browse files Browse the repository at this point in the history
  • Loading branch information
open-junius committed Jul 8, 2024
1 parent 8f8b92c commit 6daad1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
6 changes: 3 additions & 3 deletions pallets/subtensor/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3839,7 +3839,7 @@ fn test_transfer_coldkey_in_arbitration() {

// Try to transfer balance
let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: recipient_account_id.into(),
dest: recipient_account_id,
value: 1000,
});

Expand Down Expand Up @@ -3937,7 +3937,7 @@ fn test_transfer_coldkey_not_in_arbitration() {
SubtensorModule::add_balance_to_coldkey_account(&coldkey_account_id, 60000);

let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death {
dest: recipient_account_id.into(),
dest: recipient_account_id,
value: 1000,
});

Expand All @@ -3958,6 +3958,6 @@ fn generate_valid_pow(coldkey: &AccountId, block_number: u64, difficulty: u32) -
if SubtensorModule::hash_meets_difficulty(&work, difficulty.into()) {
return (work.as_bytes().to_vec(), nonce);
}
nonce += 1;
nonce = nonce.saturating_add(1);
}
}
29 changes: 0 additions & 29 deletions pallets/subtensor/tests/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,35 +1253,6 @@ fn test_swap_stake_for_coldkey() {
});
}

#[test]
fn test_swap_owner_for_coldkey() {
new_test_ext(1).execute_with(|| {
let old_coldkey = U256::from(1);
let new_coldkey = U256::from(2);
let hotkey1 = U256::from(3);
let hotkey2 = U256::from(4);
let mut weight = Weight::zero();

// Initialize Owner for old_coldkey
Owner::<Test>::insert(hotkey1, old_coldkey);
Owner::<Test>::insert(hotkey2, old_coldkey);

// Initialize OwnedHotkeys map
OwnedHotkeys::<Test>::insert(old_coldkey, vec![hotkey1, hotkey2]);

// Perform the swap
SubtensorModule::swap_owner_for_coldkey(&old_coldkey, &new_coldkey, &mut weight);

// Verify the swap
assert_eq!(Owner::<Test>::get(hotkey1), new_coldkey);
assert_eq!(Owner::<Test>::get(hotkey2), new_coldkey);

// Verify weight update
let expected_weight = <Test as frame_system::Config>::DbWeight::get().reads_writes(1, 2);
assert_eq!(weight, expected_weight);
});
}

#[test]
fn test_swap_total_hotkey_coldkey_stakes_this_interval_for_coldkey() {
new_test_ext(1).execute_with(|| {
Expand Down

0 comments on commit 6daad1e

Please sign in to comment.