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

fix: add verification on accounts into x/foundation Grants cli #732

Merged
merged 4 commits into from
Oct 19, 2022
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion x/foundation/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
47 changes: 47 additions & 0 deletions x/foundation/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ func (s *IntegrationTestSuite) TestNewQueryCmdMember() {
false,
nil,
},
"invalid member": {
[]string{
"",
},
false,
nil,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -265,6 +272,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdProposal() {
},
false,
},
"invalid id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -396,6 +423,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVotes() {
},
false,
},
"invalid proposal id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -440,6 +473,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdTallyResult() {
},
false,
},
"invalid proposal id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -496,6 +535,14 @@ func (s *IntegrationTestSuite) TestNewQueryCmdGrants() {
false,
0,
},
"invalid grantee": {
[]string{
"",
foundation.ReceiveFromTreasuryAuthorization{}.MsgTypeURL(),
},
false,
0,
},
}

for name, tc := range testCases {
Expand Down