From ff81f8a28920e499b3511f96d14b7c6cb73f92fb Mon Sep 17 00:00:00 2001 From: Adu Date: Thu, 30 Jun 2022 23:12:25 +0800 Subject: [PATCH] fix: Simulation is not deterministic due to GenSignedMockTx (#12374) --- test_helpers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test_helpers.go b/test_helpers.go index 4cdc47f3abad..84ab354dd1a7 100644 --- a/test_helpers.go +++ b/test_helpers.go @@ -3,7 +3,9 @@ package simapp import ( "context" "encoding/json" + "math/rand" "testing" + "time" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" @@ -257,6 +259,7 @@ func SignCheckDeliver( chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { tx, err := simtestutil.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)}, @@ -307,6 +310,7 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i var err error for i := 0; i < numToGenerate; i++ { txs[i], err = simtestutil.GenSignedMockTx( + rand.New(rand.NewSource(time.Now().UnixNano())), txGen, msgs, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 0)},