Skip to content

Commit 7f938f7

Browse files
constconst
authored andcommitted
tests pass
1 parent 0432b53 commit 7f938f7

File tree

3 files changed

+279
-386
lines changed

3 files changed

+279
-386
lines changed

pallets/subtensor/src/swap_hotkey.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use super::*;
2-
use crate::MIN_BALANCE_TO_PERFORM_COLDKEY_SWAP;
3-
use frame_support::traits::fungible::Mutate;
4-
use frame_support::traits::tokens::Preservation;
5-
use frame_support::{storage::IterableStorageDoubleMap, weights::Weight};
6-
use sp_core::{Get, U256};
2+
use frame_support::weights::Weight;
3+
use sp_core::Get;
74

85
impl<T: Config> Pallet<T> {
96
/// Swaps the hotkey of a coldkey account.
@@ -86,7 +83,7 @@ impl<T: Config> Pallet<T> {
8683
Self::burn_tokens(actual_burn_amount);
8784

8885
// Perform the hotkey swap
89-
Self::perform_hotkey_swap(old_hotkey, new_hotkey, &coldkey, &mut weight);
86+
let _ = Self::perform_hotkey_swap(old_hotkey, new_hotkey, &coldkey, &mut weight);
9087

9188
// Update the last transaction block for the coldkey
9289
Self::set_last_tx_block(&coldkey, block);
@@ -143,10 +140,9 @@ impl<T: Config> Pallet<T> {
143140

144141
// Swap LastTxBlock
145142
// LastTxBlock( hotkey ) --> u64 -- the last transaction block for the hotkey.
146-
let old_last_tx_block: u64 = LastTxBlock::<T>::get( old_hotkey );
147143
LastTxBlock::<T>::remove( old_hotkey );
148144
LastTxBlock::<T>::insert( new_hotkey, Self::get_current_block_as_u64() );
149-
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 2));
145+
weight.saturating_accrue(T::DbWeight::get().reads_writes(0, 2));
150146

151147
// Swap LastTxBlockDelegateTake
152148
// LastTxBlockDelegateTake( hotkey ) --> u64 -- the last transaction block for the hotkey delegate take.

0 commit comments

Comments
 (0)