Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/ec_divergence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestEcDivergence_AbsoluteDivergenceConvergesOnBase(t *testing.T) {
t.Parallel()
const (
instanceCount = 14
divergeAtInstance = 9
Expand All @@ -30,6 +31,7 @@ func TestEcDivergence_AbsoluteDivergenceConvergesOnBase(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
seedFuzzer := uint64(985623)

// uniformECChainGenerator generates different EC chain per instance but the same
Expand Down Expand Up @@ -98,6 +100,7 @@ func TestEcDivergence_AbsoluteDivergenceConvergesOnBase(t *testing.T) {
}

func TestEcDivergence_PartitionedNetworkConvergesOnChainWithMostPower(t *testing.T) {
t.Parallel()
const (
instanceCount = 23
partitionAtInstance = 13
Expand All @@ -118,6 +121,7 @@ func TestEcDivergence_PartitionedNetworkConvergesOnChainWithMostPower(t *testing
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
seedFuzzer := uint64(784523)

chainGeneratorBeforePartition := sim.NewUniformECChainGenerator(17*seedFuzzer, 5, 10)
Expand Down
16 changes: 13 additions & 3 deletions test/honest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestHonest_Agreement(t *testing.T) {
tests := []struct {
name string
options []sim.Option
useBLS bool
participantCounts []int
wantConsensusOnAnyOf []gpbft.TipSet
}{
Expand All @@ -45,7 +46,8 @@ func TestHonest_Agreement(t *testing.T) {
},
{
name: "sync bls",
options: syncOptions(sim.WithSigningBackend(signing.NewBLSBackend())),
options: syncOptions(),
useBLS: true,
participantCounts: blsParticipantCount,
wantConsensusOnAnyOf: []gpbft.TipSet{*targetChain.Head()},
},
Expand All @@ -57,7 +59,8 @@ func TestHonest_Agreement(t *testing.T) {
},
{
name: "async pair bls",
options: asyncOptions(1413, sim.WithSigningBackend(signing.NewBLSBackend())),
options: asyncOptions(1413),
useBLS: true,
wantConsensusOnAnyOf: []gpbft.TipSet{*baseChain.Head(), *targetChain.Head()},
},
}
Expand All @@ -67,9 +70,14 @@ func TestHonest_Agreement(t *testing.T) {
participantCount := participantCount
name := fmt.Sprintf("%s %d", test.name, participantCount)
t.Run(name, func(t *testing.T) {
t.Parallel()
test.options = append(test.options,
sim.WithBaseChain(&baseChain),
sim.AddHonestParticipants(participantCount, sim.NewFixedECChainGenerator(targetChain), uniformOneStoragePower))
if test.useBLS {
// Initialise a new BLS backend for each test since it's not concurrent-safe.
test.options = append(test.options, sim.WithSigningBackend(signing.NewBLSBackend()))
}
sm, err := sim.NewSimulation(test.options...)
require.NoError(t, err)
require.NoErrorf(t, sm.Run(1, maxRounds), "%s", sm.Describe())
Expand Down Expand Up @@ -133,7 +141,7 @@ func TestHonest_Disagreement(t *testing.T) {
participantCount := participantCount
name := fmt.Sprintf("%s %d", test.name, participantCount)
t.Run(name, func(t *testing.T) {

t.Parallel()
test.options = append(test.options,
sim.WithBaseChain(&baseChain),
sim.AddHonestParticipants(participantCount/2, sim.NewFixedECChainGenerator(oneChain), uniformOneStoragePower),
Expand Down Expand Up @@ -206,6 +214,7 @@ func FuzzHonest_SyncMajorityCommonPrefix(f *testing.F) {
f.Add(-955846)
f.Add(28)
f.Fuzz(func(t *testing.T, seed int) {
t.Parallel()
rng := rand.New(rand.NewSource(int64(seed)))
majorityCommonPrefixGenerator := sim.NewUniformECChainGenerator(rng.Uint64(), 10, 20)
sm, err := sim.NewSimulation(append(syncOptions(),
Expand Down Expand Up @@ -247,6 +256,7 @@ func FuzzHonest_AsyncMajorityCommonPrefix(f *testing.F) {
f.Add(-7)
f.Add(5)
f.Fuzz(func(t *testing.T, seed int) {
t.Parallel()
rng := rand.New(rand.NewSource(int64(seed)))
majorityCommonPrefixGenerator := sim.NewUniformECChainGenerator(rng.Uint64(), 10, 20)
sm, err := sim.NewSimulation(append(asyncOptions(rng.Int()),
Expand Down
6 changes: 5 additions & 1 deletion test/multi_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (

// TestHonestMultiInstance_Agreement tests for multiple chained instances of the protocol with no adversaries.
func TestHonestMultiInstance_Agreement(t *testing.T) {
t.Parallel()
// TODO: t.Parallel() here after https://github.com/filecoin-project/builtin-actors/issues/1541
//t.Parallel()
const (
instanceCount = 4000
testRNGSeed = 8965130
Expand Down Expand Up @@ -62,6 +63,7 @@ func FuzzHonestMultiInstance_AsyncDisagreement(f *testing.F) {
)
f.Add(981)
f.Fuzz(func(t *testing.T, seed int) {
t.Parallel()
tsg := sim.NewTipSetGenerator(tipSetGeneratorSeed)
baseChain := generateECChain(t, tsg)
sm, err := sim.NewSimulation(asyncOptions(seed,
Expand Down Expand Up @@ -99,6 +101,8 @@ func FuzzHonestMultiInstance_AsyncAgreement(f *testing.F) {
}

func multiAgreementTest(t *testing.T, seed int, honestCount int, instanceCount uint64, maxRounds uint64, opts ...sim.Option) {
// TODO: t.Parallel() here after https://github.com/filecoin-project/builtin-actors/issues/1541
//t.Parallel()
rng := rand.New(rand.NewSource(int64(seed)))
sm, err := sim.NewSimulation(append(opts,
sim.AddHonestParticipants(
Expand Down
2 changes: 2 additions & 0 deletions test/power_evolution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func FuzzStoragePower_AsyncIncreaseMidSimulation(f *testing.F) {
}

func storagePowerIncreaseMidSimulationTest(t *testing.T, seed int, instanceCount uint64, maxRounds uint64, o ...sim.Option) {
t.Parallel()
const (
groupOneStoragePower = 5
groupTwoStoragePowerBeforeIncrease = 2
Expand Down Expand Up @@ -119,6 +120,7 @@ func FuzzStoragePower_AsyncDecreaseRevertsToBase(f *testing.F) {
}

func storagePowerDecreaseRevertsToBaseTest(t *testing.T, seed int, instanceCount uint64, maxRounds uint64, o ...sim.Option) {
t.Parallel()
rng := rand.New(rand.NewSource(int64(seed)))
tsg := sim.NewTipSetGenerator(tipSetGeneratorSeed)
baseChain := generateECChain(t, tsg)
Expand Down