Skip to content

Check if hotkey is registered in any network only if netuid is not provided.#2487

Open
evgeny-s wants to merge 17 commits intoopentensor:devnet-readyfrom
evgeny-s:evgeny-revert-swap-key
Open

Check if hotkey is registered in any network only if netuid is not provided.#2487
evgeny-s wants to merge 17 commits intoopentensor:devnet-readyfrom
evgeny-s:evgeny-revert-swap-key

Conversation

@evgeny-s
Copy link

@evgeny-s evgeny-s commented Mar 5, 2026

Description

This PR fixes the inability to revert a hotkey swap by disabling is_hotkey_registered_on_any_network for cases where netuid is provided.

More changes:

  • Updated HotkeySwapOnSubnetInterval from 5 days to 1 day.
  • Added hotkey swap revert tests for: Parent keys, Child keys, Pending child keys, Auto stake destination, Subnet ownership, Dividend records, Voting Power, Root Reclaimable.
  • Removed test test_swap_hotkey_registered_on_other_subnet, since it tests the condition that is no longer valid.

Related Issue(s)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Breaking Change

If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run ./scripts/fix_rust.sh to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Please include any relevant screenshots or GIFs that demonstrate the changes made.

Additional Notes

Please provide any additional information or context that may be helpful for reviewers.

!Self::is_hotkey_registered_on_any_network(new_hotkey),
Error::<T>::HotKeyAlreadyRegisteredInSubNet
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to add is_hotkey_registered_on_specific_network check if netuid == Some(netuid).

Copy link
Author

Choose a reason for hiding this comment

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

Added additional check, like you suggested here: 893bfb0

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.

2 participants