refactor: remove .Type() and .Route() from msgs (#14751)
This commit is contained in:
@@ -17,18 +17,18 @@ func NewEventStats() EventStats {
|
||||
}
|
||||
|
||||
// Tally increases the count of a simulation event.
|
||||
func (es EventStats) Tally(route, op, evResult string) {
|
||||
_, ok := es[route]
|
||||
func (es EventStats) Tally(moduleName, op, evResult string) {
|
||||
_, ok := es[moduleName]
|
||||
if !ok {
|
||||
es[route] = make(map[string]map[string]int)
|
||||
es[moduleName] = make(map[string]map[string]int)
|
||||
}
|
||||
|
||||
_, ok = es[route][op]
|
||||
_, ok = es[moduleName][op]
|
||||
if !ok {
|
||||
es[route][op] = make(map[string]int)
|
||||
es[moduleName][op] = make(map[string]int)
|
||||
}
|
||||
|
||||
es[route][op][evResult]++
|
||||
es[moduleName][op][evResult]++
|
||||
}
|
||||
|
||||
// Print the event stats in JSON format.
|
||||
|
||||
@@ -68,7 +68,6 @@ type OperationInput struct {
|
||||
TxGen client.TxConfig
|
||||
Cdc *codec.ProtoCodec
|
||||
Msg sdk.Msg
|
||||
MsgType string
|
||||
CoinsSpentInMsg sdk.Coins
|
||||
Context sdk.Context
|
||||
SimAccount simtypes.Account
|
||||
@@ -87,12 +86,12 @@ func GenAndDeliverTxWithRandFees(txCtx OperationInput) (simtypes.OperationMsg, [
|
||||
|
||||
coins, hasNeg := spendable.SafeSub(txCtx.CoinsSpentInMsg...)
|
||||
if hasNeg {
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "message doesn't leave room for fees"), nil, err
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, sdk.MsgTypeURL(txCtx.Msg), "message doesn't leave room for fees"), nil, err
|
||||
}
|
||||
|
||||
fees, err = simtypes.RandomFees(txCtx.R, txCtx.Context, coins)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate fees"), nil, err
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, sdk.MsgTypeURL(txCtx.Msg), "unable to generate fees"), nil, err
|
||||
}
|
||||
return GenAndDeliverTx(txCtx, fees)
|
||||
}
|
||||
@@ -112,12 +111,12 @@ func GenAndDeliverTx(txCtx OperationInput, fees sdk.Coins) (simtypes.OperationMs
|
||||
txCtx.SimAccount.PrivKey,
|
||||
)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to generate mock tx"), nil, err
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, sdk.MsgTypeURL(txCtx.Msg), "unable to generate mock tx"), nil, err
|
||||
}
|
||||
|
||||
_, _, err = txCtx.App.SimDeliver(txCtx.TxGen.TxEncoder(), tx)
|
||||
if err != nil {
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, txCtx.MsgType, "unable to deliver tx"), nil, err
|
||||
return simtypes.NoOpMsg(txCtx.ModuleName, sdk.MsgTypeURL(txCtx.Msg), "unable to deliver tx"), nil, err
|
||||
}
|
||||
|
||||
return simtypes.NewOperationMsg(txCtx.Msg, true, "", txCtx.Cdc), nil, nil
|
||||
|
||||
Reference in New Issue
Block a user