snarkOS
snarkOS copied to clipboard
Updates conditions to advance from odd and even rounds
Motivation
This PR updates the conditions to advance from odd and even rounds by adding a quorum check. Previously, in odd rounds the code would return ‘true’ if the previous even round leader was unseen [1]. In some scenarios, this would cause nodes to pre-maturely increment rounds before seeing ‘2f+1’ certificates, the quorum threshold to increment rounds in Bullshark. For example, if the leader in even round ‘r’ was unseen, in odd round ‘r+1’ a malicious node could send a batch header with a round number beyond the GC limit. When nodes try to sync with the batch header [2], they will increment their BFT to the next round since the previous leader was unseen.
[1] https://github.com/AleoHQ/snarkOS/blob/mainnet/node/bft/src/bft.rs#L370 [2] https://github.com/AleoHQ/snarkOS/blob/mainnet/node/bft/src/primary.rs#L1249
@mdelle1 can you address this PR's issues?
Note: This PR was tested on a network with a malicious validator that was spoofing rounds and did not run into block production issues.
I ran this PR (c9e9d01) with 5 nodes on my laptop and every node periodically gets an error, after this PR it should be a debug statement because we won't be ready until we see quorum.
2024-03-12T10:52:50.035313Z ERROR BFT - A leader certificate was found, but 'is_ready' is false is_ready=false
I ran mainnet-latest (3b4737598) and it indeed didn't have the same issue.