This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 536
Conversation
This file contains 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
dbrajovic
requested review from
zivkovicmilos,
lazartravica and
Kourin1996
as code owners
April 21, 2022 12:07
@dbrajovic Can you write down the reason so that we can look back in the future? |
Kourin1996
reviewed
Apr 22, 2022
zivkovicmilos
approved these changes
Apr 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 💯
I've went through the code and the spec, along with Saltini's paper, the logic seems to be sound.
I don't like that the formula differs for N < 4
, but 🤷♂️ .
Kourin1996
approved these changes
Apr 27, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
0xAleksaOpacic
approved these changes
Apr 27, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR replaces the old calculation of finding the minimum number of validators reaching quorum.
N
- number of validators in networkF = floor((N-1) / 3)
- number of (allowed) faulty nodes in a given networkPreviously :
quorum = 2 * F + 1
Now:
quorum = ceil(2/3 * N)
Changes include
Checklist
Testing
Manual tests
Please complete this section if you ran manual tests for this functionality, otherwise delete it
Additional comments
Fixes EDGE-514
The formula (previously used) for calculating the Quorum size, which is
2F + 1
did not scale well with the number of validators in a given network. Note the following differences:2F + 1
:N = 1
,F = 0
->Q = 1
N = 2
,F = 0
->Q = 1
N = 3
,F = 0
->Q = 1
N = 4
,F = 1
->Q = 3
N = 5
,F = 1
->Q = 3
N = 6
,F = 1
->Q = 3
N = 7
,F = 2
->Q = 5
N = 8
,F = 2
->Q = 5
N = 9
,F = 2
->Q = 5
ceil(2/3 * N)
:from table (for
N=3
the formula does not apply, so a special if statement was used)N = 1
,F = 0
->Q = 1
N = 2
,F = 0
->Q = 2
N = 3
,F = 0
->Q = 3
N = 4
,F = 1
->Q = 3
N = 5
,F = 1
->Q = 4
N = 6
,F = 1
->Q = 4
N = 7
,F = 2
->Q = 5
N = 8
,F = 2
->Q = 6
N = 9
,F = 2
->Q = 6