Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return error when it met error at iteration #16

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions x/opchild/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -258,7 +255,6 @@ func (ms MsgServer) UpdateParams(ctx context.Context, req *types.MsgUpdateParams
}

return &types.MsgUpdateParamsResponse{}, nil

}

// SpendFeePool implements MsgServer interface.
Expand Down
16 changes: 16 additions & 0 deletions x/opchild/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, &params)
msg, err = types.NewMsgExecuteMessages(addrsStr[0], []sdk.Msg{updateParamsMsg})
require.NoError(t, err)

_, err = ms.ExecuteMessages(ctx, msg)
require.Error(t, err)
}

/////////////////////////////////////////
Expand Down
Loading