validator selection based on performance #6
Open
mdzor wants to merge 1 commit into
Open
Conversation
…validator to be elected.
Collaborator
|
This won't build, some errors. Before recommitting, make sure it builds, tests, and build and run benchmarks on it to know how much block weight the logic holds to see how far it can scale with the other functions that it would be called with in that same block (see on_initialize). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
previous validator selection was random
pub fn choose_validator(block: u64, subnet_id: u32, account_ids: Vec<T::AccountId>) {
// Just random selection based on block number
let rand_index = Self::get_random_number(subnet_nodes_len_for_overflow as u32, block as u32);
let validator: &T::AccountId = &account_ids[rand_index as usize];
}
proposal here is to use validator metrics.
goal is to avoid a previously slashed validator to be elected.
newest code already prevents that by making previous validator not able to be elected twice, but this PR adds validator stats that we can also use for rewards.
open for discussion, lmk