diff --git a/x/opchild/keeper/msg_server.go b/x/opchild/keeper/msg_server.go index d40e0e89..2dbfdf06 100644 --- a/x/opchild/keeper/msg_server.go +++ b/x/opchild/keeper/msg_server.go @@ -115,15 +115,12 @@ func (ms MsgServer) ExecuteMessages(ctx context.Context, req *types.MsgExecuteMe var res *sdk.Result res, err = handler(cacheCtx, msg) if err != nil { - break + return nil, err } events = append(events, res.GetEvents()...) - - } - if err != nil { - return nil, err } + writeCache() // TODO - merge events of MsgExecuteMessages itself @@ -258,7 +255,6 @@ func (ms MsgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams } return &types.MsgUpdateParamsResponse{}, nil - } // SpendFeePool implements MsgServer interface. diff --git a/x/opchild/keeper/msg_server_test.go b/x/opchild/keeper/msg_server_test.go index f597a8c0..7ee29c26 100644 --- a/x/opchild/keeper/msg_server_test.go +++ b/x/opchild/keeper/msg_server_test.go @@ -58,6 +58,22 @@ func Test_MsgServer_ExecuteMessages(t *testing.T) { require.NoError(t, err) require.Len(t, vals, 1) require.Equal(t, vals[0].Moniker, "val2") + + // should failed with err (denom not sorted) + params := types.DefaultParams() + params.MinGasPrices = sdk.DecCoins{{ + Denom: "22222", + Amount: math.LegacyNewDec(1), + }, { + Denom: "11111", + Amount: math.LegacyNewDec(2), + }} + updateParamsMsg := types.NewMsgUpdateParams(moduleAddr, ¶ms) + msg, err = types.NewMsgExecuteMessages(addrsStr[0], []sdk.Msg{updateParamsMsg}) + require.NoError(t, err) + + _, err = ms.ExecuteMessages(ctx, msg) + require.Error(t, err) } /////////////////////////////////////////