diff --git a/api/cosmos/base/query/v1beta1/pagination.pulsar.go b/api/cosmos/base/query/v1beta1/pagination.pulsar.go index 1d5fe3521990..d8491b1ea206 100644 --- a/api/cosmos/base/query/v1beta1/pagination.pulsar.go +++ b/api/cosmos/base/query/v1beta1/pagination.pulsar.go @@ -13,12 +13,11 @@ import ( ) var ( - md_PageRequest protoreflect.MessageDescriptor - fd_PageRequest_key protoreflect.FieldDescriptor - fd_PageRequest_offset protoreflect.FieldDescriptor - fd_PageRequest_limit protoreflect.FieldDescriptor - fd_PageRequest_count_total protoreflect.FieldDescriptor - fd_PageRequest_reverse protoreflect.FieldDescriptor + md_PageRequest protoreflect.MessageDescriptor + fd_PageRequest_key protoreflect.FieldDescriptor + fd_PageRequest_offset protoreflect.FieldDescriptor + fd_PageRequest_limit protoreflect.FieldDescriptor + fd_PageRequest_reverse protoreflect.FieldDescriptor ) func init() { @@ -27,7 +26,6 @@ func init() { fd_PageRequest_key = md_PageRequest.Fields().ByName("key") fd_PageRequest_offset = md_PageRequest.Fields().ByName("offset") fd_PageRequest_limit = md_PageRequest.Fields().ByName("limit") - fd_PageRequest_count_total = md_PageRequest.Fields().ByName("count_total") fd_PageRequest_reverse = md_PageRequest.Fields().ByName("reverse") } @@ -114,12 +112,6 @@ func (x *fastReflection_PageRequest) Range(f func(protoreflect.FieldDescriptor, return } } - if x.CountTotal != false { - value := protoreflect.ValueOfBool(x.CountTotal) - if !f(fd_PageRequest_count_total, value) { - return - } - } if x.Reverse != false { value := protoreflect.ValueOfBool(x.Reverse) if !f(fd_PageRequest_reverse, value) { @@ -147,8 +139,6 @@ func (x *fastReflection_PageRequest) Has(fd protoreflect.FieldDescriptor) bool { return x.Offset != uint64(0) case "cosmos.base.query.v1beta1.PageRequest.limit": return x.Limit != uint64(0) - case "cosmos.base.query.v1beta1.PageRequest.count_total": - return x.CountTotal != false case "cosmos.base.query.v1beta1.PageRequest.reverse": return x.Reverse != false default: @@ -173,8 +163,6 @@ func (x *fastReflection_PageRequest) Clear(fd protoreflect.FieldDescriptor) { x.Offset = uint64(0) case "cosmos.base.query.v1beta1.PageRequest.limit": x.Limit = uint64(0) - case "cosmos.base.query.v1beta1.PageRequest.count_total": - x.CountTotal = false case "cosmos.base.query.v1beta1.PageRequest.reverse": x.Reverse = false default: @@ -202,9 +190,6 @@ func (x *fastReflection_PageRequest) Get(descriptor protoreflect.FieldDescriptor case "cosmos.base.query.v1beta1.PageRequest.limit": value := x.Limit return protoreflect.ValueOfUint64(value) - case "cosmos.base.query.v1beta1.PageRequest.count_total": - value := x.CountTotal - return protoreflect.ValueOfBool(value) case "cosmos.base.query.v1beta1.PageRequest.reverse": value := x.Reverse return protoreflect.ValueOfBool(value) @@ -234,8 +219,6 @@ func (x *fastReflection_PageRequest) Set(fd protoreflect.FieldDescriptor, value x.Offset = value.Uint() case "cosmos.base.query.v1beta1.PageRequest.limit": x.Limit = value.Uint() - case "cosmos.base.query.v1beta1.PageRequest.count_total": - x.CountTotal = value.Bool() case "cosmos.base.query.v1beta1.PageRequest.reverse": x.Reverse = value.Bool() default: @@ -264,8 +247,6 @@ func (x *fastReflection_PageRequest) Mutable(fd protoreflect.FieldDescriptor) pr panic(fmt.Errorf("field offset of message cosmos.base.query.v1beta1.PageRequest is not mutable")) case "cosmos.base.query.v1beta1.PageRequest.limit": panic(fmt.Errorf("field limit of message cosmos.base.query.v1beta1.PageRequest is not mutable")) - case "cosmos.base.query.v1beta1.PageRequest.count_total": - panic(fmt.Errorf("field count_total of message cosmos.base.query.v1beta1.PageRequest is not mutable")) case "cosmos.base.query.v1beta1.PageRequest.reverse": panic(fmt.Errorf("field reverse of message cosmos.base.query.v1beta1.PageRequest is not mutable")) default: @@ -287,8 +268,6 @@ func (x *fastReflection_PageRequest) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfUint64(uint64(0)) case "cosmos.base.query.v1beta1.PageRequest.limit": return protoreflect.ValueOfUint64(uint64(0)) - case "cosmos.base.query.v1beta1.PageRequest.count_total": - return protoreflect.ValueOfBool(false) case "cosmos.base.query.v1beta1.PageRequest.reverse": return protoreflect.ValueOfBool(false) default: @@ -370,9 +349,6 @@ func (x *fastReflection_PageRequest) ProtoMethods() *protoiface.Methods { if x.Limit != 0 { n += 1 + runtime.Sov(uint64(x.Limit)) } - if x.CountTotal { - n += 2 - } if x.Reverse { n += 2 } @@ -415,16 +391,6 @@ func (x *fastReflection_PageRequest) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x28 } - if x.CountTotal { - i-- - if x.CountTotal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } if x.Limit != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.Limit)) i-- @@ -563,26 +529,6 @@ func (x *fastReflection_PageRequest) ProtoMethods() *protoiface.Methods { break } } - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CountTotal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.CountTotal = bool(v != 0) case 5: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reverse", wireType) @@ -1144,11 +1090,6 @@ type PageRequest struct { // limit is the total number of results to be returned in the result page. // If left empty it will default to a value to be set by each app. Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - CountTotal bool `protobuf:"varint,4,opt,name=count_total,json=countTotal,proto3" json:"count_total,omitempty"` // reverse is set to true if results are to be returned in the descending order. // // Since: cosmos-sdk 0.43 @@ -1196,13 +1137,6 @@ func (x *PageRequest) GetLimit() uint64 { return 0 } -func (x *PageRequest) GetCountTotal() bool { - if x != nil { - return x.CountTotal - } - return false -} - func (x *PageRequest) GetReverse() bool { if x != nil { return x.Reverse @@ -1272,35 +1206,33 @@ var file_cosmos_base_query_v1beta1_pagination_proto_rawDesc = []byte{ 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x22, 0x88, 0x01, 0x0a, 0x0b, 0x50, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, - 0x72, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, - 0x73, 0x65, 0x22, 0x3f, 0x0a, 0x0c, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x42, 0xf0, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0f, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x3b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xa2, 0x02, 0x03, 0x43, 0x42, 0x51, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xca, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, - 0x65, 0x5c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, - 0x02, 0x25, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x65, 0x3a, 0x3a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x22, 0x67, 0x0a, 0x0b, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x22, 0x3f, 0x0a, 0x0c, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x42, 0xf0, 0x01, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x42, 0x0f, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x37, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x3b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, + 0x02, 0x03, 0x43, 0x42, 0x51, 0xaa, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x42, + 0x61, 0x73, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xca, 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x25, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, + 0x42, 0x61, 0x73, 0x65, 0x3a, 0x3a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x3a, 0x3a, 0x56, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/client/flags/flags.go b/client/flags/flags.go index c397b89be82e..5d227679cc6c 100644 --- a/client/flags/flags.go +++ b/client/flags/flags.go @@ -74,7 +74,6 @@ const ( FlagSignMode = "sign-mode" FlagPageKey = "page-key" FlagOffset = "offset" - FlagCountTotal = "count-total" FlagTimeoutHeight = "timeout-height" FlagKeyAlgorithm = "algo" FlagKeyType = "key-type" @@ -159,7 +158,6 @@ func AddPaginationFlagsToCmd(cmd *cobra.Command, query string) { cmd.Flags().String(FlagPageKey, "", fmt.Sprintf("pagination page-key of %s to query for", query)) cmd.Flags().Uint64(FlagOffset, 0, fmt.Sprintf("pagination offset of %s to query for", query)) cmd.Flags().Uint64(FlagLimit, 100, fmt.Sprintf("pagination limit of %s to query for", query)) - cmd.Flags().Bool(FlagCountTotal, false, fmt.Sprintf("count total number of records in %s to query for", query)) cmd.Flags().Bool(FlagReverse, false, "results are sorted in descending order") } diff --git a/client/utils.go b/client/utils.go index 72e12e785fea..d6f2d7e9104d 100644 --- a/client/utils.go +++ b/client/utils.go @@ -54,7 +54,6 @@ func ReadPageRequest(flagSet *pflag.FlagSet) (*query.PageRequest, error) { pageKey, _ := flagSet.GetString(flags.FlagPageKey) offset, _ := flagSet.GetUint64(flags.FlagOffset) limit, _ := flagSet.GetUint64(flags.FlagLimit) - countTotal, _ := flagSet.GetBool(flags.FlagCountTotal) page, _ := flagSet.GetUint64(flags.FlagPage) reverse, _ := flagSet.GetBool(flags.FlagReverse) @@ -67,11 +66,10 @@ func ReadPageRequest(flagSet *pflag.FlagSet) (*query.PageRequest, error) { } return &query.PageRequest{ - Key: []byte(pageKey), - Offset: offset, - Limit: limit, - CountTotal: countTotal, - Reverse: reverse, + Key: []byte(pageKey), + Offset: offset, + Limit: limit, + Reverse: reverse, }, nil } diff --git a/proto/cosmos/base/query/v1beta1/pagination.proto b/proto/cosmos/base/query/v1beta1/pagination.proto index 0a368144abaf..84ecb533dbe7 100644 --- a/proto/cosmos/base/query/v1beta1/pagination.proto +++ b/proto/cosmos/base/query/v1beta1/pagination.proto @@ -16,21 +16,10 @@ message PageRequest { // should be set. bytes key = 1; - // offset is a numeric offset that can be used when key is unavailable. - // It is less efficient than using key. Only one of offset or key should - // be set. - uint64 offset = 2; - // limit is the total number of results to be returned in the result page. // If left empty it will default to a value to be set by each app. uint64 limit = 3; - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - bool count_total = 4; - // reverse is set to true if results are to be returned in the descending order. // // Since: cosmos-sdk 0.43 diff --git a/types/query/pagination.go b/types/query/pagination.go index c7d70c404b9b..a48b96453d74 100644 --- a/types/query/pagination.go +++ b/types/query/pagination.go @@ -104,9 +104,6 @@ func Paginate( } else if count == end+1 { nextKey = iterator.Key() - if !pageRequest.CountTotal { - break - } } if iterator.Error() != nil { return nil, iterator.Error() @@ -114,9 +111,6 @@ func Paginate( } res := &PageResponse{NextKey: nextKey} - if pageRequest.CountTotal { - res.Total = count - } return res, nil } @@ -152,8 +146,6 @@ func initPageRequestDefaults(pageRequest *PageRequest) *PageRequest { if pageRequestCopy.Limit == 0 { pageRequestCopy.Limit = DefaultLimit - // count total results when the limit is zero/not supplied - pageRequestCopy.CountTotal = true } return &pageRequestCopy diff --git a/types/query/pagination.pb.go b/types/query/pagination.pb.go index cc37a2517295..7e486a2da54d 100644 --- a/types/query/pagination.pb.go +++ b/types/query/pagination.pb.go @@ -41,11 +41,6 @@ type PageRequest struct { // limit is the total number of results to be returned in the result page. // If left empty it will default to a value to be set by each app. Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - CountTotal bool `protobuf:"varint,4,opt,name=count_total,json=countTotal,proto3" json:"count_total,omitempty"` // reverse is set to true if results are to be returned in the descending order. // // Since: cosmos-sdk 0.43 @@ -106,13 +101,6 @@ func (m *PageRequest) GetLimit() uint64 { return 0 } -func (m *PageRequest) GetCountTotal() bool { - if m != nil { - return m.CountTotal - } - return false -} - func (m *PageRequest) GetReverse() bool { if m != nil { return m.Reverse @@ -194,25 +182,24 @@ func init() { } var fileDescriptor_53d6d609fe6828af = []byte{ - // 282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x14, 0x85, 0x6b, 0xfa, 0x2b, 0xb7, 0x03, 0xb2, 0x10, 0x72, 0x17, 0x13, 0x75, 0x8a, 0x90, 0x88, - 0x55, 0xf1, 0x00, 0x48, 0x5d, 0x59, 0x50, 0xc4, 0xc4, 0x52, 0x39, 0xe1, 0x36, 0x44, 0x6d, 0xe2, - 0x34, 0xbe, 0xa9, 0xc8, 0x1b, 0x30, 0xf2, 0x58, 0x8c, 0x1d, 0x19, 0x51, 0xf2, 0x22, 0x28, 0x76, - 0x10, 0x93, 0xfd, 0x9d, 0x7b, 0x74, 0xef, 0xd1, 0xa1, 0xb7, 0xb1, 0x36, 0x99, 0x36, 0x32, 0x52, - 0x06, 0xe4, 0xb1, 0x82, 0xb2, 0x96, 0xa7, 0x75, 0x04, 0xa8, 0xd6, 0xb2, 0x50, 0x49, 0x9a, 0x2b, - 0x4c, 0x75, 0x1e, 0x14, 0xa5, 0x46, 0xcd, 0x96, 0xce, 0x1b, 0x74, 0xde, 0xc0, 0x7a, 0x83, 0xde, - 0xbb, 0xfa, 0x20, 0x74, 0xfe, 0xa4, 0x12, 0x08, 0xe1, 0x58, 0x81, 0x41, 0x76, 0x49, 0x87, 0x7b, - 0xa8, 0x39, 0xf1, 0x88, 0xbf, 0x08, 0xbb, 0x2f, 0xbb, 0xa6, 0x13, 0xbd, 0xdb, 0x19, 0x40, 0x7e, - 0xe1, 0x11, 0x7f, 0x14, 0xf6, 0xc4, 0xae, 0xe8, 0xf8, 0x90, 0x66, 0x29, 0xf2, 0xa1, 0x95, 0x1d, - 0xb0, 0x1b, 0x3a, 0x8f, 0x75, 0x95, 0xe3, 0x16, 0x35, 0xaa, 0x03, 0x1f, 0x79, 0xc4, 0x9f, 0x85, - 0xd4, 0x4a, 0xcf, 0x9d, 0xc2, 0x38, 0x9d, 0x96, 0x70, 0x82, 0xd2, 0x00, 0x1f, 0xdb, 0xe1, 0x1f, - 0xae, 0x1e, 0xe8, 0xc2, 0x25, 0x31, 0x85, 0xce, 0x0d, 0xb0, 0x25, 0x9d, 0xe5, 0xf0, 0x8e, 0xdb, - 0xff, 0x3c, 0xd3, 0x8e, 0x1f, 0xa1, 0xee, 0x6e, 0xbb, 0xfd, 0x2e, 0x92, 0x83, 0xcd, 0xe6, 0xab, - 0x11, 0xe4, 0xdc, 0x08, 0xf2, 0xd3, 0x08, 0xf2, 0xd9, 0x8a, 0xc1, 0xb9, 0x15, 0x83, 0xef, 0x56, - 0x0c, 0x5e, 0xfc, 0x24, 0xc5, 0xb7, 0x2a, 0x0a, 0x62, 0x9d, 0xc9, 0xbe, 0x37, 0xf7, 0xdc, 0x99, - 0xd7, 0xbd, 0xc4, 0xba, 0x00, 0xe3, 0x3a, 0x8c, 0x26, 0xb6, 0xb1, 0xfb, 0xdf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x3d, 0x43, 0x85, 0xf7, 0x5f, 0x01, 0x00, 0x00, + // 261 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0xcf, 0x4a, 0xc3, 0x40, + 0x10, 0xc6, 0xbb, 0xd6, 0xfe, 0x61, 0xed, 0x41, 0x16, 0x91, 0xf4, 0xb2, 0x84, 0x9e, 0x82, 0xe0, + 0x2e, 0xc5, 0x07, 0x10, 0x7a, 0xf5, 0x22, 0x39, 0x7a, 0x91, 0x4d, 0x9d, 0xc6, 0xa5, 0x4d, 0x36, + 0xcd, 0x4c, 0x8a, 0x79, 0x0b, 0x1f, 0xcb, 0x63, 0x8f, 0x1e, 0x25, 0x79, 0x11, 0x49, 0x36, 0xe2, + 0x69, 0xe6, 0x37, 0xfc, 0x98, 0x0f, 0x3e, 0x7e, 0xb7, 0x75, 0x98, 0x39, 0xd4, 0x89, 0x41, 0xd0, + 0xc7, 0x0a, 0xca, 0x5a, 0x9f, 0xd6, 0x09, 0x90, 0x59, 0xeb, 0xc2, 0xa4, 0x36, 0x37, 0x64, 0x5d, + 0xae, 0x8a, 0xd2, 0x91, 0x13, 0x4b, 0xef, 0xaa, 0xce, 0x55, 0xbd, 0xab, 0x06, 0x77, 0x95, 0xf2, + 0xab, 0x67, 0x93, 0x42, 0x0c, 0xc7, 0x0a, 0x90, 0xc4, 0x35, 0x1f, 0xef, 0xa1, 0x0e, 0x58, 0xc8, + 0xa2, 0x45, 0xdc, 0xad, 0xe2, 0x96, 0x4f, 0xdd, 0x6e, 0x87, 0x40, 0xc1, 0x45, 0xc8, 0xa2, 0xcb, + 0x78, 0x20, 0x71, 0xc3, 0x27, 0x07, 0x9b, 0x59, 0x0a, 0xc6, 0xfd, 0xd9, 0x83, 0x08, 0xf8, 0xac, + 0x84, 0x13, 0x94, 0x08, 0xc1, 0x24, 0x64, 0xd1, 0x3c, 0xfe, 0xc3, 0xd5, 0x23, 0x5f, 0xf8, 0x20, + 0x2c, 0x5c, 0x8e, 0x20, 0x96, 0x7c, 0x9e, 0xc3, 0x07, 0xbd, 0xfe, 0xc7, 0xcd, 0x3a, 0x7e, 0x82, + 0xba, 0x7b, 0x4d, 0x8e, 0xcc, 0x61, 0x48, 0xf4, 0xb0, 0xd9, 0x7c, 0x35, 0x92, 0x9d, 0x1b, 0xc9, + 0x7e, 0x1a, 0xc9, 0x3e, 0x5b, 0x39, 0x3a, 0xb7, 0x72, 0xf4, 0xdd, 0xca, 0xd1, 0x4b, 0x94, 0x5a, + 0x7a, 0xaf, 0x12, 0xb5, 0x75, 0x99, 0x1e, 0x5a, 0xf1, 0xe3, 0x1e, 0xdf, 0xf6, 0x9a, 0xea, 0x02, + 0xd0, 0x37, 0x94, 0x4c, 0xfb, 0x3e, 0x1e, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x18, 0xf7, 0x10, + 0x9c, 0x3d, 0x01, 0x00, 0x00, } func (m *PageRequest) Marshal() (dAtA []byte, err error) { @@ -245,16 +232,6 @@ func (m *PageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - if m.CountTotal { - i-- - if m.CountTotal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } if m.Limit != 0 { i = encodeVarintPagination(dAtA, i, uint64(m.Limit)) i-- @@ -337,9 +314,6 @@ func (m *PageRequest) Size() (n int) { if m.Limit != 0 { n += 1 + sovPagination(uint64(m.Limit)) } - if m.CountTotal { - n += 2 - } if m.Reverse { n += 2 } @@ -469,26 +443,6 @@ func (m *PageRequest) Unmarshal(dAtA []byte) error { break } } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CountTotal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CountTotal = bool(v != 0) case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Reverse", wireType) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index b05a93e17b6b..26f0ed030cee 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -102,9 +102,8 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { suite.Require().Error(err) pageReq := &query.PageRequest{ - Key: nil, - Limit: 1, - CountTotal: false, + Key: nil, + Limit: 1, } req := types.NewQueryAllBalancesRequest(addr, pageReq, false) res, err := queryClient.AllBalances(gocontext.Background(), req) @@ -131,9 +130,8 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { suite.T().Log("query second page with nextkey") pageReq = &query.PageRequest{ - Key: res.Pagination.NextKey, - Limit: 1, - CountTotal: true, + Key: res.Pagination.NextKey, + Limit: 1, } req = types.NewQueryAllBalancesRequest(addr, pageReq, false) res, err = queryClient.AllBalances(gocontext.Background(), req) @@ -145,9 +143,8 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { suite.T().Log("query third page with nextkey") pageReq = &query.PageRequest{ - Key: pageThree, - Limit: 1, - CountTotal: true, + Key: pageThree, + Limit: 1, } req = types.NewQueryAllBalancesRequest(addr, pageReq, false) res, err = queryClient.AllBalances(gocontext.Background(), req) @@ -157,9 +154,8 @@ func (suite *KeeperTestSuite) TestQueryAllBalances() { suite.T().Log("query third page with nextkey and resolve ibc denom") pageReq = &query.PageRequest{ - Key: pageThree, - Limit: 1, - CountTotal: true, + Key: pageThree, + Limit: 1, } req = types.NewQueryAllBalancesRequest(addr, pageReq, true) res, err = queryClient.AllBalances(gocontext.Background(), req) @@ -180,9 +176,8 @@ func (suite *KeeperTestSuite) TestSpendableBalances() { suite.Require().Error(err) pageReq := &query.PageRequest{ - Key: nil, - Limit: 2, - CountTotal: false, + Key: nil, + Limit: 2, } req := types.NewQuerySpendableBalancesRequest(addr, pageReq) acc := authtypes.NewBaseAccountWithAddress(addr) @@ -351,8 +346,7 @@ func (suite *KeeperTestSuite) TestQueryDenomsMetadata() { func() { req = &types.QueryDenomsMetadataRequest{ Pagination: &query.PageRequest{ - Limit: 3, - CountTotal: true, + Limit: 3, }, } }, @@ -401,8 +395,7 @@ func (suite *KeeperTestSuite) TestQueryDenomsMetadata() { expMetadata = []types.Metadata{metadataAtom, metadataEth} req = &types.QueryDenomsMetadataRequest{ Pagination: &query.PageRequest{ - Limit: 7, - CountTotal: true, + Limit: 7, }, } }, @@ -627,8 +620,7 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwners() { req: &types.QueryDenomOwnersRequest{ Denom: sdk.DefaultBondDenom, Pagination: &query.PageRequest{ - Limit: 6, - CountTotal: true, + Limit: 6, }, }, expPass: true, @@ -640,9 +632,8 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwners() { req: &types.QueryDenomOwnersRequest{ Denom: sdk.DefaultBondDenom, Pagination: &query.PageRequest{ - Offset: 6, - Limit: 10, - CountTotal: true, + Offset: 6, + Limit: 10, }, }, expPass: true, @@ -718,8 +709,7 @@ func (suite *KeeperTestSuite) TestQuerySendEnabled() { name: "limit 1", req: &types.QuerySendEnabledRequest{ Pagination: &query.PageRequest{ - Limit: 1, - CountTotal: true, + Limit: 1, }, }, exp: &types.QuerySendEnabledResponse{ diff --git a/x/evidence/keeper/grpc_query_test.go b/x/evidence/keeper/grpc_query_test.go index 8be75de194da..227b37f9a985 100644 --- a/x/evidence/keeper/grpc_query_test.go +++ b/x/evidence/keeper/grpc_query_test.go @@ -123,9 +123,8 @@ func (suite *KeeperTestSuite) TestQueryAllEvidence() { numEvidence := 100 _ = suite.populateEvidence(suite.ctx, numEvidence) pageReq := &query.PageRequest{ - Key: nil, - Limit: 50, - CountTotal: false, + Key: nil, + Limit: 50, } req = types.NewQueryAllEvidenceRequest(pageReq) }, diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 0620e8863f0f..a8363c156b3c 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -249,7 +249,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { "request with limit 2 and count true", func() { req = &v1.QueryProposalsRequest{ - Pagination: &query.PageRequest{Limit: 2, CountTotal: true}, + Pagination: &query.PageRequest{Limit: 2}, } expRes = &v1.QueryProposalsResponse{ @@ -353,8 +353,7 @@ func (suite *KeeperTestSuite) TestGRPCQueryProposals() { req = &v1.QueryProposalsRequest{ ProposalStatus: v1.StatusDepositPeriod, Pagination: &query.PageRequest{ - Limit: 2, - CountTotal: true, + Limit: 2, }, } diff --git a/x/group/internal/orm/iterator.go b/x/group/internal/orm/iterator.go index 6b3927b0949e..facc6b135dc3 100644 --- a/x/group/internal/orm/iterator.go +++ b/x/group/internal/orm/iterator.go @@ -133,7 +133,6 @@ func Paginate( offset := pageRequest.Offset key := pageRequest.Key limit := pageRequest.Limit - countTotal := pageRequest.CountTotal if offset > 0 && key != nil { return nil, fmt.Errorf("invalid request, either offset or key is expected, got both") @@ -142,8 +141,6 @@ func Paginate( if limit == 0 { limit = defaultPageLimit - // count total results when the limit is zero/not supplied - countTotal = true } if it == nil { @@ -206,7 +203,7 @@ func Paginate( // a count of the total number of items available for pagination in UIs. // countTotal is only respected when offset is used. It is ignored when key // is set. - if !countTotal || len(key) != 0 { + if len(key) != 0 { break } } @@ -214,7 +211,7 @@ func Paginate( destRef.Set(tmpSlice) res := &query.PageResponse{NextKey: nextKey} - if countTotal && len(key) == 0 { + if len(key) == 0 { res.Total = count } diff --git a/x/slashing/keeper/grpc_query_test.go b/x/slashing/keeper/grpc_query_test.go index cb370d2ea976..c05b44fda0a1 100644 --- a/x/slashing/keeper/grpc_query_test.go +++ b/x/slashing/keeper/grpc_query_test.go @@ -81,7 +81,7 @@ func (s *KeeperTestSuite) TestGRPCSigningInfos() { require.Equal(signingInfos, infoResp.Info) infoResp, err = queryClient.SigningInfos(gocontext.Background(), - &slashingtypes.QuerySigningInfosRequest{Pagination: &query.PageRequest{Limit: 1, CountTotal: true}}) + &slashingtypes.QuerySigningInfosRequest{Pagination: &query.PageRequest{Limit: 1}}) require.NoError(err) require.Len(infoResp.Info, 1) require.Equal(signingInfos[0], infoResp.Info[0])