Fix bep3 sims determinism (#555)

* fix bep3 sims

* remove newline
This commit is contained in:
Denali Marsh 2020-06-05 11:24:08 -07:00 committed by GitHub
parent bc804040b3
commit 978efbcc49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -368,6 +368,16 @@
"kava1znuktqgtjr8g85tetu2wt9wd33gstqr7pad92h" "kava1znuktqgtjr8g85tetu2wt9wd33gstqr7pad92h"
], ],
"quote_asset": "usd" "quote_asset": "usd"
},
{
"active": true,
"base_asset": "bnb",
"market_id": "bnb:usd:30",
"oracles": [
"kava1nyqy04x3ecpcuss3llmyu4fc2v4ma99h8vffjz",
"kava1znuktqgtjr8g85tetu2wt9wd33gstqr7pad92h"
],
"quote_asset": "usd"
} }
] ]
}, },

View File

@ -17,6 +17,7 @@ import (
var ( var (
noOpMsg = simulation.NoOpMsg(types.ModuleName) noOpMsg = simulation.NoOpMsg(types.ModuleName)
randomNumber = []byte{114, 21, 74, 180, 81, 92, 21, 91, 173, 164, 143, 111, 120, 58, 241, 58, 40, 22, 59, 133, 102, 233, 55, 149, 12, 199, 231, 63, 122, 23, 88, 9}
) )
// Simulation operation weights constants // Simulation operation weights constants
@ -98,11 +99,7 @@ func SimulateMsgCreateAtomicSwap(ak types.AccountKeeper, k keeper.Keeper) simula
recipientOtherChain := simulation.RandStringOfLength(r, 43) recipientOtherChain := simulation.RandStringOfLength(r, 43)
senderOtherChain := simulation.RandStringOfLength(r, 43) senderOtherChain := simulation.RandStringOfLength(r, 43)
// Generate cryptographically strong pseudo-random number // Use same random number for determinism
randomNumber, err := types.GenerateSecureRandomNumber()
if err != nil {
return noOpMsg, nil, err
}
timestamp := ctx.BlockTime().Unix() timestamp := ctx.BlockTime().Unix()
randomNumberHash := types.CalculateRandomHash(randomNumber, timestamp) randomNumberHash := types.CalculateRandomHash(randomNumber, timestamp)