Skip to content

Commit 32f03f9

Browse files
committed
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 <yacov.manevich@avalabs.org>
1 parent d2de35d commit 32f03f9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

snow/consensus/snowball/binary_snowflake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func newBinarySnowflake(alphaPreference int, terminationConditions []termination
2020
// Invariant:
2121
// len(terminationConditions) == len(confidence)
2222
// terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence
23-
// terminationConditions[i].beta <= terminationConditions[i+1].beta
23+
// terminationConditions[i].beta >= terminationConditions[i+1].beta
2424
// confidence[i] >= confidence[i+1] (except after finalizing due to early termination)
2525
type binarySnowflake struct {
2626
// wrap the binary slush logic

snow/consensus/snowball/nnary_snowflake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func newNnarySnowflake(alphaPreference int, terminationConditions []terminationC
2525
// Invariant:
2626
// len(terminationConditions) == len(confidence)
2727
// terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence
28-
// terminationConditions[i].beta <= terminationConditions[i+1].beta
28+
// terminationConditions[i].beta >= terminationConditions[i+1].beta
2929
// confidence[i] >= confidence[i+1] (except after finalizing due to early termination)
3030
type nnarySnowflake struct {
3131
// wrap the n-nary slush logic

snow/consensus/snowball/unary_snowflake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func newUnarySnowflake(alphaPreference int, terminationConditions []terminationC
2222
// Invariant:
2323
// len(terminationConditions) == len(confidence)
2424
// terminationConditions[i].alphaConfidence < terminationConditions[i+1].alphaConfidence
25-
// terminationConditions[i].beta <= terminationConditions[i+1].beta
25+
// terminationConditions[i].beta >= terminationConditions[i+1].beta
2626
// confidence[i] >= confidence[i+1] (except after finalizing due to early termination)
2727
type unarySnowflake struct {
2828
// alphaPreference is the threshold required to update the preference

0 commit comments

Comments
 (0)