-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make snowman use snowflake directly instead of snowball (#3403)
Signed-off-by: Yacov Manevich <[email protected]>
- Loading branch information
Showing
10 changed files
with
78 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
package snowman | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"gonum.org/v1/gonum/mathext/prng" | ||
|
||
"github.com/ava-labs/avalanchego/snow/consensus/snowball" | ||
) | ||
|
||
func TestConvergenceSnowFlakeSnowBall(t *testing.T) { | ||
require := require.New(t) | ||
|
||
params := snowball.Parameters{ | ||
K: 20, | ||
AlphaPreference: 11, | ||
AlphaConfidence: 11, | ||
Beta: 20, | ||
ConcurrentRepolls: 1, | ||
OptimalProcessing: 1, | ||
MaxOutstandingItems: 1, | ||
MaxItemProcessingTime: 1, | ||
} | ||
|
||
for peerCount := 20; peerCount < 2000; peerCount *= 10 { | ||
numNodes := peerCount | ||
|
||
t.Run(fmt.Sprintf("%d nodes", numNodes), func(t *testing.T) { | ||
n := NewNetwork(params, 10, prng.NewMT19937()) | ||
for i := 0; i < numNodes; i++ { | ||
var sbFactory snowball.Factory | ||
if i%2 == 0 { | ||
sbFactory = snowball.SnowflakeFactory | ||
} else { | ||
sbFactory = snowball.SnowballFactory | ||
} | ||
|
||
factory := TopologicalFactory{factory: sbFactory} | ||
sm := factory.New() | ||
require.NoError(n.AddNode(t, sm)) | ||
} | ||
|
||
for !n.Finalized() { | ||
require.NoError(n.Round()) | ||
} | ||
|
||
require.True(n.Agreement()) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters