-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Bug] imprecision in test function is_round_reached() #3377
Comments
I've submitted a pull request to address this issue: Fix: Correct quorum threshold calculation in is_round_reached() #3384 This PR updates the quorum threshold calculation to ensure proper Byzantine fault tolerance. The new implementation correctly calculates the quorum as The PR includes:
Thanks |
It is a bug in a test function that may cause false positives or negatives from the tests that use it. |
Thank you for the feedback. I appreciate the context about the bug's impact and the existence of more comprehensive test suites. As I'm getting familiar with the codebase, I wanted to focus on addressing some smaller issues first. Will try to do more high impact PR's soon. |
Just commenting to confirm the impact is minor here—we run these cases with |
🐛 Bug Report
This bug does not affect mainnet. It is a bug in a test function
that may cause false positives or negatives from the tests that use it.
However, there are other more complete test suites that
are being run and passed, so this bug is minor.
The bug is in this function:
There are 12 tests that use this test function permalink here, but this function is not doing what it claims.
I presume validators here are equal (not stake-weighted).
If there are N validators,
f
should be(N - 1)/3
(where/
means integer division rounding down),and quorum threshold should. be
N - f
(not2f + 1
as mentioned in the comment),which can be computed from N as
2N/3 + 1
(same meaning of/
, integer division).For example:
For 4 validators, this function will return 3, which is correct.
For 5 validators, this function will return 3, which is incorrect.
When there are 5 validators, the quorum threshold should be 4.
See also the definition of
quorum_threshold()
in snarkVMledger/committee/src/lib.rs
permalink
(note the comment at the permalink still has
2f + 1
, but that should be fixed with this PR.The code does the correct calculation.
The text was updated successfully, but these errors were encountered: