Skip to content

Conversation

camfairchild
Copy link
Contributor

Description

This PR makes delegate info useful for dTAO. It pulls all the nominators and their stake across all subnets.

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

This is a breaking change as it changes the content meaning and return type of the delegate info calls.
However, the previous contents are not very useful.

get_delegated is changed as the delegate_info for each element of the returned list Vec<(DelegateInfo, (u16, u64))> has the field nominators set to an empty vec. This speeds up the query as we're grabbing the delegates that one coldkey is staked to, so there's no need to grab all the other nominators. The stake for this coldkey is already included in the list. Also note that the return type itself has changed to be a tuple of the both the delegate_info and a tuple of (netuid, alpha_stake).

For get_delegate and get_delegates, the return types are the same.

However, in the DelegateInfo type, the field nominators is a different type that now includes the netuid for each nominator. Vec<(AccountId, Vec<(Compact<u16>, Compact<u64>)>)>, or a list of nominator-tuples with their address and a list of netuids they are staked-to under this hotkey and the amount in alpha.

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 cargo fmt and cargo clippy 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.

@camfairchild camfairchild added the breaking-change This PR introduces a noteworthy breaking change label Feb 19, 2025
Copy link
Contributor

@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!

@sam0x17 sam0x17 merged commit d474fe1 into devnet-ready Feb 19, 2025
17 checks passed
@distributedstatemachine
Copy link
Collaborator

Tests ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This PR introduces a noteworthy breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants