Skip to content
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

add default 1024 max stake limit for querying UIDs with vpermit. #1379

Merged
merged 5 commits into from
Jun 3, 2023

Conversation

ifrit98
Copy link
Contributor

@ifrit98 ifrit98 commented Jun 2, 2023

  • Small change, make sure that UIDs with a vpermit but under stake limit (1024 by default) are still queried.

@ifrit98 ifrit98 requested review from Eugene-hu and unconst June 2, 2023 18:10
@ifrit98 ifrit98 self-assigned this Jun 2, 2023
@@ -328,12 +329,14 @@ def forward(
# Set `topk` to the number of items in `self.metagraph.n` if `topk` is not provided or is -1.
# Find the available `uids` that are currently serving.
# If `topk` is larger than the number of available `uids`, set `topk` to the number of available `uids`.
available_uids = torch.tensor( [ uid for uid, ax in enumerate( self.metagraph.axons ) if (ax.is_serving) and (not self.metagraph.validator_permit[uid]) ], dtype = torch.int64 ).to( self.device )
# Check if we have vpermit and if we do, ensure query only UIDs with less than vpermit_tao_limit.
candidate_uids = [uid for uid, ax in enumerate(self.metagraph.axons) if ax.is_serving and ((self.metagraph.validator_permit[uid] and self.metagraph.S[uid] < self.config.neuron.vpermit_tao_limit) or not self.metagraph.validator_permit[uid])]
Copy link
Contributor

@adriansmares adriansmares Jun 2, 2023

Choose a reason for hiding this comment

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

This condition should also be updated in check_weights.

Can also be simplified to not self.metagraph.validator_permit[uid] or self.metagraph.S[uid] < self.config.neuron.vpermit_tao_limit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assume it would be as simple as changing the 2nd if condition in check_weights to:

for uid, hotkey in enumerate( self.hotkeys ):
    if hotkey != self.metagraph.hotkeys[ uid ]:
        self.moving_averaged_scores[ uid ] = 0 #hotkey has been replaced
    if self.metagraph.validator_permit[ uid ] and self.metagraph.S[ uid ] < self.config.neuron.vpermit_tao_limit:
        self.moving_averaged_scores[ uid ] = 0 # hotkey has validation rights and is below the tao limit

Let me know if this is an incorrect assumption.

@ifrit98 ifrit98 requested a review from adriansmares June 3, 2023 14:23
@unconst unconst merged commit 9d85204 into master Jun 3, 2023
@ifrit98 ifrit98 deleted the validator_vpermit_hotfix branch June 28, 2023 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants