Conversation
| } | ||
| } | ||
| None => SelectiveMetagraph { | ||
| _ => SelectiveMetagraph { |
There was a problem hiding this comment.
This means if the SelectiveMetagraphIndex is Validators, we'd still be going to this match arm. Is this correct?
There was a problem hiding this comment.
Yes, it is correct. get validators is a separate branch. that's the validator_only parameter means.
There was a problem hiding this comment.
But is there a case where the validators_only parameter is false, and yet the SelectedMetagraphIndex is Validators?
There was a problem hiding this comment.
if validators_only is false, we don't return validators in the result. The index is wield, let me check how to change it. thanks
There was a problem hiding this comment.
removed the validators index.
There was a problem hiding this comment.
should we not use the index of ValidatorsOnly to do this and not add a boolean to the api?
e.g. remove the only_validators param. Then, if ValidatorsOnly is present just keys that are validators.
This requires we add a uids field to the struct also
There was a problem hiding this comment.
I'd say this impl can be like this:
- we add
SelectedMetagraphIndex::Validators. Then it gonna handled the same way as otherSelectedMetagraphIndexindices. - we add
validatorsfield intoMetagraphstruct.
Result:
get_metagraph_infoalways has filedMetagraph::validatorsfieldSelectiveMetagraphreturns object with filedvalidatorsas Vec with related HK indexes ifSelectedMetagraphIndex::Validatorspassed in params as item infield_indices- SDK
MetagraphInfoclass will get a new fieldvalidators
This is gonnabe clearest way for this and SDK implementation as far as I see.
Pleas feel free to correct me if I'm wrong.
There was a problem hiding this comment.
Agreed, we can handle the validators the same as other items in metagraph. user can get any data according to passed index list.
basfroman
left a comment
There was a problem hiding this comment.
LGTM for SDK
Tested with PR opentensor/bittensor#2887 locally
Description
Related Issue(s)
Type of Change
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
cargo fmtandcargo clippyto 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.