Skip to content

Commit

Permalink
fix warnings 🪳
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Apr 26, 2024
1 parent 08515ce commit d07c7dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 7 additions & 5 deletions pallets/subtensor/src/registration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::*;
use frame_support::pallet_prelude::{DispatchResult, DispatchResultWithPostInfo};
use frame_support::pallet_prelude::DispatchResultWithPostInfo;
use frame_support::storage::IterableStorageDoubleMap;
use sp_core::{Get, H256, U256};
use sp_io::hashing::{keccak_256, sha2_256};
Expand Down Expand Up @@ -102,7 +102,8 @@ impl<T: Config> Pallet<T> {
);

// --- 8. Ensure the remove operation from the coldkey is a success.
let actual_burn_amount = Self::remove_balance_from_coldkey_account(&coldkey, registration_cost_as_balance)?;
let actual_burn_amount =
Self::remove_balance_from_coldkey_account(&coldkey, registration_cost_as_balance)?;

// The burn occurs here.
Self::burn_tokens(actual_burn_amount);
Expand Down Expand Up @@ -431,14 +432,14 @@ impl<T: Config> Pallet<T> {
if neurons_n == 0 {
return 0; // If there are no neurons in this network.
}

let current_block: u64 = Self::get_current_block_as_u64();
let immunity_period: u64 = Self::get_immunity_period(netuid) as u64;
for neuron_uid_i in 0..neurons_n {
let pruning_score: u16 = Self::get_pruning_score_for_uid(netuid, neuron_uid_i);
let block_at_registration: u64 =
Self::get_neuron_block_at_registration(netuid, neuron_uid_i);

if min_score == pruning_score {
if current_block - block_at_registration < immunity_period {
//neuron is in immunity period
Expand Down Expand Up @@ -730,7 +731,8 @@ impl<T: Config> Pallet<T> {
Self::can_remove_balance_from_coldkey_account(&coldkey, swap_cost_as_balance),
Error::<T>::NotEnoughBalance
);
let actual_burn_amount = Self::remove_balance_from_coldkey_account(&coldkey, swap_cost_as_balance)?;
let actual_burn_amount =
Self::remove_balance_from_coldkey_account(&coldkey, swap_cost_as_balance)?;
Self::burn_tokens(actual_burn_amount);

Owner::<T>::remove(old_hotkey);
Expand Down
4 changes: 0 additions & 4 deletions pallets/subtensor/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ fn test_add_stake_under_limit() {
new_test_ext(1).execute_with(|| {
let hotkey_account_id = U256::from(561337);
let coldkey_account_id = U256::from(61337);
let who: <Test as frame_system::Config>::AccountId = hotkey_account_id;
let netuid: u16 = 1;
let start_nonce: u64 = 0;
let tempo: u16 = 13;
Expand Down Expand Up @@ -403,7 +402,6 @@ fn test_add_stake_rate_limit_exceeded() {
new_test_ext(1).execute_with(|| {
let hotkey_account_id = U256::from(561337);
let coldkey_account_id = U256::from(61337);
let who: <Test as frame_system::Config>::AccountId = hotkey_account_id;
let netuid: u16 = 1;
let start_nonce: u64 = 0;
let tempo: u16 = 13;
Expand Down Expand Up @@ -446,7 +444,6 @@ fn test_remove_stake_under_limit() {
new_test_ext(1).execute_with(|| {
let hotkey_account_id = U256::from(561337);
let coldkey_account_id = U256::from(61337);
let who: <Test as frame_system::Config>::AccountId = hotkey_account_id;
let netuid: u16 = 1;
let start_nonce: u64 = 0;
let tempo: u16 = 13;
Expand Down Expand Up @@ -482,7 +479,6 @@ fn test_remove_stake_rate_limit_exceeded() {
new_test_ext(1).execute_with(|| {
let hotkey_account_id = U256::from(561337);
let coldkey_account_id = U256::from(61337);
let who: <Test as frame_system::Config>::AccountId = hotkey_account_id;
let netuid: u16 = 1;
let start_nonce: u64 = 0;
let tempo: u16 = 13;
Expand Down

0 comments on commit d07c7dd

Please sign in to comment.