Skip to content

Commit

Permalink
Fix comparison comment in comment in snowflake algorithms
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
yacovm committed Aug 1, 2024
1 parent d2de35d commit 386dd30
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion snow/consensus/snowball/binary_snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion snow/consensus/snowball/nnary_snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion snow/consensus/snowball/unary_snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 386dd30

Please # to comment.