-
Notifications
You must be signed in to change notification settings - Fork 208
RPC to get validators #1614
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
base: devnet-ready
Are you sure you want to change the base?
RPC to get validators #1614
Conversation
@@ -1356,13 +1369,52 @@ impl<T: Config> Pallet<T> { | |||
..Default::default() | |||
} | |||
} | |||
None => SelectiveMetagraph { | |||
_ => SelectiveMetagraph { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is correct. get validators is a separate branch. that's the validator_only parameter means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the validators index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this impl can be like this:
- we add
SelectedMetagraphIndex::Validators
. Then it gonna handled the same way as otherSelectedMetagraphIndex
indices. - we add
validators
field intoMetagraph
struct.
Result:
get_metagraph_info
always has filedMetagraph::validators
fieldSelectiveMetagraph
returns object with filedvalidators
as Vec with related HK indexes ifSelectedMetagraphIndex::Validators
passed in params as item infield_indices
- SDK
MetagraphInfo
class 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, we can handle the validators the same as other items in metagraph. user can get any data according to passed index list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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.