From 436d2b0b09008913135202eb746ed4e85da50dc7 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 4 Oct 2022 07:11:55 +0000 Subject: [PATCH 1/3] Add verification on accounts --- x/foundation/client/cli/query.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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, } From 2c3bf5e8c2b51d936a2021263f69ce985fa77a34 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 18 Oct 2022 07:18:49 +0000 Subject: [PATCH 2/3] Add unit tests on query cli --- x/foundation/client/testutil/query.go | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) 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 { From 794e211af35d099f4cfd7f2023e60287d7189bf4 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 18 Oct 2022 07:20:18 +0000 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6521f6edf..6dd5b0af65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/foundation) [\#712](https://github.com/line/lbm-sdk/pull/712) fix x/foundation EndBlocker * (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/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