diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d62f194f5d8..615918e156b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Features + +* (x/groups) [#14879](https://github.com/cosmos/cosmos-sdk/pull/14879) Add `Query/Groups` query to get all the groups. + ### Improvements * (simapp) [#15305](https://github.com/cosmos/cosmos-sdk/pull/15305) Add `AppStateFnWithExtendedCb` with callback function to extend rawState and `AppStateRandomizedFnWithState` with extra genesisState argument which is the genesis state of the app. diff --git a/proto/cosmos/group/v1/query.proto b/proto/cosmos/group/v1/query.proto index 51a011a9db8f..2ce08855f7b0 100644 --- a/proto/cosmos/group/v1/query.proto +++ b/proto/cosmos/group/v1/query.proto @@ -82,6 +82,13 @@ service Query { rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { option (google.api.http).get = "/cosmos/group/v1/proposals/{proposal_id}/tally"; }; + + // Groups queries all groups in state. + // + // Since: cosmos-sdk 0.47.1 + rpc Groups(QueryGroupsRequest) returns (QueryGroupsResponse) { + option (google.api.http).get = "/cosmos/group/v1/groups"; + }; } // QueryGroupInfoRequest is the Query/GroupInfo request type. @@ -311,3 +318,23 @@ message QueryTallyResultResponse { // tally defines the requested tally. TallyResult tally = 1 [(gogoproto.nullable) = false]; } + +// QueryGroupsRequest is the Query/Groups request type. +// +// Since: cosmos-sdk 0.47.1 +message QueryGroupsRequest { + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryGroupsResponse is the Query/Groups response type. +// +// Since: cosmos-sdk 0.47.1 +message QueryGroupsResponse { + // `groups` is all the groups present in state. + repeated GroupInfo groups = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} diff --git a/x/group/client/cli/query.go b/x/group/client/cli/query.go index 1535566f525d..e7b866d92508 100644 --- a/x/group/client/cli/query.go +++ b/x/group/client/cli/query.go @@ -33,6 +33,7 @@ func QueryCmd(name string) *cobra.Command { QueryVotesByVoterCmd(), QueryGroupsByMemberCmd(), QueryTallyResultCmd(), + QueryGroupsCmd(), ) return queryCmd @@ -504,3 +505,37 @@ func QueryVotesByVoterCmd() *cobra.Command { return cmd } + +func QueryGroupsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "groups", + Short: "Query for groups present in the state", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := group.NewQueryClient(clientCtx) + + res, err := queryClient.Groups(cmd.Context(), &group.QueryGroupsRequest{ + Pagination: pageReq, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "groups") + + return cmd +} diff --git a/x/group/client/testutil/query.go b/x/group/client/testutil/query.go index 74c152b50978..28ec0746be81 100644 --- a/x/group/client/testutil/query.go +++ b/x/group/client/testutil/query.go @@ -149,6 +149,55 @@ func (s *IntegrationTestSuite) TestQueryGroupsByMembers() { } } +func (s *IntegrationTestSuite) TestQueryGroups() { + val := s.network.Validators[0] + clientCtx := val.ClientCtx + require := s.Require() + + testCases := []struct { + name string + args []string + expectErr bool + expectErrMsg string + numItems int + expectGroups []*group.GroupInfo + }{ + { + name: "valid req", + args: []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, + expectErr: false, + numItems: 5, + }, + { + name: "valid req with pagination", + args: []string{ + "--limit=2", + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + }, + expectErr: false, + numItems: 2, + }, + } + + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + cmd := client.QueryGroupsCmd() + out, err := cli.ExecTestCLICmd(clientCtx, cmd, tc.args) + if tc.expectErr { + require.Contains(out.String(), tc.expectErrMsg) + } else { + require.NoError(err, out.String()) + + var resp group.QueryGroupsResponse + val.ClientCtx.Codec.MustUnmarshalJSON(out.Bytes(), &resp) + + require.Len(resp.Groups, tc.numItems) + } + }) + } +} + func (s *IntegrationTestSuite) TestQueryGroupMembers() { val := s.network.Validators[0] clientCtx := val.ClientCtx diff --git a/x/group/keeper/grpc_query.go b/x/group/keeper/grpc_query.go index ff26844dde56..616f21133847 100644 --- a/x/group/keeper/grpc_query.go +++ b/x/group/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "math" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -346,3 +347,25 @@ func (k Keeper) TallyResult(goCtx context.Context, request *group.QueryTallyResu Tally: tallyResult, }, nil } + +// Groups returns all the groups present in the state. +func (k Keeper) Groups(goCtx context.Context, request *group.QueryGroupsRequest) (*group.QueryGroupsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + it, err := k.groupTable.PrefixScan(ctx.KVStore(k.key), 1, math.MaxUint64) + if err != nil { + return nil, err + } + defer it.Close() + + var groups []*group.GroupInfo + pageRes, err := orm.Paginate(it, request.Pagination, &groups) + if err != nil { + return nil, err + } + + return &group.QueryGroupsResponse{ + Groups: groups, + Pagination: pageRes, + }, nil +} diff --git a/x/group/query.pb.go b/x/group/query.pb.go index 47cfd7fccd98..ec7e0f9a6da0 100644 --- a/x/group/query.pb.go +++ b/x/group/query.pb.go @@ -1380,6 +1380,111 @@ func (m *QueryTallyResultResponse) GetTally() TallyResult { return TallyResult{} } +// QueryGroupsRequest is the Query/Groups request type. +// +// Since: cosmos-sdk 0.47.1 +type QueryGroupsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGroupsRequest) Reset() { *m = QueryGroupsRequest{} } +func (m *QueryGroupsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGroupsRequest) ProtoMessage() {} +func (*QueryGroupsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0fcf9f1d74302290, []int{26} +} +func (m *QueryGroupsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGroupsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGroupsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGroupsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGroupsRequest.Merge(m, src) +} +func (m *QueryGroupsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGroupsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGroupsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGroupsRequest proto.InternalMessageInfo + +func (m *QueryGroupsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryGroupsResponse is the Query/Groups response type. +// +// Since: cosmos-sdk 0.47.1 +type QueryGroupsResponse struct { + // `groups` is all the groups present in state. + Groups []*GroupInfo `protobuf:"bytes,1,rep,name=groups,proto3" json:"groups,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryGroupsResponse) Reset() { *m = QueryGroupsResponse{} } +func (m *QueryGroupsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGroupsResponse) ProtoMessage() {} +func (*QueryGroupsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0fcf9f1d74302290, []int{27} +} +func (m *QueryGroupsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGroupsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGroupsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGroupsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGroupsResponse.Merge(m, src) +} +func (m *QueryGroupsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGroupsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGroupsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGroupsResponse proto.InternalMessageInfo + +func (m *QueryGroupsResponse) GetGroups() []*GroupInfo { + if m != nil { + return m.Groups + } + return nil +} + +func (m *QueryGroupsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + func init() { proto.RegisterType((*QueryGroupInfoRequest)(nil), "cosmos.group.v1.QueryGroupInfoRequest") proto.RegisterType((*QueryGroupInfoResponse)(nil), "cosmos.group.v1.QueryGroupInfoResponse") @@ -1407,91 +1512,95 @@ func init() { proto.RegisterType((*QueryGroupsByMemberResponse)(nil), "cosmos.group.v1.QueryGroupsByMemberResponse") proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.group.v1.QueryTallyResultRequest") proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.group.v1.QueryTallyResultResponse") + proto.RegisterType((*QueryGroupsRequest)(nil), "cosmos.group.v1.QueryGroupsRequest") + proto.RegisterType((*QueryGroupsResponse)(nil), "cosmos.group.v1.QueryGroupsResponse") } func init() { proto.RegisterFile("cosmos/group/v1/query.proto", fileDescriptor_0fcf9f1d74302290) } var fileDescriptor_0fcf9f1d74302290 = []byte{ - // 1249 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x98, 0xcf, 0x6f, 0xdc, 0x44, - 0x14, 0xc7, 0x33, 0x25, 0x69, 0x92, 0x97, 0xb6, 0x11, 0x43, 0x5a, 0x12, 0x37, 0xda, 0x04, 0x03, - 0xf9, 0x1d, 0x3b, 0xbb, 0x49, 0xd3, 0x8a, 0x9f, 0xea, 0x4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b, - 0x30, 0xc3, 0x41, 0xdf, 0x67, 0x8e, 0x5e, 0x6c, 0xe3, 0xba, 0xbf, 0x1a, 0x59, 0x1b, 0xec, 0x3e, - 0x49, 0x47, 0x6e, 0x02, 0xe7, 0x48, 0x7d, 0x92, 0x78, 0x98, 0x7c, 0x07, 0x9f, 0xce, 0xd8, 0x9a, - 0xa8, 0xcc, 0x22, 0x0c, 0xba, 0xc1, 0x38, 0x17, 0x57, 0x23, 0xa2, 0xb8, 0xd1, 0x25, 0x1e, 0x22, - 0x7f, 0x4a, 0xd0, 0x27, 0xb8, 0xd7, 0xec, 0x62, 0xcf, 0x03, 0xda, 0xb7, 0xae, 0x7f, 0x4d, 0xd0, - 0x5d, 0x44, 0x40, 0x70, 0x53, 0xcb, 0x42, 0x28, 0xaf, 0xd5, 0x09, 0xbb, 0x12, 0x31, 0xfd, 0x6b, - 0xf1, 0x57, 0x04, 0xed, 0x09, 0x62, 0x05, 0x9a, 0xdb, 0xee, 0x1d, 0xc9, 0xd4, 0xbb, 0xbe, 0x69, - 0xf5, 0xa5, 0x67, 0x0a, 0x82, 0x50, 0xff, 0xab, 0x50, 0x0f, 0xc3, 0x96, 0x00, 0x2d, 0xd1, 0x39, - 0x38, 0x50, 0x4e, 0x88, 0xdf, 0x0b, 0xfb, 0xd0, 0xce, 0x83, 0x5d, 0x79, 0x05, 0x9e, 0xe7, 0x6c, - 0xbb, 0x5a, 0xb5, 0xea, 0x9e, 0x6d, 0x87, 0x55, 0x27, 0xf3, 0xcb, 0x61, 0x17, 0x67, 0x33, 0x90, - 0x8b, 0x9b, 0xba, 0x05, 0x43, 0x8e, 0x7b, 0x19, 0x0f, 0x81, 0xa8, 0x6f, 0xf5, 0x25, 0x15, 0x07, - 0x9f, 0xfc, 0x39, 0x33, 0x50, 0x12, 0x09, 0x85, 0xfb, 0xcf, 0xc2, 0x10, 0x5f, 0x96, 0x7e, 0x4e, - 0x60, 0xb4, 0xbd, 0x75, 0x3a, 0x17, 0x59, 0x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1, 0x56, 0xe9, 0x72, 0xca, 0x79, 0x2b, 0xde, 0x08, 0xbe, 0x51, 0x3d, - 0x21, 0x30, 0xe6, 0xf3, 0x01, 0x74, 0x21, 0xbe, 0x64, 0xd4, 0x9b, 0x48, 0x8b, 0x19, 0x22, 0x91, - 0x6c, 0x93, 0x93, 0xad, 0x51, 0x25, 0xf9, 0x69, 0x0a, 0x4d, 0x21, 0xf7, 0x21, 0xc5, 0x37, 0x9e, - 0x9c, 0xe6, 0xc8, 0xd3, 0xd3, 0x1c, 0xf9, 0xeb, 0x34, 0x47, 0xbe, 0x38, 0xcb, 0x0d, 0x3c, 0x3d, - 0xcb, 0x0d, 0xfc, 0x71, 0x96, 0x1b, 0xf8, 0xe0, 0x25, 0xc3, 0x74, 0x3e, 0x3c, 0x2c, 0x2b, 0xfb, - 0xac, 0xe6, 0xad, 0x29, 0xfe, 0x59, 0xb5, 0x2b, 0x1f, 0xa9, 0x1f, 0x8b, 0x02, 0xe5, 0x8b, 0xfc, - 0xcf, 0xb0, 0xeb, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x11, 0xfe, 0x04, 0xa9, 0x4e, 0x16, 0x00, - 0x00, + // 1292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x98, 0x4b, 0x6f, 0x1b, 0x55, + 0x14, 0xc7, 0x73, 0x4b, 0x9e, 0x27, 0x6d, 0x23, 0x6e, 0xd3, 0x36, 0x99, 0x46, 0x4e, 0x98, 0x96, + 0xbc, 0x33, 0x13, 0x3b, 0x69, 0x5a, 0xf1, 0x54, 0x2d, 0x41, 0xc8, 0xa2, 0x28, 0x35, 0x11, 0x0b, + 0x84, 0x14, 0x8d, 0xe3, 0x89, 0x19, 0x61, 0xcf, 0xb8, 0x9e, 0x49, 0x84, 0x15, 0x79, 0x83, 0x04, + 0x0b, 0xc4, 0x02, 0x5a, 0x84, 0x4a, 0xc4, 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x87, 0x3c, 0xac, 0x6b, 0xa2, 0x7d, 0x43, 0x40, 0x8a, 0xa2, 0x42, 0xd5, 0x72, 0x30, 0xc8, + 0xe4, 0x11, 0xa2, 0x25, 0x4d, 0x2b, 0x46, 0x76, 0x4f, 0xb1, 0x4f, 0x08, 0xcc, 0x04, 0xc6, 0xd4, + 0xd0, 0xed, 0x3c, 0xbf, 0xfc, 0x0f, 0x07, 0xeb, 0x27, 0x02, 0x2f, 0x24, 0x70, 0xa0, 0x54, 0x9b, + 0x70, 0x91, 0x83, 0xd4, 0x30, 0x00, 0x25, 0xeb, 0xfc, 0xf5, 0x5c, 0x28, 0x7b, 0xd7, 0xed, 0x9e, + 0x7e, 0xc7, 0x31, 0xfa, 0xf5, 0xc4, 0xe0, 0xc5, 0x89, 0xea, 0x9f, 0xbf, 0xde, 0x13, 0xf5, 0x16, + 0x8c, 0x33, 0xec, 0xed, 0xba, 0x55, 0xb3, 0x6c, 0xad, 0x22, 0x74, 0x9c, 0x86, 0xd1, 0x1a, 0xde, + 0x6a, 0x8f, 0x22, 0x88, 0x5b, 0x5b, 0x25, 0xf9, 0x6d, 0xfc, 0x11, 0x69, 0x27, 0xe2, 0x3b, 0xde, + 0x84, 0x61, 0x11, 0x86, 0x1b, 0xee, 0x64, 0xe8, 0xed, 0x5a, 0x49, 0xad, 0x50, 0xf9, 0x31, 0x01, + 0xd9, 0xb7, 0xa0, 0x98, 0x48, 0x2e, 0xc2, 0xbf, 0xf8, 0x79, 0xe8, 0x5a, 0x8f, 0xbf, 0x27, 0x70, + 0x3d, 0x11, 0x11, 0x15, 0xb8, 0x05, 0x23, 0xe2, 0xb5, 0x44, 0x83, 0x13, 0x24, 0x68, 0xc7, 0x76, + 0xaf, 0xab, 0x75, 0x98, 0x66, 0xa0, 0xef, 0x5a, 0x8e, 0x9e, 0x6f, 0xe1, 0xba, 0x57, 0xf5, 0xb4, + 0x0d, 0x76, 0xbf, 0xa4, 0x43, 0x37, 0x81, 0x71, 0x24, 0x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0xfd, 0xb2, 0x7f, 0x46, 0x60, 0x58, 0xf8, 0x0b, 0xfa, 0x62, + 0x74, 0xe9, 0x80, 0x11, 0x92, 0x66, 0x3b, 0x85, 0x21, 0x95, 0xca, 0xa8, 0x16, 0xe8, 0x5c, 0x88, + 0x4a, 0x6c, 0xdc, 0xea, 0x91, 0x67, 0x57, 0x6f, 0xd2, 0x27, 0x04, 0xae, 0x44, 0x3b, 0x5d, 0xba, + 0x96, 0x5c, 0x33, 0xd2, 0xba, 0x4b, 0xeb, 0x67, 0x4b, 0x42, 0xec, 0x57, 0x18, 0xf6, 0x06, 0x5d, + 0x8f, 0xc5, 0x6e, 0x0f, 0x01, 0x6e, 0x02, 0x9e, 0xef, 0xff, 0x09, 0x81, 0x4b, 0x11, 0x86, 0x94, + 0xae, 0x46, 0xb3, 0xc4, 0xfb, 0x65, 0x29, 0x7b, 0x86, 0x0c, 0x44, 0x7f, 0x83, 0xa1, 0xbf, 0x4e, + 0x5f, 0x0d, 0xa1, 0xbb, 0x16, 0xc7, 0xa5, 0x6e, 0xe9, 0xcd, 0x6c, 0x98, 0x5f, 0x7f, 0xf5, 0x88, + 0xdd, 0x6c, 0xd2, 0x1f, 0x08, 0x8c, 0x05, 0xbc, 0x67, 0xdc, 0x56, 0x1b, 0xed, 0x95, 0xe3, 0xb6, + 0xda, 0x18, 0x43, 0x9b, 0x30, 0xbf, 0xcc, 0x9a, 0x79, 0xc1, 0x03, 0x23, 0xf3, 0x35, 0x81, 0xf3, + 0x5e, 0xeb, 0x17, 0xb7, 0xdd, 0x46, 0x78, 0xd6, 0xb8, 0xed, 0x36, 0xca, 0x49, 0x26, 0xcc, 0x72, + 0x8b, 0x10, 0x15, 0x45, 0x0d, 0x1f, 0x13, 0xb8, 0xe8, 0x37, 0x59, 0xb4, 0xc3, 0x0e, 0xea, 0x73, + 0x89, 0xd2, 0x72, 0xba, 0x60, 0xc4, 0x5b, 0x63, 0x78, 0x2b, 0x74, 0x29, 0x61, 0xbf, 0xe5, 0xbf, + 0x08, 0x9e, 0x51, 0x3d, 0x26, 0x30, 0xea, 0xb1, 0x3e, 0x74, 0x3e, 0xba, 0x64, 0xd8, 0x8e, 0x49, + 0x0b, 0x29, 0x22, 0x91, 0x6c, 0x83, 0x91, 0xad, 0x52, 0x25, 0xfe, 0x6b, 0x0a, 0x4c, 0x21, 0xb3, + 0x5e, 0xd4, 0x81, 0x41, 0xfe, 0xae, 0xf4, 0x7a, 0x92, 0x12, 0x82, 0xe8, 0x46, 0x72, 0x10, 0xc2, + 0x4c, 0x33, 0x98, 0x49, 0x7a, 0x35, 0x46, 0xa6, 0xfc, 0x6b, 0x4f, 0x4f, 0x32, 0xe4, 0xd9, 0x49, + 0x86, 0xfc, 0x79, 0x92, 0x21, 0x5f, 0x9c, 0x66, 0xfa, 0x9e, 0x9d, 0x66, 0xfa, 0x7e, 0x3f, 0xcd, + 0xf4, 0xbd, 0x77, 0xa3, 0x6c, 0x38, 0x1f, 0x1c, 0x14, 0x95, 0x3d, 0xab, 0x2a, 0x92, 0xf9, 0x3f, + 0x2b, 0x76, 0xe9, 0x43, 0xf5, 0x23, 0xbe, 0x40, 0x71, 0x90, 0xfd, 0xbd, 0x7b, 0xed, 0x9f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x1c, 0xce, 0x79, 0xa7, 0xb7, 0x17, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1536,6 +1645,10 @@ type QueryClient interface { // then it simply returns the `final_tally_result` state stored in the // proposal itself. TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) + // Groups queries all groups in state. + // + // Since: cosmos-sdk 0.47.1 + Groups(ctx context.Context, in *QueryGroupsRequest, opts ...grpc.CallOption) (*QueryGroupsResponse, error) } type queryClient struct { @@ -1663,6 +1776,15 @@ func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultReque return out, nil } +func (c *queryClient) Groups(ctx context.Context, in *QueryGroupsRequest, opts ...grpc.CallOption) (*QueryGroupsResponse, error) { + out := new(QueryGroupsResponse) + err := c.cc.Invoke(ctx, "/cosmos.group.v1.Query/Groups", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // GroupInfo queries group info based on group id. @@ -1695,6 +1817,10 @@ type QueryServer interface { // then it simply returns the `final_tally_result` state stored in the // proposal itself. TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) + // Groups queries all groups in state. + // + // Since: cosmos-sdk 0.47.1 + Groups(context.Context, *QueryGroupsRequest) (*QueryGroupsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1740,6 +1866,9 @@ func (*UnimplementedQueryServer) GroupsByMember(ctx context.Context, req *QueryG func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") } +func (*UnimplementedQueryServer) Groups(ctx context.Context, req *QueryGroupsRequest) (*QueryGroupsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Groups not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1979,6 +2108,24 @@ func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_Groups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGroupsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Groups(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.group.v1.Query/Groups", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Groups(ctx, req.(*QueryGroupsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.group.v1.Query", HandlerType: (*QueryServer)(nil), @@ -2035,6 +2182,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "TallyResult", Handler: _Query_TallyResult_Handler, }, + { + MethodName: "Groups", + Handler: _Query_Groups_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/group/v1/query.proto", @@ -3084,6 +3235,90 @@ func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryGroupsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGroupsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGroupsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *QueryGroupsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGroupsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGroupsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Groups) > 0 { + for iNdEx := len(m.Groups) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Groups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -3508,6 +3743,38 @@ func (m *QueryTallyResultResponse) Size() (n int) { return n } +func (m *QueryGroupsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGroupsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Groups) > 0 { + for _, e := range m.Groups { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -6196,6 +6463,212 @@ func (m *QueryTallyResultResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGroupsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGroupsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGroupsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGroupsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGroupsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGroupsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Groups", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Groups = append(m.Groups, &GroupInfo{}) + if err := m.Groups[len(m.Groups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/group/query.pb.gw.go b/x/group/query.pb.gw.go index d9f8b8c588b0..a0a30e91c3a6 100644 --- a/x/group/query.pb.gw.go +++ b/x/group/query.pb.gw.go @@ -901,6 +901,42 @@ func local_request_Query_TallyResult_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_Groups_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Groups_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGroupsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Groups_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Groups(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Groups_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGroupsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Groups_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Groups(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1206,6 +1242,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Groups_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1507,6 +1566,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Groups_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Groups_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Groups_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1536,6 +1615,8 @@ var ( pattern_Query_GroupsByMember_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "group", "v1", "groups_by_member", "address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_TallyResult_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"cosmos", "group", "v1", "proposals", "proposal_id", "tally"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Groups_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "group", "v1", "groups"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1564,4 +1645,6 @@ var ( forward_Query_GroupsByMember_0 = runtime.ForwardResponseMessage forward_Query_TallyResult_0 = runtime.ForwardResponseMessage + + forward_Query_Groups_0 = runtime.ForwardResponseMessage )