Skip to content

Conversation

@JohnReedV
Copy link
Contributor

@JohnReedV JohnReedV commented Oct 28, 2025

Description

Removes trust, rank and pruning_score and instead selects a neuron for deregistration based on immunity, emission, reg_block, and then uid

Related Issue(s)

@JohnReedV JohnReedV added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Oct 28, 2025
@JohnReedV JohnReedV changed the title Refactor Neuron Deregistration Emission-based Neuron Deregistration Nov 20, 2025
Comment on lines +28 to +34
let rank_keys: Vec<NetUid> = Rank::<T>::iter_keys().collect();
let rank_removed = rank_keys.len() as u64;
total_reads = total_reads.saturating_add(rank_removed);
for k in rank_keys {
Rank::<T>::remove(k);
total_writes = total_writes.saturating_add(1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using ::clear MultiRemovalResults in one go and the backend/loops fields as reads/writes may be more optimal iterations/memory wise, I'm not sure how many items are there

Comment on lines +39 to +45
let trust_keys: Vec<NetUid> = Trust::<T>::iter_keys().collect();
let trust_removed = trust_keys.len() as u64;
total_reads = total_reads.saturating_add(trust_removed);
for k in trust_keys {
Trust::<T>::remove(k);
total_writes = total_writes.saturating_add(1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Comment on lines +50 to +56
let ps_keys: Vec<NetUid> = PruningScores::<T>::iter_keys().collect();
let ps_removed = ps_keys.len() as u64;
total_reads = total_reads.saturating_add(ps_removed);
for k in ps_keys {
PruningScores::<T>::remove(k);
total_writes = total_writes.saturating_add(1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

ppolewicz and others added 2 commits November 24, 2025 05:28
Co-authored-by: Loris Moulin <45130584+l0r1s@users.noreply.github.com>
Comment on lines +522 to +523
let min_free: u16 = Self::get_min_non_immune_uids(netuid);
let can_prune_non_immune = free_count > min_free;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants