-
Notifications
You must be signed in to change notification settings - Fork 237
Trim uids #1998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devnet-ready
Are you sure you want to change the base?
Trim uids #1998
Conversation
@@ -107,6 +96,143 @@ impl<T: Config> Pallet<T> { | |||
IsNetworkMember::<T>::insert(new_hotkey.clone(), netuid, true); // Fill network is member. | |||
} | |||
|
|||
/// Appends the uid to the network. | |||
pub fn clear_neuron(netuid: NetUid, neuron_uid: u16) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We clear weights set FOR the uid being cleared. Do we also need to clear weights set BY the uid being cleared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to understand, I get the impression the comment is to the wrong section maybe?
In clear_neuron
it seems we only reset the value but weights are not touched, only bonds are removed.
In trim_to_max_allowed_uids
we effectively clear the weights, bonds and also all connections to remaining neurons here:
https://github.com/opentensor/subtensor/pull/1998/files#diff-6e4716cd71324b7ff12eb21a83873e667f5c91b5fe9a18f64bc2fe2b8f748ff0R212
Is it about this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a validator sets weights, the weights get into the state as a value-vector associated with netuid+validator_uid tuple:
(netuid, validator_uid) => [(miner_uid_1, weight_1), (miner_uid_2, weight_2), ...]
In trim_to_max_allowed_uids
we make the value-vector shorter, effectively removing the unneeded miner UIDs.
But we ignore the fact that UID that is being removed could also have been the validator and have set weights, so the corresponding key (netuid, validator_uid)
remains in the map, but it needs to be fully removed.
Description
Allows subnets to trim the number of active UIDs while preserving immune UIDs (temporally and owner owned), compressing the UIDs to the left and migrating/clearing associated storage.
A new extrinsic + storage item has been defined for the minimum allowed number of UIDs of a subnet and we can't trim below this limit which is set to 256 to start with and will allow gradual controlled trimming on a per subnet basis to prevent abuse.