diff --git a/CHANGELOG.md b/CHANGELOG.md index a6dbab2b80f3..d8bef91b7200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ * Bring in Cosmos-SDK [v0.46.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.7) changes [#402](https://github.com/provenance-io/cosmos-sdk/pull/402). +### Bug Fixes + +* Pull in Cosmos-SDK authz validate basic fix [#12184](https://github.com/cosmos/cosmos-sdk/pull/12184) + --- ## [v0.46.6-pio-3](https://github.com/provenance-io/cosmos-sdk/releases/tag/v0.46.6-pio-3) - 2022-12-20 diff --git a/x/authz/client/cli/tx.go b/x/authz/client/cli/tx.go index daf1c5ef0347..211e0d78be18 100644 --- a/x/authz/client/cli/tx.go +++ b/x/authz/client/cli/tx.go @@ -62,9 +62,9 @@ func NewCmdGrantAuthorization() *cobra.Command { fmt.Sprintf(`create a new grant authorization to an address to execute a transaction on your behalf: Examples: - $ %s tx %s grant cosmos1skjw.. send %s --spend-limit=1000stake --from=cosmos1skl.. + $ %s tx %s grant cosmos1skjw.. send --spend-limit=1000stake --from=cosmos1skl.. $ %s tx %s grant cosmos1skjw.. generic --msg-type=/cosmos.gov.v1.MsgVote --from=cosmos1sk.. - `, version.AppName, authz.ModuleName, bank.SendAuthorization{}.MsgTypeURL(), version.AppName, authz.ModuleName), + `, version.AppName, authz.ModuleName, version.AppName, authz.ModuleName), ), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/authz/msgs.go b/x/authz/msgs.go index 0bab3187ef1d..f60e53472005 100644 --- a/x/authz/msgs.go +++ b/x/authz/msgs.go @@ -222,6 +222,16 @@ func (msg MsgExec) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrapf("messages cannot be empty") } + msgs, err := msg.GetMessages() + if err != nil { + return err + } + for _, msg := range msgs { + if err = msg.ValidateBasic(); err != nil { + return err + } + } + return nil } diff --git a/x/authz/msgs_test.go b/x/authz/msgs_test.go index 9b642a3a82f2..5d7eb3c39fb9 100644 --- a/x/authz/msgs_test.go +++ b/x/authz/msgs_test.go @@ -30,6 +30,13 @@ func TestMsgExecAuthorized(t *testing.T) { }{ {"nil grantee address", nil, []sdk.Msg{}, false}, {"zero-messages test: should fail", grantee, []sdk.Msg{}, false}, + {"invalid nested msg", grantee, []sdk.Msg{ + &banktypes.MsgSend{ + Amount: sdk.NewCoins(sdk.NewInt64Coin("steak", 2)), + FromAddress: "invalid_from_address", + ToAddress: grantee.String(), + }, + }, false}, {"valid test: msg type", grantee, []sdk.Msg{ &banktypes.MsgSend{ Amount: sdk.NewCoins(sdk.NewInt64Coin("steak", 2)),