subtensor
subtensor copied to clipboard
Get validators efficiently
I propose that we add a convenience function to return subnet validators, so that all miners of all service-based subnets can efficiently get the information they need about the validators in one go, without getting data for the other miners (nearly a thousand on sn1) unnecessarily.
I suggest to add it as a feature of the selective metagraph fetcher, which already is quite nice, flexible and efficient.
The new boolean flag only_validators would:
- check how many validators a subnet can have (it's a hyperparameter currently set to 64 on all subnets, but that might change in the future)
- check how much effective stake is required for a validator to be able to set weights (currently it's 1k alpha on mainnet, 10 alpha on testnet, but this can change)
- get a list of uids which meet the minimum stake requirement and have vpermit set to
true - sort it by stake
- leave only as many as the hyperparameter specifies that this subnet supports
- return the sorted result
Bittensor can survive without this, but clients will need to do this work on their side and either they won't do it properly and we'll have bugs or they will do it well and we'll have extra load on subtensors that can be avoided.