diff --git a/CHANGELOG.md b/CHANGELOG.md index 65cebf1935..10f0a01cf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (baseapp) [\#724](https://github.com/line/lbm-sdk/pull/724) add checking pubkey type from validator params * (x/staking) [\#726](https://github.com/line/lbm-sdk/pull/726) check allowedList size in StakeAuthorization.Accept() * (x/staking) [\#728](https://github.com/line/lbm-sdk/pull/728) fix typo in unbondingToUnbonded() panic +* (x/foundation) [\#732](https://github.com/line/lbm-sdk/pull/732) add verification on accounts into x/foundation Grants cli ### Breaking Changes * (proto) [\#564](https://github.com/line/lbm-sdk/pull/564) change gRPC path to original cosmos path diff --git a/x/foundation/client/cli/query.go b/x/foundation/client/cli/query.go index 1271e7fcbd..faa228bbbc 100644 --- a/x/foundation/client/cli/query.go +++ b/x/foundation/client/cli/query.go @@ -377,12 +377,18 @@ func NewQueryCmdGrants() *cobra.Command { return err } + grantee, err := sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + msgTypeURL := "" if len(args) >= 2 { msgTypeURL = args[1] } + params := foundation.QueryGrantsRequest{ - Grantee: args[0], + Grantee: grantee.String(), MsgTypeUrl: msgTypeURL, Pagination: pageReq, } diff --git a/x/foundation/client/testutil/query.go b/x/foundation/client/testutil/query.go index 53f8d8581f..6f985b3fdf 100644 --- a/x/foundation/client/testutil/query.go +++ b/x/foundation/client/testutil/query.go @@ -179,6 +179,13 @@ func (s *IntegrationTestSuite) TestNewQueryCmdMember() { false, nil, }, + "invalid member": { + []string{ + "", + }, + false, + nil, + }, } for name, tc := range testCases { @@ -265,6 +272,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdProposal() { }, false, }, + "invalid id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -352,6 +365,20 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVote() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + s.permanentMember.String(), + }, + false, + }, + "invalid voter": { + []string{ + fmt.Sprintf("%d", s.proposalID), + "", + }, + false, + }, } for name, tc := range testCases { @@ -396,6 +423,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVotes() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -440,6 +473,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdTallyResult() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -496,6 +535,14 @@ func (s *IntegrationTestSuite) TestNewQueryCmdGrants() { false, 0, }, + "invalid grantee": { + []string{ + "", + foundation.ReceiveFromTreasuryAuthorization{}.MsgTypeURL(), + }, + false, + 0, + }, } for name, tc := range testCases {