diff --git a/proto/cosmos/bank/v1beta1/query.proto b/proto/cosmos/bank/v1beta1/query.proto index bc5e29137a95..e3a464f8baac 100644 --- a/proto/cosmos/bank/v1beta1/query.proto +++ b/proto/cosmos/bank/v1beta1/query.proto @@ -90,7 +90,13 @@ message QueryAllBalancesResponse { // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC // method. -message QueryTotalSupplyRequest {} +message QueryTotalSupplyRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} // QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC // method @@ -98,6 +104,9 @@ message QueryTotalSupplyResponse { // supply is the supply of the coins repeated cosmos.base.v1beta1.Coin supply = 1 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. diff --git a/x/bank/client/cli/query.go b/x/bank/client/cli/query.go index a192c8deba1b..4019bb738d9a 100644 --- a/x/bank/client/cli/query.go +++ b/x/bank/client/cli/query.go @@ -183,8 +183,13 @@ To query for the total supply of a specific coin denomination use: queryClient := types.NewQueryClient(clientCtx) ctx := cmd.Context() + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } if denom == "" { - res, err := queryClient.TotalSupply(ctx, &types.QueryTotalSupplyRequest{}) + res, err := queryClient.TotalSupply(ctx, &types.QueryTotalSupplyRequest{Pagination: pageReq}) if err != nil { return err } diff --git a/x/bank/keeper/grpc_query.go b/x/bank/keeper/grpc_query.go index fa385e3cb468..356cc4596b04 100644 --- a/x/bank/keeper/grpc_query.go +++ b/x/bank/keeper/grpc_query.go @@ -77,11 +77,14 @@ func (k BaseKeeper) AllBalances(ctx context.Context, req *types.QueryAllBalances } // TotalSupply implements the Query/TotalSupply gRPC method -func (k BaseKeeper) TotalSupply(ctx context.Context, _ *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error) { +func (k BaseKeeper) TotalSupply(ctx context.Context, req *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - totalSupply := k.GetTotalSupply(sdkCtx) + totalSupply, pageRes, err := k.GetPaginatedTotalSupply(sdkCtx, req.Pagination) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } - return &types.QueryTotalSupplyResponse{Supply: totalSupply}, nil + return &types.QueryTotalSupplyResponse{Supply: totalSupply, Pagination: pageRes}, nil } // SupplyOf implements the Query/SupplyOf gRPC method diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 305665ee506f..b4dfa8fab20f 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/query" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" vestexported "github.com/cosmos/cosmos-sdk/x/auth/vesting/exported" "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -23,8 +24,8 @@ type Keeper interface { GetSupply(ctx sdk.Context, denom string) sdk.Coin GetTotalSupply(ctx sdk.Context) sdk.Coins + GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool) - GetDenomMetaData(ctx sdk.Context, denom string) (types.Metadata, bool) SetDenomMetaData(ctx sdk.Context, denomMetaData types.Metadata) IterateAllDenomMetaData(ctx sdk.Context, cb func(types.Metadata) bool) @@ -53,6 +54,29 @@ type BaseKeeper struct { paramSpace paramtypes.Subspace } +func (k BaseKeeper) GetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error) { + store := ctx.KVStore(k.storeKey) + supplyStore := prefix.NewStore(store, types.SupplyKey) + + supply := sdk.NewCoins() + + pageRes, err := query.Paginate(supplyStore, pagination, func(_, value []byte) error { + var result sdk.Coin + err := k.cdc.UnmarshalBinaryBare(value, &result) + if err != nil { + return err + } + supply = append(supply, result) + return nil + }) + + if err != nil { + return nil, nil, err + } + + return supply, pageRes, nil +} + func (k BaseKeeper) GetTotalSupply(ctx sdk.Context) sdk.Coins { balances := sdk.NewCoins() k.IterateTotalSupply(ctx, func(balance sdk.Coin) bool { diff --git a/x/bank/keeper/querier.go b/x/bank/keeper/querier.go index c2d6ca8a2f67..e69ca72cf9b2 100644 --- a/x/bank/keeper/querier.go +++ b/x/bank/keeper/querier.go @@ -3,7 +3,6 @@ package keeper import ( abci "github.com/tendermint/tendermint/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -77,24 +76,20 @@ func queryAllBalance(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQue } func queryTotalSupply(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQuerierCdc *codec.LegacyAmino) ([]byte, error) { - var params types.QueryTotalSupplyParams + var params types.QueryTotalSupplyRequest err := legacyQuerierCdc.UnmarshalJSON(req.Data, ¶ms) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - //TODO: pagenate - totalSupply := k.GetTotalSupply(ctx) + totalSupply, pageRes, err := k.GetPaginatedTotalSupply(ctx, params.Pagination) - start, end := client.Paginate(len(totalSupply), params.Page, params.Limit, 100) - if start < 0 || end < 0 { - totalSupply = sdk.Coins{} - } else { - totalSupply = totalSupply[start:end] + supplyRes := &types.QueryTotalSupplyResponse{ + Supply: totalSupply, + Pagination: pageRes, } - - res, err := legacyQuerierCdc.MarshalJSON(totalSupply) + res, err := codec.MarshalJSONIndent(legacyQuerierCdc, supplyRes) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } diff --git a/x/bank/types/query.pb.go b/x/bank/types/query.pb.go index c4bedb0098c5..5ad95812ba8c 100644 --- a/x/bank/types/query.pb.go +++ b/x/bank/types/query.pb.go @@ -219,6 +219,8 @@ func (m *QueryAllBalancesResponse) GetPagination() *query.PageResponse { // QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC // method. type QueryTotalSupplyRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} } @@ -259,6 +261,8 @@ var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo type QueryTotalSupplyResponse struct { // supply is the supply of the coins Supply github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"supply"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } @@ -301,6 +305,13 @@ func (m *QueryTotalSupplyResponse) GetSupply() github_com_cosmos_cosmos_sdk_type return nil } +func (m *QueryTotalSupplyResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. type QuerySupplyOfRequest struct { // denom is the coin denom to query balances for. @@ -690,59 +701,59 @@ func init() { func init() { proto.RegisterFile("cosmos/bank/v1beta1/query.proto", fileDescriptor_9c6fc1939682df13) } var fileDescriptor_9c6fc1939682df13 = []byte{ - // 824 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0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76, 0x5b, 0x5d, 0x44, 0xbf, 0x57, 0xaf, 0x11, 0xfc, 0xdd, 0xed, 0x64, - 0x78, 0x58, 0xe5, 0x5e, 0x6b, 0xd5, 0x96, 0xa2, 0x27, 0x48, 0xae, 0x79, 0xce, 0x75, 0x16, 0x9f, - 0x8a, 0xc2, 0xb5, 0xb8, 0xbe, 0x7f, 0x98, 0x41, 0x07, 0x87, 0x19, 0xf4, 0xf5, 0x30, 0x83, 0x9e, - 0x1f, 0x65, 0x62, 0x07, 0x47, 0x99, 0xd8, 0xa7, 0xa3, 0x4c, 0xec, 0xe6, 0xfc, 0xc0, 0x8f, 0xe1, - 0x7d, 0x01, 0xcb, 0xbf, 0x89, 0x95, 0x38, 0xff, 0x77, 0xb6, 0xf2, 0x23, 0x00, 0x00, 0xff, 0xff, - 0xb4, 0xd4, 0xb0, 0xfc, 0x75, 0x0a, 0x00, 0x00, + // 825 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0xd3, 0x58, + 0x14, 0xcd, 0xeb, 0x4c, 0xd3, 0xf4, 0x46, 0x33, 0x8b, 0xd7, 0x8c, 0x26, 0x75, 0xa7, 0xc9, 0xc8, + 0x9d, 0x69, 0xd3, 0x92, 0xda, 0x4d, 0x8b, 0x54, 0xc1, 0x06, 0x35, 0x45, 0xb0, 0x40, 0xa8, 0x21, + 0xb0, 0x42, 0x42, 0xe8, 0x25, 0x31, 0x26, 0x6a, 0xe2, 0xe7, 0xe6, 0x39, 0x88, 0xaa, 0xaa, 0x84, + 0x90, 0x90, 0x58, 0x01, 0x12, 0x0b, 0x16, 0x6c, 0xca, 0x06, 0x09, 0x96, 0xfc, 0x8a, 0x2e, 0x58, + 0x54, 0x62, 0xc3, 0x0a, 0x50, 0xcb, 0x82, 0x9f, 0x81, 0xf2, 0x3e, 0x5c, 0x27, 0x71, 0x13, 0x2f, + 0xc2,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x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1238,6 +1249,18 @@ func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = 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] = 0xa + } return len(dAtA) - i, nil } @@ -1261,6 +1284,18 @@ func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = 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.Supply) > 0 { for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- { { @@ -1627,6 +1662,10 @@ func (m *QueryTotalSupplyRequest) Size() (n int) { } var l int _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -1642,6 +1681,10 @@ func (m *QueryTotalSupplyResponse) Size() (n int) { n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -2218,6 +2261,42 @@ func (m *QueryTotalSupplyRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: QueryTotalSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + 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:]) @@ -2302,6 +2381,42 @@ func (m *QueryTotalSupplyResponse) Unmarshal(dAtA []byte) error { 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:]) diff --git a/x/bank/types/query.pb.gw.go b/x/bank/types/query.pb.gw.go index 3dec93b8b363..8b8ed9a52607 100644 --- a/x/bank/types/query.pb.gw.go +++ b/x/bank/types/query.pb.gw.go @@ -179,10 +179,21 @@ func local_request_Query_AllBalances_0(ctx context.Context, marshaler runtime.Ma } +var ( + filter_Query_TotalSupply_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + func request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryTotalSupplyRequest 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_TotalSupply_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.TotalSupply(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -192,6 +203,13 @@ func local_request_Query_TotalSupply_0(ctx context.Context, marshaler runtime.Ma var protoReq QueryTotalSupplyRequest 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_TotalSupply_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.TotalSupply(ctx, &protoReq) return msg, metadata, err