helium / blockchain-core

Apache License 2.0
214 stars 86 forks source link

change consensus deselection weighting #1468

Closed PaulVMo closed 2 years ago

PaulVMo commented 2 years ago

This change lays the foundation for additional tunability in the election process, specifically with the goal of removing low performers more quickly from the group. This flexibility is achieved through two changes:

  1. New chain var election_penalty_history_percentage which is used during scoring of existing group members before selecting members for removal. This value controls whether and how much the previous penalties contribute to the score: ([election_penalty_history_percentage] * [total existing penalty]) + [current epoch performance penalty] + [current epoch tenure penalty]
  2. Changes the tenure penalty from being applied at the beginning of the round to the end of the round. This makes it so that the tenure penalty for the current group is not part of the previous penalties. This is necessary because if the election_penalty_history_percentage is zero, we still want to count the current round's tenure penalty in the score for deselecting.

These changes are guarded behind election_version = 7. No changes are made in the logic for selection new validators into CG. It continues to be weighted random based on the total penalty score at time of the election.

To achieve the goal of more quickly removing low performers, I suggest that election_penalty_history_percentage = 0. This causes the deselection to be based entirely on performance in the existing group which in my opinion is the most important consideration for a well functioning CG. In the long-run, this will still provide equal rewards for equal performance. If all validators have perform perfectly during an epoch, the odds of being removed are equal. That said, governance processes should be used to select the value of this new var and are outside the scope of this PR.