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.
Description
This PR makes delegate info useful for dTAO. It pulls all the nominators and their stake across all subnets.
Type of Change
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 thedelegate_info
for each element of the returned listVec<(DelegateInfo, (u16, u64))>
has the fieldnominators
set to an emptyvec
. 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 thedelegate_info
and a tuple of(netuid, alpha_stake)
.For
get_delegate
andget_delegates
, the return types are the same.However, in the
DelegateInfo
type, the fieldnominators
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
cargo fmt
andcargo clippy
to ensure my code is formatted and linted correctlyScreenshots (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.