From c4033f95c168094c6af0667465f58a2f5d367407 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Tue, 30 Nov 2021 14:35:21 -0500 Subject: [PATCH] e2e: stabilize validator update form (#7340) This might be a source of non-determinism in the e2e test. --- 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 570df6676..353bb6b75 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" @@ -282,6 +283,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 }