From 518d51e6709a6bacc10934336d012f6649abc32e Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Mon, 8 Mar 2021 17:42:04 +0530 Subject: [PATCH 1/7] add orderBy parameter to grpc query --- docs/core/proto-docs.md | 1 + proto/cosmos/tx/v1beta1/service.proto | 2 + types/tx/service.pb.go | 149 +++++++++++++++++--------- x/auth/tx/service.go | 10 +- x/auth/tx/service_test.go | 14 +++ 5 files changed, 127 insertions(+), 49 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 9e985a6a6a1b..9fe9ada73eef 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -7221,6 +7221,7 @@ RPC method. | ----- | ---- | ----- | ----------- | | `events` | [string](#string) | repeated | events is the list of transaction event type. | | `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an pagination for the request. | +| `order_by` | [string](#string) | | order_by defines events sorting order | diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 59df75bab12b..51d93b881579 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -42,6 +42,8 @@ message GetTxsEventRequest { repeated string events = 1; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; + // order_by defines events sorting order + string order_by = 3; } // GetTxsEventResponse is the response type for the Service.TxsByEvents diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index f01a60fe52a9..c1a37d45848c 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -77,6 +77,8 @@ type GetTxsEventRequest struct { Events []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` // pagination defines an pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` + // order_by defines events sorting order + OrderBy string `protobuf:"bytes,3,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` } func (m *GetTxsEventRequest) Reset() { *m = GetTxsEventRequest{} } @@ -126,6 +128,13 @@ func (m *GetTxsEventRequest) GetPagination() *query.PageRequest { return nil } +func (m *GetTxsEventRequest) GetOrderBy() string { + if m != nil { + return m.OrderBy + } + return "" +} + // GetTxsEventResponse is the response type for the Service.TxsByEvents // RPC method. type GetTxsEventResponse struct { @@ -513,54 +522,55 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x4f, 0x13, 0x41, - 0x14, 0xef, 0xb6, 0xc8, 0xc7, 0x2b, 0x68, 0x1d, 0x10, 0x6b, 0xd1, 0xa5, 0x2c, 0x16, 0x08, 0x89, - 0xbb, 0xa1, 0x7a, 0x20, 0xc6, 0xc4, 0xd0, 0x52, 0x08, 0x51, 0x3e, 0xb2, 0xc5, 0x83, 0xc6, 0xa4, - 0x99, 0xb6, 0xc3, 0xb2, 0x91, 0xee, 0x94, 0xce, 0x94, 0x2c, 0x01, 0x62, 0xe2, 0xd1, 0x93, 0x89, - 0xff, 0x94, 0x47, 0x12, 0x2f, 0x1e, 0x0d, 0xf8, 0x47, 0x78, 0x34, 0x3b, 0x3b, 0x6d, 0xb7, 0x65, - 0x0b, 0xc4, 0x13, 0x33, 0xcc, 0xef, 0xfd, 0x3e, 0xde, 0x9b, 0x9d, 0xc2, 0x74, 0x85, 0xb2, 0x1a, - 0x65, 0x06, 0x77, 0x8d, 0xa3, 0xa5, 0x32, 0xe1, 0x78, 0xc9, 0x60, 0xa4, 0x71, 0x64, 0x57, 0x88, - 0x5e, 0x6f, 0x50, 0x4e, 0xd1, 0x7d, 0x1f, 0xa0, 0x73, 0x57, 0x97, 0x80, 0xd4, 0x63, 0x8b, 0x52, - 0xeb, 0x80, 0x18, 0xb8, 0x6e, 0x1b, 0xd8, 0x71, 0x28, 0xc7, 0xdc, 0xa6, 0x0e, 0xf3, 0x0b, 0x52, - 0xb3, 0x92, 0xb1, 0x8c, 0x19, 0x31, 0x70, 0xb9, 0x62, 0xb7, 0x89, 0xbd, 0x8d, 0x04, 0xa5, 0xae, - 0xca, 0x72, 0x57, 0x9e, 0x4d, 0x58, 0xd4, 0xa2, 0x62, 0x69, 0x78, 0x2b, 0xf9, 0xdf, 0xc5, 0x20, - 0xed, 0x61, 0x93, 0x34, 0x8e, 0xdb, 0x95, 0x75, 0x6c, 0xd9, 0x8e, 0xf0, 0xe0, 0x63, 0x35, 0x0e, - 0x68, 0x9d, 0xf0, 0x5d, 0x97, 0x15, 0x8e, 0x88, 0xc3, 0x4d, 0x72, 0xd8, 0x24, 0x8c, 0xa3, 0x49, - 0x18, 0x24, 0xde, 0x9e, 0x25, 0x95, 0x74, 0x6c, 0x61, 0xc4, 0x94, 0x3b, 0xb4, 0x06, 0xd0, 0x61, - 0x48, 0x46, 0xd3, 0xca, 0x42, 0x3c, 0x3b, 0xa7, 0xcb, 0xd8, 0x9e, 0x9c, 0x2e, 0xe4, 0x5a, 0xf1, - 0xf5, 0x1d, 0x6c, 0x11, 0xc9, 0x69, 0x06, 0x2a, 0xb5, 0x73, 0x05, 0xc6, 0xbb, 0x64, 0x59, 0x9d, - 0x3a, 0x8c, 0xa0, 0x79, 0x88, 0x71, 0xd7, 0x17, 0x8d, 0x67, 0x1f, 0xe8, 0x57, 0xfa, 0xa9, 0xef, - 0xba, 0xa6, 0x87, 0x40, 0xeb, 0x30, 0xca, 0xdd, 0x52, 0x43, 0xd6, 0xb1, 0x64, 0x54, 0x54, 0x3c, - 0xed, 0xb2, 0x22, 0x7a, 0x18, 0x28, 0x94, 0x60, 0x33, 0xce, 0xdb, 0x6b, 0x8f, 0x28, 0x98, 0x28, - 0x26, 0x12, 0xcd, 0xdf, 0x98, 0x48, 0x32, 0x05, 0x23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x50, 0x95, 0xdf, 0x17, 0xaa, 0xf2, 0xed, 0x52, 0x8d, 0x9c, - 0x5f, 0xaa, 0x91, 0x5f, 0x97, 0x6a, 0xe4, 0x43, 0xc6, 0xb2, 0xf9, 0x7e, 0xb3, 0xac, 0x57, 0x68, - 0xad, 0x55, 0xeb, 0xff, 0x79, 0xc6, 0xaa, 0x9f, 0x0c, 0x7e, 0x5c, 0x27, 0x1e, 0x59, 0x79, 0x50, - 0xfc, 0x70, 0x3c, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0x96, 0xba, 0xfb, 0xcb, 0x0f, 0x07, 0x00, - 0x00, + // 765 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0xdb, 0x48, + 0x18, 0x8d, 0x13, 0x96, 0x84, 0x2f, 0xb0, 0x9b, 0x1d, 0x58, 0x36, 0x84, 0x5d, 0x13, 0xcc, 0x06, + 0x22, 0xa4, 0xb5, 0x45, 0x76, 0x0f, 0xa8, 0xaa, 0x54, 0x91, 0x10, 0x10, 0x6a, 0xf9, 0x21, 0x87, + 0x1e, 0x5a, 0x55, 0x8a, 0x9c, 0x64, 0x30, 0x56, 0x89, 0x27, 0x78, 0x26, 0xc8, 0x11, 0xa0, 0x4a, + 0x3d, 0xf6, 0xd2, 0x4a, 0xfd, 0xa7, 0x7a, 0x44, 0xea, 0xa5, 0xc7, 0x0a, 0xfa, 0x47, 0xf4, 0x58, + 0x79, 0x3c, 0x49, 0x9c, 0xe0, 0x00, 0xea, 0x89, 0x19, 0xe6, 0xbd, 0xf7, 0xbd, 0xf7, 0x7d, 0xe3, + 0x09, 0x2c, 0xd4, 0x09, 0x6d, 0x12, 0xaa, 0x31, 0x57, 0x3b, 0x5b, 0xab, 0x61, 0x66, 0xac, 0x69, + 0x14, 0x3b, 0x67, 0x56, 0x1d, 0xab, 0x2d, 0x87, 0x30, 0x82,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 0x32, + 0x1b, 0x6e, 0xc2, 0xcb, 0x7c, 0x01, 0xc9, 0xc0, 0xdb, 0x17, 0x6a, 0xe0, 0xf6, 0x6b, 0x1d, 0x6a, + 0x20, 0xe4, 0x09, 0x55, 0x64, 0x6e, 0x20, 0x8d, 0x46, 0x18, 0x28, 0x3e, 0xf9, 0x74, 0x2d, 0x4b, + 0x57, 0xd7, 0xb2, 0xf4, 0xf5, 0x5a, 0x96, 0x3e, 0xdc, 0xc8, 0x91, 0xab, 0x1b, 0x39, 0xf2, 0xe5, + 0x46, 0x8e, 0xbc, 0xcc, 0x99, 0x16, 0x3b, 0x6e, 0xd7, 0xd4, 0x3a, 0x69, 0x76, 0xb9, 0xfe, 0x9f, + 0x7f, 0x69, 0xe3, 0xb5, 0xc6, 0x3a, 0x2d, 0xec, 0x89, 0xd5, 0xc6, 0xf9, 0x8f, 0xca, 0x7f, 0x3f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, 0x60, 0x88, 0xc9, 0x2b, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -779,6 +789,13 @@ func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.OrderBy) > 0 { + i -= len(m.OrderBy) + copy(dAtA[i:], m.OrderBy) + i = encodeVarintService(dAtA, i, uint64(len(m.OrderBy))) + i-- + dAtA[i] = 0x1a + } if m.Pagination != nil { { size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) @@ -1122,6 +1139,10 @@ func (m *GetTxsEventRequest) Size() (n int) { l = m.Pagination.Size() n += 1 + l + sovService(uint64(l)) } + l = len(m.OrderBy) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } return n } @@ -1342,6 +1363,38 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderBy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OrderBy = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index d33bcac91329..2b0aa8a32650 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -52,6 +52,7 @@ func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventReque if err != nil { return nil, err } + orderBy := parseOrderBy(req.OrderBy) if len(req.Events) == 0 { return nil, status.Error(codes.InvalidArgument, "must declare at least one event to search") @@ -63,7 +64,7 @@ func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventReque } } - result, err := QueryTxsByEvents(s.clientCtx, req.Events, page, limit, "") + result, err := QueryTxsByEvents(s.clientCtx, req.Events, page, limit, orderBy) if err != nil { return nil, err } @@ -161,3 +162,10 @@ func RegisterTxService( func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.ServeMux) { txtypes.RegisterServiceHandlerClient(context.Background(), mux, txtypes.NewServiceClient(clientConn)) } + +func parseOrderBy(orderBy string) string { + if orderBy == "desc" || orderBy == "asc" { + return orderBy + } + return "asc" +} diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index b460867b4b25..390598a53445 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -173,6 +173,14 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { &tx.GetTxsEventRequest{Events: []string{"foobar"}}, true, "event foobar should be of the format: {eventType}.{eventAttribute}={value}", }, + { + "request with order-by", + &tx.GetTxsEventRequest{ + Events: []string{"message.action='/cosmos.bank.v1beta1.Msg/Send'"}, + OrderBy: "asc", + }, + false, "", + }, { "without pagination", &tx.GetTxsEventRequest{ @@ -248,6 +256,12 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPCGateway() { false, "", }, + { + "expect pass with with order-by filter", + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=asc", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), + false, + "", + }, { "expect pass with multiple-events", fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), From 4462b293b219bb12dca5b5aa2295db53125239f7 Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Tue, 9 Mar 2021 13:44:46 +0530 Subject: [PATCH 2/7] add orderby parameter --- server/rosetta/client_online.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/rosetta/client_online.go b/server/rosetta/client_online.go index f5e5cfafeebf..741236c50977 100644 --- a/server/rosetta/client_online.go +++ b/server/rosetta/client_online.go @@ -173,7 +173,7 @@ func (c *Client) BlockTransactionsByHash(ctx context.Context, hash string) (crgt return crgtypes.BlockTransactionsResponse{}, err } - txs, err := c.listTransactionsInBlock(ctx, blockResp.Block.Index) + txs, err := c.listTransactionsInBlock(ctx, blockResp.Block.Index, "asc") if err != nil { return crgtypes.BlockTransactionsResponse{}, err } @@ -190,7 +190,7 @@ func (c *Client) BlockTransactionsByHeight(ctx context.Context, height *int64) ( return crgtypes.BlockTransactionsResponse{}, err } - txs, err := c.listTransactionsInBlock(ctx, blockResp.Block.Index) + txs, err := c.listTransactionsInBlock(ctx, blockResp.Block.Index, "asc") if err != nil { return crgtypes.BlockTransactionsResponse{}, err } @@ -211,9 +211,9 @@ func (c *Client) coins(ctx context.Context) (sdk.Coins, error) { } // listTransactionsInBlock returns the list of the transactions in a block given its height -func (c *Client) listTransactionsInBlock(ctx context.Context, height int64) ([]*sdkTxWithHash, error) { +func (c *Client) listTransactionsInBlock(ctx context.Context, height int64, orderBy string) ([]*sdkTxWithHash, error) { txQuery := fmt.Sprintf(`tx.height=%d`, height) - txList, err := c.clientCtx.Client.TxSearch(ctx, txQuery, true, nil, nil, "") + txList, err := c.clientCtx.Client.TxSearch(ctx, txQuery, true, nil, nil, orderBy) if err != nil { return nil, crgerrs.WrapError(crgerrs.ErrUnknown, err.Error()) } From 3f1f12a4fbfa7220386f6395fa47a2f618764cbe Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Fri, 12 Mar 2021 10:25:32 +0530 Subject: [PATCH 3/7] change orderBy param to enum --- docs/core/proto-docs.md | 16 ++- proto/cosmos/tx/v1beta1/service.proto | 11 +- types/tx/service.pb.go | 187 +++++++++++++++----------- x/auth/tx/service.go | 12 +- x/auth/tx/service_test.go | 2 +- 5 files changed, 142 insertions(+), 86 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 9fe9ada73eef..c65cf871beeb 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -515,6 +515,7 @@ - [SimulateResponse](#cosmos.tx.v1beta1.SimulateResponse) - [BroadcastMode](#cosmos.tx.v1beta1.BroadcastMode) + - [OrderBy](#cosmos.tx.v1beta1.OrderBy) - [Service](#cosmos.tx.v1beta1.Service) @@ -7221,7 +7222,7 @@ RPC method. | ----- | ---- | ----- | ----------- | | `events` | [string](#string) | repeated | events is the list of transaction event type. | | `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an pagination for the request. | -| `order_by` | [string](#string) | | order_by defines events sorting order | +| `order_by` | [OrderBy](#cosmos.tx.v1beta1.OrderBy) | | | @@ -7294,6 +7295,19 @@ BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC metho | BROADCAST_MODE_ASYNC | 3 | BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns immediately. | + + + +### OrderBy +OrderBy defines the sorting order + +| Name | Number | Description | +| ---- | ------ | ----------- | +| UNKNOWN | 0 | | +| ASC | 1 | | +| DESC | 2 | | + + diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 51d93b881579..2abd6ee61df9 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -7,6 +7,7 @@ import "cosmos/tx/v1beta1/tx.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +option (gogoproto.goproto_registration) = true; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; // Service defines a gRPC service for interacting with transactions. @@ -42,8 +43,14 @@ message GetTxsEventRequest { repeated string events = 1; // pagination defines an pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 2; - // order_by defines events sorting order - string order_by = 3; + OrderBy order_by = 3; +} + +// OrderBy defines the sorting order +enum OrderBy { + UNKNOWN = 0; + ASC = 1; + DESC = 2; } // GetTxsEventResponse is the response type for the Service.TxsByEvents diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index c1a37d45848c..dec146e00fd5 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -11,6 +11,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -22,6 +23,7 @@ import ( // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal +var _ = golang_proto.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -31,6 +33,35 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// OrderBy defines the sorting order +type OrderBy int32 + +const ( + OrderBy_UNKNOWN OrderBy = 0 + OrderBy_ASC OrderBy = 1 + OrderBy_DESC OrderBy = 2 +) + +var OrderBy_name = map[int32]string{ + 0: "UNKNOWN", + 1: "ASC", + 2: "DESC", +} + +var OrderBy_value = map[string]int32{ + "UNKNOWN": 0, + "ASC": 1, + "DESC": 2, +} + +func (x OrderBy) String() string { + return proto.EnumName(OrderBy_name, int32(x)) +} + +func (OrderBy) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{0} +} + // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. type BroadcastMode int32 @@ -67,7 +98,7 @@ func (x BroadcastMode) String() string { } func (BroadcastMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{0} + return fileDescriptor_e0b00a618705eca7, []int{1} } // GetTxsEventRequest is the request type for the Service.TxsByEvents @@ -77,8 +108,7 @@ type GetTxsEventRequest struct { Events []string `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` // pagination defines an pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` - // order_by defines events sorting order - OrderBy string `protobuf:"bytes,3,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` + OrderBy OrderBy `protobuf:"varint,3,opt,name=order_by,json=orderBy,proto3,enum=cosmos.tx.v1beta1.OrderBy" json:"order_by,omitempty"` } func (m *GetTxsEventRequest) Reset() { *m = GetTxsEventRequest{} } @@ -128,11 +158,11 @@ func (m *GetTxsEventRequest) GetPagination() *query.PageRequest { return nil } -func (m *GetTxsEventRequest) GetOrderBy() string { +func (m *GetTxsEventRequest) GetOrderBy() OrderBy { if m != nil { return m.OrderBy } - return "" + return OrderBy_UNKNOWN } // GetTxsEventResponse is the response type for the Service.TxsByEvents @@ -508,69 +538,86 @@ func (m *GetTxResponse) GetTxResponse() *types.TxResponse { } func init() { + proto.RegisterEnum("cosmos.tx.v1beta1.OrderBy", OrderBy_name, OrderBy_value) + golang_proto.RegisterEnum("cosmos.tx.v1beta1.OrderBy", OrderBy_name, OrderBy_value) proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value) + golang_proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value) proto.RegisterType((*GetTxsEventRequest)(nil), "cosmos.tx.v1beta1.GetTxsEventRequest") + golang_proto.RegisterType((*GetTxsEventRequest)(nil), "cosmos.tx.v1beta1.GetTxsEventRequest") proto.RegisterType((*GetTxsEventResponse)(nil), "cosmos.tx.v1beta1.GetTxsEventResponse") + golang_proto.RegisterType((*GetTxsEventResponse)(nil), "cosmos.tx.v1beta1.GetTxsEventResponse") proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") + golang_proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") + golang_proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest") + golang_proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest") proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse") + golang_proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse") proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest") + golang_proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest") proto.RegisterType((*GetTxResponse)(nil), "cosmos.tx.v1beta1.GetTxResponse") + golang_proto.RegisterType((*GetTxResponse)(nil), "cosmos.tx.v1beta1.GetTxResponse") } func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } +func init() { + golang_proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) +} var fileDescriptor_e0b00a618705eca7 = []byte{ - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0xdb, 0x48, - 0x18, 0x8d, 0x13, 0x96, 0x84, 0x2f, 0xb0, 0x9b, 0x1d, 0x58, 0x36, 0x84, 0x5d, 0x13, 0xcc, 0x06, - 0x22, 0xa4, 0xb5, 0x45, 0x76, 0x0f, 0xa8, 0xaa, 0x54, 0x91, 0x10, 0x10, 0x6a, 0xf9, 0x21, 0x87, - 0x1e, 0x5a, 0x55, 0x8a, 0x9c, 0x64, 0x30, 0x56, 0x89, 0x27, 0x78, 0x26, 0xc8, 0x11, 0xa0, 0x4a, - 0x3d, 0xf6, 0xd2, 0x4a, 0xfd, 0xa7, 0x7a, 0x44, 0xea, 0xa5, 0xc7, 0x0a, 0xfa, 0x47, 0xf4, 0x58, - 0x79, 0x3c, 0x49, 0x9c, 0xe0, 0x00, 0xea, 0x89, 0x19, 0xe6, 0xbd, 0xf7, 0xbd, 0xf7, 0x7d, 0xe3, - 0x09, 0x2c, 0xd4, 0x09, 0x6d, 0x12, 0xaa, 0x31, 0x57, 0x3b, 0x5b, 0xab, 0x61, 0x66, 0xac, 0x69, - 0x14, 0x3b, 0x67, 0x56, 0x1d, 0xab, 0x2d, 0x87, 0x30, 0x82, 0x7e, 0xf7, 0x01, 0x2a, 0x73, 0x55, - 0x01, 0xc8, 0xfc, 0x65, 0x12, 0x62, 0x9e, 0x60, 0xcd, 0x68, 0x59, 0x9a, 0x61, 0xdb, 0x84, 0x19, - 0xcc, 0x22, 0x36, 0xf5, 0x09, 0x99, 0x25, 0xa1, 0x58, 0x33, 0x28, 0xd6, 0x8c, 0x5a, 0xdd, 0xea, - 0x09, 0x7b, 0x1b, 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96, 0x3e, 0xdc, 0xc8, 0x91, 0xab, 0x1b, 0x39, 0xf2, 0xe5, - 0x46, 0x8e, 0xbc, 0xcc, 0x99, 0x16, 0x3b, 0x6e, 0xd7, 0xd4, 0x3a, 0x69, 0x76, 0xb9, 0xfe, 0x9f, - 0x7f, 0x69, 0xe3, 0xb5, 0xc6, 0x3a, 0x2d, 0xec, 0x89, 0xd5, 0xc6, 0xf9, 0x8f, 0xca, 0x7f, 0x3f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x09, 0x60, 0x88, 0xc9, 0x2b, 0x07, 0x00, 0x00, + // 813 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x9d, 0xd2, 0x64, 0x5f, 0xba, 0x4b, 0x98, 0x2e, 0x4b, 0xc8, 0x82, 0x9b, 0xf5, 0x92, + 0x6e, 0x88, 0x84, 0xad, 0x06, 0x90, 0x2a, 0xc4, 0x25, 0xbf, 0x5a, 0x55, 0xa5, 0x49, 0xe5, 0xb4, + 0x42, 0x20, 0xa4, 0xc8, 0x49, 0xa6, 0xae, 0x45, 0xe3, 0x49, 0x3d, 0x93, 0xca, 0x51, 0x5b, 0x21, + 0x71, 0xe4, 0x84, 0xc4, 0x9f, 0xc1, 0x3f, 0xc1, 0x91, 0x63, 0x25, 0x2e, 0x1c, 0x51, 0xc3, 0x1f, + 0xc1, 0x11, 0x79, 0x3c, 0x49, 0x9c, 0xd4, 0x69, 0xab, 0x3d, 0xf5, 0x4d, 0xe7, 0x7b, 0xdf, 0xfb, + 0xde, 0x37, 0xcf, 0x2f, 0xb0, 0xd1, 0x25, 0xb4, 0x4f, 0xa8, 0xce, 0x3c, 0xfd, 0x62, 0xab, 0x83, + 0x99, 0xb9, 0xa5, 0x53, 0xec, 0x5e, 0xd8, 0x5d, 0xac, 0x0d, 0x5c, 0xc2, 0x08, 0x7a, 0x2f, 0x00, + 0x68, 0xcc, 0xd3, 0x04, 0x20, 0xfb, 0x91, 0x45, 0x88, 0x75, 0x86, 0x75, 0x73, 0x60, 0xeb, 0xa6, + 0xe3, 0x10, 0x66, 0x32, 0x9b, 0x38, 0x34, 0x48, 0xc8, 0xbe, 0x16, 0x8c, 0x1d, 0x93, 0x62, 0xdd, + 0xec, 0x74, 0xed, 0x29, 0xb1, 0x7f, 0x10, 0xa0, 0xec, 0xdd, 0xb2, 0xcc, 0x13, 0x77, 0xcf, 0x2d, + 0x62, 0x11, 0x1e, 0xea, 0x7e, 0x24, 0xfe, 0x5b, 0x0c, 0xd3, 0x9e, 0x0f, 0xb1, 0x3b, 0x9a, 0x66, + 0x0e, 0x4c, 0xcb, 0x76, 0xb8, 0x86, 0x00, 0xab, 0xfe, 0x2e, 0x01, 0xda, 0xc5, 0xec, 0xc8, 0xa3, + 0xf5, 0x0b, 0xec, 0x30, 0x03, 0x9f, 0x0f, 0x31, 0x65, 0xe8, 0x05, 0xac, 0x62, 0xff, 0x4c, 0x33, + 0x52, 0x2e, 0x5e, 0x78, 0x62, 0x88, 0x13, 0xda, 0x01, 0x98, 0x51, 0x64, 0xe4, 0x9c, 0x54, 0x48, + 0x95, 0x36, 0x35, 0xd1, 0xb7, 0x5f, 0x4f, 0xe3, 0xf5, 0x26, 0xfd, 0x6b, 0x87, 0xa6, 0x85, 0x05, + 0xa7, 0x11, 0xca, 0x44, 0x5f, 0x42, 0x92, 0xb8, 0x3d, 0xec, 0xb6, 0x3b, 0xa3, 0x4c, 0x3c, 0x27, + 0x15, 0x9e, 0x95, 0xb2, 0xda, 0x1d, 0xf7, 0xb4, 0xa6, 0x0f, 0xa9, 0x8c, 0x8c, 0x04, 0x09, 0x02, + 0xf5, 0x46, 0x82, 0xf5, 0x39, 0xb5, 0x74, 0x40, 0x1c, 0x8a, 0xd1, 0x1b, 0x88, 0x33, 0x2f, 0xd0, + 0x9a, 0x2a, 0xbd, 0x1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fc, 0xdc, 0xd9, 0xdc, 0x72, 0x80, 0xa8, 0x99, 0xe7, 0x35, 0x37, 0xd0, 0xc7, 0x7a, 0xd4, 0x52, + 0xa6, 0xfa, 0xa5, 0x3f, 0x22, 0xd7, 0xe8, 0x27, 0x48, 0x85, 0x3e, 0x36, 0x94, 0xbf, 0xef, 0x1b, + 0x9d, 0x95, 0xdf, 0x7c, 0x08, 0x26, 0x44, 0xbc, 0xe2, 0x22, 0x5e, 0xaa, 0x2f, 0xa2, 0x45, 0xf8, + 0x3d, 0x5f, 0x41, 0x2a, 0xb4, 0x26, 0x23, 0x05, 0xdc, 0x5d, 0xfa, 0x91, 0x02, 0x22, 0xb6, 0xad, + 0xaa, 0x70, 0x01, 0x19, 0xb4, 0x44, 0x40, 0xa5, 0xfa, 0xe7, 0xad, 0x22, 0xdd, 0xdc, 0x2a, 0xd2, + 0x3f, 0xb7, 0x8a, 0xf4, 0xeb, 0x58, 0x89, 0xfd, 0x31, 0x56, 0xa4, 0x9b, 0xb1, 0x12, 0xfb, 0x7b, + 0xac, 0xc4, 0xbe, 0xcf, 0x5b, 0x36, 0x3b, 0x1d, 0x76, 0xb4, 0x2e, 0xe9, 0x4f, 0xf2, 0x83, 0x3f, + 0x9f, 0xd1, 0xde, 0x8f, 0x3a, 0x1b, 0x0d, 0xb0, 0x4f, 0xd8, 0x59, 0xe5, 0xbf, 0x4f, 0x9f, 0xff, + 0x1f, 0x00, 0x00, 0xff, 0xff, 0x16, 0xe2, 0x93, 0xd4, 0x76, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -789,12 +836,10 @@ func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.OrderBy) > 0 { - i -= len(m.OrderBy) - copy(dAtA[i:], m.OrderBy) - i = encodeVarintService(dAtA, i, uint64(len(m.OrderBy))) + if m.OrderBy != 0 { + i = encodeVarintService(dAtA, i, uint64(m.OrderBy)) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x18 } if m.Pagination != nil { { @@ -1139,9 +1184,8 @@ func (m *GetTxsEventRequest) Size() (n int) { l = m.Pagination.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.OrderBy) - if l > 0 { - n += 1 + l + sovService(uint64(l)) + if m.OrderBy != 0 { + n += 1 + sovService(uint64(m.OrderBy)) } return n } @@ -1364,10 +1408,10 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OrderBy", wireType) } - var stringLen uint64 + m.OrderBy = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1377,24 +1421,11 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.OrderBy |= OrderBy(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderBy = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 2b0aa8a32650..6d945a908509 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -163,9 +163,13 @@ func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.Serv txtypes.RegisterServiceHandlerClient(context.Background(), mux, txtypes.NewServiceClient(clientConn)) } -func parseOrderBy(orderBy string) string { - if orderBy == "desc" || orderBy == "asc" { - return orderBy +func parseOrderBy(orderBy txtypes.OrderBy) string { + switch orderBy { + case txtypes.OrderBy_ASC: + return "asc" + case txtypes.OrderBy_DESC: + return "desc" + default: + return "asc" } - return "asc" } diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 390598a53445..19b3f1e71ded 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -177,7 +177,7 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { "request with order-by", &tx.GetTxsEventRequest{ Events: []string{"message.action='/cosmos.bank.v1beta1.Msg/Send'"}, - OrderBy: "asc", + OrderBy: tx.OrderBy_ASC, }, false, "", }, From 8dfd45bfcdb22b757e0a2790609a0610bc5d9908 Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Fri, 12 Mar 2021 10:49:50 +0530 Subject: [PATCH 4/7] lint --- docs/core/proto-docs.md | 6 +- proto/cosmos/tx/v1beta1/service.proto | 9 +- types/tx/service.pb.go | 128 +++++++++++++------------- x/auth/tx/service.go | 4 +- x/auth/tx/service_test.go | 4 +- 5 files changed, 79 insertions(+), 72 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index c65cf871beeb..a72edf1aa055 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -7303,9 +7303,9 @@ OrderBy defines the sorting order | Name | Number | Description | | ---- | ------ | ----------- | -| UNKNOWN | 0 | | -| ASC | 1 | | -| DESC | 2 | | +| ORDER_BY_UNKNOWN | 0 | ORDER_BY_UNKNOWN specifies an unknown sorting order | +| ORDER_BY_ASC | 1 | ORDER_BY_ASC defines ascending order | +| ORDER_BY_DESC | 2 | ORDER_BY_DESC defines descending order | diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 2abd6ee61df9..73573668a683 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -48,9 +48,12 @@ message GetTxsEventRequest { // OrderBy defines the sorting order enum OrderBy { - UNKNOWN = 0; - ASC = 1; - DESC = 2; + // ORDER_BY_UNKNOWN specifies an unknown sorting order + ORDER_BY_UNKNOWN = 0; + // ORDER_BY_ASC defines ascending order + ORDER_BY_ASC = 1; + // ORDER_BY_DESC defines descending order + ORDER_BY_DESC = 2; } // GetTxsEventResponse is the response type for the Service.TxsByEvents diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index dec146e00fd5..3e8ab9e5cac0 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -37,21 +37,24 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type OrderBy int32 const ( - OrderBy_UNKNOWN OrderBy = 0 - OrderBy_ASC OrderBy = 1 - OrderBy_DESC OrderBy = 2 + // ORDER_BY_UNKNOWN specifies an unknown sorting order + OrderBy_ORDER_BY_UNKNOWN OrderBy = 0 + // ORDER_BY_ASC defines ascending order + OrderBy_ORDER_BY_ASC OrderBy = 1 + // ORDER_BY_DESC defines descending order + OrderBy_ORDER_BY_DESC OrderBy = 2 ) var OrderBy_name = map[int32]string{ - 0: "UNKNOWN", - 1: "ASC", - 2: "DESC", + 0: "ORDER_BY_UNKNOWN", + 1: "ORDER_BY_ASC", + 2: "ORDER_BY_DESC", } var OrderBy_value = map[string]int32{ - "UNKNOWN": 0, - "ASC": 1, - "DESC": 2, + "ORDER_BY_UNKNOWN": 0, + "ORDER_BY_ASC": 1, + "ORDER_BY_DESC": 2, } func (x OrderBy) String() string { @@ -162,7 +165,7 @@ func (m *GetTxsEventRequest) GetOrderBy() OrderBy { if m != nil { return m.OrderBy } - return OrderBy_UNKNOWN + return OrderBy_ORDER_BY_UNKNOWN } // GetTxsEventResponse is the response type for the Service.TxsByEvents @@ -566,58 +569,59 @@ func init() { } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 813 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6f, 0xe3, 0x44, - 0x14, 0x8e, 0x9d, 0xd2, 0x64, 0x5f, 0xba, 0x4b, 0x98, 0x2e, 0x4b, 0xc8, 0x82, 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 0x03, 0x9f, 0x0f, 0x31, 0x65, 0xe8, 0x05, 0xac, 0x62, 0xff, 0x4c, 0x33, - 0x52, 0x2e, 0x5e, 0x78, 0x62, 0x88, 0x13, 0xda, 0x01, 0x98, 0x51, 0x64, 0xe4, 0x9c, 0x54, 0x48, - 0x95, 0x36, 0x35, 0xd1, 0xb7, 0x5f, 0x4f, 0xe3, 0xf5, 0x26, 0xfd, 0x6b, 0x87, 0xa6, 0x85, 0x05, - 0xa7, 0x11, 0xca, 0x44, 0x5f, 0x42, 0x92, 0xb8, 0x3d, 0xec, 0xb6, 0x3b, 0xa3, 0x4c, 0x3c, 0x27, - 0x15, 0x9e, 0x95, 0xb2, 0xda, 0x1d, 0xf7, 0xb4, 0xa6, 0x0f, 0xa9, 0x8c, 0x8c, 0x04, 0x09, 0x02, - 0xf5, 0x46, 0x82, 0xf5, 0x39, 0xb5, 0x74, 0x40, 0x1c, 0x8a, 0xd1, 0x1b, 0x88, 0x33, 0x2f, 0xd0, - 0x9a, 0x2a, 0xbd, 0x1f, 0xc1, 0x74, 0xe4, 0x19, 0x3e, 0x02, 0xed, 0xc2, 0x1a, 0xf3, 0xda, 0xae, - 0xc8, 0xa3, 0x19, 0x99, 0x67, 0x7c, 0x32, 0xd7, 0x01, 0xf7, 0x3e, 0x94, 0x28, 0xc0, 0x46, 0x8a, - 0x4d, 0x63, 0x9f, 0x28, 0x6c, 0x44, 0x9c, 0x1b, 0xf1, 0xe6, 0x41, 0x23, 0x04, 0x53, 0x28, 0x55, - 0xc5, 0x80, 0x2a, 0x2e, 0x31, 0x7b, 0x5d, 0x93, 0x32, 0xbf, 0x58, 0xe0, 0xff, 0x87, 0x90, 0x64, - 0x5e, 0xbb, 0x33, 0x62, 0xd8, 0xef, 0x4a, 0x2a, 0xac, 0x19, 0x09, 0xe6, 0x55, 0xfc, 0x23, 0xfa, - 0x02, 0x56, 0xfa, 0xa4, 0x87, 0xb9, 0xf9, 0xcf, 0x4a, 0xb9, 0x88, 0x66, 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fd, 0x31, 0x56, 0xa4, 0x9b, 0xb1, 0x12, 0xfb, 0x7b, - 0xac, 0xc4, 0xbe, 0xcf, 0x5b, 0x36, 0x3b, 0x1d, 0x76, 0xb4, 0x2e, 0xe9, 0x4f, 0xf2, 0x83, 0x3f, - 0x9f, 0xd1, 0xde, 0x8f, 0x3a, 0x1b, 0x0d, 0xb0, 0x4f, 0xd8, 0x59, 0xe5, 0xbf, 0x4f, 0x9f, 0xff, - 0x1f, 0x00, 0x00, 0xff, 0xff, 0x16, 0xe2, 0x93, 0xd4, 0x76, 0x07, 0x00, 0x00, + // 827 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x8e, 0x9d, 0xb2, 0x49, 0x5f, 0xb2, 0xc5, 0x9d, 0x5d, 0x4a, 0x48, 0xc1, 0x9b, 0xba, 0x64, + 0x1b, 0x45, 0xc2, 0x56, 0x03, 0x48, 0x15, 0xe2, 0x92, 0x5f, 0x5d, 0xad, 0x4a, 0x93, 0xca, 0xd9, + 0x0a, 0x15, 0x21, 0x59, 0x4e, 0x32, 0xf5, 0x5a, 0x6c, 0x3c, 0x59, 0xcf, 0x64, 0xe5, 0xa8, 0xad, + 0x90, 0x38, 0x72, 0x42, 0xe2, 0xcf, 0xe0, 0x9f, 0xe0, 0xc8, 0x71, 0x25, 0x2e, 0x1c, 0xd1, 0x86, + 0x3f, 0x82, 0x23, 0xf2, 0x78, 0x92, 0x38, 0x59, 0x67, 0x77, 0xc5, 0x29, 0x6f, 0x3c, 0xdf, 0xfb, + 0xde, 0xf7, 0xbe, 0x79, 0x33, 0x81, 0xbd, 0x01, 0xa1, 0x23, 0x42, 0x0d, 0x16, 0x18, 0x67, 0x8f, + 0xfb, 0x98, 0xd9, 0x8f, 0x0d, 0x8a, 0xfd, 0x33, 0x77, 0x80, 0xf5, 0xb1, 0x4f,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, 0xb6, 0x00, + 0x7f, 0x25, 0x55, 0xd1, 0x29, 0xbc, 0xc7, 0xcf, 0x12, 0xed, 0x25, 0xb0, 0xc6, 0x27, 0xa1, 0x58, + 0xda, 0x0c, 0x10, 0x35, 0xcb, 0xbc, 0xe6, 0x1e, 0xfa, 0xc4, 0x48, 0x7a, 0xaf, 0xa9, 0xf1, 0x26, + 0x9c, 0x9e, 0x77, 0xe8, 0x47, 0xc8, 0xc5, 0xee, 0x21, 0x2a, 0x5f, 0x75, 0x7d, 0x97, 0xe5, 0xf7, + 0xaf, 0x83, 0x09, 0x11, 0x0f, 0xb8, 0x88, 0xfb, 0xda, 0xbd, 0x64, 0x11, 0x61, 0xcf, 0x6f, 0x21, + 0x17, 0x7b, 0x41, 0x13, 0x05, 0x5c, 0xfe, 0x3f, 0x48, 0x14, 0x90, 0xf0, 0x10, 0x6b, 0x2a, 0x17, + 0x50, 0x40, 0x1b, 0x04, 0x34, 0x9a, 0x7f, 0x5c, 0xa8, 0xd2, 0xf9, 0x85, 0x2a, 0xfd, 0x7d, 0xa1, + 0x4a, 0xbf, 0xcc, 0xd4, 0xd4, 0xef, 0x33, 0x55, 0x3a, 0x9f, 0xa9, 0xa9, 0xbf, 0x66, 0x6a, 0xea, + 0xbb, 0xb2, 0xe3, 0xb2, 0xe3, 0x49, 0x5f, 0x1f, 0x90, 0xd1, 0x3c, 0x3f, 0xfa, 0xf9, 0x8c, 0x0e, + 0x7f, 0x30, 0xd8, 0x74, 0x8c, 0x43, 0xc2, 0xfe, 0x16, 0xff, 0xeb, 0xfa, 0xfc, 0xbf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x1b, 0x62, 0x6e, 0x4d, 0x91, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 6d945a908509..2d73a110b704 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -165,9 +165,9 @@ func RegisterGRPCGatewayRoutes(clientConn gogogrpc.ClientConn, mux *runtime.Serv func parseOrderBy(orderBy txtypes.OrderBy) string { switch orderBy { - case txtypes.OrderBy_ASC: + case txtypes.OrderBy_ORDER_BY_ASC: return "asc" - case txtypes.OrderBy_DESC: + case txtypes.OrderBy_ORDER_BY_DESC: return "desc" default: return "asc" diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 19b3f1e71ded..811a5485524a 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -177,7 +177,7 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { "request with order-by", &tx.GetTxsEventRequest{ Events: []string{"message.action='/cosmos.bank.v1beta1.Msg/Send'"}, - OrderBy: tx.OrderBy_ASC, + OrderBy: tx.OrderBy_ORDER_BY_ASC, }, false, "", }, @@ -258,7 +258,7 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPCGateway() { }, { "expect pass with with order-by filter", - fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=asc", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=ORDER_BY_ASC", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), false, "", }, From 888034871a57a4484414c3d77ebcd1f71a25d57c Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Fri, 12 Mar 2021 11:02:41 +0530 Subject: [PATCH 5/7] proto lint --- docs/core/proto-docs.md | 2 +- proto/cosmos/tx/v1beta1/service.proto | 4 +- types/tx/service.pb.go | 120 +++++++++++++------------- x/auth/tx/service_test.go | 14 ++- 4 files changed, 76 insertions(+), 64 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index a72edf1aa055..0a453431d792 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -7303,7 +7303,7 @@ OrderBy defines the sorting order | Name | Number | Description | | ---- | ------ | ----------- | -| ORDER_BY_UNKNOWN | 0 | ORDER_BY_UNKNOWN specifies an unknown sorting order | +| ORDER_BY_UNSPECIFIED | 0 | ORDER_BY_UNSPECIFIED specifies an unknown sorting order | | ORDER_BY_ASC | 1 | ORDER_BY_ASC defines ascending order | | ORDER_BY_DESC | 2 | ORDER_BY_DESC defines descending order | diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 73573668a683..839b510de614 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -48,8 +48,8 @@ message GetTxsEventRequest { // OrderBy defines the sorting order enum OrderBy { - // ORDER_BY_UNKNOWN specifies an unknown sorting order - ORDER_BY_UNKNOWN = 0; + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order + ORDER_BY_UNSPECIFIED = 0; // ORDER_BY_ASC defines ascending order ORDER_BY_ASC = 1; // ORDER_BY_DESC defines descending order diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 3e8ab9e5cac0..23f6eb887f17 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -37,8 +37,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type OrderBy int32 const ( - // ORDER_BY_UNKNOWN specifies an unknown sorting order - OrderBy_ORDER_BY_UNKNOWN OrderBy = 0 + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order + OrderBy_ORDER_BY_UNSPECIFIED OrderBy = 0 // ORDER_BY_ASC defines ascending order OrderBy_ORDER_BY_ASC OrderBy = 1 // ORDER_BY_DESC defines descending order @@ -46,15 +46,15 @@ const ( ) var OrderBy_name = map[int32]string{ - 0: "ORDER_BY_UNKNOWN", + 0: "ORDER_BY_UNSPECIFIED", 1: "ORDER_BY_ASC", 2: "ORDER_BY_DESC", } var OrderBy_value = map[string]int32{ - "ORDER_BY_UNKNOWN": 0, - "ORDER_BY_ASC": 1, - "ORDER_BY_DESC": 2, + "ORDER_BY_UNSPECIFIED": 0, + "ORDER_BY_ASC": 1, + "ORDER_BY_DESC": 2, } func (x OrderBy) String() string { @@ -165,7 +165,7 @@ func (m *GetTxsEventRequest) GetOrderBy() OrderBy { if m != nil { return m.OrderBy } - return OrderBy_ORDER_BY_UNKNOWN + return OrderBy_ORDER_BY_UNSPECIFIED } // GetTxsEventResponse is the response type for the Service.TxsByEvents @@ -569,59 +569,59 @@ func init() { } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 827 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x8f, 0xdb, 0x44, - 0x14, 0x8e, 0x9d, 0xb2, 0x49, 0x5f, 0xb2, 0xc5, 0x9d, 0x5d, 0x4a, 0x48, 0xc1, 0x9b, 0xba, 0x64, - 0x1b, 0x45, 0xc2, 0x56, 0x03, 0x48, 0x15, 0xe2, 0x92, 0x5f, 0x5d, 0xad, 0x4a, 0x93, 0xca, 0xd9, - 0x0a, 0x15, 0x21, 0x59, 0x4e, 0x32, 0xf5, 0x5a, 0x6c, 0x3c, 0x59, 0xcf, 0x64, 0xe5, 0xa8, 0xad, - 0x90, 0x38, 0x72, 0x42, 0xe2, 0xcf, 0xe0, 0x9f, 0xe0, 0xc8, 0x71, 0x25, 0x2e, 0x1c, 0xd1, 0x86, - 0x3f, 0x82, 0x23, 0xf2, 0x78, 0x92, 0x38, 0x59, 0x67, 0x77, 0xc5, 0x29, 0x6f, 0x3c, 0xdf, 0xfb, - 0xde, 0xf7, 0xbe, 0x79, 0x33, 0x81, 0xbd, 0x01, 0xa1, 0x23, 0x42, 0x0d, 0x16, 0x18, 0x67, 0x8f, - 0xfb, 0x98, 0xd9, 0x8f, 0x0d, 0x8a, 0xfd, 0x33, 0x77, 0x80, 0xf5, 0xb1, 0x4f, 0x18, 0x41, 0x77, - 0x23, 0x80, 0xce, 0x02, 0x5d, 0x00, 0x8a, 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xcf, 0x12, 0xed, 0x25, 0xb0, 0xc6, 0x27, 0xa1, 0x58, - 0xda, 0x0c, 0x10, 0x35, 0xcb, 0xbc, 0xe6, 0x1e, 0xfa, 0xc4, 0x48, 0x7a, 0xaf, 0xa9, 0xf1, 0x26, - 0x9c, 0x9e, 0x77, 0xe8, 0x47, 0xc8, 0xc5, 0xee, 0x21, 0x2a, 0x5f, 0x75, 0x7d, 0x97, 0xe5, 0xf7, - 0xaf, 0x83, 0x09, 0x11, 0x0f, 0xb8, 0x88, 0xfb, 0xda, 0xbd, 0x64, 0x11, 0x61, 0xcf, 0x6f, 0x21, - 0x17, 0x7b, 0x41, 0x13, 0x05, 0x5c, 0xfe, 0x3f, 0x48, 0x14, 0x90, 0xf0, 0x10, 0x6b, 0x2a, 0x17, - 0x50, 0x40, 0x1b, 0x04, 0x34, 0x9a, 0x7f, 0x5c, 0xa8, 0xd2, 0xf9, 0x85, 0x2a, 0xfd, 0x7d, 0xa1, - 0x4a, 0xbf, 0xcc, 0xd4, 0xd4, 0xef, 0x33, 0x55, 0x3a, 0x9f, 0xa9, 0xa9, 0xbf, 0x66, 0x6a, 0xea, - 0xbb, 0xb2, 0xe3, 0xb2, 0xe3, 0x49, 0x5f, 0x1f, 0x90, 0xd1, 0x3c, 0x3f, 0xfa, 0xf9, 0x8c, 0x0e, - 0x7f, 0x30, 0xd8, 0x74, 0x8c, 0x43, 0xc2, 0xfe, 0x16, 0xff, 0xeb, 0xfa, 0xfc, 0xbf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x1b, 0x62, 0x6e, 0x4d, 0x91, 0x07, 0x00, 0x00, + // 817 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x9d, 0xa5, 0xc9, 0xbe, 0xa4, 0x4b, 0x76, 0x5a, 0x96, 0x90, 0x05, 0x37, 0xeb, 0x25, + 0x6d, 0x14, 0x09, 0x5b, 0x0d, 0x20, 0x55, 0x88, 0x4b, 0x7e, 0xb5, 0x54, 0xd0, 0xa6, 0x72, 0xca, + 0xa1, 0x08, 0x29, 0x72, 0x92, 0xa9, 0x6b, 0xd1, 0x78, 0x52, 0xcf, 0xa4, 0x72, 0xd4, 0x56, 0x48, + 0x1c, 0x39, 0x21, 0xf1, 0x67, 0xf0, 0x4f, 0x70, 0xe4, 0x58, 0x89, 0x0b, 0x47, 0xd4, 0xf0, 0x47, + 0x70, 0x44, 0x1e, 0x4f, 0x12, 0x27, 0x75, 0xda, 0x8a, 0x53, 0xde, 0x64, 0xbe, 0xf7, 0xbd, 0xef, + 0x7d, 0xf3, 0x66, 0x0c, 0x1b, 0x5d, 0x42, 0xfb, 0x84, 0xea, 0xcc, 0xd3, 0x2f, 0xb7, 0x3b, 0x98, + 0x99, 0xdb, 0x3a, 0xc5, 0xee, 0xa5, 0xdd, 0xc5, 0xda, 0xc0, 0x25, 0x8c, 0xa0, 0x97, 0x01, 0x40, + 0x63, 0x9e, 0x26, 0x00, 0xb9, 0x0f, 0x2d, 0x42, 0xac, 0x73, 0xac, 0x9b, 0x03, 0x5b, 0x37, 0x1d, + 0x87, 0x30, 0x93, 0xd9, 0xc4, 0xa1, 0x41, 0x42, 0xee, 0xad, 0x60, 0xec, 0x98, 0x14, 0xeb, 0x66, + 0xa7, 0x6b, 0x4f, 0x89, 0xfd, 0x85, 0x00, 0xe5, 0xee, 0x97, 0x65, 0x9e, 0xd8, 0x5b, 0xb7, 0x88, + 0x45, 0x78, 0xa8, 0xfb, 0x91, 0xf8, 0xb7, 0x14, 0xa6, 0xbd, 0x18, 0x62, 0x77, 0x34, 0xcd, 0x1c, + 0x98, 0x96, 0xed, 0x70, 0x0d, 0x01, 0x56, 0xfd, 0x4d, 0x02, 0xb4, 0x87, 0xd9, 0xb1, 0x47, 0x1b, + 0x97, 0xd8, 0x61, 0x06, 0xbe, 0x18, 0x62, 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 0x2b, 0xb1, 0xdf, 0xc7, 0x8a, 0x74, 0x3b, + 0x56, 0x62, 0x7f, 0x8d, 0x95, 0xd8, 0x77, 0x05, 0xcb, 0x66, 0x67, 0xc3, 0x8e, 0xd6, 0x25, 0xfd, + 0x49, 0x7e, 0xf0, 0xf3, 0x09, 0xed, 0xfd, 0xa0, 0xb3, 0xd1, 0x00, 0xfb, 0x84, 0x9d, 0x15, 0xfe, + 0xf9, 0xfa, 0xf4, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x64, 0xf5, 0xff, 0x95, 0x07, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 811a5485524a..03944d6c41e2 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -257,11 +257,23 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPCGateway() { "", }, { - "expect pass with with order-by filter", + "valid request: order by asc", fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=ORDER_BY_ASC", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), false, "", }, + { + "valid request: order by desc", + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=ORDER_BY_DESC", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), + false, + "", + }, + { + "invalid request: invalid order by", + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s&order_by=invalid_order", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), + true, + "is not a valid tx.OrderBy", + }, { "expect pass with multiple-events", fmt.Sprintf("%s/cosmos/tx/v1beta1/txs?events=%s&events=%s", val.APIAddress, "message.action='/cosmos.bank.v1beta1.Msg/Send'", "message.module='bank'"), From f2723ffb813b512bde1213cbeca1be1f038da2a8 Mon Sep 17 00:00:00 2001 From: aleem1314 Date: Fri, 12 Mar 2021 20:29:57 +0530 Subject: [PATCH 6/7] add changelog --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 2 +- proto/cosmos/tx/v1beta1/service.proto | 2 +- types/tx/service.pb.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f878eabadf4a..24048f26493a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/auth) [\#8522](https://github.com/cosmos/cosmos-sdk/pull/8522) Allow to query all stored accounts * (x/ibc) [\#7949](https://github.com/cosmos/cosmos-sdk/issues/7949) Standardized channel `Acknowledgement` moved to its own file. Codec registration redundancy removed. * (crypto/types) [\#8600](https://github.com/cosmos/cosmos-sdk/pull/8600) `CompactBitArray`: optimize the `NumTrueBitsBefore` method and add an `Equal` method. +* (grpc) [\#8815](https://github.com/cosmos/cosmos-sdk/pull/8815) Add orderBy parameter to `TxsByEvents` endpoint. ### Bug Fixes diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 0a453431d792..4d493b27c4ab 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -7303,7 +7303,7 @@ OrderBy defines the sorting order | Name | Number | Description | | ---- | ------ | ----------- | -| ORDER_BY_UNSPECIFIED | 0 | ORDER_BY_UNSPECIFIED specifies an unknown sorting order | +| ORDER_BY_UNSPECIFIED | 0 | ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. | | ORDER_BY_ASC | 1 | ORDER_BY_ASC defines ascending order | | ORDER_BY_DESC | 2 | ORDER_BY_DESC defines descending order | diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 839b510de614..25214c4374e9 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -48,7 +48,7 @@ message GetTxsEventRequest { // OrderBy defines the sorting order enum OrderBy { - // ORDER_BY_UNSPECIFIED specifies an unknown sorting order + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. ORDER_BY_UNSPECIFIED = 0; // ORDER_BY_ASC defines ascending order ORDER_BY_ASC = 1; diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 23f6eb887f17..f0eabcaca9a4 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -37,7 +37,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type OrderBy int32 const ( - // ORDER_BY_UNSPECIFIED specifies an unknown sorting order + // ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. OrderBy_ORDER_BY_UNSPECIFIED OrderBy = 0 // ORDER_BY_ASC defines ascending order OrderBy_ORDER_BY_ASC OrderBy = 1 From d384dd10c27b8517ddf8fe2e7c3bc752ffed311e Mon Sep 17 00:00:00 2001 From: MD Aleem <72057206+aleem1314@users.noreply.github.com> Date: Mon, 15 Mar 2021 16:48:03 +0530 Subject: [PATCH 7/7] Update x/auth/tx/service.go Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com> --- x/auth/tx/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 2d73a110b704..4ceebb787013 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -170,6 +170,6 @@ func parseOrderBy(orderBy txtypes.OrderBy) string { case txtypes.OrderBy_ORDER_BY_DESC: return "desc" default: - return "asc" + return "" // Defaults to Tendermint's default, which is `asc` now. } }