From 4d22fdf1159c327073708f57e60d1698c93de3f0 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Mon, 9 Nov 2020 15:59:35 +0530 Subject: [PATCH 01/26] WIP tx/broadcast grpc endpoint --- proto/cosmos/tx/v1beta1/service.proto | 41 + types/tx/service.pb.go | 1007 +++++++++++++++++++++++-- types/tx/service.pb.gw.go | 80 ++ x/auth/tx/service.go | 41 + x/auth/tx/service_test.go | 46 ++ 5 files changed, 1164 insertions(+), 51 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index eb7784001cc8..c8901e61454a 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -17,8 +17,49 @@ service Service { rpc GetTx(GetTxRequest) returns (GetTxResponse) { option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; } + + + // BroadcastTx broadcast transaction. + rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { + option (google.api.http).post = "/cosmos/tx/v1beta1/txs"; + } +} + +message BroadcastTxRequest { + // tx is the list of queried transactions. + bytes tx = 1; + string mode = 2; } +message BroadcastTxResponse { + // Response code. + int64 code = 1; + // Namespace for the Code + string codespace = 2; + // Result bytes, if any. + string data = 3; + // Amount of gas consumed by transaction. + int64 gasUsed = 4; + // Amount of gas requested for transaction. + int64 gasWanted = 5; + // The output of the application's logger (raw string). May be + // non-deterministic. + string rawLog = 6; + // Time of the previous block. For heights > 1, it's the weighted median of + // the timestamps of the valid votes in the block.LastCommit. For height == 1, + // it's genesis time. + string timestamp = 7; + // Additional information. May be non-deterministic. + string info = 8; + // The block height + int64 height = 9; + // The request transaction bytes. + cosmos.tx.v1beta1.Tx tx = 10; + // The transaction hash. + string txHash = 11; +} + + // SimulateRequest is the request type for the Service.Simulate // RPC method. message SimulateRequest { diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index ae691fd6273a..7bddce690ba1 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -29,6 +29,183 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type BroadcastTxRequest struct { + // tx is the list of queried transactions. + Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` + Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` +} + +func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } +func (m *BroadcastTxRequest) String() string { return proto.CompactTextString(m) } +func (*BroadcastTxRequest) ProtoMessage() {} +func (*BroadcastTxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{0} +} +func (m *BroadcastTxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastTxRequest.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 *BroadcastTxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastTxRequest.Merge(m, src) +} +func (m *BroadcastTxRequest) XXX_Size() int { + return m.Size() +} +func (m *BroadcastTxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastTxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo + +func (m *BroadcastTxRequest) GetTx() []byte { + if m != nil { + return m.Tx + } + return nil +} + +func (m *BroadcastTxRequest) GetMode() string { + if m != nil { + return m.Mode + } + return "" +} + +type BroadcastTxResponse struct { + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Codespace string `protobuf:"bytes,2,opt,name=codespace,proto3" json:"codespace,omitempty"` + Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + GasUsed int64 `protobuf:"varint,4,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"` + GasWanted int64 `protobuf:"varint,5,opt,name=gasWanted,proto3" json:"gasWanted,omitempty"` + RawLog string `protobuf:"bytes,6,opt,name=rawLog,proto3" json:"rawLog,omitempty"` + Timestamp string `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` + Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` + Tx *Tx `protobuf:"bytes,10,opt,name=tx,proto3" json:"tx,omitempty"` + TxHash string `protobuf:"bytes,11,opt,name=txHash,proto3" json:"txHash,omitempty"` +} + +func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } +func (m *BroadcastTxResponse) String() string { return proto.CompactTextString(m) } +func (*BroadcastTxResponse) ProtoMessage() {} +func (*BroadcastTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{1} +} +func (m *BroadcastTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastTxResponse.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 *BroadcastTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastTxResponse.Merge(m, src) +} +func (m *BroadcastTxResponse) XXX_Size() int { + return m.Size() +} +func (m *BroadcastTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo + +func (m *BroadcastTxResponse) GetCode() int64 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *BroadcastTxResponse) GetCodespace() string { + if m != nil { + return m.Codespace + } + return "" +} + +func (m *BroadcastTxResponse) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +func (m *BroadcastTxResponse) GetGasUsed() int64 { + if m != nil { + return m.GasUsed + } + return 0 +} + +func (m *BroadcastTxResponse) GetGasWanted() int64 { + if m != nil { + return m.GasWanted + } + return 0 +} + +func (m *BroadcastTxResponse) GetRawLog() string { + if m != nil { + return m.RawLog + } + return "" +} + +func (m *BroadcastTxResponse) GetTimestamp() string { + if m != nil { + return m.Timestamp + } + return "" +} + +func (m *BroadcastTxResponse) GetInfo() string { + if m != nil { + return m.Info + } + return "" +} + +func (m *BroadcastTxResponse) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BroadcastTxResponse) GetTx() *Tx { + if m != nil { + return m.Tx + } + return nil +} + +func (m *BroadcastTxResponse) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + // SimulateRequest is the request type for the Service.Simulate // RPC method. type SimulateRequest struct { @@ -40,7 +217,7 @@ func (m *SimulateRequest) Reset() { *m = SimulateRequest{} } func (m *SimulateRequest) String() string { return proto.CompactTextString(m) } func (*SimulateRequest) ProtoMessage() {} func (*SimulateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{0} + return fileDescriptor_e0b00a618705eca7, []int{2} } func (m *SimulateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -89,7 +266,7 @@ func (m *SimulateResponse) Reset() { *m = SimulateResponse{} } func (m *SimulateResponse) String() string { return proto.CompactTextString(m) } func (*SimulateResponse) ProtoMessage() {} func (*SimulateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{1} + return fileDescriptor_e0b00a618705eca7, []int{3} } func (m *SimulateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -143,7 +320,7 @@ func (m *GetTxRequest) Reset() { *m = GetTxRequest{} } func (m *GetTxRequest) String() string { return proto.CompactTextString(m) } func (*GetTxRequest) ProtoMessage() {} func (*GetTxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{2} + return fileDescriptor_e0b00a618705eca7, []int{4} } func (m *GetTxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -189,7 +366,7 @@ func (m *GetTxResponse) Reset() { *m = GetTxResponse{} } func (m *GetTxResponse) String() string { return proto.CompactTextString(m) } func (*GetTxResponse) ProtoMessage() {} func (*GetTxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{3} + return fileDescriptor_e0b00a618705eca7, []int{5} } func (m *GetTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -226,6 +403,8 @@ func (m *GetTxResponse) GetTx() *Tx { } func init() { + proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") + proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest") proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse") proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest") @@ -235,33 +414,45 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 404 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x31, 0x6b, 0xdb, 0x40, - 0x1c, 0xc5, 0x2d, 0xd1, 0xda, 0xee, 0xb5, 0xa5, 0xed, 0x41, 0xc1, 0xa8, 0xae, 0xec, 0x9e, 0x6b, - 0xe8, 0x52, 0x1d, 0x76, 0xa1, 0x78, 0x08, 0x04, 0xb2, 0x98, 0xac, 0xb2, 0xa7, 0x2c, 0xe1, 0xa4, - 0x9c, 0x65, 0x11, 0x5b, 0xa7, 0xf8, 0x4e, 0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0xa6, 0xf2, - 0x36, 0x37, 0x7b, 0x5d, 0xa5, 0x73, 0xb5, 0x1e, 0x21, 0xf0, 0xa9, 0x4f, 0xc5, 0x50, 0xe6, 0x1d, - 0x20, 0x78, 0x37, 0x26, 0x7c, 0xac, 0x32, 0x7c, 0x70, 0xd5, 0x19, 0xfd, 0x07, 0x9f, 0xb5, 0x46, - 0x87, 0x7d, 0x5b, 0xd1, 0xee, 0xbd, 0x01, 0x2a, 0x83, 0xec, 0x37, 0x41, 0x09, 0xaa, 0x79, 0x67, - 0x88, 0x0a, 0x2c, 0x2f, 0xee, 0xd2, 0x6a, 0xbd, 0xaa, 0xc9, 0x72, 0xa0, 0xd6, 0xd9, 0xf5, 0xdd, - 0xa5, 0xf9, 0x13, 0xfd, 0xc0, 0x05, 0xfb, 0x91, 0x4f, 0x8b, 0xc1, 0x7b, 0x95, 0x1e, 0x36, 0x0a, - 0x90, 0xcf, 0xbb, 0x5b, 0xcd, 0xcd, 0x02, 0x3d, 0xf0, 0xb7, 0x1a, 0x68, 0xc3, 0x3a, 0x2e, 0xda, - 0x0c, 0x7c, 0x92, 0x5e, 0xd7, 0xe9, 0xce, 0xf6, 0xd5, 0xd2, 0x36, 0x16, 0x4b, 0xdb, 0xb8, 0x5d, - 0xda, 0xc6, 0xc5, 0xca, 0x2e, 0x2d, 0x56, 0x76, 0xe9, 0x66, 0x65, 0x97, 0xf6, 0xda, 0x41, 0x28, - 0xc6, 0x89, 0xe7, 0xf8, 0x6c, 0x9a, 0x13, 0xb2, 0xc7, 0x5f, 0x7e, 0x70, 0x88, 0xc5, 0x71, 0x4c, - 0x53, 0xa4, 0x57, 0x56, 0x2b, 0xf6, 0xef, 0x21, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x4c, 0x40, 0xff, - 0xf7, 0x02, 0x00, 0x00, + // 599 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0xad, 0xdd, 0x34, 0x3f, 0x93, 0x7e, 0x1f, 0x30, 0x88, 0x68, 0x64, 0x82, 0x1b, 0x1c, 0x82, + 0xb2, 0xc1, 0x56, 0x83, 0x84, 0xb2, 0x40, 0x42, 0xea, 0xa6, 0x20, 0xb1, 0x72, 0x8b, 0x90, 0xd8, + 0xa0, 0x89, 0x3d, 0x75, 0x2c, 0x62, 0x8f, 0xc9, 0x4c, 0x8a, 0x11, 0xb0, 0x61, 0xc9, 0x0a, 0x89, + 0x57, 0xe1, 0x21, 0x58, 0x56, 0x62, 0xc3, 0x12, 0x25, 0xbc, 0x01, 0x2f, 0x80, 0xe6, 0xc7, 0x49, + 0x20, 0x6e, 0x61, 0xe5, 0x3b, 0xe3, 0x73, 0xce, 0x3d, 0x73, 0x3c, 0xd7, 0x60, 0x2f, 0xa0, 0x2c, + 0xa1, 0xcc, 0xe3, 0xb9, 0x77, 0xba, 0x3f, 0x22, 0x1c, 0xef, 0x7b, 0x8c, 0x4c, 0x4f, 0xe3, 0x80, + 0xb8, 0xd9, 0x94, 0x72, 0x0a, 0xaf, 0x28, 0x80, 0xcb, 0x73, 0x57, 0x03, 0xac, 0x76, 0x44, 0x69, + 0x34, 0x21, 0x1e, 0xce, 0x62, 0x0f, 0xa7, 0x29, 0xe5, 0x98, 0xc7, 0x34, 0x65, 0x8a, 0x60, 0x75, + 0xb5, 0xe2, 0x08, 0x33, 0xe2, 0xe1, 0x51, 0x10, 0x2f, 0x85, 0xc5, 0x42, 0x83, 0xac, 0xcd, 0xb6, + 0x3c, 0x57, 0xef, 0x9c, 0x21, 0x80, 0x07, 0x53, 0x8a, 0xc3, 0x00, 0x33, 0x7e, 0x9c, 0xfb, 0xe4, + 0xe5, 0x8c, 0x30, 0x0e, 0xff, 0x07, 0x26, 0xcf, 0x91, 0xd1, 0x31, 0xfa, 0xbb, 0xbe, 0xc9, 0x73, + 0x08, 0x41, 0x25, 0xa1, 0x21, 0x41, 0x66, 0xc7, 0xe8, 0x37, 0x7c, 0x59, 0x3b, 0x9f, 0x4d, 0x70, + 0xf5, 0x37, 0x2a, 0xcb, 0x68, 0xca, 0x88, 0xc0, 0x06, 0x02, 0x2b, 0xd8, 0xdb, 0xbe, 0xac, 0x61, + 0x1b, 0x34, 0xc4, 0x93, 0x65, 0x38, 0x28, 0x44, 0x56, 0x1b, 0x82, 0x11, 0x62, 0x8e, 0xd1, 0xb6, + 0x52, 0x17, 0x35, 0x44, 0xa0, 0x16, 0x61, 0xf6, 0x84, 0x91, 0x10, 0x55, 0xa4, 0x50, 0xb1, 0x14, + 0x5a, 0x11, 0x66, 0x4f, 0x71, 0xca, 0x49, 0x88, 0x76, 0xe4, 0xbb, 0xd5, 0x06, 0x6c, 0x81, 0xea, + 0x14, 0xbf, 0x7a, 0x4c, 0x23, 0x54, 0x95, 0x6a, 0x7a, 0x25, 0x58, 0x3c, 0x4e, 0x08, 0xe3, 0x38, + 0xc9, 0x50, 0x4d, 0x39, 0x58, 0x6e, 0x08, 0x07, 0x71, 0x7a, 0x42, 0x51, 0x5d, 0x39, 0x10, 0xb5, + 0x50, 0x1a, 0x93, 0x38, 0x1a, 0x73, 0xd4, 0x90, 0x4d, 0xf4, 0x0a, 0xf6, 0x64, 0x36, 0xa0, 0x63, + 0xf4, 0x9b, 0x83, 0x6b, 0xee, 0xc6, 0x07, 0x73, 0x8f, 0x73, 0x19, 0x59, 0x0b, 0x54, 0x79, 0xfe, + 0x10, 0xb3, 0x31, 0x6a, 0x2a, 0x23, 0x6a, 0xe5, 0x0c, 0xc1, 0xa5, 0xa3, 0x38, 0x99, 0x4d, 0x30, + 0x27, 0x45, 0xda, 0xbd, 0x65, 0xda, 0x17, 0x29, 0x3a, 0x1f, 0x0c, 0x70, 0x79, 0x45, 0xd5, 0x69, + 0xdf, 0x07, 0xf5, 0x08, 0xb3, 0xe7, 0xd2, 0xbd, 0x52, 0xb8, 0x59, 0x28, 0x88, 0x3b, 0x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1, 0x6c, 0xe4, 0x06, 0x34, 0x29, 0xb8, 0xea, 0x71, 0x87, 0x85, 0x2f, 0x3c, 0xfe, + 0x3a, 0x23, 0x42, 0x6c, 0x54, 0x95, 0x7f, 0x94, 0xbb, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd2, + 0x67, 0x7b, 0x8c, 0xe6, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -280,6 +471,8 @@ type ServiceClient interface { Simulate(ctx context.Context, in *SimulateRequest, opts ...grpc.CallOption) (*SimulateResponse, error) // GetTx fetches a tx by hash. GetTx(ctx context.Context, in *GetTxRequest, opts ...grpc.CallOption) (*GetTxResponse, error) + // BroadcastTx broadcast transaction. + BroadcastTx(ctx context.Context, in *BroadcastTxRequest, opts ...grpc.CallOption) (*BroadcastTxResponse, error) } type serviceClient struct { @@ -308,12 +501,23 @@ func (c *serviceClient) GetTx(ctx context.Context, in *GetTxRequest, opts ...grp return out, nil } +func (c *serviceClient) BroadcastTx(ctx context.Context, in *BroadcastTxRequest, opts ...grpc.CallOption) (*BroadcastTxResponse, error) { + out := new(BroadcastTxResponse) + err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/BroadcastTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ServiceServer is the server API for Service service. type ServiceServer interface { // Simulate simulates executing a transaction for estimating gas usage. Simulate(context.Context, *SimulateRequest) (*SimulateResponse, error) // GetTx fetches a tx by hash. GetTx(context.Context, *GetTxRequest) (*GetTxResponse, error) + // BroadcastTx broadcast transaction. + BroadcastTx(context.Context, *BroadcastTxRequest) (*BroadcastTxResponse, error) } // UnimplementedServiceServer can be embedded to have forward compatible implementations. @@ -326,6 +530,9 @@ func (*UnimplementedServiceServer) Simulate(ctx context.Context, req *SimulateRe func (*UnimplementedServiceServer) GetTx(ctx context.Context, req *GetTxRequest) (*GetTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetTx not implemented") } +func (*UnimplementedServiceServer) BroadcastTx(ctx context.Context, req *BroadcastTxRequest) (*BroadcastTxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented") +} func RegisterServiceServer(s grpc1.Server, srv ServiceServer) { s.RegisterService(&_Service_serviceDesc, srv) @@ -367,6 +574,24 @@ func _Service_GetTx_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Service_BroadcastTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BroadcastTxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServiceServer).BroadcastTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.tx.v1beta1.Service/BroadcastTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServiceServer).BroadcastTx(ctx, req.(*BroadcastTxRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Service_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmos.tx.v1beta1.Service", HandlerType: (*ServiceServer)(nil), @@ -379,11 +604,149 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "GetTx", Handler: _Service_GetTx_Handler, }, + { + MethodName: "BroadcastTx", + Handler: _Service_BroadcastTx_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmos/tx/v1beta1/service.proto", } +func (m *BroadcastTxRequest) 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 *BroadcastTxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Mode) > 0 { + i -= len(m.Mode) + copy(dAtA[i:], m.Mode) + i = encodeVarintService(dAtA, i, uint64(len(m.Mode))) + i-- + dAtA[i] = 0x12 + } + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintService(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BroadcastTxResponse) 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 *BroadcastTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintService(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x5a + } + if m.Tx != nil { + { + size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + } + if m.Height != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x48 + } + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintService(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x42 + } + if len(m.Timestamp) > 0 { + i -= len(m.Timestamp) + copy(dAtA[i:], m.Timestamp) + i = encodeVarintService(dAtA, i, uint64(len(m.Timestamp))) + i-- + dAtA[i] = 0x3a + } + if len(m.RawLog) > 0 { + i -= len(m.RawLog) + copy(dAtA[i:], m.RawLog) + i = encodeVarintService(dAtA, i, uint64(len(m.RawLog))) + i-- + dAtA[i] = 0x32 + } + if m.GasWanted != 0 { + i = encodeVarintService(dAtA, i, uint64(m.GasWanted)) + i-- + dAtA[i] = 0x28 + } + if m.GasUsed != 0 { + i = encodeVarintService(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x20 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintService(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Codespace) > 0 { + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) + i = encodeVarintService(dAtA, i, uint64(len(m.Codespace))) + i-- + dAtA[i] = 0x12 + } + if m.Code != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *SimulateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -542,50 +905,73 @@ func encodeVarintService(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *SimulateRequest) Size() (n int) { +func (m *BroadcastTxRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Tx != nil { - l = m.Tx.Size() + l = len(m.Tx) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Mode) + if l > 0 { n += 1 + l + sovService(uint64(l)) } return n } -func (m *SimulateResponse) Size() (n int) { +func (m *BroadcastTxResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.GasInfo != nil { - l = m.GasInfo.Size() + if m.Code != 0 { + n += 1 + sovService(uint64(m.Code)) + } + l = len(m.Codespace) + if l > 0 { n += 1 + l + sovService(uint64(l)) } - if m.Result != nil { - l = m.Result.Size() + l = len(m.Data) + if l > 0 { n += 1 + l + sovService(uint64(l)) } - return n -} - -func (m *GetTxRequest) Size() (n int) { - if m == nil { - return 0 + if m.GasUsed != 0 { + n += 1 + sovService(uint64(m.GasUsed)) } - var l int - _ = l - l = len(m.Hash) + if m.GasWanted != 0 { + n += 1 + sovService(uint64(m.GasWanted)) + } + l = len(m.RawLog) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Timestamp) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Info) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovService(uint64(m.Height)) + } + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovService(uint64(l)) + } + l = len(m.TxHash) if l > 0 { n += 1 + l + sovService(uint64(l)) } return n } -func (m *GetTxResponse) Size() (n int) { +func (m *SimulateRequest) Size() (n int) { if m == nil { return 0 } @@ -598,12 +984,531 @@ func (m *GetTxResponse) Size() (n int) { return n } -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *SimulateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GasInfo != nil { + l = m.GasInfo.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Result != nil { + l = m.Result.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *GetTxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *GetTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } func sozService(x uint64) (n int) { return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *BroadcastTxRequest) 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 ErrIntOverflowService + } + 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: BroadcastTxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastTxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) + if m.Tx == nil { + m.Tx = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", 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.Mode = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BroadcastTxResponse) 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 ErrIntOverflowService + } + 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: BroadcastTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) + } + m.Code = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Code |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Codespace", 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.Codespace = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) + } + m.GasUsed = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasUsed |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) + } + m.GasWanted = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasWanted |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawLog", 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.RawLog = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", 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.Timestamp = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", 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.Info = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tx == nil { + m.Tx = &Tx{} + } + if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", 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.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SimulateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/types/tx/service.pb.gw.go b/types/tx/service.pb.gw.go index 270036363ad5..f3423bf970e4 100644 --- a/types/tx/service.pb.gw.go +++ b/types/tx/service.pb.gw.go @@ -121,6 +121,42 @@ func local_request_Service_GetTx_0(ctx context.Context, marshaler runtime.Marsha } +var ( + filter_Service_BroadcastTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BroadcastTxRequest + 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_Service_BroadcastTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BroadcastTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq BroadcastTxRequest + 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_Service_BroadcastTx_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BroadcastTx(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterServiceHandlerServer registers the http handlers for service Service to "mux". // UnaryRPC :call ServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -167,6 +203,26 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se }) + mux.Handle("POST", pattern_Service_BroadcastTx_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Service_BroadcastTx_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Service_BroadcastTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -248,6 +304,26 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) + mux.Handle("POST", pattern_Service_BroadcastTx_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_Service_BroadcastTx_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Service_BroadcastTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -255,10 +331,14 @@ var ( pattern_Service_Simulate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "simulate"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Service_BroadcastTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( forward_Service_Simulate_0 = runtime.ForwardResponseMessage forward_Service_GetTx_0 = runtime.ForwardResponseMessage + + forward_Service_BroadcastTx_0 = runtime.ForwardResponseMessage ) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index d430dc2b0a38..31cd78988e45 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -91,6 +91,47 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype }, nil } +func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) { + if req.Tx == nil { + return nil, status.Error(codes.InvalidArgument, "invalid empty tx") + } + if req.Mode == "" { + return nil, status.Error(codes.InvalidArgument, "invalid empty mode") + } + clientCtx := s.clientCtx.WithBroadcastMode(req.Mode) + + resp, err := clientCtx.BroadcastTx(req.Tx) + + if err != nil { + return nil, err + } + // Create a proto codec, we need it to unmarshal the tx bytes. + cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry) + var protoTx txtypes.Tx + + bz, err := resp.Tx.Marshal() + if err != nil { + return nil, err + } + if err := cdc.UnmarshalBinaryBare(bz, &protoTx); err != nil { + return nil, err + } + return &txtypes.BroadcastTxResponse{ + Code: int64(resp.Code), + Codespace: resp.Codespace, + Data: resp.Data, + GasUsed: int64(resp.GasUsed), + GasWanted: int64(resp.GasWanted), + Height: resp.Height, + Info: resp.Info, + RawLog: resp.RawLog, + Timestamp: resp.Timestamp, + TxHash: resp.TxHash, + Tx: &protoTx, + }, nil + +} + // RegisterTxService registers the tx service on the gRPC router. func RegisterTxService( qrt gogogrpc.Server, diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index ec51cf0e2bb9..b44f4a7d9c93 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -139,6 +139,52 @@ func (s IntegrationTestSuite) TestGetTx() { s.Require().Equal("foobar", getTxRes.Tx.Body.Memo) } +func (s IntegrationTestSuite) TestBroadcastTx() { + val := s.network.Validators[0] + + // prepare txBuilder with msg + txBuilder := val.ClientCtx.TxConfig.NewTxBuilder() + feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)} + gasLimit := testdata.NewTestGasLimit() + s.Require().NoError( + txBuilder.SetMsgs(&banktypes.MsgSend{ + FromAddress: val.Address.String(), + ToAddress: val.Address.String(), + Amount: sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}, + }), + ) + txBuilder.SetFeeAmount(feeAmount) + txBuilder.SetGasLimit(gasLimit) + txBuilder.SetMemo("foobar") + + // setup txFactory + txFactory := clienttx.Factory{}. + WithChainID(val.ClientCtx.ChainID). + WithKeybase(val.ClientCtx.Keyring). + WithTxConfig(val.ClientCtx.TxConfig). + WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) + + // Sign Tx. + err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) + s.Require().NoError(err) + + txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + fmt.Println(string(txBytes)) + s.Require().NoError(err) + + // Query the tx via gRPC. + grpcRes, err := s.queryClient.BroadcastTx( + context.Background(), + &tx.BroadcastTxRequest{ + Mode: "async", + Tx: txBytes, + }, + ) + s.Require().NoError(err) + fmt.Println(grpcRes) + s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) +} + func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } From 6674921953c1aeaca36ebaeda63def862be3bd52 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Mon, 9 Nov 2020 16:15:39 +0530 Subject: [PATCH 02/26] fix lint --- proto/cosmos/tx/v1beta1/service.proto | 6 +- types/tx/service.pb.go | 118 +++++++++++++++----------- x/auth/tx/service.go | 6 +- 3 files changed, 76 insertions(+), 54 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index c8901e61454a..c4e268081fca 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -25,15 +25,19 @@ service Service { } } +// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest +// RPC method. message BroadcastTxRequest { // tx is the list of queried transactions. bytes tx = 1; string mode = 2; } +// BroadcastTxResponse is the response type for the +// Service.BroadcastTx method. message BroadcastTxResponse { // Response code. - int64 code = 1; + uint32 code = 1; // Namespace for the Code string codespace = 2; // Result bytes, if any. diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 7bddce690ba1..cd327a1b381b 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -29,6 +29,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest +// RPC method. type BroadcastTxRequest struct { // tx is the list of queried transactions. Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` @@ -82,18 +84,34 @@ func (m *BroadcastTxRequest) GetMode() string { return "" } +// BroadcastTxResponse is the response type for the +// Service.BroadcastTx method. type BroadcastTxResponse struct { - Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + // Response code. + Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + // Namespace for the Code Codespace string `protobuf:"bytes,2,opt,name=codespace,proto3" json:"codespace,omitempty"` - Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - GasUsed int64 `protobuf:"varint,4,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"` - GasWanted int64 `protobuf:"varint,5,opt,name=gasWanted,proto3" json:"gasWanted,omitempty"` - RawLog string `protobuf:"bytes,6,opt,name=rawLog,proto3" json:"rawLog,omitempty"` + // Result bytes, if any. + Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + // Amount of gas consumed by transaction. + GasUsed int64 `protobuf:"varint,4,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"` + // Amount of gas requested for transaction. + GasWanted int64 `protobuf:"varint,5,opt,name=gasWanted,proto3" json:"gasWanted,omitempty"` + // The output of the application's logger (raw string). May be + // non-deterministic. + RawLog string `protobuf:"bytes,6,opt,name=rawLog,proto3" json:"rawLog,omitempty"` + // Time of the previous block. For heights > 1, it's the weighted median of + // the timestamps of the valid votes in the block.LastCommit. For height == 1, + // it's genesis time. Timestamp string `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` - Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` - Tx *Tx `protobuf:"bytes,10,opt,name=tx,proto3" json:"tx,omitempty"` - TxHash string `protobuf:"bytes,11,opt,name=txHash,proto3" json:"txHash,omitempty"` + // Additional information. May be non-deterministic. + Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` + // The block height + Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` + // The request transaction bytes. + Tx *Tx `protobuf:"bytes,10,opt,name=tx,proto3" json:"tx,omitempty"` + // The transaction hash. + TxHash string `protobuf:"bytes,11,opt,name=txHash,proto3" json:"txHash,omitempty"` } func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } @@ -129,7 +147,7 @@ func (m *BroadcastTxResponse) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo -func (m *BroadcastTxResponse) GetCode() int64 { +func (m *BroadcastTxResponse) GetCode() uint32 { if m != nil { return m.Code } @@ -414,45 +432,45 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 599 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xad, 0xdd, 0x34, 0x3f, 0x93, 0x7e, 0x1f, 0x30, 0x88, 0x68, 0x64, 0x82, 0x1b, 0x1c, 0x82, - 0xb2, 0xc1, 0x56, 0x83, 0x84, 0xb2, 0x40, 0x42, 0xea, 0xa6, 0x20, 0xb1, 0x72, 0x8b, 0x90, 0xd8, - 0xa0, 0x89, 0x3d, 0x75, 0x2c, 0x62, 0x8f, 0xc9, 0x4c, 0x8a, 0x11, 0xb0, 0x61, 0xc9, 0x0a, 0x89, - 0x57, 0xe1, 0x21, 0x58, 0x56, 0x62, 0xc3, 0x12, 0x25, 0xbc, 0x01, 0x2f, 0x80, 0xe6, 0xc7, 0x49, - 0x20, 0x6e, 0x61, 0xe5, 0x3b, 0xe3, 0x73, 0xce, 0x3d, 0x73, 0x3c, 0xd7, 0x60, 0x2f, 0xa0, 0x2c, - 0xa1, 0xcc, 0xe3, 0xb9, 0x77, 0xba, 0x3f, 0x22, 0x1c, 0xef, 0x7b, 0x8c, 0x4c, 0x4f, 0xe3, 0x80, - 0xb8, 0xd9, 0x94, 0x72, 0x0a, 0xaf, 0x28, 0x80, 0xcb, 0x73, 0x57, 0x03, 0xac, 0x76, 0x44, 0x69, - 0x34, 0x21, 0x1e, 0xce, 0x62, 0x0f, 0xa7, 0x29, 0xe5, 0x98, 0xc7, 0x34, 0x65, 0x8a, 0x60, 0x75, - 0xb5, 0xe2, 0x08, 0x33, 0xe2, 0xe1, 0x51, 0x10, 0x2f, 0x85, 0xc5, 0x42, 0x83, 0xac, 0xcd, 0xb6, - 0x3c, 0x57, 0xef, 0x9c, 0x21, 0x80, 0x07, 0x53, 0x8a, 0xc3, 0x00, 0x33, 0x7e, 0x9c, 0xfb, 0xe4, - 0xe5, 0x8c, 0x30, 0x0e, 0xff, 0x07, 0x26, 0xcf, 0x91, 0xd1, 0x31, 0xfa, 0xbb, 0xbe, 0xc9, 0x73, - 0x08, 0x41, 0x25, 0xa1, 0x21, 0x41, 0x66, 0xc7, 0xe8, 0x37, 0x7c, 0x59, 0x3b, 0x9f, 0x4d, 0x70, - 0xf5, 0x37, 0x2a, 0xcb, 0x68, 0xca, 0x88, 0xc0, 0x06, 0x02, 0x2b, 0xd8, 0xdb, 0xbe, 0xac, 0x61, - 0x1b, 0x34, 0xc4, 0x93, 0x65, 0x38, 0x28, 0x44, 0x56, 0x1b, 0x82, 0x11, 0x62, 0x8e, 0xd1, 0xb6, - 0x52, 0x17, 0x35, 0x44, 0xa0, 0x16, 0x61, 0xf6, 0x84, 0x91, 0x10, 0x55, 0xa4, 0x50, 0xb1, 0x14, - 0x5a, 0x11, 0x66, 0x4f, 0x71, 0xca, 0x49, 0x88, 0x76, 0xe4, 0xbb, 0xd5, 0x06, 0x6c, 0x81, 0xea, - 0x14, 0xbf, 0x7a, 0x4c, 0x23, 0x54, 0x95, 0x6a, 0x7a, 0x25, 0x58, 0x3c, 0x4e, 0x08, 0xe3, 0x38, - 0xc9, 0x50, 0x4d, 0x39, 0x58, 0x6e, 0x08, 0x07, 0x71, 0x7a, 0x42, 0x51, 0x5d, 0x39, 0x10, 0xb5, - 0x50, 0x1a, 0x93, 0x38, 0x1a, 0x73, 0xd4, 0x90, 0x4d, 0xf4, 0x0a, 0xf6, 0x64, 0x36, 0xa0, 0x63, - 0xf4, 0x9b, 0x83, 0x6b, 0xee, 0xc6, 0x07, 0x73, 0x8f, 0x73, 0x19, 0x59, 0x0b, 0x54, 0x79, 0xfe, - 0x10, 0xb3, 0x31, 0x6a, 0x2a, 0x23, 0x6a, 0xe5, 0x0c, 0xc1, 0xa5, 0xa3, 0x38, 0x99, 0x4d, 0x30, - 0x27, 0x45, 0xda, 0xbd, 0x65, 0xda, 0x17, 0x29, 0x3a, 0x1f, 0x0c, 0x70, 0x79, 0x45, 0xd5, 0x69, - 0xdf, 0x07, 0xf5, 0x08, 0xb3, 0xe7, 0xd2, 0xbd, 0x52, 0xb8, 0x59, 0x28, 0x88, 0x3b, 0xe1, 0xca, - 0x6b, 0x50, 0x08, 0x1d, 0x62, 0xf6, 0x28, 0x3d, 0xa1, 0x32, 0x4b, 0x51, 0xc0, 0x21, 0xa8, 0x4e, - 0x09, 0x9b, 0x4d, 0xb8, 0xfc, 0x28, 0xcd, 0x41, 0xe7, 0x7c, 0xae, 0x2f, 0x71, 0xbe, 0xc6, 0x3b, - 0x0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0x00, + // 601 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, + 0x1c, 0x6d, 0xb2, 0xae, 0x7f, 0xdc, 0x8d, 0x3f, 0x46, 0x54, 0x56, 0x28, 0x59, 0x48, 0x29, 0xea, + 0x85, 0x44, 0x2b, 0x12, 0xea, 0x01, 0x09, 0x69, 0x97, 0x81, 0xc4, 0x29, 0x1b, 0x42, 0xe2, 0x82, + 0xdc, 0xc4, 0x4b, 0x23, 0x9a, 0x38, 0xd4, 0xee, 0x08, 0x02, 0x2e, 0x1c, 0x39, 0x21, 0xf1, 0x55, + 0xf8, 0x10, 0x1c, 0x27, 0x71, 0xe1, 0x88, 0x5a, 0xbe, 0x01, 0x5f, 0x00, 0xd9, 0x4e, 0xda, 0x42, + 0xb3, 0xc1, 0x29, 0x3f, 0x3b, 0xef, 0xbd, 0xdf, 0xf3, 0x8b, 0x7f, 0x01, 0x7b, 0x3e, 0x65, 0x31, + 0x65, 0x2e, 0xcf, 0xdc, 0xd3, 0xfd, 0x11, 0xe1, 0x78, 0xdf, 0x65, 0x64, 0x7a, 0x1a, 0xf9, 0xc4, + 0x49, 0xa7, 0x94, 0x53, 0x78, 0x55, 0x01, 0x1c, 0x9e, 0x39, 0x39, 0xc0, 0xe8, 0x84, 0x94, 0x86, + 0x13, 0xe2, 0xe2, 0x34, 0x72, 0x71, 0x92, 0x50, 0x8e, 0x79, 0x44, 0x13, 0xa6, 0x08, 0x46, 0x37, + 0x57, 0x1c, 0x61, 0x46, 0x5c, 0x3c, 0xf2, 0xa3, 0xa5, 0xb0, 0x58, 0xe4, 0x20, 0x63, 0xb3, 0x2d, + 0xcf, 0xd4, 0x3b, 0x7b, 0x08, 0xe0, 0xc1, 0x94, 0xe2, 0xc0, 0xc7, 0x8c, 0x1f, 0x67, 0x1e, 0x79, + 0x35, 0x23, 0x8c, 0x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x31, 0x37, 0xb5, 0x4f, 0x0b, 0xb3, 0x72, 0xb6, 0x30, 0x2b, 0xdf, 0x17, 0x66, 0xe5, + 0x79, 0x2f, 0x8c, 0xf8, 0x78, 0x36, 0x72, 0x7c, 0x1a, 0x17, 0x5c, 0xf5, 0xb8, 0xcb, 0x82, 0x97, + 0x2e, 0x7f, 0x93, 0x12, 0x21, 0x36, 0xaa, 0xc9, 0x3f, 0xca, 0xbd, 0xdf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x11, 0x68, 0xcf, 0x1e, 0xe6, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1195,7 +1213,7 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= int64(b&0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 31cd78988e45..3f964684ea37 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -117,11 +117,11 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque return nil, err } return &txtypes.BroadcastTxResponse{ - Code: int64(resp.Code), + Code: resp.Code, Codespace: resp.Codespace, Data: resp.Data, - GasUsed: int64(resp.GasUsed), - GasWanted: int64(resp.GasWanted), + GasUsed: resp.GasUsed, + GasWanted: resp.GasWanted, Height: resp.Height, Info: resp.Info, RawLog: resp.RawLog, From 6134a9bf82bc8cf9f6a874387392e43b75c663e2 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Mon, 9 Nov 2020 17:33:51 +0530 Subject: [PATCH 03/26] fix proto lint --- proto/cosmos/tx/v1beta1/service.proto | 12 +- types/tx/service.pb.go | 153 ++++++++++++++++++-------- x/auth/tx/service.go | 1 + 3 files changed, 119 insertions(+), 47 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index c4e268081fca..a022e314b0f7 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -4,6 +4,7 @@ package cosmos.tx.v1beta1; import "google/api/annotations.proto"; import "cosmos/base/abci/v1beta1/abci.proto"; import "cosmos/tx/v1beta1/tx.proto"; +import "gogoproto/gogo.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; @@ -43,12 +44,12 @@ message BroadcastTxResponse { // Result bytes, if any. string data = 3; // Amount of gas consumed by transaction. - int64 gasUsed = 4; + int64 gas_used = 4; // Amount of gas requested for transaction. - int64 gasWanted = 5; + int64 gas_wanted = 5; // The output of the application's logger (raw string). May be // non-deterministic. - string rawLog = 6; + string raw_log = 6; // Time of the previous block. For heights > 1, it's the weighted median of // the timestamps of the valid votes in the block.LastCommit. For height == 1, // it's genesis time. @@ -60,7 +61,10 @@ message BroadcastTxResponse { // The request transaction bytes. cosmos.tx.v1beta1.Tx tx = 10; // The transaction hash. - string txHash = 11; + string txhash = 11 [(gogoproto.customname) = "TxHash"]; + + repeated cosmos.base.abci.v1beta1.ABCIMessageLog logs = 12 [(gogoproto.nullable) = false]; + } diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index cd327a1b381b..9f4ec6635de5 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -94,12 +95,12 @@ type BroadcastTxResponse struct { // Result bytes, if any. Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // Amount of gas consumed by transaction. - GasUsed int64 `protobuf:"varint,4,opt,name=gasUsed,proto3" json:"gasUsed,omitempty"` + GasUsed int64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` // Amount of gas requested for transaction. - GasWanted int64 `protobuf:"varint,5,opt,name=gasWanted,proto3" json:"gasWanted,omitempty"` + GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` // The output of the application's logger (raw string). May be // non-deterministic. - RawLog string `protobuf:"bytes,6,opt,name=rawLog,proto3" json:"rawLog,omitempty"` + RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"` // Time of the previous block. For heights > 1, it's the weighted median of // the timestamps of the valid votes in the block.LastCommit. For height == 1, // it's genesis time. @@ -111,7 +112,8 @@ type BroadcastTxResponse struct { // The request transaction bytes. Tx *Tx `protobuf:"bytes,10,opt,name=tx,proto3" json:"tx,omitempty"` // The transaction hash. - TxHash string `protobuf:"bytes,11,opt,name=txHash,proto3" json:"txHash,omitempty"` + TxHash string `protobuf:"bytes,11,opt,name=txhash,proto3" json:"txhash,omitempty"` + Logs []types.ABCIMessageLog `protobuf:"bytes,12,rep,name=logs,proto3" json:"logs"` } func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } @@ -224,6 +226,13 @@ func (m *BroadcastTxResponse) GetTxHash() string { return "" } +func (m *BroadcastTxResponse) GetLogs() []types.ABCIMessageLog { + if m != nil { + return m.Logs + } + return nil +} + // SimulateRequest is the request type for the Service.Simulate // RPC method. type SimulateRequest struct { @@ -432,45 +441,49 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 601 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x6f, 0xd3, 0x30, - 0x1c, 0x6d, 0xb2, 0xae, 0x7f, 0xdc, 0x8d, 0x3f, 0x46, 0x54, 0x56, 0x28, 0x59, 0x48, 0x29, 0xea, - 0x85, 0x44, 0x2b, 0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, 0xde, 0xf5, 0x64, 0x0d, 0x3b, - 0xa0, 0x29, 0x9e, 0x2c, 0xc5, 0x7e, 0x21, 0xb2, 0xda, 0x10, 0x8c, 0x00, 0x73, 0x8c, 0xb6, 0x94, - 0xba, 0xa8, 0x21, 0x02, 0xf5, 0x10, 0xb3, 0xa7, 0x8c, 0x04, 0xa8, 0x6a, 0x69, 0xfd, 0x2d, 0xaf, - 0x58, 0x0a, 0xad, 0x10, 0xb3, 0x67, 0x38, 0xe1, 0x24, 0x40, 0xdb, 0xf2, 0xdd, 0x6a, 0x03, 0xb6, - 0x41, 0x6d, 0x8a, 0x5f, 0x3f, 0xa1, 0x21, 0xaa, 0x49, 0xb5, 0x7c, 0x25, 0x58, 0x3c, 0x8a, 0x09, - 0xe3, 0x38, 0x4e, 0x51, 0x5d, 0x39, 0x58, 0x6e, 0x08, 0x07, 0x51, 0x72, 0x42, 0x51, 0x43, 0x39, - 0x10, 0xb5, 0x50, 0x1a, 0x93, 0x28, 0x1c, 0x73, 0xd4, 0x94, 0x4d, 0xf2, 0x15, 0xec, 0xc9, 0x6c, - 0x80, 0xa5, 0xf5, 0x5b, 0x83, 0xeb, 0xce, 0xc6, 0x07, 0x73, 0x8e, 0x33, 0x19, 0x59, 0x1b, 0xd4, - 0x78, 0xf6, 0x08, 0xb3, 0x31, 0x6a, 0x29, 0x23, 0x6a, 0x65, 0x0f, 0xc1, 0xe5, 0xa3, 0x28, 0x9e, - 0x4d, 0x30, 0x27, 0x45, 0xda, 0xbd, 0x65, 0xda, 0x17, 0x29, 0xda, 0x1f, 0x35, 0x70, 0x65, 0x45, - 0xcd, 0xd3, 0x7e, 0x00, 0x1a, 0x21, 0x66, 0x2f, 0xa4, 0x7b, 0xa5, 0x70, 0xab, 0x50, 0x10, 0x77, - 0xc2, 0x91, 0xd7, 0xa0, 0x10, 0x3a, 0xc4, 0xec, 0x71, 0x72, 0x42, 0x65, 0x96, 0xa2, 0x80, 0x43, - 0x50, 0x9b, 0x12, 0x36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, 0xbd, 0xdf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x11, 0x68, 0xcf, 0x1e, 0xe6, 0x04, 0x00, 0x00, + // 671 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0x93, 0xd4, 0x69, 0x36, 0x2d, 0x1f, 0x0b, 0x14, 0x13, 0x5a, 0xc7, 0xb8, 0x04, 0xe5, + 0x82, 0xad, 0x06, 0x09, 0xf5, 0x80, 0x84, 0x08, 0x87, 0x52, 0xa9, 0x5c, 0xdc, 0x22, 0x24, 0x2e, + 0xd5, 0xc6, 0xde, 0x6e, 0x2c, 0x12, 0xaf, 0xc9, 0x6c, 0x5a, 0x23, 0xe0, 0xc2, 0x05, 0x89, 0x13, + 0x12, 0x7f, 0xaa, 0xc7, 0x4a, 0x5c, 0x38, 0x55, 0x28, 0xe5, 0x1f, 0xf0, 0x07, 0xd0, 0xae, 0xed, + 0xb6, 0x50, 0xb7, 0x70, 0xf2, 0x78, 0xf7, 0xbd, 0x37, 0xcf, 0xf3, 0x32, 0x41, 0x2d, 0x9f, 0xc3, + 0x88, 0x83, 0x2b, 0x12, 0x77, 0x77, 0xa5, 0x4f, 0x05, 0x59, 0x71, 0x81, 0x8e, 0x77, 0x43, 0x9f, + 0x3a, 0xf1, 0x98, 0x0b, 0x8e, 0xaf, 0xa6, 0x00, 0x47, 0x24, 0x4e, 0x06, 0x68, 0x2e, 0x32, 0xce, + 0xd9, 0x90, 0xba, 0x24, 0x0e, 0x5d, 0x12, 0x45, 0x5c, 0x10, 0x11, 0xf2, 0x08, 0x52, 0x42, 0x73, + 0x39, 0x53, 0xec, 0x13, 0xa0, 0x2e, 0xe9, 0xfb, 0xe1, 0xb1, 0xb0, 0x7c, 0xc9, 0x40, 0xcd, 0xb3, + 0x6d, 0x45, 0x92, 0xdd, 0x5d, 0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x5f, 0xb3, 0x6c, 0x2e, 0x5f, 0x88, 0x49, 0x7d, 0xd8, 0xcb, 0x1f, 0xbf, 0xfd, 0xfc, 0x5a, 0x5e, + 0xb2, 0x6f, 0xbb, 0x05, 0x9b, 0x9f, 0x77, 0x8b, 0xd1, 0x8c, 0x72, 0x8f, 0x5b, 0x05, 0x92, 0xa7, + 0xbf, 0xbd, 0x69, 0x9d, 0x0f, 0xc8, 0x1a, 0xde, 0x55, 0x0d, 0x4d, 0xbc, 0xe8, 0x16, 0xed, 0xbc, + 0xfb, 0x4e, 0x8e, 0xeb, 0x03, 0x7e, 0x8f, 0x1a, 0xa7, 0x76, 0x14, 0xb7, 0x0b, 0x64, 0xcf, 0xae, + 0x7f, 0xf3, 0xde, 0xbf, 0x60, 0x99, 0x07, 0x53, 0x79, 0x30, 0xec, 0x85, 0x42, 0x0f, 0xd0, 0x7b, + 0xbc, 0x3f, 0x35, 0xb5, 0x83, 0xa9, 0xa9, 0xfd, 0x98, 0x9a, 0xda, 0x97, 0x23, 0xb3, 0x74, 0x70, + 0x64, 0x96, 0xbe, 0x1f, 0x99, 0xa5, 0x57, 0x6d, 0x16, 0x8a, 0xc1, 0xa4, 0xef, 0xf8, 0x7c, 0x94, + 0x73, 0xd3, 0xc7, 0x7d, 0x08, 0x5e, 0xbb, 0xe2, 0x6d, 0x4c, 0xa5, 0x58, 0x5f, 0x57, 0x7f, 0x52, + 0x0f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x93, 0x5e, 0x79, 0x23, 0x4f, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -688,6 +701,20 @@ func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } if len(m.TxHash) > 0 { i -= len(m.TxHash) copy(dAtA[i:], m.TxHash) @@ -986,6 +1013,12 @@ func (m *BroadcastTxResponse) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } return n } @@ -1503,6 +1536,40 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { } m.TxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, types.ABCIMessageLog{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 3f964684ea37..97481a9d91da 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -128,6 +128,7 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque Timestamp: resp.Timestamp, TxHash: resp.TxHash, Tx: &protoTx, + Logs: resp.Logs, }, nil } From 4871d3293ffb972892b19a0040e70839620d0cff Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Thu, 12 Nov 2020 13:15:55 +0530 Subject: [PATCH 04/26] Update service.proto --- proto/cosmos/tx/v1beta1/service.proto | 52 +- types/tx/service.pb.go | 662 +++++--------------------- x/auth/tx/service.go | 42 +- x/auth/tx/service_test.go | 4 +- 4 files changed, 158 insertions(+), 602 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index a022e314b0f7..898ce94697c6 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -18,8 +18,7 @@ service Service { rpc GetTx(GetTxRequest) returns (GetTxResponse) { option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; } - - + // BroadcastTx broadcast transaction. rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { option (google.api.http).post = "/cosmos/tx/v1beta1/txs"; @@ -31,40 +30,31 @@ service Service { message BroadcastTxRequest { // tx is the list of queried transactions. bytes tx = 1; - string mode = 2; + BroadcastMode mode = 2; +} + +// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. +enum BroadcastMode { + // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + // the tx to be committed in a block. + BROADCAST_MODE_BLOCK = 0; + + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + // a CheckTx execution response only. + BROADCAST_MODE_SYNC = 1; + + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + // immediately. + BROADCAST_MODE_ASYNC = 2; } // BroadcastTxResponse is the response type for the // Service.BroadcastTx method. message BroadcastTxResponse { - // Response code. - uint32 code = 1; - // Namespace for the Code - string codespace = 2; - // Result bytes, if any. - string data = 3; - // Amount of gas consumed by transaction. - int64 gas_used = 4; - // Amount of gas requested for transaction. - int64 gas_wanted = 5; - // The output of the application's logger (raw string). May be - // non-deterministic. - string raw_log = 6; - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - string timestamp = 7; - // Additional information. May be non-deterministic. - string info = 8; - // The block height - int64 height = 9; - // The request transaction bytes. - cosmos.tx.v1beta1.Tx tx = 10; - // The transaction hash. - string txhash = 11 [(gogoproto.customname) = "TxHash"]; - - repeated cosmos.base.abci.v1beta1.ABCIMessageLog logs = 12 [(gogoproto.nullable) = false]; - + // tx is the queried transaction. + cosmos.tx.v1beta1.Tx tx = 1; + // tx_response is the queried TxResponses. + cosmos.base.abci.v1beta1.TxResponse tx_response = 2; } diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 9f4ec6635de5..25e57eed103a 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -30,12 +30,47 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. +type BroadcastMode int32 + +const ( + // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + // the tx to be committed in a block. + BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 0 + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + // a CheckTx execution response only. + BroadcastMode_BROADCAST_MODE_SYNC BroadcastMode = 1 + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + // immediately. + BroadcastMode_BROADCAST_MODE_ASYNC BroadcastMode = 2 +) + +var BroadcastMode_name = map[int32]string{ + 0: "BROADCAST_MODE_BLOCK", + 1: "BROADCAST_MODE_SYNC", + 2: "BROADCAST_MODE_ASYNC", +} + +var BroadcastMode_value = map[string]int32{ + "BROADCAST_MODE_BLOCK": 0, + "BROADCAST_MODE_SYNC": 1, + "BROADCAST_MODE_ASYNC": 2, +} + +func (x BroadcastMode) String() string { + return proto.EnumName(BroadcastMode_name, int32(x)) +} + +func (BroadcastMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{0} +} + // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. type BroadcastTxRequest struct { // tx is the list of queried transactions. - Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` - Mode string `protobuf:"bytes,2,opt,name=mode,proto3" json:"mode,omitempty"` + Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` + Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` } func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } @@ -78,42 +113,20 @@ func (m *BroadcastTxRequest) GetTx() []byte { return nil } -func (m *BroadcastTxRequest) GetMode() string { +func (m *BroadcastTxRequest) GetMode() BroadcastMode { if m != nil { return m.Mode } - return "" + return BroadcastMode_BROADCAST_MODE_BLOCK } // BroadcastTxResponse is the response type for the // Service.BroadcastTx method. type BroadcastTxResponse struct { - // Response code. - Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` - // Namespace for the Code - Codespace string `protobuf:"bytes,2,opt,name=codespace,proto3" json:"codespace,omitempty"` - // Result bytes, if any. - Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - // Amount of gas consumed by transaction. - GasUsed int64 `protobuf:"varint,4,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - // Amount of gas requested for transaction. - GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` - // The output of the application's logger (raw string). May be - // non-deterministic. - RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"` - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - Timestamp string `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - // Additional information. May be non-deterministic. - Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` - // The block height - Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` - // The request transaction bytes. - Tx *Tx `protobuf:"bytes,10,opt,name=tx,proto3" json:"tx,omitempty"` - // The transaction hash. - TxHash string `protobuf:"bytes,11,opt,name=txhash,proto3" json:"txhash,omitempty"` - Logs []types.ABCIMessageLog `protobuf:"bytes,12,rep,name=logs,proto3" json:"logs"` + // tx is the queried transaction. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` + // tx_response is the queried TxResponses. + TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"` } func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } @@ -149,69 +162,6 @@ func (m *BroadcastTxResponse) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo -func (m *BroadcastTxResponse) GetCode() uint32 { - if m != nil { - return m.Code - } - return 0 -} - -func (m *BroadcastTxResponse) GetCodespace() string { - if m != nil { - return m.Codespace - } - return "" -} - -func (m *BroadcastTxResponse) GetData() string { - if m != nil { - return m.Data - } - return "" -} - -func (m *BroadcastTxResponse) GetGasUsed() int64 { - if m != nil { - return m.GasUsed - } - return 0 -} - -func (m *BroadcastTxResponse) GetGasWanted() int64 { - if m != nil { - return m.GasWanted - } - return 0 -} - -func (m *BroadcastTxResponse) GetRawLog() string { - if m != nil { - return m.RawLog - } - return "" -} - -func (m *BroadcastTxResponse) GetTimestamp() string { - if m != nil { - return m.Timestamp - } - return "" -} - -func (m *BroadcastTxResponse) GetInfo() string { - if m != nil { - return m.Info - } - return "" -} - -func (m *BroadcastTxResponse) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - func (m *BroadcastTxResponse) GetTx() *Tx { if m != nil { return m.Tx @@ -219,16 +169,9 @@ func (m *BroadcastTxResponse) GetTx() *Tx { return nil } -func (m *BroadcastTxResponse) GetTxHash() string { +func (m *BroadcastTxResponse) GetTxResponse() *types.TxResponse { if m != nil { - return m.TxHash - } - return "" -} - -func (m *BroadcastTxResponse) GetLogs() []types.ABCIMessageLog { - if m != nil { - return m.Logs + return m.TxResponse } return nil } @@ -430,6 +373,7 @@ func (m *GetTxResponse) GetTx() *Tx { } func init() { + proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value) proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest") @@ -441,49 +385,43 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 671 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x93, 0xd4, 0x69, 0x36, 0x2d, 0x1f, 0x0b, 0x14, 0x13, 0x5a, 0xc7, 0xb8, 0x04, 0xe5, - 0x82, 0xad, 0x06, 0x09, 0xf5, 0x80, 0x84, 0x08, 0x87, 0x52, 0xa9, 0x5c, 0xdc, 0x22, 0x24, 0x2e, - 0xd5, 0xc6, 0xde, 0x6e, 0x2c, 0x12, 0xaf, 0xc9, 0x6c, 0x5a, 0x23, 0xe0, 0xc2, 0x05, 0x89, 0x13, - 0x12, 0x7f, 0xaa, 0xc7, 0x4a, 0x5c, 0x38, 0x55, 0x28, 0xe5, 0x1f, 0xf0, 0x07, 0xd0, 0xae, 0xed, - 0xb6, 0x50, 0xb7, 0x70, 0xf2, 0x78, 0xf7, 0xbd, 0x37, 0xcf, 0xf3, 0x32, 0x41, 0x2d, 0x9f, 0xc3, - 0x88, 0x83, 0x2b, 0x12, 0x77, 0x77, 0xa5, 0x4f, 0x05, 0x59, 0x71, 0x81, 0x8e, 0x77, 0x43, 0x9f, - 0x3a, 0xf1, 0x98, 0x0b, 0x8e,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xff, 0xff, 0x93, 0x5e, 0x79, 0x23, 0x4f, 0x05, 0x00, 0x00, + // 563 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0x12, 0x4d, + 0x18, 0x67, 0x37, 0x7d, 0xdb, 0xbe, 0x0f, 0x6d, 0xc5, 0x69, 0x55, 0x82, 0x75, 0x8b, 0x43, 0x31, + 0x8d, 0x89, 0x3b, 0x29, 0x1a, 0xd3, 0x83, 0x89, 0x01, 0xda, 0x34, 0x46, 0x2b, 0xc9, 0xc2, 0xc5, + 0xc6, 0x84, 0x0c, 0x30, 0x5d, 0x36, 0xc2, 0x0e, 0x32, 0x43, 0xb3, 0x46, 0xbd, 0xe8, 0xcd, 0x93, + 0x89, 0x5f, 0xca, 0x63, 0x13, 0x2f, 0x1e, 0x0d, 0xf8, 0x0d, 0xfc, 0x02, 0x86, 0xd9, 0x59, 0x4a, + 0xdb, 0xa5, 0xea, 0x69, 0x9f, 0xdd, 0xf9, 0xfd, 0x9b, 0xe7, 0x99, 0x59, 0xd8, 0x68, 0x72, 0xd1, + 0xe5, 0x82, 0xc8, 0x80, 0x1c, 0x6f, 0x37, 0x98, 0xa4, 0xdb, 0x44, 0xb0, 0xfe, 0xb1, 0xd7, 0x64, + 0x76, 0xaf, 0xcf, 0x25, 0x47, 0x57, 0x43, 0x80, 0x2d, 0x03, 0x5b, 0x03, 0x32, 0xeb, 0x2e, 0xe7, + 0x6e, 0x87, 0x11, 0xda, 0xf3, 0x08, 0xf5, 0x7d, 0x2e, 0xa9, 0xf4, 0xb8, 0x2f, 0x42, 0x42, 0x26, + 0xa7, 0x15, 0x1b, 0x54, 0x30, 0x42, 0x1b, 0x4d, 0x6f, 0x22, 0x3c, 0x7e, 0xd1, 0xa0, 0xcc, 0x45, + 0x5b, 0x19, 0xe8, 0xb5, 0x35, 0x97, 0xbb, 0x5c, 0x95, 0x64, 0x5c, 0x85, 0x5f, 0xf1, 0x21, 0xa0, + 0x52, 0x9f, 0xd3, 0x56, 0x93, 0x0a, 0x59, 0x0b, 0x1c, 0xf6, 0x7a, 0xc0, 0x84, 0x44, 0x2b, 0x60, + 0xca, 0x20, 0x6d, 0x64, 0x8d, 0xad, 0x25, 0xc7, 0x94, 0x01, 0x7a, 0x00, 0x73, 0x5d, 0xde, 0x62, + 0x69, 0x33, 0x6b, 0x6c, 0xad, 0x14, 0xb2, 0xf6, 0x85, 0xf0, 0xf6, 0x44, 0xe4, 0x80, 0xb7, 0x98, + 0xa3, 0xd0, 0xf8, 0xa3, 0x01, 0xab, 0x67, 0xc4, 0x45, 0x8f, 0xfb, 0x82, 0xa1, 0xfc, 0x44, 0x3d, + 0x59, 0xb8, 0x16, 0xa3, 0x55, 0x0b, 0x94, 0xe9, 0x1e, 0x24, 0x65, 0x50, 0xef, 0x6b, 0x96, 0xf2, + 0x4e, 0x16, 0x36, 0x23, 0xfc, 0xb8, 0x0f, 0xb6, 0xda, 0xfa, 0x14, 0x4d, 0x63, 0x1d, 0x90, 0x93, + 0x1a, 0xef, 0xc0, 0x95, 0xaa, 0xd7, 0x1d, 0x74, 0xa8, 0x64, 0xd1, 0xf6, 0xfe, 0x2e, 0x00, 0xfe, + 0x64, 0x40, 0xea, 0x94, 0xaa, 0xc3, 0x3f, 0x82, 0x45, 0x97, 0x8a, 0xba, 0xe7, 0x1f, 0x71, 0xad, + 0x70, 0x7b, 0x76, 0xa4, 0x7d, 0x2a, 0x9e, 0xf8, 0x47, 0xdc, 0x59, 0x70, 0xc3, 0x02, 0xed, 0xc0, + 0x7c, 0x9f, 0x89, 0x41, 0x47, 0xea, 0xed, 0x64, 0x67, 0x73, 0x1d, 0x85, 0x73, 0x34, 0x1e, 0x63, + 0x58, 0xda, 0x67, 0x53, 0x23, 0x42, 0x30, 0xd7, 0xa6, 0xa2, 0xad, 0x32, 0xfc, 0xef, 0xa8, 0x1a, + 0x3f, 0x84, 0x65,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bd, 0x22, 0xf2, 0x4d, 0x8f, 0x8d, 0xc5, 0x1a, + 0xf3, 0xea, 0x07, 0x71, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0xdf, 0x75, 0x07, 0xcb, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -664,12 +602,10 @@ func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Mode) > 0 { - i -= len(m.Mode) - copy(dAtA[i:], m.Mode) - i = encodeVarintService(dAtA, i, uint64(len(m.Mode))) + if m.Mode != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Mode)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if len(m.Tx) > 0 { i -= len(m.Tx) @@ -701,26 +637,17 @@ func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Logs) > 0 { - for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) + if m.TxResponse != nil { + { + size, err := m.TxResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x62 + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintService(dAtA, i, uint64(len(m.TxHash))) i-- - dAtA[i] = 0x5a + dAtA[i] = 0x12 } if m.Tx != nil { { @@ -732,62 +659,7 @@ func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 - } - if m.Height != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x48 - } - if len(m.Info) > 0 { - i -= len(m.Info) - copy(dAtA[i:], m.Info) - i = encodeVarintService(dAtA, i, uint64(len(m.Info))) - i-- - dAtA[i] = 0x42 - } - if len(m.Timestamp) > 0 { - i -= len(m.Timestamp) - copy(dAtA[i:], m.Timestamp) - i = encodeVarintService(dAtA, i, uint64(len(m.Timestamp))) - i-- - dAtA[i] = 0x3a - } - if len(m.RawLog) > 0 { - i -= len(m.RawLog) - copy(dAtA[i:], m.RawLog) - i = encodeVarintService(dAtA, i, uint64(len(m.RawLog))) - i-- - dAtA[i] = 0x32 - } - if m.GasWanted != 0 { - i = encodeVarintService(dAtA, i, uint64(m.GasWanted)) - i-- - dAtA[i] = 0x28 - } - if m.GasUsed != 0 { - i = encodeVarintService(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x20 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintService(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if len(m.Codespace) > 0 { - i -= len(m.Codespace) - copy(dAtA[i:], m.Codespace) - i = encodeVarintService(dAtA, i, uint64(len(m.Codespace))) - i-- - dAtA[i] = 0x12 - } - if m.Code != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Code)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -960,9 +832,8 @@ func (m *BroadcastTxRequest) Size() (n int) { if l > 0 { n += 1 + l + sovService(uint64(l)) } - l = len(m.Mode) - if l > 0 { - n += 1 + l + sovService(uint64(l)) + if m.Mode != 0 { + n += 1 + sovService(uint64(m.Mode)) } return n } @@ -973,52 +844,14 @@ func (m *BroadcastTxResponse) Size() (n int) { } var l int _ = l - if m.Code != 0 { - n += 1 + sovService(uint64(m.Code)) - } - l = len(m.Codespace) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.GasUsed != 0 { - n += 1 + sovService(uint64(m.GasUsed)) - } - if m.GasWanted != 0 { - n += 1 + sovService(uint64(m.GasWanted)) - } - l = len(m.RawLog) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Timestamp) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Info) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovService(uint64(m.Height)) - } if m.Tx != nil { l = m.Tx.Size() n += 1 + l + sovService(uint64(l)) } - l = len(m.TxHash) - if l > 0 { + if m.TxResponse != nil { + l = m.TxResponse.Size() n += 1 + l + sovService(uint64(l)) } - if len(m.Logs) > 0 { - for _, e := range m.Logs { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } return n } @@ -1148,10 +981,10 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) } - var stringLen uint64 + m.Mode = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1161,24 +994,11 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Mode |= BroadcastMode(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.Mode = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipService(dAtA[iNdEx:]) @@ -1233,242 +1053,6 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - m.Code = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Code |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codespace", 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.Codespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) - } - m.GasWanted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasWanted |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawLog", 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.RawLog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", 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.Timestamp = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", 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.Info = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) } @@ -1504,41 +1088,9 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", 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.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1565,8 +1117,10 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Logs = append(m.Logs, types.ABCIMessageLog{}) - if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.TxResponse == nil { + m.TxResponse = &types.TxResponse{} + } + if err := m.TxResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 97481a9d91da..7ae14438af11 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -95,11 +95,19 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque if req.Tx == nil { return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } - if req.Mode == "" { - return nil, status.Error(codes.InvalidArgument, "invalid empty mode") - } - clientCtx := s.clientCtx.WithBroadcastMode(req.Mode) + var mode string + switch req.Mode { + case txtypes.BroadcastMode_BROADCAST_MODE_SYNC: + mode = "sync" + case txtypes.BroadcastMode_BROADCAST_MODE_ASYNC: + mode = "async" + case txtypes.BroadcastMode_BROADCAST_MODE_BLOCK: + mode = "block" + default: + return nil, status.Error(codes.InvalidArgument, "invalid mode") + } + clientCtx := s.clientCtx.WithBroadcastMode(mode) resp, err := clientCtx.BroadcastTx(req.Tx) if err != nil { @@ -117,18 +125,20 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque return nil, err } return &txtypes.BroadcastTxResponse{ - Code: resp.Code, - Codespace: resp.Codespace, - Data: resp.Data, - GasUsed: resp.GasUsed, - GasWanted: resp.GasWanted, - Height: resp.Height, - Info: resp.Info, - RawLog: resp.RawLog, - Timestamp: resp.Timestamp, - TxHash: resp.TxHash, - Tx: &protoTx, - Logs: resp.Logs, + Tx: &protoTx, + TxResponse: &sdk.TxResponse{ + Code: resp.Code, + Codespace: resp.Codespace, + Data: resp.Data, + GasUsed: resp.GasUsed, + GasWanted: resp.GasWanted, + Height: resp.Height, + Info: resp.Info, + RawLog: resp.RawLog, + Timestamp: resp.Timestamp, + TxHash: resp.TxHash, + Logs: resp.Logs, + }, }, nil } diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index b44f4a7d9c93..949e06e7689d 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -164,6 +164,8 @@ func (s IntegrationTestSuite) TestBroadcastTx() { WithTxConfig(val.ClientCtx.TxConfig). WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) + txBuilder.SetTimeoutHeight(txFactory.TimeoutHeight()) + // Sign Tx. err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) s.Require().NoError(err) @@ -176,7 +178,7 @@ func (s IntegrationTestSuite) TestBroadcastTx() { grpcRes, err := s.queryClient.BroadcastTx( context.Background(), &tx.BroadcastTxRequest{ - Mode: "async", + Mode: tx.BroadcastMode_BROADCAST_MODE_ASYNC, Tx: txBytes, }, ) From abc49b83618eb5542ff9d48c8861686f62f21208 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Thu, 12 Nov 2020 22:49:34 +0530 Subject: [PATCH 05/26] resolve conflicts --- types/tx/service.pb.go | 781 ++++++++++++++++++++++++++------------ types/tx/service.pb.gw.go | 87 ++++- 2 files changed, 600 insertions(+), 268 deletions(-) diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 04ee5725eae1..92e553c1cee1 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -7,8 +7,8 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -66,26 +66,6 @@ func (BroadcastMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor_e0b00a618705eca7, []int{0} } -// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest -// RPC method. -type BroadcastTxRequest struct { - // tx is the list of queried transactions. - Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` - Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` -} - -func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } -func (m *BroadcastTxRequest) String() string { return proto.CompactTextString(m) } -func (*BroadcastTxRequest) ProtoMessage() {} -func (*BroadcastTxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{0} -} -func (m *BroadcastTxRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BroadcastTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BroadcastTxRequest.Marshal(b, m, deterministic) // GetTxsEventRequest is the request type for the Service.TxsByEvents // RPC method. type GetTxsEventRequest struct { @@ -116,53 +96,6 @@ func (m *GetTxsEventRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *BroadcastTxRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BroadcastTxRequest.Merge(m, src) -} -func (m *BroadcastTxRequest) XXX_Size() int { - return m.Size() -} -func (m *BroadcastTxRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BroadcastTxRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo - -func (m *BroadcastTxRequest) GetTx() []byte { - if m != nil { - return m.Tx - } - return nil -} - -func (m *BroadcastTxRequest) GetMode() BroadcastMode { - if m != nil { - return m.Mode - } - return BroadcastMode_BROADCAST_MODE_BLOCK -} - -// BroadcastTxResponse is the response type for the -// Service.BroadcastTx method. -type BroadcastTxResponse struct { - // tx is the queried transaction. - Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` - // tx_response is the queried TxResponses. - TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"` -} - -func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } -func (m *BroadcastTxResponse) String() string { return proto.CompactTextString(m) } -func (*BroadcastTxResponse) ProtoMessage() {} -func (*BroadcastTxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{1} -} -func (m *BroadcastTxResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BroadcastTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BroadcastTxResponse.Marshal(b, m, deterministic) func (m *GetTxsEventRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTxsEventRequest.Merge(m, src) } @@ -221,21 +154,6 @@ func (m *GetTxsEventResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *BroadcastTxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_BroadcastTxResponse.Merge(m, src) -} -func (m *BroadcastTxResponse) XXX_Size() int { - return m.Size() -} -func (m *BroadcastTxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_BroadcastTxResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo - -func (m *BroadcastTxResponse) GetTx() *Tx { - if m != nil { - return m.Tx func (m *GetTxsEventResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTxsEventResponse.Merge(m, src) } @@ -262,9 +180,6 @@ func (m *GetTxsEventResponse) GetTxResponses() []*types.TxResponse { return nil } -func (m *BroadcastTxResponse) GetTxResponse() *types.TxResponse { - if m != nil { - return m.TxResponse func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { if m != nil { return m.Pagination @@ -272,6 +187,117 @@ func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { return nil } +// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest +// RPC method. +type BroadcastTxRequest struct { + // tx is the list of queried transactions. + Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` + Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` +} + +func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } +func (m *BroadcastTxRequest) String() string { return proto.CompactTextString(m) } +func (*BroadcastTxRequest) ProtoMessage() {} +func (*BroadcastTxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{2} +} +func (m *BroadcastTxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastTxRequest.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 *BroadcastTxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastTxRequest.Merge(m, src) +} +func (m *BroadcastTxRequest) XXX_Size() int { + return m.Size() +} +func (m *BroadcastTxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastTxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo + +func (m *BroadcastTxRequest) GetTx() []byte { + if m != nil { + return m.Tx + } + return nil +} + +func (m *BroadcastTxRequest) GetMode() BroadcastMode { + if m != nil { + return m.Mode + } + return BroadcastMode_BROADCAST_MODE_BLOCK +} + +// BroadcastTxResponse is the response type for the +// Service.BroadcastTx method. +type BroadcastTxResponse struct { + // tx is the queried transaction. + Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` + // tx_response is the queried TxResponses. + TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"` +} + +func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } +func (m *BroadcastTxResponse) String() string { return proto.CompactTextString(m) } +func (*BroadcastTxResponse) ProtoMessage() {} +func (*BroadcastTxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e0b00a618705eca7, []int{3} +} +func (m *BroadcastTxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BroadcastTxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BroadcastTxResponse.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 *BroadcastTxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BroadcastTxResponse.Merge(m, src) +} +func (m *BroadcastTxResponse) XXX_Size() int { + return m.Size() +} +func (m *BroadcastTxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BroadcastTxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo + +func (m *BroadcastTxResponse) GetTx() *Tx { + if m != nil { + return m.Tx + } + return nil +} + +func (m *BroadcastTxResponse) GetTxResponse() *types.TxResponse { + if m != nil { + return m.TxResponse + } + return nil +} + // SimulateRequest is the request type for the Service.Simulate // RPC method. type SimulateRequest struct { @@ -283,7 +309,7 @@ func (m *SimulateRequest) Reset() { *m = SimulateRequest{} } func (m *SimulateRequest) String() string { return proto.CompactTextString(m) } func (*SimulateRequest) ProtoMessage() {} func (*SimulateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{2} + return fileDescriptor_e0b00a618705eca7, []int{4} } func (m *SimulateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -332,7 +358,7 @@ func (m *SimulateResponse) Reset() { *m = SimulateResponse{} } func (m *SimulateResponse) String() string { return proto.CompactTextString(m) } func (*SimulateResponse) ProtoMessage() {} func (*SimulateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{3} + return fileDescriptor_e0b00a618705eca7, []int{5} } func (m *SimulateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -386,7 +412,7 @@ func (m *GetTxRequest) Reset() { *m = GetTxRequest{} } func (m *GetTxRequest) String() string { return proto.CompactTextString(m) } func (*GetTxRequest) ProtoMessage() {} func (*GetTxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{4} + return fileDescriptor_e0b00a618705eca7, []int{6} } func (m *GetTxRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -434,7 +460,7 @@ func (m *GetTxResponse) Reset() { *m = GetTxResponse{} } func (m *GetTxResponse) String() string { return proto.CompactTextString(m) } func (*GetTxResponse) ProtoMessage() {} func (*GetTxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e0b00a618705eca7, []int{5} + return fileDescriptor_e0b00a618705eca7, []int{7} } func (m *GetTxResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -479,10 +505,10 @@ func (m *GetTxResponse) GetTxResponse() *types.TxResponse { func init() { proto.RegisterEnum("cosmos.tx.v1beta1.BroadcastMode", BroadcastMode_name, BroadcastMode_value) - proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") - proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") proto.RegisterType((*GetTxsEventRequest)(nil), "cosmos.tx.v1beta1.GetTxsEventRequest") proto.RegisterType((*GetTxsEventResponse)(nil), "cosmos.tx.v1beta1.GetTxsEventResponse") + proto.RegisterType((*BroadcastTxRequest)(nil), "cosmos.tx.v1beta1.BroadcastTxRequest") + proto.RegisterType((*BroadcastTxResponse)(nil), "cosmos.tx.v1beta1.BroadcastTxResponse") proto.RegisterType((*SimulateRequest)(nil), "cosmos.tx.v1beta1.SimulateRequest") proto.RegisterType((*SimulateResponse)(nil), "cosmos.tx.v1beta1.SimulateResponse") proto.RegisterType((*GetTxRequest)(nil), "cosmos.tx.v1beta1.GetTxRequest") @@ -492,79 +518,51 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 563 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4f, 0x6f, 0x12, 0x4d, - 0x18, 0x67, 0x37, 0x7d, 0xdb, 0xbe, 0x0f, 0x6d, 0xc5, 0x69, 0x55, 0x82, 0x75, 0x8b, 0x43, 0x31, - 0x8d, 0x89, 0x3b, 0x29, 0x1a, 0xd3, 0x83, 0x89, 0x01, 0xda, 0x34, 0x46, 0x2b, 0xc9, 0xc2, 0xc5, - 0xc6, 0x84, 0x0c, 0x30, 0x5d, 0x36, 0xc2, 0x0e, 0x32, 0x43, 0xb3, 0x46, 0xbd, 0xe8, 0xcd, 0x93, - 0x89, 0x5f, 0xca, 0x63, 0x13, 0x2f, 0x1e, 0x0d, 0xf8, 0x0d, 0xfc, 0x02, 0x86, 0xd9, 0x59, 0x4a, - 0xdb, 0xa5, 0xea, 0x69, 0x9f, 0xdd, 0xf9, 0xfd, 0x9b, 0xe7, 0x99, 0x59, 0xd8, 0x68, 0x72, 0xd1, - 0xe5, 0x82, 0xc8, 0x80, 0x1c, 0x6f, 0x37, 0x98, 0xa4, 0xdb, 0x44, 0xb0, 0xfe, 0xb1, 0xd7, 0x64, - 0x76, 0xaf, 0xcf, 0x25, 0x47, 0x57, 0x43, 0x80, 0x2d, 0x03, 0x5b, 0x03, 0x32, 0xeb, 0x2e, 0xe7, - 0x6e, 0x87, 0x11, 0xda, 0xf3, 0x08, 0xf5, 0x7d, 0x2e, 0xa9, 0xf4, 0xb8, 0x2f, 0x42, 0x42, 0x26, - 0xa7, 0x15, 0x1b, 0x54, 0x30, 0x42, 0x1b, 0x4d, 0x6f, 0x22, 0x3c, 0x7e, 0xd1, 0xa0, 0xcc, 0x45, - 0x5b, 0x19, 0xe8, 0xb5, 0x35, 0x97, 0xbb, 0x5c, 0x95, 0x64, 0x5c, 0x85, 0x5f, 0xf1, 0x21, 0xa0, - 0x52, 0x9f, 0xd3, 0x56, 0x93, 0x0a, 0x59, 0x0b, 0x1c, 0xf6, 0x7a, 0xc0, 0x84, 0x44, 0x2b, 0x60, - 0xca, 0x20, 0x6d, 0x64, 0x8d, 0xad, 0x25, 0xc7, 0x94, 0x01, 0x7a, 0x00, 0x73, 0x5d, 0xde, 0x62, - 0x69, 0x33, 0x6b, 0x6c, 0xad, 0x14, 0xb2, 0xf6, 0x85, 0xf0, 0xf6, 0x44, 0xe4, 0x80, 0xb7, 0x98, - 0xa3, 0xd0, 0xf8, 0xa3, 0x01, 0xab, 0x67, 0xc4, 0x45, 0x8f, 0xfb, 0x82, 0xa1, 0xfc, 0x44, 0x3d, - 0x59, 0xb8, 0x16, 0xa3, 0x55, 0x0b, 0x94, 0xe9, 0x1e, 0x24, 0x65, 0x50, 0xef, 0x6b, 0x96, 0xf2, - 0x4e, 0x16, 0x36, 0x23, 0xfc, 0xb8, 0x0f, 0xb6, 0xda, 0xfa, 0x14, 0x4d, 0x63, 0x1d, 0x90, 0x93, - 0x1a, 0xef, 0xc0, 0x95, 0xaa, 0xd7, 0x1d, 0x74, 0xa8, 0x64, 0xd1, 0xf6, 0xfe, 0x2e, 0x00, 0xfe, - 0x64, 0x40, 0xea, 0x94, 0xaa, 0xc3, 0x3f, 0x82, 0x45, 0x97, 0x8a, 0xba, 0xe7, 0x1f, 0x71, 0xad, - 0x70, 0x7b, 0x76, 0xa4, 0x7d, 0x2a, 0x9e, 0xf8, 0x47, 0xdc, 0x59, 0x70, 0xc3, 0x02, 0xed, 0xc0, - 0x7c, 0x9f, 0x89, 0x41, 0x47, 0xea, 0xed, 0x64, 0x67, 0x73, 0x1d, 0x85, 0x73, 0x34, 0x1e, 0x63, - 0x58, 0xda, 0x67, 0x53, 0x23, 0x42, 0x30, 0xd7, 0xa6, 0xa2, 0xad, 0x32, 0xfc, 0xef, 0xa8, 0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, 0xe3, 0x9e, 0x68, 0xbd, 0x22, 0xf2, 0x4d, 0x8f, 0x8d, 0xc5, 0x1a, - 0xf3, 0xea, 0x07, 0x71, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0xdf, 0x75, 0x07, 0xcb, - 0x04, 0x00, 0x00, - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0x1d, 0xfa, 0xc3, 0xa4, 0x08, 0x58, 0x7e, 0x14, 0x99, 0xe2, 0x06, 0xa7, 0x69, 0x23, - 0x24, 0xbc, 0x6a, 0xb8, 0xf4, 0x80, 0x84, 0x84, 0x54, 0x22, 0x6e, 0xc8, 0xed, 0x89, 0x4b, 0xb5, - 0x09, 0x5b, 0xc7, 0x22, 0xf1, 0xba, 0xde, 0x4d, 0xb4, 0x15, 0xf4, 0xc2, 0x91, 0x13, 0x12, 0x2f, - 0xc5, 0x31, 0x12, 0x17, 0x8e, 0x28, 0xe1, 0x0d, 0x78, 0x01, 0xe4, 0xf5, 0x3a, 0x71, 0xa8, 0x4d, - 0x7b, 0xf2, 0xae, 0xfc, 0xfd, 0xcc, 0x37, 0xe3, 0x31, 0x6c, 0xf7, 0x18, 0x1f, 0x32, 0x8e, 0x85, - 0xc4, 0xe3, 0xfd, 0x2e, 0x15, 0x64, 0x1f, 0x73, 0x1a, 0x8f, 0x83, 0x1e, 0x75, 0xa3, 0x98, 0x09, - 0x86, 0xee, 0xa6, 0x00, 0x57, 0x48, 0x57, 0x03, 0xac, 0x2d, 0x9f, 0x31, 0x7f, 0x40, 0x31, 0x89, - 0x02, 0x4c, 0xc2, 0x90, 0x09, 0x22, 0x02, 0x16, 0xf2, 0x94, 0x60, 0x35, 0xb4, 0x62, 0x97, 0x70, - 0x8a, 0x49, 0xb7, 0x17, 0xcc, 0x85, 0x93, 0x8b, 0x06, 0x59, 0x97, 0x6d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f, 0xbc, 0x6b, 0xfa, 0x81, 0xe8, 0x8f, 0xba, - 0x6e, 0x8f, 0x0d, 0x33, 0x6e, 0xfa, 0x78, 0xc6, 0xdf, 0x7f, 0xc0, 0xe2, 0x3c, 0xa2, 0x89, 0x58, - 0x77, 0x4d, 0xfd, 0x6e, 0x9e, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xae, 0x63, 0xf9, 0x38, 0x2f, - 0x05, 0x00, 0x00, + // 695 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x5f, 0x4f, 0xd3, 0x50, + 0x14, 0x5f, 0x37, 0xfe, 0x79, 0x06, 0x88, 0x17, 0xd4, 0x65, 0x62, 0xa9, 0xe5, 0x6f, 0x48, 0x6c, + 0xc3, 0xf4, 0x81, 0x07, 0x13, 0xc3, 0x00, 0x89, 0x51, 0xc4, 0x74, 0xbc, 0x48, 0x4c, 0x96, 0xbb, + 0xed, 0x52, 0x1a, 0x59, 0x6f, 0xe9, 0xbd, 0x23, 0x25, 0xca, 0x8b, 0xbe, 0xf9, 0x64, 0xe2, 0x97, + 0xf2, 0x91, 0xc4, 0x17, 0x1f, 0x0d, 0xf8, 0x05, 0xfc, 0x06, 0xa6, 0xb7, 0xb7, 0x5b, 0xc7, 0x3a, + 0xe0, 0xcd, 0x27, 0x6e, 0xe9, 0xef, 0xcf, 0x39, 0xbf, 0x73, 0x7b, 0x06, 0x33, 0x75, 0xca, 0x9a, + 0x94, 0x99, 0x3c, 0x30, 0x8f, 0x57, 0x6a, 0x84, 0xe3, 0x15, 0x93, 0x11, 0xff, 0xd8, 0xa9, 0x13, + 0xc3, 0xf3, 0x29, 0xa7, 0xe8, 0x4e, 0x04, 0x30, 0x78, 0x60, 0x48, 0x40, 0x71, 0xda, 0xa6, 0xd4, + 0x3e, 0x24, 0x26, 0xf6, 0x1c, 0x13, 0xbb, 0x2e, 0xe5, 0x98, 0x3b, 0xd4, 0x65, 0x11, 0xa1, 0x38, + 0x2b, 0x15, 0x6b, 0x98, 0x11, 0x13, 0xd7, 0xea, 0x4e, 0x5b, 0x38, 0x7c, 0x90, 0xa0, 0x62, 0xaf, + 0x2d, 0x0f, 0xe4, 0xbb, 0x29, 0x9b, 0xda, 0x54, 0x1c, 0xcd, 0xf0, 0x24, 0xff, 0xbb, 0x9c, 0x94, + 0x3d, 0x6a, 0x11, 0xff, 0xa4, 0xcd, 0xf4, 0xb0, 0xed, 0xb8, 0xa2, 0x86, 0x08, 0xab, 0xfb, 0x80, + 0xb6, 0x08, 0xdf, 0x0d, 0xd8, 0xe6, 0x31, 0x71, 0xb9, 0x45, 0x8e, 0x5a, 0x84, 0x71, 0x34, 0x05, + 0x83, 0x24, 0x7c, 0x2e, 0x28, 0x9a, 0xb2, 0x74, 0xcb, 0x8a, 0x1e, 0xd0, 0x0b, 0x80, 0x0e, 0xbf, + 0x90, 0xd5, 0x94, 0xa5, 0x7c, 0x69, 0xc1, 0x90, 0x4d, 0x87, 0x66, 0x86, 0x30, 0x8b, 0x9b, 0x37, + 0xde, 0x62, 0x9b, 0x48, 0x45, 0x2b, 0xc1, 0xd4, 0xcf, 0x14, 0x98, 0xec, 0x32, 0x65, 0x1e, 0x75, + 0x19, 0x41, 0x8b, 0x90, 0xe3, 0x01, 0x2b, 0x28, 0x5a, 0x6e, 0x29, 0x5f, 0xba, 0x6b, 0xf4, 0xa4, + 0x69, 0xec, 0x06, 0x56, 0x88, 0x40, 0x5b, 0x30, 0xca, 0x83, 0xaa, 0x2f, 0x79, 0xac, 0x90, 0x15, + 0x8c, 0xb9, 0xae, 0x52, 0x44, 0x82, 0x09, 0xa2, 0x04, 0x5b, 0x79, 0xde, 0x3e, 0x87, 0x42, 0xc9, + 0x8e, 0x72, 0xa2, 0xa3, 0xc5, 0x6b, 0x3b, 0x92, 0x4a, 0xc9, 0x96, 0xf6, 0x00, 0x95, 0x7d, 0x8a, + 0x1b, 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ff, 0xff, 0xe3, + 0x60, 0x2a, 0x38, 0x03, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -618,6 +616,12 @@ func (c *serviceClient) GetTx(ctx context.Context, in *GetTxRequest, opts ...grp func (c *serviceClient) BroadcastTx(ctx context.Context, in *BroadcastTxRequest, opts ...grpc.CallOption) (*BroadcastTxResponse, error) { out := new(BroadcastTxResponse) err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/BroadcastTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *serviceClient) GetTxsEvent(ctx context.Context, in *GetTxsEventRequest, opts ...grpc.CallOption) (*GetTxsEventResponse, error) { out := new(GetTxsEventResponse) err := c.cc.Invoke(ctx, "/cosmos.tx.v1beta1.Service/GetTxsEvent", in, out, opts...) @@ -651,6 +655,7 @@ func (*UnimplementedServiceServer) GetTx(ctx context.Context, req *GetTxRequest) } func (*UnimplementedServiceServer) BroadcastTx(ctx context.Context, req *BroadcastTxRequest) (*BroadcastTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BroadcastTx not implemented") +} func (*UnimplementedServiceServer) GetTxsEvent(ctx context.Context, req *GetTxsEventRequest) (*GetTxsEventResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetTxsEvent not implemented") } @@ -697,8 +702,6 @@ func _Service_GetTx_Handler(srv interface{}, ctx context.Context, dec func(inter func _Service_BroadcastTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(BroadcastTxRequest) -func _Service_GetTxsEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTxsEventRequest) if err := dec(in); err != nil { return nil, err } @@ -711,6 +714,16 @@ func _Service_GetTxsEvent_Handler(srv interface{}, ctx context.Context, dec func } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ServiceServer).BroadcastTx(ctx, req.(*BroadcastTxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Service_GetTxsEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTxsEventRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { return srv.(ServiceServer).GetTxsEvent(ctx, in) } info := &grpc.UnaryServerInfo{ @@ -738,6 +751,8 @@ var _Service_serviceDesc = grpc.ServiceDesc{ { MethodName: "BroadcastTx", Handler: _Service_BroadcastTx_Handler, + }, + { MethodName: "GetTxsEvent", Handler: _Service_GetTxsEvent_Handler, }, @@ -746,7 +761,6 @@ var _Service_serviceDesc = grpc.ServiceDesc{ Metadata: "cosmos/tx/v1beta1/service.proto", } -func (m *BroadcastTxRequest) Marshal() (dAtA []byte, err error) { func (m *GetTxsEventRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -757,27 +771,16 @@ func (m *GetTxsEventRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BroadcastTxRequest) MarshalTo(dAtA []byte) (int, error) { func (m *GetTxsEventRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Mode != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x10 - } - if len(m.Tx) > 0 { - i -= len(m.Tx) - copy(dAtA[i:], m.Tx) - i = encodeVarintService(dAtA, i, uint64(len(m.Tx))) if m.Pagination != nil { { size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) @@ -800,7 +803,6 @@ func (m *GetTxsEventRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *BroadcastTxResponse) Marshal() (dAtA []byte, err error) { func (m *GetTxsEventResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -811,21 +813,16 @@ func (m *GetTxsEventResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *BroadcastTxResponse) MarshalTo(dAtA []byte) (int, error) { func (m *GetTxsEventResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *GetTxsEventResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.TxResponse != nil { - { - size, err := m.TxResponse.MarshalToSizedBuffer(dAtA[:i]) if m.Pagination != nil { { size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) @@ -836,20 +833,7 @@ func (m *GetTxsEventResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if m.Tx != nil { - { - size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - dAtA[i] = 0x1a + dAtA[i] = 0x1a } if len(m.TxResponses) > 0 { for iNdEx := len(m.TxResponses) - 1; iNdEx >= 0; iNdEx-- { @@ -882,6 +866,88 @@ func (m *GetTxsEventResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *BroadcastTxRequest) 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 *BroadcastTxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Mode != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Mode)) + i-- + dAtA[i] = 0x10 + } + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintService(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BroadcastTxResponse) 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 *BroadcastTxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TxResponse != nil { + { + size, err := m.TxResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Tx != nil { + { + size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *SimulateRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1052,19 +1118,12 @@ func encodeVarintService(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *BroadcastTxRequest) Size() (n int) { func (m *GetTxsEventRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Tx) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Mode != 0 { - n += 1 + sovService(uint64(m.Mode)) l = len(m.Event) if l > 0 { n += 1 + l + sovService(uint64(l)) @@ -1076,19 +1135,12 @@ func (m *GetTxsEventRequest) Size() (n int) { return n } -func (m *BroadcastTxResponse) Size() (n int) { func (m *GetTxsEventResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Tx != nil { - l = m.Tx.Size() - n += 1 + l + sovService(uint64(l)) - } - if m.TxResponse != nil { - l = m.TxResponse.Size() if len(m.Txs) > 0 { for _, e := range m.Txs { l = e.Size() @@ -1108,6 +1160,39 @@ func (m *GetTxsEventResponse) Size() (n int) { return n } +func (m *BroadcastTxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tx) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.Mode != 0 { + n += 1 + sovService(uint64(m.Mode)) + } + return n +} + +func (m *BroadcastTxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.TxResponse != nil { + l = m.TxResponse.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + func (m *SimulateRequest) Size() (n int) { if m == nil { return 0 @@ -1174,7 +1259,6 @@ func sovService(x uint64) (n int) { func sozService(x uint64) (n int) { return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1198,10 +1282,6 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BroadcastTxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BroadcastTxRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: GetTxsEventRequest: wiretype end group for non-group") } if fieldNum <= 0 { @@ -1210,9 +1290,6 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) - } - var byteLen int return fmt.Errorf("proto: wrong wireType = %d for field Event", wireType) } var stringLen uint64 @@ -1225,16 +1302,11 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + byteLen intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthService @@ -1246,16 +1318,6 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) - if m.Tx == nil { - m.Tx = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 m.Event = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: @@ -1272,7 +1334,6 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Mode |= BroadcastMode(b&0x7F) << shift msglen |= int(b&0x7F) << shift if b < 0x80 { break @@ -1319,7 +1380,6 @@ func (m *GetTxsEventRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1343,10 +1403,6 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: BroadcastTxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BroadcastTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: GetTxsEventResponse: wiretype end group for non-group") } if fieldNum <= 0 { @@ -1355,7 +1411,6 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) } var msglen int @@ -1383,10 +1438,6 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Tx == nil { - m.Tx = &Tx{} - } - if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { m.Txs = append(m.Txs, &Tx{}) if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -1394,7 +1445,6 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", wireType) return fmt.Errorf("proto: wrong wireType = %d for field TxResponses", wireType) } var msglen int @@ -1456,10 +1506,6 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.TxResponse == nil { - m.TxResponse = &types.TxResponse{} - } - if err := m.TxResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if m.Pagination == nil { m.Pagination = &query.PageResponse{} } @@ -1491,6 +1537,237 @@ func (m *GetTxsEventResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *BroadcastTxRequest) 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 ErrIntOverflowService + } + 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: BroadcastTxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastTxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) + if m.Tx == nil { + m.Tx = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) + } + m.Mode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mode |= BroadcastMode(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BroadcastTxResponse) 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 ErrIntOverflowService + } + 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: BroadcastTxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BroadcastTxResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tx == nil { + m.Tx = &Tx{} + } + if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TxResponse == nil { + m.TxResponse = &types.TxResponse{} + } + if err := m.TxResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SimulateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/types/tx/service.pb.gw.go b/types/tx/service.pb.gw.go index 8d7139b103aa..71735c5547c8 100644 --- a/types/tx/service.pb.gw.go +++ b/types/tx/service.pb.gw.go @@ -127,11 +127,6 @@ var ( func request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq BroadcastTxRequest - filter_Service_GetTxsEvent_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetTxsEventRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -142,19 +137,12 @@ func request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marsha } msg, err := client.BroadcastTx(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_GetTxsEvent_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.GetTxsEvent(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } func local_request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq BroadcastTxRequest -func local_request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetTxsEventRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { @@ -165,6 +153,37 @@ func local_request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime. } msg, err := server.BroadcastTx(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Service_GetTxsEvent_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetTxsEventRequest + 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_Service_GetTxsEvent_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetTxsEvent(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Service_GetTxsEvent_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetTxsEventRequest + 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_Service_GetTxsEvent_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -221,7 +240,6 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se }) mux.Handle("POST", pattern_Service_BroadcastTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - mux.Handle("GET", pattern_Service_GetTxsEvent_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) @@ -231,7 +249,6 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se return } resp, md, err := local_request_Service_BroadcastTx_0(rctx, inboundMarshaler, server, req, pathParams) - resp, md, err := local_request_Service_GetTxsEvent_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -239,6 +256,25 @@ func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, se } forward_Service_BroadcastTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Service_GetTxsEvent_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.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Service_GetTxsEvent_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + forward_Service_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -325,7 +361,6 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) mux.Handle("POST", pattern_Service_BroadcastTx_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - mux.Handle("GET", pattern_Service_GetTxsEvent_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) @@ -335,7 +370,6 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl return } resp, md, err := request_Service_BroadcastTx_0(rctx, inboundMarshaler, client, req, pathParams) - resp, md, err := request_Service_GetTxsEvent_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -343,6 +377,25 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl } forward_Service_BroadcastTx_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Service_GetTxsEvent_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_Service_GetTxsEvent_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + forward_Service_GetTxsEvent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -356,6 +409,7 @@ var ( pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Service_BroadcastTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Service_GetTxsEvent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(true))) ) @@ -365,5 +419,6 @@ var ( forward_Service_GetTx_0 = runtime.ForwardResponseMessage forward_Service_BroadcastTx_0 = runtime.ForwardResponseMessage + forward_Service_GetTxsEvent_0 = runtime.ForwardResponseMessage ) From 05f62824ed26a77d0fce62974ffc2958e9f4a288 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Mon, 16 Nov 2020 11:39:09 +0530 Subject: [PATCH 06/26] update service.proto --- proto/cosmos/tx/v1beta1/service.proto | 12 +-- types/tx/service.pb.go | 117 ++++++++++++++------------ x/auth/tx/service.go | 26 +++--- x/auth/tx/service_test.go | 3 +- 4 files changed, 84 insertions(+), 74 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index ccbc2f3d1248..d17538766e5e 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -59,17 +59,19 @@ message BroadcastTxRequest { // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. enum BroadcastMode { + option (gogoproto.goproto_enum_prefix) = false; + + // zero-value for mode ordering + BROADCAST_MODE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "none"]; // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for // the tx to be committed in a block. - BROADCAST_MODE_BLOCK = 0; - + BROADCAST_MODE_BLOCK = 1 [(gogoproto.enumvalue_customname) = "block"]; // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. - BROADCAST_MODE_SYNC = 1; - + BROADCAST_MODE_SYNC = 2 [(gogoproto.enumvalue_customname) = "sync"]; // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns // immediately. - BROADCAST_MODE_ASYNC = 2; + BROADCAST_MODE_ASYNC = 3 [(gogoproto.enumvalue_customname) = "async"]; } // BroadcastTxResponse is the response type for the diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 92e553c1cee1..243d1033157c 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -35,27 +35,31 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type BroadcastMode int32 const ( + // zero-value for mode ordering + BroadcastMode_none BroadcastMode = 0 // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for // the tx to be committed in a block. - BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 0 + BroadcastMode_block BroadcastMode = 1 // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. - BroadcastMode_BROADCAST_MODE_SYNC BroadcastMode = 1 + BroadcastMode_sync BroadcastMode = 2 // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns // immediately. - BroadcastMode_BROADCAST_MODE_ASYNC BroadcastMode = 2 + BroadcastMode_async BroadcastMode = 3 ) var BroadcastMode_name = map[int32]string{ - 0: "BROADCAST_MODE_BLOCK", - 1: "BROADCAST_MODE_SYNC", - 2: "BROADCAST_MODE_ASYNC", + 0: "BROADCAST_MODE_UNSPECIFIED", + 1: "BROADCAST_MODE_BLOCK", + 2: "BROADCAST_MODE_SYNC", + 3: "BROADCAST_MODE_ASYNC", } var BroadcastMode_value = map[string]int32{ - "BROADCAST_MODE_BLOCK": 0, - "BROADCAST_MODE_SYNC": 1, - "BROADCAST_MODE_ASYNC": 2, + "BROADCAST_MODE_UNSPECIFIED": 0, + "BROADCAST_MODE_BLOCK": 1, + "BROADCAST_MODE_SYNC": 2, + "BROADCAST_MODE_ASYNC": 3, } func (x BroadcastMode) String() string { @@ -239,7 +243,7 @@ func (m *BroadcastTxRequest) GetMode() BroadcastMode { if m != nil { return m.Mode } - return BroadcastMode_BROADCAST_MODE_BLOCK + return BroadcastMode_none } // BroadcastTxResponse is the response type for the @@ -518,51 +522,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 695 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 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, 0x80, - 0xb6, 0x08, 0xdf, 0x0d, 0xd8, 0xe6, 0x31, 0x71, 0xb9, 0x45, 0x8e, 0x5a, 0x84, 0x71, 0x34, 0x05, - 0x83, 0x24, 0x7c, 0x2e, 0x28, 0x9a, 0xb2, 0x74, 0xcb, 0x8a, 0x1e, 0xd0, 0x0b, 0x80, 0x0e, 0xbf, - 0x90, 0xd5, 0x94, 0xa5, 0x7c, 0x69, 0xc1, 0x90, 0x4d, 0x87, 0x66, 0x86, 0x30, 0x8b, 0x9b, 0x37, - 0xde, 0x62, 0x9b, 0x48, 0x45, 0x2b, 0xc1, 0xd4, 0xcf, 0x14, 0x98, 0xec, 0x32, 0x65, 0x1e, 0x75, - 0x19, 0x41, 0x8b, 0x90, 0xe3, 0x01, 0x2b, 0x28, 0x5a, 0x6e, 0x29, 0x5f, 0xba, 0x6b, 0xf4, 0xa4, - 0x69, 0xec, 0x06, 0x56, 0x88, 0x40, 0x5b, 0x30, 0xca, 0x83, 0xaa, 0x2f, 0x79, 0xac, 0x90, 0x15, - 0x8c, 0xb9, 0xae, 0x52, 0x44, 0x82, 0x09, 0xa2, 0x04, 0x5b, 0x79, 0xde, 0x3e, 0x87, 0x42, 0xc9, - 0x8e, 0x72, 0xa2, 0xa3, 0xc5, 0x6b, 0x3b, 0x92, 0x4a, 0xc9, 0x96, 0xf6, 0x00, 0x95, 0x7d, 0x8a, - 0x1b, 0x75, 0xcc, 0x78, 0x68, 0x16, 0xc5, 0x38, 0x0e, 0x59, 0x1e, 0x88, 0x0c, 0x47, 0xad, 0x2c, - 0x0f, 0xd0, 0x53, 0x18, 0x68, 0xd2, 0x06, 0x11, 0xd1, 0x8d, 0x97, 0xb4, 0x94, 0x0e, 0xdb, 0x22, - 0xdb, 0xb4, 0x41, 0x2c, 0x81, 0xd6, 0xbf, 0x28, 0x30, 0xd9, 0x25, 0x2e, 0xe3, 0x9a, 0x6f, 0xab, - 0xf7, 0x4d, 0x2b, 0x34, 0xdd, 0x84, 0x7c,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f, 0x06, 0x45, - 0xc4, 0x68, 0x26, 0x45, 0x32, 0x39, 0xa0, 0xa2, 0xd6, 0x1f, 0x20, 0x0d, 0xe7, 0x84, 0xa1, 0x8a, - 0xa6, 0xcd, 0xb4, 0x4d, 0x69, 0x7e, 0x0c, 0x67, 0x7a, 0x8a, 0x3e, 0x41, 0x3e, 0xf1, 0x11, 0xa1, - 0xf9, 0xab, 0x3e, 0xbe, 0x8e, 0xfb, 0xc2, 0x75, 0x30, 0x59, 0x83, 0x2a, 0x6a, 0x28, 0xe8, 0xf7, - 0x52, 0x6b, 0x60, 0xa1, 0x7b, 0x62, 0xe3, 0xa5, 0xba, 0xf7, 0xae, 0xe1, 0x54, 0xf7, 0x94, 0xc5, - 0x19, 0xbb, 0xa3, 0x3e, 0xee, 0xe5, 0xe7, 0x3f, 0xce, 0x55, 0xe5, 0xec, 0x5c, 0x55, 0x7e, 0x9f, - 0xab, 0xca, 0xb7, 0x0b, 0x35, 0x73, 0x76, 0xa1, 0x66, 0x7e, 0x5d, 0xa8, 0x99, 0xbd, 0x79, 0xdb, - 0xe1, 0x07, 0xad, 0x9a, 0x51, 0xa7, 0xcd, 0x98, 0x1b, 0xfd, 0x79, 0xcc, 0x1a, 0x1f, 0x4c, 0x7e, - 0xe2, 0x91, 0x50, 0xac, 0x36, 0x24, 0x7e, 0x2c, 0x9e, 0xfc, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xe3, - 0x60, 0x2a, 0x38, 0x03, 0x07, 0x00, 0x00, + // 752 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x3d, 0x4f, 0xdb, 0x40, + 0x18, 0x8e, 0x93, 0xf0, 0x75, 0x01, 0x9a, 0x1e, 0xb4, 0x8a, 0x5c, 0x6a, 0x8c, 0xc3, 0x47, 0x84, + 0x54, 0x5b, 0xa4, 0x1d, 0x18, 0x2a, 0x55, 0x24, 0x04,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0, 0xae, 0x4d, + 0x90, 0x9c, 0xbe, 0x15, 0x23, 0x26, 0x2f, 0xfd, 0xf1, 0xe7, 0x9f, 0xaf, 0xd1, 0xa7, 0xda, 0x13, + 0x23, 0x64, 0x01, 0xb7, 0xdd, 0x1a, 0x60, 0x80, 0xdf, 0x19, 0x9c, 0x0e, 0x91, 0x0c, 0xde, 0xb8, + 0xac, 0xf6, 0x07, 0x08, 0xc3, 0x59, 0x6e, 0xa8, 0xc0, 0x29, 0x23, 0x6c, 0xf5, 0x1a, 0xef, 0xbd, + 0x21, 0x39, 0x85, 0x1f, 0x40, 0x22, 0xf0, 0x56, 0xc2, 0xb9, 0xdb, 0xde, 0xe6, 0xae, 0xfb, 0xfc, + 0x5d, 0x30, 0x51, 0x83, 0xc2, 0x6b, 0x48, 0x69, 0x8f, 0x43, 0x6b, 0xa0, 0x9e, 0x7b, 0x60, 0x85, + 0x86, 0xba, 0xdf, 0xdc, 0xeb, 0xa1, 0xee, 0x21, 0x9b, 0xb8, 0xed, 0x0e, 0xfb, 0xb8, 0xe7, 0x5e, + 0xfd, 0xb8, 0x54, 0xa4, 0x8b, 0x4b, 0x45, 0xfa, 0x7d, 0xa9, 0x48, 0x5f, 0xae, 0x94, 0xc8, 0xc5, + 0x95, 0x12, 0xf9, 0x75, 0xa5, 0x44, 0xf6, 0xe6, 0x2c, 0x9b, 0x1d, 0xb4, 0xca, 0x7a, 0x85, 0xd4, + 0xdb, 0x5c, 0xff, 0xe3, 0x19, 0xad, 0x1e, 0x1a, 0xec, 0xa4, 0x81, 0x3d, 0xb1, 0xf2, 0x20, 0xff, + 0xf7, 0x79, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x29, 0xde, 0x3d, 0x7e, 0x54, 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 23822ce15f8a..8d72337085bb 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -185,23 +185,25 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype }, nil } +func normalizeBoradcastMode(mode txtypes.BroadcastMode) string { + switch mode { + case txtypes.BroadcastMode_async: + return "async" + case txtypes.BroadcastMode_sync: + return "sync" + case txtypes.BroadcastMode_block: + return "block" + default: + return "sync" + } +} + func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) { if req.Tx == nil { return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } - var mode string - switch req.Mode { - case txtypes.BroadcastMode_BROADCAST_MODE_SYNC: - mode = "sync" - case txtypes.BroadcastMode_BROADCAST_MODE_ASYNC: - mode = "async" - case txtypes.BroadcastMode_BROADCAST_MODE_BLOCK: - mode = "block" - default: - return nil, status.Error(codes.InvalidArgument, "invalid mode") - } - clientCtx := s.clientCtx.WithBroadcastMode(mode) + clientCtx := s.clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) resp, err := clientCtx.BroadcastTx(req.Tx) if err != nil { diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index bdfa0973d466..8606dda3438a 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -230,12 +230,11 @@ func (s IntegrationTestSuite) TestBroadcastTx() { grpcRes, err := s.queryClient.BroadcastTx( context.Background(), &tx.BroadcastTxRequest{ - Mode: tx.BroadcastMode_BROADCAST_MODE_ASYNC, + Mode: tx.BroadcastMode_async, Tx: txBytes, }, ) s.Require().NoError(err) - fmt.Println(grpcRes) s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) } From a0e5111b9cd7ad8e49169f05a6f877da98ffeef5 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Mon, 16 Nov 2020 11:55:52 +0530 Subject: [PATCH 07/26] Update service.proto --- proto/cosmos/tx/v1beta1/service.proto | 2 - types/tx/service.pb.go | 94 +++++++++++++-------------- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index d17538766e5e..2a65e3d58cca 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -59,8 +59,6 @@ message BroadcastTxRequest { // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. enum BroadcastMode { - option (gogoproto.goproto_enum_prefix) = false; - // zero-value for mode ordering BROADCAST_MODE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "none"]; // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 243d1033157c..2ee068558bb3 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -522,54 +522,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 752 bytes of a gzipped FileDescriptorProto + // 744 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x3d, 0x4f, 0xdb, 0x40, - 0x18, 0x8e, 0x93, 0xf0, 0x75, 0x01, 0x9a, 0x1e, 0xb4, 0x8a, 0x5c, 0x6a, 0x8c, 0xc3, 0x47, 0x84, - 0x54, 0x5b, 0xa4, 0x1d, 0x18, 0x2a, 0x55, 0x24, 0x04, 0x84, 0x5a, 0x3e, 0xe4, 0xd0, 0xa1, 0x2c, - 0xd1, 0x25, 0x39, 0x8c, 0x45, 0xe2, 0x0b, 0xb9, 0x0b, 0x32, 0x6a, 0x59, 0xda, 0xa5, 0x62, 0xaa, - 0xd4, 0x99, 0xa9, 0x6b, 0x7f, 0x48, 0x47, 0xa4, 0x2e, 0x1d, 0x2b, 0xe8, 0x1f, 0xe8, 0x3f, 0xa8, - 0x7c, 0xbe, 0x24, 0x0e, 0x38, 0xc0,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e, 0xb0, 0x75, 0xca, 0x39, 0x79, 0x3e, 0xde, 0xf7, 0xb9, 0xd7, 0x6f, 0xc0, 0x4c, + 0x95, 0xd0, 0x06, 0xa1, 0x06, 0x73, 0x8d, 0x93, 0xe5, 0x0a, 0x66, 0x68, 0xd9, 0xa0, 0xb8, 0x75, + 0x62, 0x57, 0xb1, 0xde, 0x6c, 0x11, 0x46, 0xe0, 0x63, 0x1f, 0xa0, 0x33, 0x57, 0x17, 0x00, 0x79, + 0xda, 0x22, 0xc4, 0xaa, 0x63, 0x03, 0x35, 0x6d, 0x03, 0x39, 0x0e, 0x61, 0x88, 0xd9, 0xc4, 0xa1, + 0x3e, 0x41, 0xce, 0x08, 0xc5, 0x0a, 0xa2, 0xd8, 0x40, 0x95, 0xaa, 0xdd, 0x11, 0xf6, 0x1e, 0x04, + 0x48, 0xbe, 0x6d, 0xcb, 0x5c, 0xf1, 0xdb, 0x94, 0x45, 0x2c, 0xc2, 0x8f, 0x86, 0x77, 0x12, 0xdf, + 0x2e, 0x85, 0x65, 0x8f, 0xdb, 0xb8, 0x75, 0xda, 0x61, 0x36, 0x91, 0x65, 0x3b, 0xbc, 0x06, 0x1f, + 0xab, 0xb5, 0x00, 0xdc, 0xc0, 0x6c, 0xcf, 0xa5, 0xc5, 0x13, 0xec, 0x30, 0x13, 0x1f, 0xb7, 0x31, + 0x65, 0x70, 0x0a, 0x0c, 0x62, 0xef, 0x39, 0x2d, 0xa9, 0x52, 0x76, 0xd4, 0xf4, 0x1f, 0xe0, 0x3a, + 0x00, 0x5d, 0x7e, 0x3a, 0xae, 0x4a, 0xd9, 0x64, 0x6e, 0x41, 0x17, 0x4d, 0x7b, 0x66, 0x3a, 0x37, + 0x0b, 0x9a, 0xd7, 0x77, 0x91, 0x85, 0x85, 0xa2, 0x19, 0x62, 0x6a, 0x97, 0x12, 0x98, 0xec, 0x31, + 0xa5, 0x4d, 0xe2, 0x50, 0x0c, 0x17, 0x41, 0x82, 0xb9, 0x34, 0x2d, 0xa9, 0x89, 0x6c, 0x32, 0xf7, + 0x44, 0xbf, 0x95, 0xa6, 0xbe, 0xe7, 0x9a, 0x1e, 0x02, 0x6e, 0x80, 0x31, 0xe6, 0x96, 0x5b, 0x82, + 0x47, 0xd3, 0x71, 0xce, 0x98, 0xeb, 0x29, 0x85, 0x27, 0x18, 0x22, 0x0a, 0xb0, 0x99, 0x64, 0x9d, + 0xb3, 0x27, 0x14, 0xee, 0x28, 0xc1, 0x3b, 0x5a, 0xbc, 0xb7, 0x23, 0xa1, 0x14, 0x6e, 0x69, 0x1f, + 0xc0, 0x7c, 0x8b, 0xa0, 0x5a, 0x15, 0x51, 0xe6, 0x99, 0xf9, 0x31, 0x4e, 0x80, 0x38, 0x73, 0x79, + 0x86, 0x63, 0x66, 0x9c, 0xb9, 0xf0, 0x15, 0x18, 0x68, 0x90, 0x1a, 0xe6, 0xd1, 0x4d, 0xe4, 0xd4, + 0x88, 0x0e, 0x3b, 0x22, 0x5b, 0xa4, 0x86, 0x4d, 0x8e, 0xd6, 0xbe, 0x48, 0x60, 0xb2, 0x47, 0x5c, + 0xc4, 0x35, 0xdf, 0x51, 0xef, 0x9b, 0x96, 0x67, 0x5a, 0x04, 0xc9, 0x50, 0x58, 0xe2, 0xda, 0x1e, + 0x96, 0x15, 0xe8, 0x66, 0xa5, 0xad, 0x80, 0x47, 0x25, 0xbb, 0xd1, 0xae, 0x23, 0x16, 0xdc, 0xe9, + 0x03, 0x0b, 0xd0, 0xce, 0x25, 0x90, 0xea, 0x52, 0x45, 0xf1, 0xaf, 0xc1, 0x88, 0x85, 0x68, 0xd9, + 0x76, 0x0e, 0x88, 0x50, 0x98, 0xed, 0x5f, 0xd2, 0x06, 0xa2, 0x9b, 0xce, 0x01, 0x31, 0x87, 0x2d, + 0xff, 0x00, 0x57, 0xc0, 0x50, 0x0b, 0xd3, 0x76, 0x9d, 0x89, 0x76, 0xd4, 0xfe, 0x5c, 0x93, 0xe3, + 0x4c, 0x81, 0xd7, 0x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 0x06, 0x3f, 0x81, 0x64, 0xe8, 0x7d, + 0x84, 0xf3, 0x77, 0xbd, 0xc7, 0x5d, 0xf7, 0x85, 0xfb, 0x60, 0xa2, 0x06, 0x85, 0xd7, 0x90, 0xd6, + 0x9e, 0x46, 0xd6, 0x40, 0x3d, 0xf7, 0xd0, 0xf2, 0x8c, 0x74, 0xbf, 0xbd, 0xd1, 0x23, 0xdd, 0x23, + 0x76, 0x70, 0xe0, 0x0e, 0xfb, 0xb8, 0xe7, 0xdf, 0xfc, 0xb8, 0x52, 0xa4, 0xcb, 0x2b, 0x45, 0xfa, + 0x7d, 0xa5, 0x48, 0x5f, 0xaf, 0x95, 0xd8, 0xe5, 0xb5, 0x12, 0xfb, 0x75, 0xad, 0xc4, 0xf6, 0xe7, + 0x2d, 0x9b, 0x1d, 0xb6, 0x2b, 0x7a, 0x95, 0x34, 0x02, 0xae, 0xff, 0xf1, 0x82, 0xd6, 0x8e, 0x0c, + 0x76, 0xda, 0xc4, 0x9e, 0x58, 0x65, 0x88, 0xff, 0xef, 0xbc, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, + 0xe1, 0x0f, 0x32, 0x38, 0x4e, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From c1d323ee50e446d5beb6914cdfc20170bf951218 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Wed, 18 Nov 2020 11:01:56 +0530 Subject: [PATCH 08/26] review changes --- proto/cosmos/tx/v1beta1/service.proto | 4 +- types/tx/service.pb.go | 124 +++++++++++++------------- x/auth/tx/service.go | 4 +- x/auth/tx/service_test.go | 4 +- 4 files changed, 68 insertions(+), 68 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 167e1fbf0476..64f02e37ffd8 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -52,8 +52,8 @@ message GetTxsEventResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. message BroadcastTxRequest { - // tx is the list of queried transactions. - bytes tx = 1; + // txRaw is the raw transaction. + bytes txRaw = 1; BroadcastMode mode = 2; } diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 2ee068558bb3..45d7e0ddef52 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -194,9 +194,9 @@ func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. type BroadcastTxRequest struct { - // tx is the list of queried transactions. - Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` - Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` + // txRaw is the raw transaction. + TxRaw []byte `protobuf:"bytes,1,opt,name=txRaw,proto3" json:"txRaw,omitempty"` + Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` } func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } @@ -232,9 +232,9 @@ func (m *BroadcastTxRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo -func (m *BroadcastTxRequest) GetTx() []byte { +func (m *BroadcastTxRequest) GetTxRaw() []byte { if m != nil { - return m.Tx + return m.TxRaw } return nil } @@ -522,54 +522,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 744 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x3d, 0x4f, 0xdb, 0x40, - 0x18, 0x8e, 0x13, 0x3e, 0x2f, 0x40, 0xd3, 0x83, 0x56, 0x91, 0x4b, 0x8d, 0x71, 0xf8, 0x88, 0x90, - 0x6a, 0x8b, 0xb4, 0x03, 0x43, 0xa5, 0x8a, 0x84, 0x80, 0x50, 0xcb, 0x87, 0x1c, 0x3a, 0x94, 0x25, - 0xba, 0x24, 0x87, 0xb1, 0x48, 0x7c, 0x21, 0x77, 0x41, 0x46, 0x2d, 0x4b, 0xbb, 0x31, 0x55, 0xea, - 0xcc, 0xda, 0xdf, 0xd2, 0x11, 0xa9, 0x4b, 0xc7, 0x0a, 0xfa, 0x07, 0xfa, 0x0f, 0x2a, 0x9f, 0xcf, - 0x89, 0x03, 0x0e, 0xb0, 0x75, 0xca, 0x39, 0x79, 0x3e, 0xde, 0xf7, 0xb9, 0xd7, 0x6f, 0xc0, 0x4c, - 0x95, 0xd0, 0x06, 0xa1, 0x06, 0x73, 0x8d, 0x93, 0xe5, 0x0a, 0x66, 0x68, 0xd9, 0xa0, 0xb8, 0x75, - 0x62, 0x57, 0xb1, 0xde, 0x6c, 0x11, 0x46, 0xe0, 0x63, 0x1f, 0xa0, 0x33, 0x57, 0x17, 0x00, 0x79, - 0xda, 0x22, 0xc4, 0xaa, 0x63, 0x03, 0x35, 0x6d, 0x03, 0x39, 0x0e, 0x61, 0x88, 0xd9, 0xc4, 0xa1, - 0x3e, 0x41, 0xce, 0x08, 0xc5, 0x0a, 0xa2, 0xd8, 0x40, 0x95, 0xaa, 0xdd, 0x11, 0xf6, 0x1e, 0x04, - 0x48, 0xbe, 0x6d, 0xcb, 0x5c, 0xf1, 0xdb, 0x94, 0x45, 0x2c, 0xc2, 0x8f, 0x86, 0x77, 0x12, 0xdf, - 0x2e, 0x85, 0x65, 0x8f, 0xdb, 0xb8, 0x75, 0xda, 0x61, 0x36, 0x91, 0x65, 0x3b, 0xbc, 0x06, 0x1f, - 0xab, 0xb5, 0x00, 0xdc, 0xc0, 0x6c, 0xcf, 0xa5, 0xc5, 0x13, 0xec, 0x30, 0x13, 0x1f, 0xb7, 0x31, - 0x65, 0x70, 0x0a, 0x0c, 0x62, 0xef, 0x39, 0x2d, 0xa9, 0x52, 0x76, 0xd4, 0xf4, 0x1f, 0xe0, 0x3a, - 0x00, 0x5d, 0x7e, 0x3a, 0xae, 0x4a, 0xd9, 0x64, 0x6e, 0x41, 0x17, 0x4d, 0x7b, 0x66, 0x3a, 0x37, - 0x0b, 0x9a, 0xd7, 0x77, 0x91, 0x85, 0x85, 0xa2, 0x19, 0x62, 0x6a, 0x97, 0x12, 0x98, 0xec, 0x31, - 0xa5, 0x4d, 0xe2, 0x50, 0x0c, 0x17, 0x41, 0x82, 0xb9, 0x34, 0x2d, 0xa9, 0x89, 0x6c, 0x32, 0xf7, - 0x44, 0xbf, 0x95, 0xa6, 0xbe, 0xe7, 0x9a, 0x1e, 0x02, 0x6e, 0x80, 0x31, 0xe6, 0x96, 0x5b, 0x82, - 0x47, 0xd3, 0x71, 0xce, 0x98, 0xeb, 0x29, 0x85, 0x27, 0x18, 0x22, 0x0a, 0xb0, 0x99, 0x64, 0x9d, - 0xb3, 0x27, 0x14, 0xee, 0x28, 0xc1, 0x3b, 0x5a, 0xbc, 0xb7, 0x23, 0xa1, 0x14, 0x6e, 0x69, 0x1f, - 0xc0, 0x7c, 0x8b, 0xa0, 0x5a, 0x15, 0x51, 0xe6, 0x99, 0xf9, 0x31, 0x4e, 0x80, 0x38, 0x73, 0x79, - 0x86, 0x63, 0x66, 0x9c, 0xb9, 0xf0, 0x15, 0x18, 0x68, 0x90, 0x1a, 0xe6, 0xd1, 0x4d, 0xe4, 0xd4, - 0x88, 0x0e, 0x3b, 0x22, 0x5b, 0xa4, 0x86, 0x4d, 0x8e, 0xd6, 0xbe, 0x48, 0x60, 0xb2, 0x47, 0x5c, - 0xc4, 0x35, 0xdf, 0x51, 0xef, 0x9b, 0x96, 0x67, 0x5a, 0x04, 0xc9, 0x50, 0x58, 0xe2, 0xda, 0x1e, - 0x96, 0x15, 0xe8, 0x66, 0xa5, 0xad, 0x80, 0x47, 0x25, 0xbb, 0xd1, 0xae, 0x23, 0x16, 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, 0xba, 0x31, 0x3b, 0x72, 0xe6, 0x4e, 0x8c, 0x98, 0xb9, 0xcc, - 0xe7, 0x9f, 0x7f, 0xbe, 0xc5, 0x9f, 0x6b, 0xcf, 0x8c, 0x88, 0xd5, 0x1b, 0xb8, 0x35, 0xc1, 0x20, - 0xbf, 0x2d, 0x38, 0x13, 0x21, 0x19, 0xbe, 0x6b, 0x59, 0xed, 0x0f, 0x10, 0x86, 0x73, 0xdc, 0x50, - 0x81, 0xd3, 0x46, 0xd4, 0xd2, 0x35, 0x3e, 0x7a, 0xe3, 0x71, 0x06, 0x3f, 0x81, 0x64, 0xe8, 0x7d, - 0x84, 0xf3, 0x77, 0xbd, 0xc7, 0x5d, 0xf7, 0x85, 0xfb, 0x60, 0xa2, 0x06, 0x85, 0xd7, 0x90, 0xd6, - 0x9e, 0x46, 0xd6, 0x40, 0x3d, 0xf7, 0xd0, 0xf2, 0x8c, 0x74, 0xbf, 0xbd, 0xd1, 0x23, 0xdd, 0x23, - 0x76, 0x70, 0xe0, 0x0e, 0xfb, 0xb8, 0xe7, 0xdf, 0xfc, 0xb8, 0x52, 0xa4, 0xcb, 0x2b, 0x45, 0xfa, - 0x7d, 0xa5, 0x48, 0x5f, 0xaf, 0x95, 0xd8, 0xe5, 0xb5, 0x12, 0xfb, 0x75, 0xad, 0xc4, 0xf6, 0xe7, - 0x2d, 0x9b, 0x1d, 0xb6, 0x2b, 0x7a, 0x95, 0x34, 0x02, 0xae, 0xff, 0xf1, 0x82, 0xd6, 0x8e, 0x0c, - 0x76, 0xda, 0xc4, 0x9e, 0x58, 0x65, 0x88, 0xff, 0xef, 0xbc, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, - 0xe1, 0x0f, 0x32, 0x38, 0x4e, 0x07, 0x00, 0x00, + // 750 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcf, 0x4f, 0x13, 0x41,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x54, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -898,10 +898,10 @@ func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.Tx) > 0 { - i -= len(m.Tx) - copy(dAtA[i:], m.Tx) - i = encodeVarintService(dAtA, i, uint64(len(m.Tx))) + if len(m.TxRaw) > 0 { + i -= len(m.TxRaw) + copy(dAtA[i:], m.TxRaw) + i = encodeVarintService(dAtA, i, uint64(len(m.TxRaw))) i-- dAtA[i] = 0xa } @@ -1173,7 +1173,7 @@ func (m *BroadcastTxRequest) Size() (n int) { } var l int _ = l - l = len(m.Tx) + l = len(m.TxRaw) if l > 0 { n += 1 + l + sovService(uint64(l)) } @@ -1575,7 +1575,7 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxRaw", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1602,9 +1602,9 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) - if m.Tx == nil { - m.Tx = []byte{} + m.TxRaw = append(m.TxRaw[:0], dAtA[iNdEx:postIndex]...) + if m.TxRaw == nil { + m.TxRaw = []byte{} } iNdEx = postIndex case 2: diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 8d72337085bb..e6533cb15c54 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -199,12 +199,12 @@ func normalizeBoradcastMode(mode txtypes.BroadcastMode) string { } func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) { - if req.Tx == nil { + if req.TxRaw == nil { return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } clientCtx := s.clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) - resp, err := clientCtx.BroadcastTx(req.Tx) + resp, err := clientCtx.BroadcastTx(req.TxRaw) if err != nil { return nil, err diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 8606dda3438a..fab93493e7dd 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -230,8 +230,8 @@ func (s IntegrationTestSuite) TestBroadcastTx() { grpcRes, err := s.queryClient.BroadcastTx( context.Background(), &tx.BroadcastTxRequest{ - Mode: tx.BroadcastMode_async, - Tx: txBytes, + Mode: tx.BroadcastMode_async, + TxRaw: txBytes, }, ) s.Require().NoError(err) From 3ed911091561d2ce379b0c5e1b6c5affcec4a538 Mon Sep 17 00:00:00 2001 From: aleem1413 Date: Wed, 18 Nov 2020 11:07:57 +0530 Subject: [PATCH 09/26] proto lint --- proto/cosmos/tx/v1beta1/service.proto | 4 +- types/tx/service.pb.go | 101 +++++++++++++------------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 64f02e37ffd8..6a72ab7712a9 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -52,8 +52,8 @@ message GetTxsEventResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. message BroadcastTxRequest { - // txRaw is the raw transaction. - bytes txRaw = 1; + // tx_raw is the raw transaction. + bytes tx_raw = 1; BroadcastMode mode = 2; } diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 45d7e0ddef52..4b3f9bf66e7a 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -194,8 +194,8 @@ func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. type BroadcastTxRequest struct { - // txRaw is the raw transaction. - TxRaw []byte `protobuf:"bytes,1,opt,name=txRaw,proto3" json:"txRaw,omitempty"` + // tx_raw is the raw transaction. + TxRaw []byte `protobuf:"bytes,1,opt,name=tx_raw,json=txRaw,proto3" json:"tx_raw,omitempty"` Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` } @@ -522,54 +522,55 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 750 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcf, 0x4f, 0x13, 0x41, - 0x14, 0xee, 0xb6, 0xfc, 0x9c, 0x82, 0xd6, 0x01, 0x4d, 0xb3, 0xe2, 0xb2, 0x6c, 0xf9, 0xd1, 0x90, - 0xb8, 0x1b, 0xaa, 0x07, 0x0e, 0x26, 0x86, 0x96, 0x42, 0x88, 0xf2, 0x23, 0x5b, 0x3c, 0xe8, 0xa5, - 0x4e, 0xdb, 0x61, 0xd9, 0xd0, 0xee, 0x94, 0xce, 0x14, 0x97, 0x28, 0x17, 0xbd, 0x71, 0x32, 0xf1, - 0xcc, 0xd5, 0xbf, 0xc5, 0x23, 0x89, 0x17, 0x8f, 0x06, 0xfc, 0x07, 0xfc, 0x0f, 0xcc, 0xce, 0xce, - 0xb6, 0x5b, 0xd8, 0x02, 0x37, 0x4f, 0x9d, 0x69, 0xbf, 0xf7, 0x7d, 0xef, 0x7d, 0xef, 0xcd, 0x2b, - 0x98, 0xae, 0x12, 0xda, 0x20, 0xd4, 0x60, 0xae, 0x71, 0xb4, 0x54, 0xc1, 0x0c, 0x2d, 0x19, 0x14, - 0xb7, 0x8e, 0xec, 0x2a, 0xd6, 0x9b, 0x2d, 0xc2, 0x08, 0x7c, 0xe0, 0x03, 0x74, 0xe6, 0xea, 0x02, - 0x20, 0x4f, 0x59,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4, 0x70, 0x6b, 0x45, 0x82, 0x29, 0x5c, - 0xd2, 0x7b, 0x00, 0xf3, 0x2d, 0x82, 0x6a, 0x55, 0x44, 0x99, 0x27, 0xd6, 0xb1, 0x91, 0xb9, 0x26, - 0xfa, 0xc0, 0x6d, 0x1c, 0x33, 0xfd, 0x0b, 0x7c, 0x0e, 0x06, 0x1a, 0xa4, 0x86, 0xb9, 0x81, 0xf7, - 0x72, 0x6a, 0x44, 0x9d, 0x1d, 0xaa, 0x4d, 0x52, 0xc3, 0x26, 0x47, 0x6b, 0x5f, 0x24, 0x30, 0xd1, - 0x23, 0x21, 0x4c, 0x9b, 0x03, 0x71, 0xe6, 0x72, 0x81, 0xbe, 0x9e, 0xc5, 0x99, 0x0b, 0x8b, 0x20, - 0x19, 0xb2, 0x4c, 0x34, 0xef, 0x6e, 0x8e, 0x81, 0xae, 0x63, 0xda, 0x32, 0xb8, 0x5f, 0xb2, 0x1b, - 0xed, 0x3a, 0x62, 0x41, 0x67, 0xef, 0x98, 0x80, 0x76, 0x2a, 0x81, 0x54, 0x37, 0x54, 0x24, 0xff, - 0x02, 0x8c, 0x58, 0x88, 0x96, 0x6d, 0x67, 0x8f, 0x08, 0x86, 0x99, 0xfe, 0x29, 0xad, 0x23, 0xba, - 0xe1, 0xec, 0x11, 0x73, 0xd8, 0xf2, 0x0f, 0x70, 0x19, 0x0c, 0xb5, 0x30, 0x6d, 0xd7, 0x99, 0x28, - 0x47, 0xed, 0x1f, 0x6b, 0x72, 0x9c, 0x29, 0xf0, 0x9a, 0x06, 0xc6, 0xf8, 0x00, 0x06, 0x35, 0x40, - 0x30, 0xb0, 0x8f, 0xe8, 0xbe, 0x18, 0x77, 0x7e, 0xd6, 0x4e, 0xc0, 0xb8, 0xc0, 0xfc, 0x0f, 0xa7, - 0x17, 0xbf, 0x4b, 0x60, 0xbc, 0x67, 0x0e, 0x60, 0x16, 0xc8, 0x79, 0x73, 0x7b, 0x65, 0xb5, 0xb0, - 0x52, 0xda, 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0xa0, 0x0e, 0xfb, 0xa8, 0xe7, 0x5f, 0xfe, 0xb8, 0x50, - 0xa4, 0xf3, 0x0b, 0x45, 0xfa, 0x7d, 0xa1, 0x48, 0x5f, 0x2f, 0x95, 0xd8, 0xf9, 0xa5, 0x12, 0xfb, - 0x75, 0xa9, 0xc4, 0xde, 0xcd, 0x59, 0x36, 0xdb, 0x6f, 0x57, 0xf4, 0x2a, 0x69, 0x04, 0xb1, 0xfe, - 0xc7, 0x53, 0x5a, 0x3b, 0x30, 0xd8, 0x71, 0x13, 0x7b, 0x64, 0x95, 0x21, 0xfe, 0xef, 0xf3, 0xec, - 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x9c, 0x02, 0x96, 0x54, 0x07, 0x00, 0x00, + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4b, 0x4f, 0xdb, 0x4a, + 0x14, 0x8e, 0x13, 0xc2, 0x63, 0x02, 0xf7, 0xe6, 0x0e, 0x70, 0x15, 0xf9, 0x72, 0x8d, 0x71, 0x78, + 0x44, 0x48, 0xb5, 0x45, 0xda, 0x05, 0x8b, 0x4a, 0x15, 0x09, 0x01, 0xa1, 0x96, 0x87, 0x1c, 0xba, + 0x68, 0x37, 0xd1, 0x24, 0x19, 0x8c, 0x45, 0xe2, 0x09, 0x99, 0x09, 0x18, 0xb5, 0x6c, 0xda, 0x1d, + 0xab, 0x4a, 0x5d, 0xb3, 0xed, 0x6f, 0xe9, 0x12, 0xa9, 0x9b, 0x2e, 0x2b, 0xe8, 0x1f, 0xe8, 0x3f, + 0xa8, 0x3c, 0x1e, 0x27, 0x0e, 0x38, 0xc0, 0xae, 0xab, 0x8c, 0x93, 0xef, 0x71, 0xce, 0x37, 0xc7, + 0x27, 0x60, 0xb6, 0x46, 0x68, 0x93, 0x50, 0x83, 0xb9, 0xc6, 0xc9, 0x4a, 0x15, 0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0, 0xd1, 0x4c, 0x9c, 0x33, 0xe6, 0xfb, 0x4a, 0xe1, 0x09, 0x86, 0x88, 0x02, 0x6c, + 0xa6, 0x58, 0xf7, 0xec, 0x09, 0x85, 0x3b, 0x4a, 0xf0, 0x8e, 0x96, 0x1e, 0xec, 0x48, 0x28, 0x85, + 0x5b, 0x42, 0x00, 0x16, 0xda, 0x04, 0xd5, 0x6b, 0x88, 0x32, 0xcf, 0xcc, 0x8f, 0x71, 0x1a, 0x0c, + 0x7b, 0x75, 0xa2, 0x53, 0x9e, 0xe3, 0xb8, 0x99, 0x64, 0xae, 0x89, 0x4e, 0xe1, 0x33, 0x30, 0xd4, + 0x24, 0x75, 0xcc, 0x13, 0xfc, 0x2b, 0xaf, 0x46, 0x34, 0xda, 0xd5, 0xda, 0x26, 0x75, 0x6c, 0x72, + 0xb4, 0xf6, 0x51, 0x02, 0x93, 0x7d, 0x1e, 0x22, 0xb5, 0x05, 0x10, 0x67, 0x2e, 0x37, 0x18, 0x18, + 0x5a, 0x9c, 0xb9, 0xb0, 0x04, 0x52, 0xa1, 0xcc, 0xc4, 0xed, 0x3d, 0x2e, 0x32, 0xd0, 0x8b, 0x4c, + 0x5b, 0x05, 0x7f, 0x97, 0xed, 0x66, 0xa7, 0x81, 0x58, 0x70, 0xb5, 0x8f, 0x2c, 0x40, 0xbb, 0x90, + 0x40, 0xba, 0x47, 0x15, 0xc5, 0x3f, 0x07, 0xa3, 0x16, 0xa2, 0x15, 0xdb, 0x39, 0x20, 0x42, 0x61, + 0x6e, 0x70, 0x49, 0x9b, 0x88, 0x6e, 0x39, 0x07, 0xc4, 0x1c, 0xb1, 0xfc, 0x03, 0x5c, 0x05, 0xc3, + 0x6d, 0x4c, 0x3b, 0x0d, 0x26, 0xda, 0x51, 0x07, 0x73, 0x4d, 0x8e, 0x33, 0x05, 0x5e, 0xd3, 0xc0, + 0x38, 0x9f, 0xc0, 0xa0, 0x07, 0x08, 0x86, 0x0e, 0x11, 0x3d, 0x14, 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x17, 0x1f, 0x82, 0x89, 0x1a, 0x14, 0x5e, 0x43, 0x46, 0xfb, 0x37, 0xb2, 0x06, 0xea, + 0xb9, 0x87, 0x76, 0x68, 0xa4, 0xfb, 0xdd, 0xc5, 0x1e, 0xe9, 0x1e, 0xb1, 0x8a, 0x03, 0x77, 0x38, + 0xc0, 0xbd, 0xf0, 0xe2, 0xeb, 0xb5, 0x22, 0x5d, 0x5d, 0x2b, 0xd2, 0x8f, 0x6b, 0x45, 0xfa, 0x74, + 0xa3, 0xc4, 0xae, 0x6e, 0x94, 0xd8, 0xf7, 0x1b, 0x25, 0xf6, 0x76, 0xc1, 0xb2, 0xd9, 0x61, 0xa7, + 0xaa, 0xd7, 0x48, 0x33, 0xe0, 0xfa, 0x1f, 0x4f, 0x68, 0xfd, 0xc8, 0x60, 0x67, 0x2d, 0xec, 0x89, + 0x55, 0x87, 0xf9, 0xdf, 0xcf, 0xd3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x8b, 0x8d, 0x36, + 0x55, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 52a9860398c48b0c4c44868a54028916f8531cc3 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 15:35:47 +0100 Subject: [PATCH 10/26] Switch to txraw --- Makefile | 2 +- proto/cosmos/tx/v1beta1/service.proto | 70 +++++++------- types/query/query.pb.go | 2 +- types/tx/service.pb.go | 133 ++++++++++++++------------ x/auth/tx/service.go | 25 ++--- x/auth/tx/service_test.go | 14 ++- 6 files changed, 127 insertions(+), 119 deletions(-) diff --git a/Makefile b/Makefile index baace1ee14b0..f9011d13d3b8 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ devdoc-update: ### Protobuf ### ############################################################################### -proto-all: proto-format proto-lint proto-check-breaking proto-gen +proto-all: proto-format proto-lint proto-gen proto-gen: @echo "Generating Protobuf files" diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 6a72ab7712a9..d5bc6dd0c399 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -6,27 +6,28 @@ import "cosmos/base/abci/v1beta1/abci.proto"; import "cosmos/tx/v1beta1/tx.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/tx/v1beta1/tx.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; // Service defines a gRPC service for interacting with transactions. service Service { - // Simulate simulates executing a transaction for estimating gas usage. - rpc Simulate(SimulateRequest) returns (SimulateResponse) { - option (google.api.http).post = "/cosmos/tx/v1beta1/simulate"; - } - // GetTx fetches a tx by hash. - rpc GetTx(GetTxRequest) returns (GetTxResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; - } - // BroadcastTx broadcast transaction. - rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { - option (google.api.http).post = "/cosmos/tx/v1beta1/txs"; - } - // GetTxsEvent fetches txs by event. - rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; - } + // Simulate simulates executing a transaction for estimating gas usage. + rpc Simulate(SimulateRequest) returns (SimulateResponse) { + option (google.api.http).post = "/cosmos/tx/v1beta1/simulate"; + } + // GetTx fetches a tx by hash. + rpc GetTx(GetTxRequest) returns (GetTxResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; + } + // BroadcastTx broadcast transaction. + rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { + option (google.api.http).post = "/cosmos/tx/v1beta1/txs"; + } + // GetTxsEvent fetches txs by event. + rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { + option (google.api.http).get = "/cosmos/tx/v1beta1/txs"; + } } // GetTxsEventRequest is the request type for the Service.TxsByEvents @@ -52,36 +53,35 @@ message GetTxsEventResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. message BroadcastTxRequest { - // tx_raw is the raw transaction. - bytes tx_raw = 1; - BroadcastMode mode = 2; + // tx_raw is the raw transaction. + cosmos.tx.v1beta1.TxRaw tx_raw = 1; + BroadcastMode mode = 2; } // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. enum BroadcastMode { - // zero-value for mode ordering - BROADCAST_MODE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "none"]; - // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for - // the tx to be committed in a block. - BROADCAST_MODE_BLOCK = 1 [(gogoproto.enumvalue_customname) = "block"]; - // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for - // a CheckTx execution response only. - BROADCAST_MODE_SYNC = 2 [(gogoproto.enumvalue_customname) = "sync"]; - // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns - // immediately. - BROADCAST_MODE_ASYNC = 3 [(gogoproto.enumvalue_customname) = "async"]; + // zero-value for mode ordering + BROADCAST_MODE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "none"]; + // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + // the tx to be committed in a block. + BROADCAST_MODE_BLOCK = 1 [(gogoproto.enumvalue_customname) = "block"]; + // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + // a CheckTx execution response only. + BROADCAST_MODE_SYNC = 2 [(gogoproto.enumvalue_customname) = "sync"]; + // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + // immediately. + BROADCAST_MODE_ASYNC = 3 [(gogoproto.enumvalue_customname) = "async"]; } // BroadcastTxResponse is the response type for the // Service.BroadcastTx method. message BroadcastTxResponse { - // tx is the queried transaction. - cosmos.tx.v1beta1.Tx tx = 1; - // tx_response is the queried TxResponses. - cosmos.base.abci.v1beta1.TxResponse tx_response = 2; + // tx is the queried transaction. + cosmos.tx.v1beta1.Tx tx = 1; + // tx_response is the queried TxResponses. + cosmos.base.abci.v1beta1.TxResponse tx_response = 2; } - // SimulateRequest is the request type for the Service.Simulate // RPC method. message SimulateRequest { diff --git a/types/query/query.pb.go b/types/query/query.pb.go index c04a6bde32b6..266d337002e8 100644 --- a/types/query/query.pb.go +++ b/types/query/query.pb.go @@ -783,7 +783,7 @@ type Module struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // module version Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - //checksum + // checksum Sum string `protobuf:"bytes,3,opt,name=sum,proto3" json:"sum,omitempty"` } diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 4b3f9bf66e7a..314d91c62048 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -195,7 +195,7 @@ func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { // RPC method. type BroadcastTxRequest struct { // tx_raw is the raw transaction. - TxRaw []byte `protobuf:"bytes,1,opt,name=tx_raw,json=txRaw,proto3" json:"tx_raw,omitempty"` + TxRaw *TxRaw `protobuf:"bytes,1,opt,name=tx_raw,json=txRaw,proto3" json:"tx_raw,omitempty"` Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` } @@ -232,7 +232,7 @@ func (m *BroadcastTxRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo -func (m *BroadcastTxRequest) GetTxRaw() []byte { +func (m *BroadcastTxRequest) GetTxRaw() *TxRaw { if m != nil { return m.TxRaw } @@ -522,55 +522,55 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 756 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4b, 0x4f, 0xdb, 0x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, 0xe2, 0x8b, 0x8d, 0x36, - 0x55, 0x07, 0x00, 0x00, + // 762 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcd, 0x4e, 0xdb, 0x4a, + 0x18, 0x8d, 0x13, 0xc2, 0xcf, 0x04, 0xee, 0xcd, 0x1d, 0xb8, 0x57, 0x91, 0x2f, 0x35, 0xc6, 0xe1, + 0x27, 0x42, 0xaa, 0x2d, 0xd2, 0x2e, 0x58, 0x54, 0xaa, 0x48, 0x08, 0x08, 0xb5, 0xfc, 0xc8, 0xa1, + 0x8b, 0x76, 0x13, 0x4d, 0x92, 0xc1, 0x58, 0x24, 0x9e, 0x90, 0x99, 0x80, 0x11, 0x65, 0xd3, 0xee, + 0x58, 0x55, 0xea, 0x9a, 0x6d, 0x9f, 0xa5, 0x4b, 0xa4, 0x6e, 0xba, 0xac, 0xa0, 0x2f, 0xd0, 0x37, + 0xa8, 0x3c, 0x1e, 0x27, 0x0e, 0x38, 0xc0, 0xae, 0x2b, 0xcf, 0xc0, 0xf9, 0xce, 0x39, 0xdf, 0x99, + 0x99, 0x2f, 0x60, 0xa6, 0x46, 0x68, 0x93, 0x50, 0x83, 0xb9, 0xc6, 0xf1, 0x72, 0x15, 0x33, 0xb4, + 0x6c, 0x50, 0xdc, 0x3e, 0xb6, 0x6b, 0x58, 0x6f, 0xb5, 0x09, 0x23, 0xf0, 0x1f, 0x1f, 0xa0, 0x33, + 0x57, 0x17, 0x00, 0x79, 0xda, 0x22, 0xc4, 0x6a, 0x60, 0x03, 0xb5, 0x6c, 0x03, 0x39, 0x0e, 0x61, + 0x88, 0xd9, 0xc4, 0xa1, 0x7e, 0x81, 0x9c, 0x15, 0x8c, 0x55, 0x44, 0xb1, 0x81, 0xaa, 0x35, 0xbb, + 0x4b, 0xec, 0x6d, 0x04, 0x48, 0xbe, 0x2b, 0xcb, 0x5c, 0xf1, 0xbf, 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0xd8, 0xf7, 0x1b, 0x25, 0xf6, + 0x6e, 0xde, 0xb2, 0xd9, 0x41, 0xa7, 0xaa, 0xd7, 0x48, 0x33, 0xa8, 0xf5, 0x3f, 0x4f, 0x69, 0xfd, + 0xd0, 0x60, 0xa7, 0x2d, 0xec, 0x91, 0x55, 0x87, 0xf9, 0x0f, 0xd3, 0xb3, 0xdf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x3d, 0x4b, 0xd2, 0x27, 0x8b, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -899,10 +899,15 @@ func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.TxRaw) > 0 { - i -= len(m.TxRaw) - copy(dAtA[i:], m.TxRaw) - i = encodeVarintService(dAtA, i, uint64(len(m.TxRaw))) + if m.TxRaw != nil { + { + size, err := m.TxRaw.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -1174,8 +1179,8 @@ func (m *BroadcastTxRequest) Size() (n int) { } var l int _ = l - l = len(m.TxRaw) - if l > 0 { + if m.TxRaw != nil { + l = m.TxRaw.Size() n += 1 + l + sovService(uint64(l)) } if m.Mode != 0 { @@ -1578,7 +1583,7 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TxRaw", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1588,24 +1593,26 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - m.TxRaw = append(m.TxRaw[:0], dAtA[iNdEx:postIndex]...) if m.TxRaw == nil { - m.TxRaw = []byte{} + m.TxRaw = &TxRaw{} + } + if err := m.TxRaw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 2: diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index e6533cb15c54..a04bdab44056 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -7,6 +7,7 @@ import ( "strings" gogogrpc "github.com/gogo/protobuf/grpc" + "github.com/gogo/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -204,11 +205,15 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque } clientCtx := s.clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) - resp, err := clientCtx.BroadcastTx(req.TxRaw) - + txBytes, err := proto.Marshal(req.TxRaw) + if err != nil { + return nil, err + } + resp, err := clientCtx.BroadcastTx(txBytes) if err != nil { return nil, err } + // Create a proto codec, we need it to unmarshal the tx bytes. cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry) var protoTx txtypes.Tx @@ -221,20 +226,8 @@ func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxReque return nil, err } return &txtypes.BroadcastTxResponse{ - Tx: &protoTx, - TxResponse: &sdk.TxResponse{ - Code: resp.Code, - Codespace: resp.Codespace, - Data: resp.Data, - GasUsed: resp.GasUsed, - GasWanted: resp.GasWanted, - Height: resp.Height, - Info: resp.Info, - RawLog: resp.RawLog, - Timestamp: resp.Timestamp, - TxHash: resp.TxHash, - Logs: resp.Logs, - }, + Tx: &protoTx, + TxResponse: resp, }, nil } diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index fab93493e7dd..45b095f011d3 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -10,6 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" clienttx "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -222,19 +223,26 @@ func (s IntegrationTestSuite) TestBroadcastTx() { err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) s.Require().NoError(err) + // To get the TxRaw to be broadcasted, we unforunately need to first encode + // the tx into bytes, then decode it into TxRaw. txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) - fmt.Println(string(txBytes)) + s.Require().NoError(err) + // Create a proto codec, we need it to unmarshal the tx bytes. + cdc := codec.NewProtoCodec(val.ClientCtx.InterfaceRegistry) + var txRaw tx.TxRaw + err = cdc.UnmarshalBinaryBare(txBytes, &txRaw) s.Require().NoError(err) // Query the tx via gRPC. grpcRes, err := s.queryClient.BroadcastTx( context.Background(), &tx.BroadcastTxRequest{ - Mode: tx.BroadcastMode_async, - TxRaw: txBytes, + Mode: tx.BroadcastMode_sync, + TxRaw: &txRaw, }, ) s.Require().NoError(err) + s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) } From 152022e093b935499801f0e0d84969b377d3bd7a Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 15:36:37 +0100 Subject: [PATCH 11/26] Add check breaking at the end --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9011d13d3b8..b71fc9528cdc 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ devdoc-update: ### Protobuf ### ############################################################################### -proto-all: proto-format proto-lint proto-gen +proto-all: proto-format proto-lint proto-gen proto-check-breaking proto-gen: @echo "Generating Protobuf files" From 6e2c50d71307805c92825d6cf8aeb24a03d0df91 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 17:48:44 +0100 Subject: [PATCH 12/26] Fix broadcast --- client/broadcast.go | 39 +++++++ client/grpc_query.go | 28 ++++- proto/cosmos/tx/v1beta1/service.proto | 4 +- types/tx/service.pb.go | 161 ++++++++------------------ x/auth/tx/service.go | 45 +------ x/auth/tx/service_test.go | 5 +- 6 files changed, 117 insertions(+), 165 deletions(-) diff --git a/client/broadcast.go b/client/broadcast.go index e28d76c54f3a..8d7d0b4ab749 100644 --- a/client/broadcast.go +++ b/client/broadcast.go @@ -5,12 +5,16 @@ import ( "fmt" "strings" + "github.com/gogo/protobuf/proto" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/mempool" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/tx" ) // BroadcastTx broadcasts a transactions either synchronously or asynchronously @@ -142,3 +146,38 @@ func (ctx Context) BroadcastTxAsync(txBytes []byte) (*sdk.TxResponse, error) { return sdk.NewResponseFormatBroadcastTx(res), err } + +// TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types +// from the tx service. Calls `clientCtx.BroadcastTx` under the hood. +func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error) { + if req == nil || req.TxRaw == nil { + return nil, status.Error(codes.InvalidArgument, "invalid empty tx") + } + + clientCtx = clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) + txBytes, err := proto.Marshal(req.TxRaw) + if err != nil { + return nil, err + } + resp, err := clientCtx.BroadcastTx(txBytes) + if err != nil { + return nil, err + } + + return &tx.BroadcastTxResponse{ + TxResponse: resp, + }, nil +} + +func normalizeBoradcastMode(mode tx.BroadcastMode) string { + switch mode { + case tx.BroadcastMode_async: + return "async" + case tx.BroadcastMode_sync: + return "sync" + case tx.BroadcastMode_block: + return "block" + default: + return "sync" + } +} diff --git a/client/grpc_query.go b/client/grpc_query.go index 979333f64137..dbf76c015def 100644 --- a/client/grpc_query.go +++ b/client/grpc_query.go @@ -12,10 +12,10 @@ import ( "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/metadata" - grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - "github.com/cosmos/cosmos-sdk/codec/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" + "github.com/cosmos/cosmos-sdk/types/tx" ) var _ gogogrpc.ClientConn = Context{} @@ -23,7 +23,29 @@ var _ gogogrpc.ClientConn = Context{} var protoCodec = encoding.GetCodec(proto.Name) // Invoke implements the grpc ClientConn.Invoke method -func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply interface{}, opts ...grpc.CallOption) error { +func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply interface{}, opts ...grpc.CallOption) (err error) { + // Two things can happen here: + // 1. either we're broadcasting a Tx, in which call we call Tendermint's broadcast endpoint directly, + // 2. or we are querying for state, in which case we call ABCI's Query. + + // Case 1. Broadcasting a Tx. + if method == "/cosmos.tx.v1beta1.Service/BroadcastTx" { + req, ok := args.(*tx.BroadcastTxRequest) + if !ok { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "expected %T, got %T", (*tx.BroadcastTxRequest)(nil), args) + } + res, ok := reply.(*tx.BroadcastTxResponse) + if !ok { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "expected %T, got %T", (*tx.BroadcastTxResponse)(nil), args) + } + + broadcastRes, err := TxServiceBroadcast(grpcCtx, ctx, req) + *res = *broadcastRes + + return err + } + + // Case 2. Querying state. reqBz, err := protoCodec.Marshal(args) if err != nil { return err diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index d5bc6dd0c399..7700fd639a55 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -76,10 +76,8 @@ enum BroadcastMode { // BroadcastTxResponse is the response type for the // Service.BroadcastTx method. message BroadcastTxResponse { - // tx is the queried transaction. - cosmos.tx.v1beta1.Tx tx = 1; // tx_response is the queried TxResponses. - cosmos.base.abci.v1beta1.TxResponse tx_response = 2; + cosmos.base.abci.v1beta1.TxResponse tx_response = 1; } // SimulateRequest is the request type for the Service.Simulate diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 314d91c62048..090526f1a27b 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -249,10 +249,8 @@ func (m *BroadcastTxRequest) GetMode() BroadcastMode { // BroadcastTxResponse is the response type for the // Service.BroadcastTx method. type BroadcastTxResponse struct { - // tx is the queried transaction. - Tx *Tx `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` // tx_response is the queried TxResponses. - TxResponse *types.TxResponse `protobuf:"bytes,2,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"` + TxResponse *types.TxResponse `protobuf:"bytes,1,opt,name=tx_response,json=txResponse,proto3" json:"tx_response,omitempty"` } func (m *BroadcastTxResponse) Reset() { *m = BroadcastTxResponse{} } @@ -288,13 +286,6 @@ func (m *BroadcastTxResponse) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxResponse proto.InternalMessageInfo -func (m *BroadcastTxResponse) GetTx() *Tx { - if m != nil { - return m.Tx - } - return nil -} - func (m *BroadcastTxResponse) GetTxResponse() *types.TxResponse { if m != nil { return m.TxResponse @@ -522,55 +513,55 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 762 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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- 0xd0, 0x60, 0xa7, 0x2d, 0xec, 0x91, 0x55, 0x87, 0xf9, 0x0f, 0xd3, 0xb3, 0xdf, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x3d, 0x4b, 0xd2, 0x27, 0x8b, 0x07, 0x00, 0x00, + // 765 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x4e, 0xdb, 0x4c, + 0x14, 0x8d, 0x13, 0xc2, 0xcf, 0x04, 0xbe, 0x2f, 0x1d, 0x68, 0x15, 0xb9, 0xd4, 0x18, 0x87, 0x9f, + 0x08, 0xa9, 0xb6, 0x48, 0xbb, 0x60, 0x51, 0xa9, 0x22, 0x21, 0x20, 0xd4, 0xf2, 0x23, 0x87, 0x2e, + 0x5a, 0x55, 0x8a, 0x26, 0xc9, 0x60, 0x2c, 0x12, 0x4f, 0xc8, 0x4c, 0xc0, 0x88, 0xb2, 0xe9, 0x92, + 0x55, 0xa5, 0xae, 0xd9, 0xf6, 0x59, 0xba, 0x44, 0xea, 0xa6, 0xcb, 0x0a, 0xfa, 0x02, 0x7d, 0x83, + 0xca, 0xe3, 0x49, 0xe2, 0x04, 0x07, 0x50, 0x57, 0x1e, 0xc3, 0xb9, 0xe7, 0x9c, 0x7b, 0xe6, 0xfa, + 0x06, 0xcc, 0x54, 0x08, 0xad, 0x13, 0x6a, 0x30, 0xd7, 0x38, 0x5e, 0x2e, 0x63, 0x86, 0x96, 0x0d, + 0x8a, 0x9b, 0xc7, 0x76, 0x05, 0xeb, 0x8d, 0x26, 0x61, 0x04, 0x3e, 0xf2, 0x01, 0x3a, 0x73, 0x75, + 0x01, 0x90, 0xa7, 0x2d, 0x42, 0xac, 0x1a, 0x36, 0x50, 0xc3, 0x36, 0x90, 0xe3, 0x10, 0x86, 0x98, + 0x4d, 0x1c, 0xea, 0x17, 0xc8, 0x69, 0xc1, 0x58, 0x46, 0x14, 0x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0xcf, 0x27, 0x3a, 0xe1, 0x39, 0x26, 0xb2, 0xa9, 0xf0, 0x9e, 0xd0, 0x89, 0x19, 0x67, + 0xde, 0x03, 0xbe, 0x04, 0x43, 0x75, 0x52, 0xc5, 0x3c, 0xdb, 0xff, 0xb2, 0x6a, 0x08, 0xbc, 0xa3, + 0xb2, 0x45, 0xaa, 0xd8, 0xe4, 0x68, 0xed, 0x23, 0x98, 0xec, 0x11, 0x17, 0x71, 0x16, 0x40, 0x22, + 0x90, 0x92, 0xb0, 0xf0, 0xb0, 0x90, 0x40, 0x37, 0x24, 0x6d, 0x05, 0xfc, 0x5f, 0xb4, 0xeb, 0xad, + 0x1a, 0x62, 0xed, 0xcb, 0x84, 0xf3, 0x20, 0xca, 0x5c, 0x41, 0x38, 0xe0, 0x9e, 0xa2, 0xcc, 0xd5, + 0x2e, 0x24, 0x90, 0xec, 0x96, 0x0a, 0x57, 0xaf, 0xc0, 0xa8, 0x85, 0x68, 0xc9, 0x76, 0xf6, 0x89, + 0x60, 0x98, 0x1d, 0x6c, 0x69, 0x03, 0xd1, 0x4d, 0x67, 0x9f, 0x98, 0x23, 0x96, 0x7f, 0x80, 0x2b, + 0x60, 0xb8, 0x89, 0x69, 0xab, 0xc6, 0xc4, 0xf8, 0xa9, 0x83, 0x6b, 0x4d, 0x8e, 0x33, 0x05, 0x5e, + 0xd3, 0xc0, 0x38, 0x9f, 0xb9, 0x76, 0x0f, 0x10, 0x0c, 0x1d, 0x20, 0x7a, 0x20, 0x26, 0x9c, 0x9f, + 0xb5, 0x73, 0x30, 0x21, 0x30, 0xc2, 0xec, 0xc3, 0x1a, 0xed, 0x4f, 0x3a, 0xfa, 0x6f, 0x49, 0x2f, + 0x7d, 0x93, 0xc0, 0x44, 0xcf, 0xfd, 0xc2, 0x0c, 0x90, 0x73, 0xe6, 0xce, 0xea, 0x5a, 0x7e, 0xb5, + 0xb8, 0x57, 0xda, 0xda, 0x59, 0x2b, 0x94, 0xde, 0x6d, 0x17, 0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 0x56, 0xa4, + 0xab, 0x6b, 0x45, 0xfa, 0x75, 0xad, 0x48, 0x5f, 0x6e, 0x94, 0xc8, 0xd5, 0x8d, 0x12, 0xf9, 0x79, + 0xa3, 0x44, 0x3e, 0xcc, 0x5b, 0x36, 0x3b, 0x68, 0x95, 0xf5, 0x0a, 0xa9, 0xb7, 0x6b, 0xfd, 0xc7, + 0x73, 0x5a, 0x3d, 0x34, 0xd8, 0x69, 0x03, 0x7b, 0x64, 0xe5, 0x61, 0xfe, 0x83, 0xf3, 0xe2, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x22, 0xf3, 0xa3, 0x60, 0x63, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -944,18 +935,6 @@ func (m *BroadcastTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintService(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - if m.Tx != nil { - { - size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -1195,10 +1174,6 @@ func (m *BroadcastTxResponse) Size() (n int) { } var l int _ = l - if m.Tx != nil { - l = m.Tx.Size() - n += 1 + l + sovService(uint64(l)) - } if m.TxResponse != nil { l = m.TxResponse.Size() n += 1 + l + sovService(uint64(l)) @@ -1688,42 +1663,6 @@ func (m *BroadcastTxResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tx == nil { - m.Tx = &Tx{} - } - if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TxResponse", wireType) } diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index a04bdab44056..18f7bd6455ca 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -7,7 +7,6 @@ import ( "strings" gogogrpc "github.com/gogo/protobuf/grpc" - "github.com/gogo/protobuf/proto" "github.com/grpc-ecosystem/grpc-gateway/runtime" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -186,50 +185,8 @@ func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtype }, nil } -func normalizeBoradcastMode(mode txtypes.BroadcastMode) string { - switch mode { - case txtypes.BroadcastMode_async: - return "async" - case txtypes.BroadcastMode_sync: - return "sync" - case txtypes.BroadcastMode_block: - return "block" - default: - return "sync" - } -} - func (s txServer) BroadcastTx(ctx context.Context, req *txtypes.BroadcastTxRequest) (*txtypes.BroadcastTxResponse, error) { - if req.TxRaw == nil { - return nil, status.Error(codes.InvalidArgument, "invalid empty tx") - } - - clientCtx := s.clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) - txBytes, err := proto.Marshal(req.TxRaw) - if err != nil { - return nil, err - } - resp, err := clientCtx.BroadcastTx(txBytes) - if err != nil { - return nil, err - } - - // Create a proto codec, we need it to unmarshal the tx bytes. - cdc := codec.NewProtoCodec(s.clientCtx.InterfaceRegistry) - var protoTx txtypes.Tx - - bz, err := resp.Tx.Marshal() - if err != nil { - return nil, err - } - if err := cdc.UnmarshalBinaryBare(bz, &protoTx); err != nil { - return nil, err - } - return &txtypes.BroadcastTxResponse{ - Tx: &protoTx, - TxResponse: resp, - }, nil - + return client.TxServiceBroadcast(ctx, s.clientCtx, req) } // RegisterTxService registers the tx service on the gRPC router. diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 45b095f011d3..a1c079d09ce5 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -208,7 +208,6 @@ func (s IntegrationTestSuite) TestBroadcastTx() { ) txBuilder.SetFeeAmount(feeAmount) txBuilder.SetGasLimit(gasLimit) - txBuilder.SetMemo("foobar") // setup txFactory txFactory := clienttx.Factory{}. @@ -217,8 +216,6 @@ func (s IntegrationTestSuite) TestBroadcastTx() { WithTxConfig(val.ClientCtx.TxConfig). WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) - txBuilder.SetTimeoutHeight(txFactory.TimeoutHeight()) - // Sign Tx. err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) s.Require().NoError(err) @@ -243,7 +240,7 @@ func (s IntegrationTestSuite) TestBroadcastTx() { ) s.Require().NoError(err) - s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) + s.Require().Equal(uint32(0), grpcRes.TxResponse.Code) } func TestIntegrationTestSuite(t *testing.T) { From d2ec8f9c91b25f88bd05ca2ac06be40ee37e20ba Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 18:28:35 +0100 Subject: [PATCH 13/26] Send Msg on SetupSuite --- client/grpc_query.go | 3 ++ x/auth/tx/service_test.go | 72 +++++++++++++++------------------------ 2 files changed, 30 insertions(+), 45 deletions(-) diff --git a/client/grpc_query.go b/client/grpc_query.go index dbf76c015def..fb867ae82173 100644 --- a/client/grpc_query.go +++ b/client/grpc_query.go @@ -40,6 +40,9 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply } broadcastRes, err := TxServiceBroadcast(grpcCtx, ctx, req) + if err != nil { + return err + } *res = *broadcastRes return err diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 9d8dd1323c3d..5521a8197ad5 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -32,23 +32,45 @@ type IntegrationTestSuite struct { network *network.Network queryClient tx.ServiceClient + txRes sdk.TxResponse } func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") cfg := network.DefaultConfig() - cfg.NumValidators = 1 + cfg.NumValidators = 2 s.cfg = cfg s.network = network.New(s.T(), cfg) - s.Require().NotNil(s.network) + val := s.network.Validators[0] + _, err := s.network.WaitForHeight(1) s.Require().NoError(err) - s.queryClient = tx.NewServiceClient(s.network.Validators[0].ClientCtx) + s.queryClient = tx.NewServiceClient(val.ClientCtx) + + // Create a new MsgSend tx from val to itself. + out, err := bankcli.MsgSendExec( + val.ClientCtx, + val.Address, + val.Address, + sdk.NewCoins( + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)), + ), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), + fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), + fmt.Sprintf("--%s=foobar", flags.FlagMemo), + ) + s.Require().NoError(err) + s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &s.txRes)) + s.Require().Equal(uint32(0), s.txRes.Code) + + s.Require().NoError(s.network.WaitForNextBlock()) } func (s *IntegrationTestSuite) TearDownSuite() { @@ -104,27 +126,6 @@ func (s IntegrationTestSuite) TestSimulate() { func (s IntegrationTestSuite) TestGetTxEvents() { val := s.network.Validators[0] - // Create a new MsgSend tx from val to itself. - out, err := bankcli.MsgSendExec( - val.ClientCtx, - val.Address, - val.Address, - sdk.NewCoins( - sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)), - ), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--%s=foobar", flags.FlagMemo), - ) - s.Require().NoError(err) - var txRes sdk.TxResponse - s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txRes)) - s.Require().Equal(uint32(0), txRes.Code) - - s.Require().NoError(s.network.WaitForNextBlock()) - // Query the tx via gRPC. grpcRes, err := s.queryClient.GetTxsEvent( context.Background(), @@ -166,38 +167,19 @@ func (s IntegrationTestSuite) TestGetTxEvents() { func (s IntegrationTestSuite) TestGetTx() { val := s.network.Validators[0] - // Create a new MsgSend tx from val to itself. - out, err := bankcli.MsgSendExec( - val.ClientCtx, - val.Address, - val.Address, - sdk.NewCoins( - sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)), - ), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--%s=foobar", flags.FlagMemo), - ) - s.Require().NoError(err) - var txRes sdk.TxResponse - s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txRes)) - s.Require().Equal(uint32(0), txRes.Code) - s.Require().NoError(s.network.WaitForNextBlock()) // Query the tx via gRPC. grpcRes, err := s.queryClient.GetTx( context.Background(), - &tx.GetTxRequest{Hash: txRes.TxHash}, + &tx.GetTxRequest{Hash: s.txRes.TxHash}, ) s.Require().NoError(err) s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) s.Require().NotZero(grpcRes.TxResponse.Height) // Query the tx via grpc-gateway. - restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, txRes.TxHash)) + restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, s.txRes.TxHash)) s.Require().NoError(err) var getTxRes tx.GetTxResponse s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes)) From 4b323c4d4ef71b0f1f417510adadb139a42265d3 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 18:33:43 +0100 Subject: [PATCH 14/26] Remove proto-check-breaking --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b71fc9528cdc..f9011d13d3b8 100644 --- a/Makefile +++ b/Makefile @@ -357,7 +357,7 @@ devdoc-update: ### Protobuf ### ############################################################################### -proto-all: proto-format proto-lint proto-gen proto-check-breaking +proto-all: proto-format proto-lint proto-gen proto-gen: @echo "Generating Protobuf files" From 48b8e4c788316eb5170e6527bbe55e0efbbbc0a2 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 18:41:25 +0100 Subject: [PATCH 15/26] 1 validator in test --- x/auth/tx/service_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 5521a8197ad5..de82ad5cbc62 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -39,7 +39,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") cfg := network.DefaultConfig() - cfg.NumValidators = 2 + cfg.NumValidators = 1 s.cfg = cfg s.network = network.New(s.T(), cfg) From 41039b0e999c6cb2c00ebe0a3538758c30ddc33b Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 19:13:11 +0100 Subject: [PATCH 16/26] Add grpc server tests for broadcast --- server/grpc/server_test.go | 92 ++++++++++++++++++++++++++++++++------ x/auth/tx/service_test.go | 36 +++++++++++---- 2 files changed, 107 insertions(+), 21 deletions(-) diff --git a/server/grpc/server_test.go b/server/grpc/server_test.go index 9afa0b750b04..0b77ee96ff89 100644 --- a/server/grpc/server_test.go +++ b/server/grpc/server_test.go @@ -13,37 +13,37 @@ import ( "google.golang.org/grpc/metadata" rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + clienttx "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" "github.com/cosmos/cosmos-sdk/types/tx" txtypes "github.com/cosmos/cosmos-sdk/types/tx" + "github.com/cosmos/cosmos-sdk/types/tx/signing" + authclient "github.com/cosmos/cosmos-sdk/x/auth/client" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) type IntegrationTestSuite struct { suite.Suite + cfg network.Config network *network.Network + conn *grpc.ClientConn } func (s *IntegrationTestSuite) SetupSuite() { s.T().Log("setting up integration test suite") - s.network = network.New(s.T(), network.DefaultConfig()) + s.cfg = network.DefaultConfig() + s.network = network.New(s.T(), s.cfg) s.Require().NotNil(s.network) _, err := s.network.WaitForHeight(2) s.Require().NoError(err) -} - -func (s *IntegrationTestSuite) TearDownSuite() { - s.T().Log("tearing down integration test suite") - s.network.Cleanup() -} -func (s *IntegrationTestSuite) TestGRPCServer() { val0 := s.network.Validators[0] conn, err := grpc.Dial( val0.AppConfig.GRPC.Address, @@ -51,16 +51,27 @@ func (s *IntegrationTestSuite) TestGRPCServer() { ) s.Require().NoError(err) defer conn.Close() +} + +func (s *IntegrationTestSuite) TearDownSuite() { + s.T().Log("tearing down integration test suite") + s.network.Cleanup() +} +func (s *IntegrationTestSuite) TestGRPCServer_TestService() { // gRPC query to test service should work - testClient := testdata.NewQueryClient(conn) + testClient := testdata.NewQueryClient(s.conn) testRes, err := testClient.Echo(context.Background(), &testdata.EchoRequest{Message: "hello"}) s.Require().NoError(err) s.Require().Equal("hello", testRes.Message) +} + +func (s *IntegrationTestSuite) TestGRPCServer_BankBalance() { + val0 := s.network.Validators[0] // gRPC query to bank service should work denom := fmt.Sprintf("%stoken", val0.Moniker) - bankClient := banktypes.NewQueryClient(conn) + bankClient := banktypes.NewQueryClient(s.conn) var header metadata.MD bankRes, err := bankClient.Balance( context.Background(), @@ -83,9 +94,11 @@ func (s *IntegrationTestSuite) TestGRPCServer() { ) blockHeight = header.Get(grpctypes.GRPCBlockHeightHeader) s.Require().Equal([]string{"1"}, blockHeight) +} +func (s *IntegrationTestSuite) TestGRPCServer_Reflection() { // Test server reflection - reflectClient := rpb.NewServerReflectionClient(conn) + reflectClient := rpb.NewServerReflectionClient(s.conn) stream, err := reflectClient.ServerReflectionInfo(context.Background(), grpc.WaitForReady(true)) s.Require().NoError(err) s.Require().NoError(stream.Send(&rpb.ServerReflectionRequest{ @@ -100,11 +113,13 @@ func (s *IntegrationTestSuite) TestGRPCServer() { } // Make sure the following services are present s.Require().True(servicesMap["cosmos.bank.v1beta1.Query"]) +} +func (s *IntegrationTestSuite) TestGRPCServer_GetTxsEvent() { // Query the tx via gRPC without pagination. This used to panic, see // https://github.com/cosmos/cosmos-sdk/issues/8038. - txServiceClient := txtypes.NewServiceClient(conn) - _, err = txServiceClient.GetTxsEvent( + txServiceClient := txtypes.NewServiceClient(s.conn) + _, err := txServiceClient.GetTxsEvent( context.Background(), &tx.GetTxsEventRequest{ Event: "message.action=send", @@ -115,6 +130,57 @@ func (s *IntegrationTestSuite) TestGRPCServer() { s.Require().Error(err) } +func (s *IntegrationTestSuite) TestGRPCServer_BroadcastTx() { + val0 := s.network.Validators[0] + + // prepare txBuilder with msg + txBuilder := val0.ClientCtx.TxConfig.NewTxBuilder() + feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)} + gasLimit := testdata.NewTestGasLimit() + s.Require().NoError( + txBuilder.SetMsgs(&banktypes.MsgSend{ + FromAddress: val0.Address.String(), + ToAddress: val0.Address.String(), + Amount: sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}, + }), + ) + txBuilder.SetFeeAmount(feeAmount) + txBuilder.SetGasLimit(gasLimit) + + // setup txFactory + txFactory := clienttx.Factory{}. + WithChainID(val0.ClientCtx.ChainID). + WithKeybase(val0.ClientCtx.Keyring). + WithTxConfig(val0.ClientCtx.TxConfig). + WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) + + // Sign Tx. + err := authclient.SignTx(txFactory, val0.ClientCtx, val0.Moniker, txBuilder, false) + s.Require().NoError(err) + + // To get the TxRaw to be broadcasted, we unforunately need to first encode + // the tx into bytes, then decode it into TxRaw. + txBytes, err := val0.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) + // Create a proto codec, we need it to unmarshal the tx bytes. + cdc := codec.NewProtoCodec(val0.ClientCtx.InterfaceRegistry) + var txRaw tx.TxRaw + err = cdc.UnmarshalBinaryBare(txBytes, &txRaw) + s.Require().NoError(err) + + // Broadcast the tx via gRPC. + queryClient := tx.NewServiceClient(s.conn) + grpcRes, err := queryClient.BroadcastTx( + context.Background(), + &tx.BroadcastTxRequest{ + Mode: tx.BroadcastMode_sync, + TxRaw: &txRaw, + }, + ) + s.Require().NoError(err) + s.Require().Equal(uint32(0), grpcRes.TxResponse.Code) +} + // Test and enforce that we upfront reject any connections to baseapp containing // invalid initial x-cosmos-block-height that aren't positive and in the range [0, max(int64)] // See issue https://github.com/cosmos/cosmos-sdk/issues/7662. diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index de82ad5cbc62..7f6ed1e56885 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -225,17 +225,37 @@ func (s IntegrationTestSuite) TestBroadcastTx() { err = cdc.UnmarshalBinaryBare(txBytes, &txRaw) s.Require().NoError(err) - // Query the tx via gRPC. - grpcRes, err := s.queryClient.BroadcastTx( - context.Background(), - &tx.BroadcastTxRequest{ + testCases := []struct { + name string + req *tx.BroadcastTxRequest + expErr bool + }{ + {"nil request", nil, true}, + {"empty request", &tx.BroadcastTxRequest{}, true}, + {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_sync, TxRaw: &txRaw, - }, - ) - s.Require().NoError(err) + }, false}, + } - s.Require().Equal(uint32(0), grpcRes.TxResponse.Code) + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + // Broadcast the tx via gRPC. + grpcRes, err := s.queryClient.BroadcastTx( + context.Background(), + tc.req, + ) + + if tc.expErr { + s.Require().Error(err) + + } else { + s.Require().NoError(err) + s.Require().Equal(uint32(0), grpcRes.TxResponse.Code) + } + }) + } } func TestIntegrationTestSuite(t *testing.T) { From ce8f6572f87633ff2de72766114f06211c692898 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Mon, 30 Nov 2020 19:24:06 +0100 Subject: [PATCH 17/26] Fix grpc server tests --- server/grpc/server_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/grpc/server_test.go b/server/grpc/server_test.go index 0b77ee96ff89..0960844fd04a 100644 --- a/server/grpc/server_test.go +++ b/server/grpc/server_test.go @@ -45,16 +45,16 @@ func (s *IntegrationTestSuite) SetupSuite() { s.Require().NoError(err) val0 := s.network.Validators[0] - conn, err := grpc.Dial( + s.conn, err = grpc.Dial( val0.AppConfig.GRPC.Address, grpc.WithInsecure(), // Or else we get "no transport security set" ) s.Require().NoError(err) - defer conn.Close() } func (s *IntegrationTestSuite) TearDownSuite() { s.T().Log("tearing down integration test suite") + s.conn.Close() s.network.Cleanup() } From 4fb6f7ff2f616961d0974c8e2baf0c48d7bf3230 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 12:03:49 +0100 Subject: [PATCH 18/26] Add some changes --- client/broadcast.go | 24 +++--------------------- client/grpc_query.go | 6 +++++- proto/cosmos/tx/v1beta1/service.proto | 17 +++++++++-------- server/grpc/server_test.go | 12 ++---------- x/auth/tx/service_test.go | 12 ++---------- 5 files changed, 21 insertions(+), 50 deletions(-) diff --git a/client/broadcast.go b/client/broadcast.go index 8d7d0b4ab749..bd641dc0bf17 100644 --- a/client/broadcast.go +++ b/client/broadcast.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/gogo/protobuf/proto" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/mempool" "google.golang.org/grpc/codes" @@ -150,16 +149,12 @@ func (ctx Context) BroadcastTxAsync(txBytes []byte) (*sdk.TxResponse, error) { // TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types // from the tx service. Calls `clientCtx.BroadcastTx` under the hood. func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error) { - if req == nil || req.TxRaw == nil { + if req == nil || req.TxBytes == nil { return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } - clientCtx = clientCtx.WithBroadcastMode(normalizeBoradcastMode((req.Mode))) - txBytes, err := proto.Marshal(req.TxRaw) - if err != nil { - return nil, err - } - resp, err := clientCtx.BroadcastTx(txBytes) + clientCtx = clientCtx.WithBroadcastMode(req.Mode.String()) + resp, err := clientCtx.BroadcastTx(req.TxBytes) if err != nil { return nil, err } @@ -168,16 +163,3 @@ func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.Broa TxResponse: resp, }, nil } - -func normalizeBoradcastMode(mode tx.BroadcastMode) string { - switch mode { - case tx.BroadcastMode_async: - return "async" - case tx.BroadcastMode_sync: - return "sync" - case tx.BroadcastMode_block: - return "block" - default: - return "sync" - } -} diff --git a/client/grpc_query.go b/client/grpc_query.go index fb867ae82173..979bc01727e7 100644 --- a/client/grpc_query.go +++ b/client/grpc_query.go @@ -29,7 +29,7 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply // 2. or we are querying for state, in which case we call ABCI's Query. // Case 1. Broadcasting a Tx. - if method == "/cosmos.tx.v1beta1.Service/BroadcastTx" { + if isBroadcast(method) { req, ok := args.(*tx.BroadcastTxRequest) if !ok { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "expected %T, got %T", (*tx.BroadcastTxRequest)(nil), args) @@ -111,3 +111,7 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply func (Context) NewStream(gocontext.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error) { return nil, fmt.Errorf("streaming rpc not supported") } + +func isBroadcast(method string) bool { + return method == "/cosmos.tx.v1beta1.Service/BroadcastTx" +} diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 7700fd639a55..023196fc09df 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -6,7 +6,6 @@ import "cosmos/base/abci/v1beta1/abci.proto"; import "cosmos/tx/v1beta1/tx.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmos/tx/v1beta1/tx.proto"; option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; @@ -53,24 +52,26 @@ message GetTxsEventResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. message BroadcastTxRequest { - // tx_raw is the raw transaction. - cosmos.tx.v1beta1.TxRaw tx_raw = 1; - BroadcastMode mode = 2; + // tx_bytes is the raw transaction. + bytes tx_bytes = 1; + BroadcastMode mode = 2; } // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. enum BroadcastMode { + option (gogoproto.goproto_enum_stringer) = false; + // zero-value for mode ordering - BROADCAST_MODE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "none"]; + BROADCAST_MODE_UNSPECIFIED = 0; // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for // the tx to be committed in a block. - BROADCAST_MODE_BLOCK = 1 [(gogoproto.enumvalue_customname) = "block"]; + BROADCAST_MODE_BLOCK = 1; // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. - BROADCAST_MODE_SYNC = 2 [(gogoproto.enumvalue_customname) = "sync"]; + BROADCAST_MODE_SYNC = 2; // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns // immediately. - BROADCAST_MODE_ASYNC = 3 [(gogoproto.enumvalue_customname) = "async"]; + BROADCAST_MODE_ASYNC = 3; } // BroadcastTxResponse is the response type for the diff --git a/server/grpc/server_test.go b/server/grpc/server_test.go index 0960844fd04a..e08c1beef8f2 100644 --- a/server/grpc/server_test.go +++ b/server/grpc/server_test.go @@ -14,7 +14,6 @@ import ( rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" clienttx "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -158,23 +157,16 @@ func (s *IntegrationTestSuite) TestGRPCServer_BroadcastTx() { err := authclient.SignTx(txFactory, val0.ClientCtx, val0.Moniker, txBuilder, false) s.Require().NoError(err) - // To get the TxRaw to be broadcasted, we unforunately need to first encode - // the tx into bytes, then decode it into TxRaw. txBytes, err := val0.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) s.Require().NoError(err) - // Create a proto codec, we need it to unmarshal the tx bytes. - cdc := codec.NewProtoCodec(val0.ClientCtx.InterfaceRegistry) - var txRaw tx.TxRaw - err = cdc.UnmarshalBinaryBare(txBytes, &txRaw) - s.Require().NoError(err) // Broadcast the tx via gRPC. queryClient := tx.NewServiceClient(s.conn) grpcRes, err := queryClient.BroadcastTx( context.Background(), &tx.BroadcastTxRequest{ - Mode: tx.BroadcastMode_sync, - TxRaw: &txRaw, + Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, + TxBytes: txBytes, }, ) s.Require().NoError(err) diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 7f6ed1e56885..a5eda18e78a4 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -10,7 +10,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" clienttx "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/testutil/network" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -215,15 +214,8 @@ func (s IntegrationTestSuite) TestBroadcastTx() { err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) s.Require().NoError(err) - // To get the TxRaw to be broadcasted, we unforunately need to first encode - // the tx into bytes, then decode it into TxRaw. txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) s.Require().NoError(err) - // Create a proto codec, we need it to unmarshal the tx bytes. - cdc := codec.NewProtoCodec(val.ClientCtx.InterfaceRegistry) - var txRaw tx.TxRaw - err = cdc.UnmarshalBinaryBare(txBytes, &txRaw) - s.Require().NoError(err) testCases := []struct { name string @@ -233,8 +225,8 @@ func (s IntegrationTestSuite) TestBroadcastTx() { {"nil request", nil, true}, {"empty request", &tx.BroadcastTxRequest{}, true}, {"valid request", &tx.BroadcastTxRequest{ - Mode: tx.BroadcastMode_sync, - TxRaw: &txRaw, + Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, + TxBytes: txBytes, }, false}, } From e2c75f161eee174813af0ab1b4c26fdccb112cfc Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 12:28:39 +0100 Subject: [PATCH 19/26] Add ress comments --- server/grpc/server_test.go | 2 - types/tx/service.pb.go | 196 ++++++++++++++----------------------- types/tx/types.go | 14 +++ x/auth/tx/service_test.go | 23 +---- 4 files changed, 87 insertions(+), 148 deletions(-) diff --git a/server/grpc/server_test.go b/server/grpc/server_test.go index 5648233f8f32..addabdf03274 100644 --- a/server/grpc/server_test.go +++ b/server/grpc/server_test.go @@ -1,5 +1,3 @@ -// +build norace - package grpc_test import ( diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 5472ac582bb7..fc1faa934a69 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -36,16 +36,16 @@ type BroadcastMode int32 const ( // zero-value for mode ordering - BroadcastMode_none BroadcastMode = 0 + BroadcastMode_BROADCAST_MODE_UNSPECIFIED BroadcastMode = 0 // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for // the tx to be committed in a block. - BroadcastMode_block BroadcastMode = 1 + BroadcastMode_BROADCAST_MODE_BLOCK BroadcastMode = 1 // BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for // a CheckTx execution response only. - BroadcastMode_sync BroadcastMode = 2 + BroadcastMode_BROADCAST_MODE_SYNC BroadcastMode = 2 // BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns // immediately. - BroadcastMode_async BroadcastMode = 3 + BroadcastMode_BROADCAST_MODE_ASYNC BroadcastMode = 3 ) var BroadcastMode_name = map[int32]string{ @@ -62,10 +62,6 @@ var BroadcastMode_value = map[string]int32{ "BROADCAST_MODE_ASYNC": 3, } -func (x BroadcastMode) String() string { - return proto.EnumName(BroadcastMode_name, int32(x)) -} - func (BroadcastMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor_e0b00a618705eca7, []int{0} } @@ -194,9 +190,9 @@ func (m *GetTxsEventResponse) GetPagination() *query.PageResponse { // BroadcastTxRequest is the request type for the Service.BroadcastTxRequest // RPC method. type BroadcastTxRequest struct { - // tx_raw is the raw transaction. - TxRaw *TxRaw `protobuf:"bytes,1,opt,name=tx_raw,json=txRaw,proto3" json:"tx_raw,omitempty"` - Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` + // tx_bytes is the raw transaction. + TxBytes []byte `protobuf:"bytes,1,opt,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` + Mode BroadcastMode `protobuf:"varint,2,opt,name=mode,proto3,enum=cosmos.tx.v1beta1.BroadcastMode" json:"mode,omitempty"` } func (m *BroadcastTxRequest) Reset() { *m = BroadcastTxRequest{} } @@ -232,9 +228,9 @@ func (m *BroadcastTxRequest) XXX_DiscardUnknown() { var xxx_messageInfo_BroadcastTxRequest proto.InternalMessageInfo -func (m *BroadcastTxRequest) GetTxRaw() *TxRaw { +func (m *BroadcastTxRequest) GetTxBytes() []byte { if m != nil { - return m.TxRaw + return m.TxBytes } return nil } @@ -243,7 +239,7 @@ func (m *BroadcastTxRequest) GetMode() BroadcastMode { if m != nil { return m.Mode } - return BroadcastMode_none + return BroadcastMode_BROADCAST_MODE_UNSPECIFIED } // BroadcastTxResponse is the response type for the @@ -513,95 +509,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ -<<<<<<< HEAD - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x4e, 0xdb, 0x4c, - 0x14, 0x8d, 0x13, 0xc2, 0xcf, 0x04, 0xbe, 0x2f, 0x1d, 0x68, 0x15, 0xb9, 0xd4, 0x18, 0x87, 0x9f, - 0x08, 0xa9, 0xb6, 0x48, 0xbb, 0x60, 0x51, 0xa9, 0x22, 0x21, 0x20, 0xd4, 0xf2, 0x23, 0x87, 0x2e, - 0x5a, 0x55, 0x8a, 0x26, 0xc9, 0x60, 0x2c, 0x12, 0x4f, 0xc8, 0x4c, 0xc0, 0x88, 0xb2, 0xe9, 0x92, - 0x55, 0xa5, 0xae, 0xd9, 0xf6, 0x59, 0xba, 0x44, 0xea, 0xa6, 0xcb, 0x0a, 0xfa, 0x02, 0x7d, 0x83, - 0xca, 0xe3, 0x49, 0xe2, 0x04, 0x07, 0x50, 0x57, 0x1e, 0xc3, 0xb9, 0xe7, 0x9c, 0x7b, 0xe6, 0xfa, - 0x06, 0xcc, 0x54, 0x08, 0xad, 0x13, 0x6a, 0x30, 0xd7, 0x38, 0x5e, 0x2e, 0x63, 0x86, 0x96, 0x0d, - 0x8a, 0x9b, 0xc7, 0x76, 0x05, 0xeb, 0x8d, 0x26, 0x61, 0x04, 0x3e, 0xf2, 0x01, 0x3a, 0x73, 0x75, - 0x01, 0x90, 0xa7, 0x2d, 0x42, 0xac, 0x1a, 0x36, 0x50, 0xc3, 0x36, 0x90, 0xe3, 0x10, 0x86, 0x98, - 0x4d, 0x1c, 0xea, 0x17, 0xc8, 0x69, 0xc1, 0x58, 0x46, 0x14, 0x1b, 0xa8, 0x5c, 0xb1, 0x3b, 0xc4, - 0xde, 0x8b, 0x00, 0xc9, 0xb7, 0x65, 0x99, 0x2b, 0xfe, 0x37, 0x65, 0x11, 0x8b, 0xf0, 0xa3, 0xe1, - 0x9d, 0xc4, 0x5f, 0x97, 0x82, 0xb4, 0x47, 0x2d, 0xdc, 0x3c, 0xed, 0x54, 0x36, 0x90, 0x65, 0x3b, - 0xdc, 0xc3, 0xfd, 0xec, 0x5a, 0x13, 0xc0, 0x0d, 0xcc, 0xf6, 0x5c, 0x5a, 0x38, 0xc6, 0x0e, 0x33, - 0xf1, 0x51, 0x0b, 0x53, 0x06, 0xa7, 0x40, 0x1c, 0x7b, 0xef, 0x29, 0x49, 0x95, 0x32, 0x63, 0xa6, - 0xff, 0x02, 0xd7, 0x01, 0xe8, 0x72, 0xa7, 0xa2, 0xaa, 0x94, 0x49, 0x64, 0x17, 0x74, 0x11, 0x88, - 0x67, 0x44, 0xe7, 0x46, 0xda, 0xc1, 0xe8, 0xbb, 0xc8, 0xc2, 0x82, 0xd1, 0x0c, 0x54, 0x6a, 0x57, - 0x12, 0x98, 0xec, 0x11, 0xa5, 0x0d, 0xe2, 0x50, 0x0c, 0x17, 0x41, 0x8c, 0xb9, 0x34, 0x25, 0xa9, - 0xb1, 0x4c, 0x22, 0xfb, 0x58, 0xbf, 0x95, 0xb4, 0xbe, 0xe7, 0x9a, 0x1e, 0x02, 0x6e, 0x80, 0x71, - 0xe6, 0x96, 0x9a, 0xa2, 0x8e, 0xa6, 0xa2, 0xbc, 0x62, 0xae, 0xc7, 0x0a, 0x4f, 0x37, 0x50, 0x28, - 0xc0, 0x66, 0x82, 0x75, 0xce, 0x1e, 0x51, 0xb0, 0xa3, 0x18, 0xef, 0x68, 0xf1, 0xde, 0x8e, 0x04, - 0x53, 0xb0, 0xa5, 0x33, 0x00, 0x73, 0x4d, 0x82, 0xaa, 0x15, 0x44, 0x99, 0x27, 0xe6, 0xc7, 0x68, - 0x80, 0x61, 0xcf, 0x27, 0x3a, 0xe1, 0x39, 0x26, 0xb2, 0xa9, 0xf0, 0x9e, 0xd0, 0x89, 0x19, 0x67, - 0xde, 0x03, 0xbe, 0x04, 0x43, 0x75, 0x52, 0xc5, 0x3c, 0xdb, 0xff, 0xb2, 0x6a, 0x08, 0xbc, 0xa3, - 0xb2, 0x45, 0xaa, 0xd8, 0xe4, 0x68, 0xed, 0x23, 0x98, 0xec, 0x11, 0x17, 0x71, 0x16, 0x40, 0x22, - 0x90, 0x92, 0xb0, 0xf0, 0xb0, 0x90, 0x40, 0x37, 0x24, 0x6d, 0x05, 0xfc, 0x5f, 0xb4, 0xeb, 0xad, - 0x1a, 0x62, 0xed, 0xcb, 0x84, 0xf3, 0x20, 0xca, 0x5c, 0x41, 0x38, 0xe0, 0x9e, 0xa2, 0xcc, 0xd5, - 0x2e, 0x24, 0x90, 0xec, 0x96, 0x0a, 0x57, 0xaf, 0xc0, 0xa8, 0x85, 0x68, 0xc9, 0x76, 0xf6, 0x89, - 0x60, 0x98, 0x1d, 0x6c, 0x69, 0x03, 0xd1, 0x4d, 0x67, 0x9f, 0x98, 0x23, 0x96, 0x7f, 0x80, 0x2b, - 0x60, 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x6d, 0xc1, 0x99, 0x10, 0xca, 0xe0, 0x5d, 0xcb, 0xea, 0x60, 0x80, - 0x10, 0x9c, 0xe3, 0x82, 0x0a, 0x9c, 0x36, 0xc2, 0x76, 0xa5, 0x71, 0xe6, 0x8d, 0xc7, 0x39, 0xfc, - 0x04, 0x12, 0x81, 0x0f, 0x0d, 0xce, 0xdf, 0xf5, 0x7d, 0x76, 0xd5, 0x17, 0xee, 0x83, 0x09, 0x0f, - 0x0a, 0xf7, 0x90, 0xd2, 0x9e, 0x84, 0x7a, 0xa0, 0x9e, 0x7a, 0x60, 0x6b, 0x86, 0xaa, 0xdf, 0x5e, - 0xe5, 0xa1, 0xea, 0x21, 0xcb, 0xb7, 0xad, 0x0e, 0x07, 0xa8, 0xe7, 0x5e, 0x7f, 0xbf, 0x56, 0xa4, - 0xab, 0x6b, 0x45, 0xfa, 0x75, 0xad, 0x48, 0x5f, 0x6e, 0x94, 0xc8, 0xd5, 0x8d, 0x12, 0xf9, 0x79, - 0xa3, 0x44, 0x3e, 0xcc, 0x5b, 0x36, 0x3b, 0x68, 0x95, 0xf5, 0x0a, 0xa9, 0xb7, 0x6b, 0xfd, 0xc7, - 0x73, 0x5a, 0x3d, 0x34, 0xd8, 0x69, 0x03, 0x7b, 0x64, 0xe5, 0x61, 0xfe, 0x83, 0xf3, 0xe2, 0x6f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x22, 0xf3, 0xa3, 0x60, 0x63, 0x07, 0x00, 0x00, -======= - // 563 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xae, 0x1d, 0x48, 0xdb, 0x49, 0x11, 0xb0, 0x88, 0x2a, 0x32, 0xc5, 0x0d, 0x4e, 0xd3, 0x56, - 0x48, 0xd8, 0x6a, 0xb8, 0xf4, 0x80, 0x84, 0x84, 0x54, 0x22, 0x6e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ac, 0x1e, 0xa7, 0x27, 0x46, 0x24, 0xac, 0x65, 0xa3, - 0x23, 0xce, 0x12, 0xe7, 0x7f, 0x56, 0x62, 0xd5, 0xff, 0x8b, 0x49, 0x0d, 0x9c, 0xfa, 0xe7, 0x1f, - 0xbf, 0xbf, 0x99, 0x8f, 0x9d, 0x47, 0xde, 0x92, 0xdb, 0xce, 0xdc, 0x62, 0xb8, 0xad, 0x86, 0x40, - 0xb6, 0x97, 0x48, 0xe6, 0x47, 0x68, 0xd5, 0x8a, 0x01, 0xda, 0x70, 0x47, 0x19, 0xda, 0x64, 0xcb, - 0x5b, 0x76, 0xd5, 0xde, 0xc7, 0x64, 0xea, 0x97, 0xe4, 0x13, 0x54, 0x72, 0x37, 0x43, 0x1a, 0x45, - 0xb2, 0x0b, 0xa7, 0x6c, 0xed, 0x5e, 0x07, 0xd3, 0x3d, 0xd8, 0xaa, 0x87, 0x2a, 0xd9, 0x5c, 0xda, - 0x83, 0x78, 0xf5, 0xf2, 0xfb, 0xc4, 0x36, 0xc6, 0x13, 0xdb, 0xf8, 0x35, 0xb1, 0x8d, 0xaf, 0x53, - 0x7b, 0x65, 0x3c, 0xb5, 0x57, 0x7e, 0x4e, 0xed, 0x95, 0x77, 0x8d, 0x20, 0xc4, 0xee, 0xb0, 0xed, - 0x76, 0x78, 0x3f, 0xe3, 0xa6, 0x3f, 0xcf, 0xc4, 0xfb, 0x0f, 0x1e, 0x5e, 0xc4, 0x2c, 0x11, 0x6b, - 0x97, 0xd5, 0x07, 0xe7, 0xf9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x59, 0xdc, 0x70, 0x31, - 0x05, 0x00, 0x00, ->>>>>>> a51eac4f15a7f8110e529df9460fa7126c427aa3 + // 740 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4d, 0x4f, 0x13, 0x5d, + 0x14, 0xee, 0xb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x4a, 0xfe, 0x0a, 0x43, 0x2e, 0x0c, 0x07, 0xf3, 0x43, 0x5a, + 0x84, 0xfd, 0x9e, 0x77, 0x91, 0x99, 0xb9, 0x16, 0x23, 0xdf, 0xd3, 0xcc, 0xd9, 0x8f, 0xdf, 0x5f, + 0xe2, 0x8f, 0xb4, 0x87, 0x46, 0xc4, 0xee, 0x0c, 0xd4, 0x1a, 0xf0, 0x9f, 0x98, 0x04, 0x9a, 0x8e, + 0xa0, 0x0c, 0xcf, 0x31, 0x93, 0xed, 0x0f, 0x90, 0x82, 0xb3, 0x42, 0x50, 0x45, 0x53, 0x46, 0xd4, + 0xd6, 0x34, 0x3e, 0x78, 0xa3, 0x3f, 0x45, 0x1f, 0x21, 0x19, 0xfa, 0x88, 0xd0, 0xdc, 0x75, 0xdf, + 0x5e, 0x47, 0x7d, 0xfe, 0x26, 0x98, 0xac, 0x41, 0x15, 0x35, 0xa4, 0xb5, 0xc9, 0xc8, 0x1a, 0x98, + 0xa7, 0x1e, 0xda, 0x7d, 0x91, 0xea, 0x57, 0x57, 0x72, 0xa4, 0x7a, 0xc4, 0x0a, 0x0d, 0xd4, 0x51, + 0x1f, 0xf5, 0xfc, 0x8b, 0xef, 0x17, 0xaa, 0x72, 0x7e, 0xa1, 0x2a, 0xbf, 0x2e, 0x54, 0xe5, 0xf3, + 0xa5, 0x1a, 0x3b, 0xbf, 0x54, 0x63, 0x3f, 0x2f, 0xd5, 0xd8, 0xdb, 0x39, 0xcb, 0xe6, 0x07, 0xad, + 0x8a, 0x5e, 0xa5, 0xf5, 0x20, 0xd7, 0xff, 0xf3, 0x84, 0xd5, 0xde, 0x1b, 0xfc, 0xa4, 0x41, 0x3c, + 0xb2, 0xca, 0xa0, 0xf8, 0xe1, 0x78, 0xfa, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x82, 0x3e, 0xff, + 0x0f, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -932,15 +887,10 @@ func (m *BroadcastTxRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if m.TxRaw != nil { - { - size, err := m.TxRaw.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } + if len(m.TxBytes) > 0 { + i -= len(m.TxBytes) + copy(dAtA[i:], m.TxBytes) + i = encodeVarintService(dAtA, i, uint64(len(m.TxBytes))) i-- dAtA[i] = 0xa } @@ -1202,8 +1152,8 @@ func (m *BroadcastTxRequest) Size() (n int) { } var l int _ = l - if m.TxRaw != nil { - l = m.TxRaw.Size() + l = len(m.TxBytes) + if l > 0 { n += 1 + l + sovService(uint64(l)) } if m.Mode != 0 { @@ -1600,9 +1550,9 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxRaw", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowService @@ -1612,26 +1562,24 @@ func (m *BroadcastTxRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthService } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthService } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TxRaw == nil { - m.TxRaw = &TxRaw{} - } - if err := m.TxRaw.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.TxBytes = append(m.TxBytes[:0], dAtA[iNdEx:postIndex]...) + if m.TxBytes == nil { + m.TxBytes = []byte{} } iNdEx = postIndex case 2: diff --git a/types/tx/types.go b/types/tx/types.go index c572d448a898..5afb5bd40017 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -193,3 +193,17 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { func isServiceMsg(typeURL string) bool { return strings.Count(typeURL, "/") >= 2 } + +// String implements the Stringer interface. +func (bm BroadcastMode) String() string { + switch bm { + case BroadcastMode_BROADCAST_MODE_ASYNC: + return "async" + case BroadcastMode_BROADCAST_MODE_BLOCK: + return "block" + case BroadcastMode_BROADCAST_MODE_SYNC: + return "sync" + default: + return "unspecified" + } +} diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 28efc3cb68ec..fa748d1b7ebe 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -125,29 +125,8 @@ func (s IntegrationTestSuite) TestSimulate() { func (s IntegrationTestSuite) TestGetTxEvents() { val := s.network.Validators[0] - // Create a new MsgSend tx from val to itself. - out, err := bankcli.MsgSendExec( - val.ClientCtx, - val.Address, - val.Address, - sdk.NewCoins( - sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)), - ), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), - fmt.Sprintf("--gas=%d", flags.DefaultGasLimit), - fmt.Sprintf("--%s=foobar", flags.FlagMemo), - ) - s.Require().NoError(err) - var txRes sdk.TxResponse - s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &txRes)) - s.Require().Equal(uint32(0), txRes.Code) - - s.Require().NoError(s.network.WaitForNextBlock()) - // Query the tx via gRPC empty params. - _, err = s.queryClient.GetTxsEvent( + _, err := s.queryClient.GetTxsEvent( context.Background(), &tx.GetTxsEventRequest{}, ) From aade13d4167d180aad1baa73d985b2b3b794cbbe Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 13:27:27 +0100 Subject: [PATCH 20/26] Add table tests for tx service --- client/grpc_query.go | 6 + x/auth/tx/service.go | 10 +- x/auth/tx/service_test.go | 264 +++++++++++++++++++++++++++----------- 3 files changed, 206 insertions(+), 74 deletions(-) diff --git a/client/grpc_query.go b/client/grpc_query.go index 979bc01727e7..fc8cdeeb80d5 100644 --- a/client/grpc_query.go +++ b/client/grpc_query.go @@ -3,6 +3,7 @@ package client import ( gocontext "context" "fmt" + "reflect" "strconv" gogogrpc "github.com/gogo/protobuf/grpc" @@ -28,6 +29,11 @@ func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, args, reply // 1. either we're broadcasting a Tx, in which call we call Tendermint's broadcast endpoint directly, // 2. or we are querying for state, in which case we call ABCI's Query. + // In both cases, we don't allow empty request args (it will panic unexpectedly). + if reflect.ValueOf(args).IsNil() { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "request cannot be nil") + } + // Case 1. Broadcasting a Tx. if isBroadcast(method) { req, ok := args.(*tx.BroadcastTxRequest) diff --git a/x/auth/tx/service.go b/x/auth/tx/service.go index 8e0cf09b12b6..853d401beccc 100644 --- a/x/auth/tx/service.go +++ b/x/auth/tx/service.go @@ -49,6 +49,10 @@ const ( // TxsByEvents implements the ServiceServer.TxsByEvents RPC method. func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventRequest) (*txtypes.GetTxsEventResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "request cannot be nil") + } + page, limit, err := pagination.ParsePagination(req.Pagination) if err != nil { return nil, err @@ -113,7 +117,7 @@ func (s txServer) GetTxsEvent(ctx context.Context, req *txtypes.GetTxsEventReque // Simulate implements the ServiceServer.Simulate RPC method. func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (*txtypes.SimulateResponse, error) { - if req.Tx == nil { + if req == nil || req.Tx == nil { return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } @@ -139,6 +143,10 @@ func (s txServer) Simulate(ctx context.Context, req *txtypes.SimulateRequest) (* // GetTx implements the ServiceServer.GetTx RPC method. func (s txServer) GetTx(ctx context.Context, req *txtypes.GetTxRequest) (*txtypes.GetTxResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "request cannot be nil") + } + // We get hash as a hex string in the request, convert it to bytes. hash, err := hex.DecodeString(req.Hash) if err != nil { diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index fa748d1b7ebe..bec664cd0545 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -122,48 +122,77 @@ func (s IntegrationTestSuite) TestSimulate() { s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty. } -func (s IntegrationTestSuite) TestGetTxEvents() { - val := s.network.Validators[0] - - // Query the tx via gRPC empty params. - _, err := s.queryClient.GetTxsEvent( - context.Background(), - &tx.GetTxsEventRequest{}, - ) - s.Require().Error(err) - - // Query the tx via gRPC. - grpcRes, err := s.queryClient.GetTxsEvent( - context.Background(), - &tx.GetTxsEventRequest{ - Events: []string{"message.action=send"}, - Pagination: &query.PageRequest{ - CountTotal: false, - Offset: 0, - Limit: 1, +func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { + testCases := []struct { + name string + req *tx.GetTxsEventRequest + expErr bool + expErrMsg string + }{ + { + "nil request", + nil, + true, "request cannot be nil", + }, + { + "empty request", + &tx.GetTxsEventRequest{}, + true, "must declare at least one event to search", + }, + { + "request with dummy event", + &tx.GetTxsEventRequest{Events: []string{"foobar"}}, + true, "event foobar should be of the format: {eventType}.{eventAttribute}={value}", + }, + { + "without pagination", + &tx.GetTxsEventRequest{ + Events: []string{"message.action=send"}, }, + false, "", }, - ) - s.Require().NoError(err) - s.Require().Equal(len(grpcRes.Txs), 1) - s.Require().Equal("foobar", grpcRes.Txs[0].Body.Memo) - - // Query the tx via gRPC without pagination. This used to panic, see - // https://github.com/cosmos/cosmos-sdk/issues/8038. - grpcRes, err = s.queryClient.GetTxsEvent( - context.Background(), - &tx.GetTxsEventRequest{ - Events: []string{"message.action=send"}, + { + "with pagination", + &tx.GetTxsEventRequest{ + Events: []string{"message.action=send"}, + Pagination: &query.PageRequest{ + CountTotal: false, + Offset: 0, + Limit: 1, + }, + }, + false, "", }, - ) - // TODO Once https://github.com/cosmos/cosmos-sdk/pull/8029 is merged, this - // should not error anymore. - s.Require().NoError(err) + { + "with multi events", + &tx.GetTxsEventRequest{ + Events: []string{"message.action=send", "message.module=bank"}, + }, + false, "", + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + // Query the tx via gRPC. + grpcRes, err := s.queryClient.GetTxsEvent(context.Background(), tc.req) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + s.Require().NoError(err) + s.Require().Equal(len(grpcRes.Txs), 1) + s.Require().Equal("foobar", grpcRes.Txs[0].Body.Memo) + } + }) + } +} - rpcTests := []struct { +func (s IntegrationTestSuite) TestGetTxEvents_GRPCGateway() { + val := s.network.Validators[0] + testCases := []struct { name string url string - expectErr bool + expErr bool expErrMsg string }{ { @@ -197,15 +226,16 @@ func (s IntegrationTestSuite) TestGetTxEvents() { "", }, } - for _, tc := range rpcTests { + for _, tc := range testCases { s.Run(tc.name, func() { res, err := rest.GetRequest(tc.url) s.Require().NoError(err) - if tc.expectErr { + if tc.expErr { s.Require().Contains(string(res), tc.expErrMsg) } else { var result tx.GetTxsEventResponse - val.ClientCtx.JSONMarshaler.UnmarshalJSON(res, &result) + err = val.ClientCtx.JSONMarshaler.UnmarshalJSON(res, &result) + s.Require().NoError(err) s.Require().GreaterOrEqual(len(result.Txs), 1) s.Require().Equal("foobar", result.Txs[0].Body.Memo) s.Require().NotZero(result.TxResponses[0].Height) @@ -214,31 +244,77 @@ func (s IntegrationTestSuite) TestGetTxEvents() { } } -func (s IntegrationTestSuite) TestGetTx() { - val := s.network.Validators[0] - - s.Require().NoError(s.network.WaitForNextBlock()) - - // Query the tx via gRPC. - grpcRes, err := s.queryClient.GetTx( - context.Background(), - &tx.GetTxRequest{Hash: s.txRes.TxHash}, - ) - s.Require().NoError(err) - s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) - s.Require().NotZero(grpcRes.TxResponse.Height) +func (s IntegrationTestSuite) TestGetTx_GRPC() { + testCases := []struct { + name string + req *tx.GetTxRequest + expErr bool + expErrMsg string + }{ + {"nil request", nil, true, "request cannot be nil"}, + {"empty request", &tx.GetTxRequest{}, true, "transaction hash cannot be empty"}, + {"request with dummy hash", &tx.GetTxRequest{Hash: "deadbeef"}, true, "tx (DEADBEEF) not found"}, + {"good request", &tx.GetTxRequest{Hash: s.txRes.TxHash}, false, ""}, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + // Query the tx via gRPC. + grpcRes, err := s.queryClient.GetTx(context.Background(), tc.req) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + s.Require().NoError(err) + s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) + } + }) + } +} - // Query the tx via grpc-gateway. - restRes, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, s.txRes.TxHash)) - s.Require().NoError(err) - var getTxRes tx.GetTxResponse - s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &getTxRes)) - s.Require().Equal("foobar", grpcRes.Tx.Body.Memo) - s.Require().NotZero(grpcRes.TxResponse.Height) +func (s IntegrationTestSuite) TestGetTx_GRPCGateway() { + val := s.network.Validators[0] + testCases := []struct { + name string + url string + expErr bool + expErrMsg string + }{ + { + "empty params", + fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/", val.APIAddress), + true, "transaction hash cannot be empty", + }, + { + "dummy hash", + fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, "deadbeef"), + true, "tx (DEADBEEF) not found", + }, + { + "good hash", + fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, s.txRes.TxHash), + false, "", + }, + } + for _, tc := range testCases { + s.Run(tc.name, func() { + res, err := rest.GetRequest(tc.url) + s.Require().NoError(err) + if tc.expErr { + s.Require().Contains(string(res), tc.expErrMsg) + } else { + var result tx.GetTxResponse + err = val.ClientCtx.JSONMarshaler.UnmarshalJSON(res, &result) + s.Require().NoError(err) + s.Require().Equal("foobar", result.Tx.Body.Memo) + s.Require().NotZero(result.TxResponse.Height) + } + }) + } } -func (s IntegrationTestSuite) TestBroadcastTx() { +func (s IntegrationTestSuite) mkTx() []byte { val := s.network.Validators[0] + s.Require().NoError(s.network.WaitForNextBlock()) // prepare txBuilder with msg txBuilder := val.ClientCtx.TxConfig.NewTxBuilder() @@ -268,31 +344,35 @@ func (s IntegrationTestSuite) TestBroadcastTx() { txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) s.Require().NoError(err) + return txBytes +} + +func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { + txBytes := s.mkTx() + testCases := []struct { - name string - req *tx.BroadcastTxRequest - expErr bool + name string + req *tx.BroadcastTxRequest + expErr bool + expErrMsg string }{ - {"nil request", nil, true}, - {"empty request", &tx.BroadcastTxRequest{}, true}, + {"nil request", nil, true, "request cannot be nil"}, + {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, - }, false}, + }, false, ""}, } for _, tc := range testCases { tc := tc s.Run(tc.name, func() { - // Broadcast the tx via gRPC. - grpcRes, err := s.queryClient.BroadcastTx( - context.Background(), - tc.req, - ) - + // Broadcast the tx via gRPC via the validator's clientCtx (which goes + // through Tendermint). + grpcRes, err := s.queryClient.BroadcastTx(context.Background(), tc.req) if tc.expErr { s.Require().Error(err) - + s.Require().Contains(err.Error(), tc.expErrMsg) } else { s.Require().NoError(err) s.Require().Equal(uint32(0), grpcRes.TxResponse.Code) @@ -301,6 +381,44 @@ func (s IntegrationTestSuite) TestBroadcastTx() { } } +func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { + val := s.network.Validators[0] + txBytes := s.mkTx() + + testCases := []struct { + name string + req *tx.BroadcastTxRequest + expErr bool + expErrMsg string + }{ + {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, + {"no mode", &tx.BroadcastTxRequest{ + TxBytes: txBytes, + }, true, "ABC"}, + {"valid request", &tx.BroadcastTxRequest{ + Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, + TxBytes: txBytes, + }, false, ""}, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + req, err := val.ClientCtx.JSONMarshaler.MarshalJSON(tc.req) + s.Require().NoError(err) + res, err := rest.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress), "application/json", req) + s.Require().NoError(err) + if tc.expErr { + s.Require().Contains(string(res), tc.expErrMsg) + } else { + var result tx.BroadcastTxResponse + err = val.ClientCtx.JSONMarshaler.UnmarshalJSON(res, &result) + s.Require().NoError(err) + s.Require().Equal(uint32(0), result.TxResponse.Code) + } + }) + } +} + func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } From 00683e567cda59eb1f5cd04e44605793b3edc431 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 13:30:32 +0100 Subject: [PATCH 21/26] Add test for mode --- x/auth/tx/service_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index bec664cd0545..51d1424bfbf9 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -358,6 +358,9 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { }{ {"nil request", nil, true, "request cannot be nil"}, {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, + {"no mode", &tx.BroadcastTxRequest{ + TxBytes: txBytes, + }, true, "supported types: sync, async, block"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, From b37c04c02f7245028c996c564d0bc54f22171ac4 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 16:51:26 +0100 Subject: [PATCH 22/26] Add simulate tests --- proto/cosmos/tx/v1beta1/service.proto | 10 +- types/tx/service.pb.go | 96 +++++++------- types/tx/service.pb.gw.go | 36 +++--- x/auth/tx/service_test.go | 174 +++++++++++++++----------- 4 files changed, 174 insertions(+), 142 deletions(-) diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index cd70e970aa92..e7cdcd709fc7 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -13,7 +13,10 @@ option go_package = "github.com/cosmos/cosmos-sdk/types/tx"; service Service { // Simulate simulates executing a transaction for estimating gas usage. rpc Simulate(SimulateRequest) returns (SimulateResponse) { - option (google.api.http).post = "/cosmos/tx/v1beta1/simulate"; + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/simulate" + body: "*" + }; } // GetTx fetches a tx by hash. rpc GetTx(GetTxRequest) returns (GetTxResponse) { @@ -21,7 +24,10 @@ service Service { } // BroadcastTx broadcast transaction. rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { - option (google.api.http).post = "/cosmos/tx/v1beta1/txs"; + option (google.api.http) = { + post: "/cosmos/tx/v1beta1/txs" + body: "*" + }; } // GetTxsEvent fetches txs by event. rpc GetTxsEvent(GetTxsEventRequest) returns (GetTxsEventResponse) { diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index fc1faa934a69..3f15a09ffa08 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -509,54 +509,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 740 bytes of a gzipped FileDescriptorProto - 0x1f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0xff, 0xff, 0xf8, 0x82, 0x3e, 0xff, - 0x0f, 0x07, 0x00, 0x00, + // 748 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4d, 0x4f, 0x13, 0x4f, + 0x18, 0xef, 0xb6, 0xfc, 0x79, 0x79, 0x0a, 0x7f, 0xeb, 0x80, 0x58, 0x0b, 0x59, 0xca, 0xf2, 0x1a, + 0x12, 0x77, 0x43, 0xf5, 0x40, 0x8c, 0x89, 0xa1, 0xa5, 0x10, 0xa2, 0xbc, 0x64, 0x8b, 0x07, 0x8d, + 0x49, 0x33, 0x6d, 0x87, 0x65, 0x23, 0xdd, 0x29, 0x9d, 0x29, 0x59, 0x82, 0xc4, 0x84, 0xa3, 0x27, + 0x13, 0xbf, 0x82, 0x07, 0x3f, 0x8a, 0x47, 0x12, 0x2f, 0x1e, 0x0d, 0xf8, 0x1d, 0xbc, 0x9a, 0x9d, + 0x9d, 0xb6, 0xdb, 0xb2, 0x05, 0xe2, 0x89, 0x19, 0xe6, 0xf7, 0xfc, 0x5e, 0x9e, 0x67, 0x76, 0x0a, + 0x53, 0x65, 0xca, 0xaa, 0x94, 0x19, 0xdc, 0x35, 0x8e, 0x97, 0x4b, 0x84, 0xe3, 0x65, 0x83, 0x91, + 0xfa, 0xb1, 0x5d, 0x26, 0x7a, 0xad, 0x4e, 0x39, 0x45, 0xf7, 0x7d, 0x80, 0xce, 0x5d, 0x5d, 0x02, + 0x52, 0x93, 0x16, 0xa5, 0xd6, 0x21, 0x31, 0x70, 0xcd, 0x36, 0xb0, 0xe3, 0x50, 0x8e, 0xb9, 0x4d, + 0x1d, 0xe6, 0x17, 0xa4, 0x66, 0x24, 0x63, 0x09, 0x33, 0x62, 0xe0, 0x52, 0xd9, 0x6e, 0x11, 0x7b, + 0x1b, 0x09, 0x4a, 0x5d, 0x97, 0xe5, 0xae, 0x3c, 0x1b, 0xb3, 0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9, 0x65, 0x5a, 0x6d, 0xd6, 0xfa, 0x7f, 0x1e, + 0xb3, 0xca, 0x7b, 0x83, 0x9f, 0xd4, 0x88, 0x47, 0x56, 0xea, 0x17, 0x3f, 0x1f, 0x4f, 0xfe, 0x06, + 0x00, 0x00, 0xff, 0xff, 0x5f, 0x57, 0xc5, 0x79, 0x15, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/tx/service.pb.gw.go b/types/tx/service.pb.gw.go index 71735c5547c8..5a21e73c9861 100644 --- a/types/tx/service.pb.gw.go +++ b/types/tx/service.pb.gw.go @@ -31,18 +31,15 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var ( - filter_Service_Simulate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_Service_Simulate_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq SimulateRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_Simulate_0); err != nil { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -55,10 +52,11 @@ func local_request_Service_Simulate_0(ctx context.Context, marshaler runtime.Mar var protoReq SimulateRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_Simulate_0); err != nil { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -121,18 +119,15 @@ func local_request_Service_GetTx_0(ctx context.Context, marshaler runtime.Marsha } -var ( - filter_Service_BroadcastTx_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq BroadcastTxRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_BroadcastTx_0); err != nil { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -145,10 +140,11 @@ func local_request_Service_BroadcastTx_0(ctx context.Context, marshaler runtime. var protoReq BroadcastTxRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Service_BroadcastTx_0); err != nil { + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 51d1424bfbf9..2ea3e5097e44 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -77,49 +77,77 @@ func (s *IntegrationTestSuite) TearDownSuite() { s.network.Cleanup() } -func (s IntegrationTestSuite) TestSimulate() { - val := s.network.Validators[0] - - // prepare txBuilder with msg - txBuilder := val.ClientCtx.TxConfig.NewTxBuilder() - feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)} - gasLimit := testdata.NewTestGasLimit() - s.Require().NoError( - txBuilder.SetMsgs(&banktypes.MsgSend{ - FromAddress: val.Address.String(), - ToAddress: val.Address.String(), - Amount: sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}, - }), - ) - txBuilder.SetFeeAmount(feeAmount) - txBuilder.SetGasLimit(gasLimit) - txBuilder.SetMemo("foobar") +func (s IntegrationTestSuite) TestSimulateTx_GRPC() { + txBuilder := s.mkTxBuilder() + // Convert the txBuilder to a tx.Tx. + protoTx, err := txBuilderToProtoTx(txBuilder) + s.Require().NoError(err) - // setup txFactory - txFactory := clienttx.Factory{}. - WithChainID(val.ClientCtx.ChainID). - WithKeybase(val.ClientCtx.Keyring). - WithTxConfig(val.ClientCtx.TxConfig). - WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) + testCases := []struct { + name string + req *tx.SimulateRequest + expErr bool + expErrMsg string + }{ + {"nil request", nil, true, "request cannot be nil"}, + {"empty request", &tx.SimulateRequest{}, true, "invalid empty tx"}, + {"valid request", &tx.SimulateRequest{Tx: protoTx}, false, ""}, + } - // Sign Tx. - err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) - s.Require().NoError(err) + for _, tc := range testCases { + tc := tc + s.Run(tc.name, func() { + // Broadcast the tx via gRPC via the validator's clientCtx (which goes + // through Tendermint). + res, err := s.queryClient.Simulate(context.Background(), tc.req) + if tc.expErr { + s.Require().Error(err) + s.Require().Contains(err.Error(), tc.expErrMsg) + } else { + s.Require().NoError(err) + // Check the result and gas used are correct. + s.Require().Equal(len(res.GetResult().GetEvents()), 4) // 1 transfer, 3 messages. + s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty. + } + }) + } +} +func (s IntegrationTestSuite) TestSimulateTx_GRPCGateway() { + val := s.network.Validators[0] + txBuilder := s.mkTxBuilder() // Convert the txBuilder to a tx.Tx. protoTx, err := txBuilderToProtoTx(txBuilder) s.Require().NoError(err) - // Run the simulate gRPC query. - res, err := s.queryClient.Simulate( - context.Background(), - &tx.SimulateRequest{Tx: protoTx}, - ) - s.Require().NoError(err) + testCases := []struct { + name string + req *tx.SimulateRequest + expErr bool + expErrMsg string + }{ + {"empty request", &tx.SimulateRequest{}, true, "invalid empty tx"}, + {"valid request", &tx.SimulateRequest{Tx: protoTx}, false, ""}, + } - // Check the result and gas used are correct. - s.Require().Equal(len(res.GetResult().GetEvents()), 4) // 1 transfer, 3 messages. - s.Require().True(res.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty. + for _, tc := range testCases { + s.Run(tc.name, func() { + req, err := val.ClientCtx.JSONMarshaler.MarshalJSON(tc.req) + s.Require().NoError(err) + res, err := rest.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/simulate", val.APIAddress), "application/json", req) + s.Require().NoError(err) + if tc.expErr { + s.Require().Contains(string(res), tc.expErrMsg) + } else { + var result tx.SimulateResponse + err = val.ClientCtx.JSONMarshaler.UnmarshalJSON(res, &result) + s.Require().NoError(err) + // Check the result and gas used are correct. + s.Require().Equal(len(result.GetResult().GetEvents()), 4) // 1 transfer, 3 messages. + s.Require().True(result.GetGasInfo().GetGasUsed() > 0) // Gas used sometimes change, just check it's not empty. + } + }) + } } func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { @@ -312,44 +340,12 @@ func (s IntegrationTestSuite) TestGetTx_GRPCGateway() { } } -func (s IntegrationTestSuite) mkTx() []byte { +func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { val := s.network.Validators[0] - s.Require().NoError(s.network.WaitForNextBlock()) - - // prepare txBuilder with msg - txBuilder := val.ClientCtx.TxConfig.NewTxBuilder() - feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)} - gasLimit := testdata.NewTestGasLimit() - s.Require().NoError( - txBuilder.SetMsgs(&banktypes.MsgSend{ - FromAddress: val.Address.String(), - ToAddress: val.Address.String(), - Amount: sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}, - }), - ) - txBuilder.SetFeeAmount(feeAmount) - txBuilder.SetGasLimit(gasLimit) - - // setup txFactory - txFactory := clienttx.Factory{}. - WithChainID(val.ClientCtx.ChainID). - WithKeybase(val.ClientCtx.Keyring). - WithTxConfig(val.ClientCtx.TxConfig). - WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) - - // Sign Tx. - err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) - s.Require().NoError(err) - + txBuilder := s.mkTxBuilder() txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) s.Require().NoError(err) - return txBytes -} - -func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { - txBytes := s.mkTx() - testCases := []struct { name string req *tx.BroadcastTxRequest @@ -386,7 +382,9 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPC() { func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { val := s.network.Validators[0] - txBytes := s.mkTx() + txBuilder := s.mkTxBuilder() + txBytes, err := val.ClientCtx.TxConfig.TxEncoder()(txBuilder.GetTx()) + s.Require().NoError(err) testCases := []struct { name string @@ -394,10 +392,10 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { expErr bool expErrMsg string }{ - {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, + {"empty request", &tx.BroadcastTxRequest{}, true, "unknown value \"unspecified\" for enum cosmos.tx.v1beta1.BroadcastMode"}, {"no mode", &tx.BroadcastTxRequest{ TxBytes: txBytes, - }, true, "ABC"}, + }, true, "unknown value \"unspecified\" for enum cosmos.tx.v1beta1.BroadcastMode"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, @@ -426,6 +424,38 @@ func TestIntegrationTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } +func (s IntegrationTestSuite) mkTxBuilder() client.TxBuilder { + val := s.network.Validators[0] + s.Require().NoError(s.network.WaitForNextBlock()) + + // prepare txBuilder with msg + txBuilder := val.ClientCtx.TxConfig.NewTxBuilder() + feeAmount := sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)} + gasLimit := testdata.NewTestGasLimit() + s.Require().NoError( + txBuilder.SetMsgs(&banktypes.MsgSend{ + FromAddress: val.Address.String(), + ToAddress: val.Address.String(), + Amount: sdk.Coins{sdk.NewInt64Coin(s.cfg.BondDenom, 10)}, + }), + ) + txBuilder.SetFeeAmount(feeAmount) + txBuilder.SetGasLimit(gasLimit) + + // setup txFactory + txFactory := clienttx.Factory{}. + WithChainID(val.ClientCtx.ChainID). + WithKeybase(val.ClientCtx.Keyring). + WithTxConfig(val.ClientCtx.TxConfig). + WithSignMode(signing.SignMode_SIGN_MODE_DIRECT) + + // Sign Tx. + err := authclient.SignTx(txFactory, val.ClientCtx, val.Moniker, txBuilder, false) + s.Require().NoError(err) + + return txBuilder +} + // txBuilderToProtoTx converts a txBuilder into a proto tx.Tx. func txBuilderToProtoTx(txBuilder client.TxBuilder) (*tx.Tx, error) { // nolint intoAnyTx, ok := txBuilder.(codectypes.IntoAny) From 8803107df2f3b1dffabe43c00a7bb30f96924f04 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Tue, 1 Dec 2020 16:58:58 +0100 Subject: [PATCH 23/26] Add build flag back --- server/grpc/server_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/grpc/server_test.go b/server/grpc/server_test.go index addabdf03274..5648233f8f32 100644 --- a/server/grpc/server_test.go +++ b/server/grpc/server_test.go @@ -1,3 +1,5 @@ +// +build norace + package grpc_test import ( From 57cc0e8fa1e9fdb22bf8690fc08090022faf5c98 Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Wed, 2 Dec 2020 11:07:06 +0100 Subject: [PATCH 24/26] Revert custom stringer for enum --- client/broadcast.go | 17 ++++- proto/cosmos/tx/v1beta1/service.proto | 2 - types/tx/service.pb.go | 100 +++++++++++++------------- types/tx/types.go | 14 ---- x/auth/tx/service_test.go | 10 +-- 5 files changed, 73 insertions(+), 70 deletions(-) diff --git a/client/broadcast.go b/client/broadcast.go index bd641dc0bf17..e21bc080c286 100644 --- a/client/broadcast.go +++ b/client/broadcast.go @@ -153,7 +153,7 @@ func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.Broa return nil, status.Error(codes.InvalidArgument, "invalid empty tx") } - clientCtx = clientCtx.WithBroadcastMode(req.Mode.String()) + clientCtx = clientCtx.WithBroadcastMode(normalizeBroadcastMode(req.Mode)) resp, err := clientCtx.BroadcastTx(req.TxBytes) if err != nil { return nil, err @@ -163,3 +163,18 @@ func TxServiceBroadcast(grpcCtx context.Context, clientCtx Context, req *tx.Broa TxResponse: resp, }, nil } + +// normalizeBroadcastMode converts a broadcast mode into a normalized string +// to be passed into the clientCtx. +func normalizeBroadcastMode(mode tx.BroadcastMode) string { + switch mode { + case tx.BroadcastMode_BROADCAST_MODE_ASYNC: + return "async" + case tx.BroadcastMode_BROADCAST_MODE_BLOCK: + return "block" + case tx.BroadcastMode_BROADCAST_MODE_SYNC: + return "sync" + default: + return "unspecified" + } +} diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index e7cdcd709fc7..723458de38da 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -65,8 +65,6 @@ message BroadcastTxRequest { // BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. enum BroadcastMode { - option (gogoproto.goproto_enum_stringer) = false; - // zero-value for mode ordering BROADCAST_MODE_UNSPECIFIED = 0; // BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 3f15a09ffa08..73cf7ddac344 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -62,6 +62,10 @@ var BroadcastMode_value = map[string]int32{ "BROADCAST_MODE_ASYNC": 3, } +func (x BroadcastMode) String() string { + return proto.EnumName(BroadcastMode_name, int32(x)) +} + func (BroadcastMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor_e0b00a618705eca7, []int{0} } @@ -509,54 +513,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 748 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4d, 0x4f, 0x13, 0x4f, - 0x18, 0xef, 0xb6, 0xfc, 0x79, 0x79, 0x0a, 0x7f, 0xeb, 0x80, 0x58, 0x0b, 0x59, 0xca, 0xf2, 0x1a, - 0x12, 0x77, 0x43, 0xf5, 0x40, 0x8c, 0x89, 0xa1, 0xa5, 0x10, 0xa2, 0xbc, 0x64, 0x8b, 0x07, 0x8d, - 0x49, 0x33, 0x6d, 0x87, 0x65, 0x23, 0xdd, 0x29, 0x9d, 0x29, 0x59, 0x82, 0xc4, 0x84, 0xa3, 0x27, - 0x13, 0xbf, 0x82, 0x07, 0x3f, 0x8a, 0x47, 0x12, 0x2f, 0x1e, 0x0d, 0xf8, 0x1d, 0xbc, 0x9a, 0x9d, - 0x9d, 0xb6, 0xdb, 0xb2, 0x05, 0xe2, 0x89, 0x19, 0xe6, 0xf7, 0xfc, 0x5e, 0x9e, 0x67, 0x76, 0x0a, - 0x53, 0x65, 0xca, 0xaa, 0x94, 0x19, 0xdc, 0x35, 0x8e, 0x97, 0x4b, 0x84, 0xe3, 0x65, 0x83, 0x91, - 0xfa, 0xb1, 0x5d, 0x26, 0x7a, 0xad, 0x4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0, 0x0b, 0x18, 0x6a, 0xe0, 0xfa, 0xc3, 0x1c, 0x6a, 0x20, - 0xe4, 0x21, 0xd5, 0x54, 0x61, 0x20, 0x89, 0x7a, 0x18, 0xc8, 0xbe, 0xf8, 0x7e, 0xa9, 0x2a, 0x17, - 0x97, 0xaa, 0xf2, 0xeb, 0x52, 0x55, 0x3e, 0x5f, 0xa9, 0x91, 0x8b, 0x2b, 0x35, 0xf2, 0xf3, 0x4a, - 0x8d, 0xbc, 0x9d, 0xb3, 0x6c, 0x7e, 0xd0, 0x28, 0xe9, 0x65, 0x5a, 0x6d, 0xd6, 0xfa, 0x7f, 0x1e, - 0xb3, 0xca, 0x7b, 0x83, 0x9f, 0xd4, 0x88, 0x47, 0x56, 0xea, 0x17, 0x3f, 0x1f, 0x4f, 0xfe, 0x06, - 0x00, 0x00, 0xff, 0xff, 0x5f, 0x57, 0xc5, 0x79, 0x15, 0x07, 0x00, 0x00, + // 739 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4b, 0x4f, 0xdb, 0x4a, + 0x14, 0x8e, 0x1d, 0x2e, 0x8f, 0x13, 0xb8, 0x37, 0x77, 0xe0, 0x72, 0xd3, 0x80, 0x4c, 0x30, 0x4f, + 0x21, 0xd5, 0x16, 0x69, 0x17, 0xa8, 0xaa, 0x54, 0x91, 0x10, 0x10, 0x6a, 0x79, 0xc8, 0xa1, 0x8b, + 0x56, 0x95, 0xa2, 0x49, 0x32, 0x18, 0xab, 0xc4, 0x13, 0x32, 0x13, 0x64, 0x04, 0xa8, 0x52, 0x97, + 0x5d, 0x55, 0xea, 0x9f, 0xea, 0x12, 0xa9, 0x9b, 0x2e, 0x2b, 0xe8, 0x7f, 0xe8, 0xb6, 0xf2, 0x78, + 0x92, 0x38, 0xc1, 0x01, 0xd4, 0x15, 0x33, 0xcc, 0x77, 0xbe, 0xc7, 0x39, 0xe3, 0x09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, 0xf0, 0x30, 0xa5, 0x4f, 0x46, 0x7a, 0x60, 0x7e, 0xe4, 0x0b, 0x48, 0x84, 0x9e, 0xbe, + 0x48, 0x03, 0xb7, 0x5f, 0xe4, 0x48, 0x03, 0x11, 0x2f, 0xa8, 0xae, 0x09, 0x03, 0x29, 0xd4, 0xc7, + 0x40, 0xee, 0xc5, 0xd7, 0x6b, 0x4d, 0xb9, 0xba, 0xd6, 0x94, 0x1f, 0xd7, 0x9a, 0xf2, 0xf9, 0x46, + 0x8b, 0x5d, 0xdd, 0x68, 0xb1, 0xef, 0x37, 0x5a, 0xec, 0xed, 0x82, 0xed, 0xf0, 0xa3, 0x66, 0xd9, + 0xa8, 0xd0, 0x5a, 0xab, 0x36, 0xf8, 0xf3, 0x98, 0x55, 0xdf, 0x9b, 0xfc, 0xac, 0x4e, 0x7c, 0xb2, + 0xf2, 0xa0, 0xf8, 0xdd, 0x78, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x49, 0x27, 0x37, 0x34, 0x0e, + 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/tx/types.go b/types/tx/types.go index 5afb5bd40017..c572d448a898 100644 --- a/types/tx/types.go +++ b/types/tx/types.go @@ -193,17 +193,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { func isServiceMsg(typeURL string) bool { return strings.Count(typeURL, "/") >= 2 } - -// String implements the Stringer interface. -func (bm BroadcastMode) String() string { - switch bm { - case BroadcastMode_BROADCAST_MODE_ASYNC: - return "async" - case BroadcastMode_BROADCAST_MODE_BLOCK: - return "block" - case BroadcastMode_BROADCAST_MODE_SYNC: - return "sync" - default: - return "unspecified" - } -} diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 2ea3e5097e44..a5685b96d45a 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -208,7 +208,7 @@ func (s IntegrationTestSuite) TestGetTxEvents_GRPC() { s.Require().Contains(err.Error(), tc.expErrMsg) } else { s.Require().NoError(err) - s.Require().Equal(len(grpcRes.Txs), 1) + s.Require().GreaterOrEqual(len(grpcRes.Txs), 1) s.Require().Equal("foobar", grpcRes.Txs[0].Body.Memo) } }) @@ -392,10 +392,8 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { expErr bool expErrMsg string }{ - {"empty request", &tx.BroadcastTxRequest{}, true, "unknown value \"unspecified\" for enum cosmos.tx.v1beta1.BroadcastMode"}, - {"no mode", &tx.BroadcastTxRequest{ - TxBytes: txBytes, - }, true, "unknown value \"unspecified\" for enum cosmos.tx.v1beta1.BroadcastMode"}, + {"empty request", &tx.BroadcastTxRequest{}, true, "invalid empty tx"}, + {"no mode", &tx.BroadcastTxRequest{TxBytes: txBytes}, true, "supported types: sync, async, block"}, {"valid request", &tx.BroadcastTxRequest{ Mode: tx.BroadcastMode_BROADCAST_MODE_SYNC, TxBytes: txBytes, @@ -405,9 +403,11 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { for _, tc := range testCases { s.Run(tc.name, func() { req, err := val.ClientCtx.JSONMarshaler.MarshalJSON(tc.req) + fmt.Println("ABC req=", string(req)) s.Require().NoError(err) res, err := rest.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress), "application/json", req) s.Require().NoError(err) + fmt.Println("ABC res=", string(res)) if tc.expErr { s.Require().Contains(string(res), tc.expErrMsg) } else { From 31130606f8f3481c3f2c69cc4a67cc0ee3a0f6ee Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Wed, 2 Dec 2020 11:08:22 +0100 Subject: [PATCH 25/26] Remove stray logs --- x/auth/tx/service_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index a5685b96d45a..81338fde0f06 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -403,11 +403,9 @@ func (s IntegrationTestSuite) TestBroadcastTx_GRPCGateway() { for _, tc := range testCases { s.Run(tc.name, func() { req, err := val.ClientCtx.JSONMarshaler.MarshalJSON(tc.req) - fmt.Println("ABC req=", string(req)) s.Require().NoError(err) res, err := rest.PostRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs", val.APIAddress), "application/json", req) s.Require().NoError(err) - fmt.Println("ABC res=", string(res)) if tc.expErr { s.Require().Contains(string(res), tc.expErrMsg) } else { From 7c3ad41317b5f9a61d37b79f1ea9a25a4a7b754a Mon Sep 17 00:00:00 2001 From: Amaury Martiny Date: Wed, 2 Dec 2020 17:00:56 +0100 Subject: [PATCH 26/26] Use /txs/{hash} --- docs/migrations/rest.md | 2 +- proto/cosmos/tx/v1beta1/service.proto | 2 +- types/tx/service.pb.go | 96 +++++++++++++-------------- types/tx/service.pb.gw.go | 2 +- x/auth/client/rest/query.go | 2 +- x/auth/client/rest/rest_test.go | 4 +- x/auth/tx/service_test.go | 6 +- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/docs/migrations/rest.md b/docs/migrations/rest.md index d418587d0866..f27635bf350c 100644 --- a/docs/migrations/rest.md +++ b/docs/migrations/rest.md @@ -31,7 +31,7 @@ Some modules expose legacy `POST` endpoints to generate unsigned transactions fo | Legacy REST Endpoint | Description | New gGPC-gateway REST Endpoint | | ------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `GET /txs/{hash}` | Query tx by hash | `GET /cosmos/tx/v1beta1/tx/{hash}` | +| `GET /txs/{hash}` | Query tx by hash | `GET /cosmos/tx/v1beta1/txs/{hash}` | | `GET /txs` | Query tx by events | `GET /cosmos/tx/v1beta1/txs` | | `POST /txs` | Broadcast tx | `POST /cosmos/tx/v1beta1/txs` | | `POST /txs/encode` | Encodes an Amino JSON tx to an Amino binary tx | N/A, use Protobuf directly | diff --git a/proto/cosmos/tx/v1beta1/service.proto b/proto/cosmos/tx/v1beta1/service.proto index 723458de38da..59df75bab12b 100644 --- a/proto/cosmos/tx/v1beta1/service.proto +++ b/proto/cosmos/tx/v1beta1/service.proto @@ -20,7 +20,7 @@ service Service { } // GetTx fetches a tx by hash. rpc GetTx(GetTxRequest) returns (GetTxResponse) { - option (google.api.http).get = "/cosmos/tx/v1beta1/tx/{hash}"; + option (google.api.http).get = "/cosmos/tx/v1beta1/txs/{hash}"; } // BroadcastTx broadcast transaction. rpc BroadcastTx(BroadcastTxRequest) returns (BroadcastTxResponse) { diff --git a/types/tx/service.pb.go b/types/tx/service.pb.go index 73cf7ddac344..57f1f627635e 100644 --- a/types/tx/service.pb.go +++ b/types/tx/service.pb.go @@ -513,54 +513,54 @@ func init() { func init() { proto.RegisterFile("cosmos/tx/v1beta1/service.proto", fileDescriptor_e0b00a618705eca7) } var fileDescriptor_e0b00a618705eca7 = []byte{ - // 739 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4b, 0x4f, 0xdb, 0x4a, - 0x14, 0x8e, 0x1d, 0x2e, 0x8f, 0x13, 0xb8, 0x37, 0x77, 0xe0, 0x72, 0xd3, 0x80, 0x4c, 0x30, 0x4f, - 0x21, 0xd5, 0x16, 0x69, 0x17, 0xa8, 0xaa, 0x54, 0x91, 0x10, 0x10, 0x6a, 0x79, 0xc8, 0xa1, 0x8b, - 0x56, 0x95, 0xa2, 0x49, 0x32, 0x18, 0xab, 0xc4, 0x13, 0x32, 0x13, 0x64, 0x04, 0xa8, 0x52, 0x97, - 0x5d, 0x55, 0xea, 0x9f, 0xea, 0x12, 0xa9, 0x9b, 0x2e, 0x2b, 0xe8, 0x7f, 0xe8, 0xb6, 0xf2, 0x78, - 0x92, 0x38, 0xc1, 0x01, 0xd4, 0x15, 0x33, 0xcc, 0x77, 0xbe, 0xc7, 0x39, 0xe3, 0x09, 0xcc, 0x54, - 0x28, 0xab, 0x51, 0x66, 0x72, 0xcf, 0x3c, 0x5d, 0x2d, 0x13, 0x8e, 0x57, 0x4d,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48, 0x03, 0xb7, 0x5f, 0xe4, 0x48, 0x03, 0x11, 0x2f, 0xa8, 0xae, 0x09, 0x03, 0x29, 0xd4, 0xc7, - 0x40, 0xee, 0xc5, 0xd7, 0x6b, 0x4d, 0xb9, 0xba, 0xd6, 0x94, 0x1f, 0xd7, 0x9a, 0xf2, 0xf9, 0x46, - 0x8b, 0x5d, 0xdd, 0x68, 0xb1, 0xef, 0x37, 0x5a, 0xec, 0xed, 0x82, 0xed, 0xf0, 0xa3, 0x66, 0xd9, - 0xa8, 0xd0, 0x5a, 0xab, 0x36, 0xf8, 0xf3, 0x98, 0x55, 0xdf, 0x9b, 0xfc, 0xac, 0x4e, 0x7c, 0xb2, - 0xf2, 0xa0, 0xf8, 0xdd, 0x78, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x49, 0x27, 0x37, 0x34, 0x0e, - 0x07, 0x00, 0x00, + // 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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, 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, 0x11, 0x40, 0xb9, 0x06, 0xc5, 0xd5, 0x0a, + 0x66, 0xdc, 0x13, 0xf3, 0x1b, 0xf9, 0x08, 0x86, 0xb9, 0x5b, 0x2a, 0x1f, 0x73, 0xe2, 0xa5, 0x52, + 0x16, 0x46, 0xcd, 0x21, 0xee, 0xe6, 0xbc, 0x2d, 0x7a, 0x01, 0x03, 0x35, 0x5a, 0x25, 0xa2, 0x8b, + 0x77, 0xb3, 0xe9, 0x90, 0xb0, 0x6d, 0xbe, 0x4d, 0x5a, 0x25, 0xa6, 0x40, 0x6b, 0x1f, 0x61, 0xbc, + 0x4b, 0x46, 0x36, 0xae, 0x00, 0xf1, 0x40, 0x3f, 0x84, 0xd4, 0x6d, 0xdb, 0x01, 0x9d, 0x76, 0x68, + 0xcb, 0x70, 0xaf, 0x68, 0xd7, 0x9a, 0x07, 0x98, 0xb7, 0xc6, 0x86, 0x32, 0x10, 0xe5, 0xae, 0x24, + 0xec, 0x33, 0x91, 0x28, 0x77, 0xb5, 0xaf, 0x0a, 0x24, 0x3a, 0xa5, 0xd2, 0xd5, 0x2b, 0x18, 0xb6, + 0x30, 0x2b, 0xd9, 0xce, 0x1e, 0x95, 0x0c, 0x33, 0xfd, 0x2d, 0xad, 0x63, 0xb6, 0xe1, 0xec, 0x51, + 0x73, 0xc8, 0xf2, 0x17, 0x68, 0x19, 0x06, 0x1b, 0x84, 0x35, 0x0f, 0xb8, 0xbc, 0x68, 0xe9, 0xfe, + 0xb5, 0xa6, 0xc0, 0x99, 0x12, 0xaf, 0x69, 0x30, 0x2a, 0x6e, 0x57, 0x2b, 0x03, 0x82, 0x81, 0x7d, + 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x13, 0x5e, 0xe6, 0x53, 0x88, 0x07, 0xde, 0xbe, 0x50, 0x03, + 0x57, 0x9f, 0xe4, 0x50, 0x03, 0x21, 0x4f, 0xa8, 0xa6, 0x0a, 0x03, 0x49, 0xd4, 0xc7, 0x40, 0xee, + 0xf5, 0x8f, 0x0b, 0x55, 0x39, 0xbf, 0x50, 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, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/types/tx/service.pb.gw.go b/types/tx/service.pb.gw.go index 5a21e73c9861..6d94c423ecbd 100644 --- a/types/tx/service.pb.gw.go +++ b/types/tx/service.pb.gw.go @@ -402,7 +402,7 @@ func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl var ( pattern_Service_Simulate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "simulate"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "tx", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Service_GetTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmos", "tx", "v1beta1", "txs", "hash"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Service_BroadcastTx_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "tx", "v1beta1", "txs"}, "", runtime.AssumeColonVerbOpt(true))) diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index f9abae6b71fe..6fe54404beb7 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -151,7 +151,7 @@ func QueryTxRequestHandlerFn(clientCtx client.Context) http.HandlerFunc { rest.WriteErrorResponse(w, http.StatusNotFound, fmt.Sprintf("no transaction found with hash %s", hashHexStr)) } - err = checkSignModeError(clientCtx, output, "/cosmos/tx/v1beta1/tx/{txhash}") + err = checkSignModeError(clientCtx, output, "/cosmos/tx/v1beta1/txs/{txhash}") if err != nil { rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) diff --git a/x/auth/client/rest/rest_test.go b/x/auth/client/rest/rest_test.go index 671df87a8b9c..67c3cfc3fc1d 100644 --- a/x/auth/client/rest/rest_test.go +++ b/x/auth/client/rest/rest_test.go @@ -345,7 +345,7 @@ func (s *IntegrationTestSuite) broadcastReq(stdTx legacytx.StdTx, mode string) ( // testQueryIBCTx is a helper function to test querying txs which: // - show an error message on legacy REST endpoints // - succeed using gRPC -// In practise, we call this function on IBC txs. +// In practice, we call this function on IBC txs. func (s *IntegrationTestSuite) testQueryIBCTx(txRes sdk.TxResponse, cmd *cobra.Command, args []string) { val := s.network.Validators[0] @@ -381,7 +381,7 @@ func (s *IntegrationTestSuite) testQueryIBCTx(txRes sdk.TxResponse, cmd *cobra.C } // try fetching the txn using gRPC req, it will fetch info since it has proto codec. - grpcJSON, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, txRes.TxHash)) + grpcJSON, err := rest.GetRequest(fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", val.APIAddress, txRes.TxHash)) s.Require().NoError(err) var getTxRes txtypes.GetTxResponse diff --git a/x/auth/tx/service_test.go b/x/auth/tx/service_test.go index 81338fde0f06..341684acbe26 100644 --- a/x/auth/tx/service_test.go +++ b/x/auth/tx/service_test.go @@ -309,17 +309,17 @@ func (s IntegrationTestSuite) TestGetTx_GRPCGateway() { }{ { "empty params", - fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/", val.APIAddress), + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/", val.APIAddress), true, "transaction hash cannot be empty", }, { "dummy hash", - fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, "deadbeef"), + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", val.APIAddress, "deadbeef"), true, "tx (DEADBEEF) not found", }, { "good hash", - fmt.Sprintf("%s/cosmos/tx/v1beta1/tx/%s", val.APIAddress, s.txRes.TxHash), + fmt.Sprintf("%s/cosmos/tx/v1beta1/txs/%s", val.APIAddress, s.txRes.TxHash), false, "", }, }