From 23ee2f8dcec2fa26c6036879c91d4301d2c13f26 Mon Sep 17 00:00:00 2001 From: denalimarsh Date: Fri, 5 Jun 2020 10:03:56 -0700 Subject: [PATCH 1/2] fix bep3 sims --- contrib/current/wip_genesis.json | 12 +++++++++++- x/bep3/simulation/operations.go | 8 +++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/contrib/current/wip_genesis.json b/contrib/current/wip_genesis.json index 669d6f2a60..02fda52c5d 100644 --- a/contrib/current/wip_genesis.json +++ b/contrib/current/wip_genesis.json @@ -368,7 +368,17 @@ "kava1znuktqgtjr8g85tetu2wt9wd33gstqr7pad92h" ], "quote_asset": "usd" - } + }, + { + "active": true, + "base_asset": "bnb", + "market_id": "bnb:usd:30", + "oracles": [ + "kava1nyqy04x3ecpcuss3llmyu4fc2v4ma99h8vffjz", + "kava1znuktqgtjr8g85tetu2wt9wd33gstqr7pad92h" + ], + "quote_asset": "usd" + } ] }, "posted_prices": [ diff --git a/x/bep3/simulation/operations.go b/x/bep3/simulation/operations.go index a907d8a712..62f4d2e929 100644 --- a/x/bep3/simulation/operations.go +++ b/x/bep3/simulation/operations.go @@ -17,6 +17,7 @@ import ( var ( 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 @@ -24,6 +25,7 @@ const ( OpWeightMsgCreateAtomicSwap = "op_weight_msg_create_atomic_swap" ) + // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( appParams simulation.AppParams, cdc *codec.Codec, ak types.AccountKeeper, k keeper.Keeper, @@ -98,11 +100,7 @@ func SimulateMsgCreateAtomicSwap(ak types.AccountKeeper, k keeper.Keeper) simula recipientOtherChain := simulation.RandStringOfLength(r, 43) senderOtherChain := simulation.RandStringOfLength(r, 43) - // Generate cryptographically strong pseudo-random number - randomNumber, err := types.GenerateSecureRandomNumber() - if err != nil { - return noOpMsg, nil, err - } + // Use same random number for determinism timestamp := ctx.BlockTime().Unix() randomNumberHash := types.CalculateRandomHash(randomNumber, timestamp) From 8e2025b5f36c1cf0e0a851bdb12fcce7975175ea Mon Sep 17 00:00:00 2001 From: denalimarsh Date: Fri, 5 Jun 2020 10:05:45 -0700 Subject: [PATCH 2/2] remove newline --- x/bep3/simulation/operations.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/bep3/simulation/operations.go b/x/bep3/simulation/operations.go index 62f4d2e929..9df0d445d4 100644 --- a/x/bep3/simulation/operations.go +++ b/x/bep3/simulation/operations.go @@ -25,7 +25,6 @@ const ( OpWeightMsgCreateAtomicSwap = "op_weight_msg_create_atomic_swap" ) - // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( appParams simulation.AppParams, cdc *codec.Codec, ak types.AccountKeeper, k keeper.Keeper,