From bdb533045d09bf44251653d0c0f8ca5dce349e14 Mon Sep 17 00:00:00 2001 From: Tarak Ben Youssef Date: Tue, 16 May 2023 19:06:04 -0600 Subject: [PATCH] use utils/rand to shuffle identity list --- cmd/bootstrap/cmd/clusters.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bootstrap/cmd/clusters.go b/cmd/bootstrap/cmd/clusters.go index 30ad8eabf43..75b37efb549 100644 --- a/cmd/bootstrap/cmd/clusters.go +++ b/cmd/bootstrap/cmd/clusters.go @@ -8,6 +8,7 @@ import ( "github.com/onflow/flow-go/model/flow/assignment" "github.com/onflow/flow-go/model/flow/factory" "github.com/onflow/flow-go/model/flow/filter" + "github.com/onflow/flow-go/utils/rand" ) // Construct cluster assignment with internal and partner nodes uniformly @@ -28,11 +29,11 @@ func constructClusterAssignment(partnerNodes, internalNodes []model.NodeInfo) (f // shuffle both collector lists based on a non-deterministic algorithm var err error - partners, err = partners.Shuffle() + err = rand.Shuffle(uint(len(partners)), func(i, j uint) { partners[i], partners[j] = partners[j], partners[i] }) if err != nil { log.Fatal().Err(err).Msg("could not shuffle partners") } - internals, err = internals.Shuffle() + err = rand.Shuffle(uint(len(internals)), func(i, j uint) { internals[i], internals[j] = internals[j], internals[i] }) if err != nil { log.Fatal().Err(err).Msg("could not shuffle internals") }