Skip to content
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

Re-define Majority and Supermajority #2160

Merged
merged 3 commits into from
Aug 20, 2024

Conversation

fed-franz
Copy link
Contributor

@fed-franz fed-franz commented Aug 20, 2024

Fix #2100

  • Eliminate MAJORITY_THRESHOLD and SUPERMAJORITY_THRESHOLD constants
  • Define majority and supermajority functions, which returns floor(x/2)+1 and ceil(x/2*3) respectively

The new definitions eliminate the risk of wrong quorum values for some edge cases.

Remove the definition of the two constants as multipliers and
define majority and supermajority as functions.

This eliminates the risk of computing the supermajority of 2/3
with the `0.67` multiplier, which could yield a wrong result
of 2/3+1.
@fed-franz fed-franz linked an issue Aug 20, 2024 that may be closed by this pull request
@fed-franz fed-franz marked this pull request as ready for review August 20, 2024 11:53
@fed-franz fed-franz added module:rusk Issues related to rusk module module:consensus Issues related to consensus module labels Aug 20, 2024
Copy link
Member

@herr-seppia herr-seppia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fed-franz fed-franz merged commit b4aa394 into master Aug 20, 2024
8 checks passed
@fed-franz fed-franz deleted the 2100-unify-majority-and-supermajority branch August 20, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:consensus Issues related to consensus module module:rusk Issues related to rusk module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Different calculation logic for majority and supermajority
2 participants