Skip to content

Commit

Permalink
refactor once again
Browse files Browse the repository at this point in the history
  • Loading branch information
andreea-popescu-reef committed Sep 15, 2024
1 parent 6575d97 commit 5e45f5c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions pallets/subtensor/src/subnets/uids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ impl<T: Config> Pallet<T> {

/// Resets the trust, emission, consensus, incentive, dividends of the neuron to default
pub fn clear_neuron(netuid: u16, neuron_uid: u16) {
Emission::<T>::mutate(netuid, |v| Self::set_element_at(v, neuron_uid.into(), 0));
Trust::<T>::mutate(netuid, |v| Self::set_element_at(v, neuron_uid.into(), 0));
Consensus::<T>::mutate(netuid, |v| Self::set_element_at(v, neuron_uid.into(), 0));
Incentive::<T>::mutate(netuid, |v| Self::set_element_at(v, neuron_uid.into(), 0));
Dividends::<T>::mutate(netuid, |v| Self::set_element_at(v, neuron_uid.into(), 0));
let neuron_index: usize = neuron_uid.into();
Self::set_element_at(&mut Emission::<T>::get(netuid), neuron_index, 0);
for storage in &mut [
&mut Trust::<T>::get(netuid),
&mut Consensus::<T>::get(netuid),
&mut Incentive::<T>::get(netuid),
&mut Dividends::<T>::get(netuid),
] {
Self::set_element_at(storage, neuron_index, 0);
}
}

/// Replace the neuron under this uid.
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 196,
spec_version: 197,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 5e45f5c

Please sign in to comment.