fix: Simulation is not deterministic due to GenSignedMockTx (#12374)

This commit is contained in:
Adu
2022-06-30 11:12:25 -04:00
committed by GitHub
parent 1642dcde66
commit 17dc431666
13 changed files with 51 additions and 4 deletions
+1 -4
View File
@@ -2,7 +2,6 @@ package sims
import (
"math/rand"
"time"
"github.com/cosmos/cosmos-sdk/client"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
@@ -13,12 +12,10 @@ import (
)
// GenSignedMockTx generates a signed mock transaction.
func GenSignedMockTx(txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) {
func GenSignedMockTx(r *rand.Rand, txConfig client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error) {
sigs := make([]signing.SignatureV2, len(priv))
// create a random length memo
r := rand.New(rand.NewSource(time.Now().UnixNano()))
memo := simulation.RandStringOfLength(r, simulation.RandIntBetween(r, 0, 100))
signMode := txConfig.SignModeHandler().DefaultMode()