From 32f03f95326110707452062ce8a975ba699cfdbc Mon Sep 17 00:00:00 2001 From: Yacov Manevich Date: Thu, 1 Aug 2024 16:38:35 +0200 Subject: [PATCH] Fix comparison comment in snowflake algorithms In the snowflake algorithms, there is the following comment: // terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence // terminationConditions[i].beta <= terminationConditions[i+1].beta However, the two lines contradict, as if alpha confidence grows with i, then beta should decrease and not increase. The reason is that the higher our confidence, the less consecutive polls we need to finalize. Signed-off-by: Yacov Manevich --- snow/consensus/snowball/binary_snowflake.go | 2 +- snow/consensus/snowball/nnary_snowflake.go | 2 +- snow/consensus/snowball/unary_snowflake.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/snow/consensus/snowball/binary_snowflake.go b/snow/consensus/snowball/binary_snowflake.go index 6dc856a7bc7c..fe0ea132d311 100644 --- a/snow/consensus/snowball/binary_snowflake.go +++ b/snow/consensus/snowball/binary_snowflake.go @@ -20,7 +20,7 @@ func newBinarySnowflake(alphaPreference int, terminationConditions []termination // Invariant: // len(terminationConditions) == len(confidence) // terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence -// terminationConditions[i].beta <= terminationConditions[i+1].beta +// terminationConditions[i].beta >= terminationConditions[i+1].beta // confidence[i] >= confidence[i+1] (except after finalizing due to early termination) type binarySnowflake struct { // wrap the binary slush logic diff --git a/snow/consensus/snowball/nnary_snowflake.go b/snow/consensus/snowball/nnary_snowflake.go index 3fe9f517c0e7..604e6ad4b2e9 100644 --- a/snow/consensus/snowball/nnary_snowflake.go +++ b/snow/consensus/snowball/nnary_snowflake.go @@ -25,7 +25,7 @@ func newNnarySnowflake(alphaPreference int, terminationConditions []terminationC // Invariant: // len(terminationConditions) == len(confidence) // terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence -// terminationConditions[i].beta <= terminationConditions[i+1].beta +// terminationConditions[i].beta >= terminationConditions[i+1].beta // confidence[i] >= confidence[i+1] (except after finalizing due to early termination) type nnarySnowflake struct { // wrap the n-nary slush logic diff --git a/snow/consensus/snowball/unary_snowflake.go b/snow/consensus/snowball/unary_snowflake.go index adfbedef4d63..4a204a49d937 100644 --- a/snow/consensus/snowball/unary_snowflake.go +++ b/snow/consensus/snowball/unary_snowflake.go @@ -22,7 +22,7 @@ func newUnarySnowflake(alphaPreference int, terminationConditions []terminationC // Invariant: // len(terminationConditions) == len(confidence) // terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence -// terminationConditions[i].beta <= terminationConditions[i+1].beta +// terminationConditions[i].beta >= terminationConditions[i+1].beta // confidence[i] >= confidence[i+1] (except after finalizing due to early termination) type unarySnowflake struct { // alphaPreference is the threshold required to update the preference