Skip to content

validator selection based on performance #6

Open
mdzor wants to merge 1 commit into
hypertensor-blockchain:mainfrom
mdzor:validator_selection_logic
Open

validator selection based on performance #6
mdzor wants to merge 1 commit into
hypertensor-blockchain:mainfrom
mdzor:validator_selection_logic

Conversation

@mdzor

@mdzor mdzor commented Jan 3, 2025

Copy link
Copy Markdown

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

@hayotensor

Copy link
Copy Markdown
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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants