reset neuron data on dereg#755
Merged
camfairchild merged 1 commit intoJan 27, 2025
Merged
Conversation
Contributor
|
@andreea-popescu-reef also changed the base against |
bdd5e14 to
5e425fb
Compare
5e425fb to
5e45f5c
Compare
5e45f5c to
4b45cd3
Compare
e264672 to
fe5557a
Compare
Contributor
Author
|
rebased this pr |
ef3ce2d to
a0f769a
Compare
camfairchild
previously approved these changes
Nov 26, 2024
basfroman
previously approved these changes
Nov 26, 2024
4e51655 to
343cef2
Compare
Contributor
Author
|
rebased again |
camfairchild
approved these changes
Jan 20, 2025
343cef2 to
8642872
Compare
camfairchild
approved these changes
Jan 27, 2025
13 tasks
boskodev790
added a commit
to boskodev790/subtensor
that referenced
this pull request
May 11, 2026
clear_neuron zeroed the per-UID slot of Emission, Consensus, Incentive, Dividends, StakeWeight, Bonds and Weights, but missed Active, ValidatorTrust, and ValidatorPermit. All three are Vec<_>-per-netuid storage (Active and ValidatorPermit are Vec<bool> via EmptyBoolVec; ValidatorTrust is Vec<u16> via EmptyU16Vec) that append_neuron initialises on a fresh UID, so when replace_neuron reuses a UID it currently left the old occupant's active=true flag, validator_permit=true flag, and validator_trust score in place until the next epoch recomputed the vectors. Between replacement and the next epoch, RPC surfaces (delegate_info, show_subnet) and on-chain readers (trim_to_max_allowed_uids and the per-mechanism validator aggregation in mechanism.rs) observed stale validator/active state for the freshly registered neuron. Same class of stale-inheritance bug PR opentensor#755 was introduced to fix; these three fields were missed there. - clear_neuron now also zeroes ValidatorTrust[uid] and resets ValidatorPermit[uid] = false and Active[uid] = false, using the same set_element_at idiom already applied to the other vec-per-netuid fields two lines above. - Add test_replace_neuron_clears_validator_trust_and_permit and test_replace_neuron_clears_active mirroring the existing test_replace_neuron_resets_last_update style. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
reviving: #522
Description
On neuron registration the trust, emission, consensus, incentive, dividends values as well as axon info associated with the assigned neuron_uid are inherited from the previous neuron. Thus for the first few blocks after registration these values will be wrong, then reset to zero and then get populated with the correct values for the newly registered neuron. This change resets these values on neuron registration.