From ebe57960f73e45121303d6b8f565096ec2b06f0d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 30 Nov 2021 14:53:40 -0500 Subject: [PATCH] e2e: stabilize validator update form (#7340) (#7351) This might be a source of non-determinism in the e2e test. (cherry picked from commit c4033f95c168094c6af0667465f58a2f5d367407) Co-authored-by: Sam Kleinman --- test/e2e/app/app.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index 395c87024..4d735ea26 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "path/filepath" + "sort" "strconv" "github.com/tendermint/tendermint/abci/example/code" @@ -279,6 +280,14 @@ func (app *Application) validatorUpdates(height uint64) (abci.ValidatorUpdates, } valUpdates = append(valUpdates, abci.UpdateValidator(keyBytes, int64(power), app.cfg.KeyType)) } + + // the validator updates could be returned in arbitrary order, + // and that seems potentially bad. This orders the validator + // set. + sort.Slice(valUpdates, func(i, j int) bool { + return valUpdates[i].PubKey.Compare(valUpdates[j].PubKey) < 0 + }) + return valUpdates, nil }