@@ -60,6 +60,10 @@ func SimulateMsgSend(ak types.AccountKeeper, bk keeper.Keeper) simtypes.Operatio
6060 accs []simtypes.Account , chainID string ,
6161 ) (simtypes.OperationMsg , []simtypes.FutureOperation , error ) {
6262 from , to , coins , skip := randomSendFields (r , ctx , accs , bk , ak )
63+ // if coins slice is empty, we can not create valid types.MsgSend
64+ if len (coins ) == 0 {
65+ return simtypes .NoOpMsg (types .ModuleName , types .TypeMsgSend , "empty coins slice" ), nil , nil
66+ }
6367
6468 // Check send_enabled status of each coin denom
6569 if err := bk .IsSendEnabledCoins (ctx , coins ... ); err != nil {
@@ -94,6 +98,10 @@ func SimulateMsgSendToModuleAccount(ak types.AccountKeeper, bk keeper.Keeper, mo
9498
9599 spendable := bk .SpendableCoins (ctx , from .Address )
96100 coins := simtypes .RandSubsetCoins (r , spendable )
101+ // if coins slice is empty, we can not create valid types.MsgSend
102+ if len (coins ) == 0 {
103+ return simtypes .NoOpMsg (types .ModuleName , types .TypeMsgSend , "empty coins slice" ), nil , nil
104+ }
97105
98106 // Check send_enabled status of each coin denom
99107 if err := bk .IsSendEnabledCoins (ctx , coins ... ); err != nil {
@@ -139,6 +147,7 @@ func sendMsgSend(
139147 }
140148 txGen := simappparams .MakeTestEncodingConfig ().TxConfig
141149 tx , err := helpers .GenTx (
150+ r ,
142151 txGen ,
143152 []sdk.Msg {msg },
144153 fees ,
@@ -361,6 +370,7 @@ func sendMsgMultiSend(
361370
362371 txGen := simappparams .MakeTestEncodingConfig ().TxConfig
363372 tx , err := helpers .GenTx (
373+ r ,
364374 txGen ,
365375 []sdk.Msg {msg },
366376 fees ,
0 commit comments