Commit 86fce5f4 authored by Ubuntu's avatar Ubuntu

add empty grpc

parent 30c64eea
......@@ -6,8 +6,8 @@ import "google/protobuf/timestamp.proto";
import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// import "google/protobuf/descriptor.proto";
// import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// import "base/v1/options.proto";
......@@ -92,7 +92,7 @@ message TxProof{
message Transaction{
TxProof tx_proof=1;
int64 timeout_block_num =2;
google.protobuf.Any tx =3 [(gogoproto.customtype) = "InterfaceType"]; // EthTx StdTx
google.protobuf.Any tx =3; // EthTx StdTx
}
//2. eth std: proto3 eth tx --> grpc --->proto3 eth tx
......
......@@ -10,8 +10,9 @@ import (
v1 "github.com/CaduceusMetaverseProtocol/metaprotocol/gen/proto/go/base/v1"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/known/emptypb"
emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
)
const (
......@@ -21,6 +22,82 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EmptyRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *EmptyRequest) Reset() {
*x = EmptyRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_ring_v1_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EmptyRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmptyRequest) ProtoMessage() {}
func (x *EmptyRequest) ProtoReflect() protoreflect.Message {
mi := &file_ring_v1_service_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EmptyRequest.ProtoReflect.Descriptor instead.
func (*EmptyRequest) Descriptor() ([]byte, []int) {
return file_ring_v1_service_proto_rawDescGZIP(), []int{0}
}
type EmptyResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *EmptyResponse) Reset() {
*x = EmptyResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_ring_v1_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EmptyResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EmptyResponse) ProtoMessage() {}
func (x *EmptyResponse) ProtoReflect() protoreflect.Message {
mi := &file_ring_v1_service_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EmptyResponse.ProtoReflect.Descriptor instead.
func (*EmptyResponse) Descriptor() ([]byte, []int) {
return file_ring_v1_service_proto_rawDescGZIP(), []int{1}
}
var File_ring_v1_service_proto protoreflect.FileDescriptor
var file_ring_v1_service_proto_rawDesc = []byte{
......@@ -33,66 +110,96 @@ var file_ring_v1_service_proto_rawDesc = []byte{
0x69, 0x6e, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72,
0x65, 0x71, 0x5f, 0x72, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x62, 0x61,
0x73, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x32, 0x84, 0x03, 0x0a, 0x0b, 0x52, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73,
0x45, 0x74, 0x68, 0x12, 0x17, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x74, 0x68, 0x1a, 0x23, 0x2e, 0x72,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x0c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x84, 0x04, 0x0a, 0x0b, 0x52, 0x69, 0x6e, 0x67, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41,
0x73, 0x45, 0x74, 0x68, 0x12, 0x17, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x74, 0x68, 0x1a, 0x23, 0x2e,
0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73,
0x53, 0x74, 0x64, 0x12, 0x17, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x64, 0x1a, 0x23, 0x2e, 0x72,
0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54, 0x72,
0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73, 0x53,
0x74, 0x64, 0x12, 0x17, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x64, 0x1a, 0x23, 0x2e, 0x72, 0x69,
0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73, 0x41,
0x6e, 0x79, 0x12, 0x14, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x23, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x51, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73,
0x12, 0x19, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x1a, 0x23, 0x2e, 0x72, 0x69,
0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61,
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73, 0x41, 0x6e,
0x79, 0x12, 0x14, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x23, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76,
0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51,
0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x78, 0x41, 0x73, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12,
0x19, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x1a, 0x23, 0x2e, 0x72, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e,
0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x12, 0x38, 0x0a, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x15, 0x2e, 0x72, 0x69, 0x6e,
0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x6e, 0x63,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xa7, 0x01, 0x0a, 0x0b,
0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4d, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x61, 0x64, 0x75, 0x63, 0x65, 0x75, 0x73,
0x4d, 0x65, 0x74, 0x61, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
0x6c, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x67,
0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x69, 0x6e, 0x67,
0x2f, 0x76, 0x31, 0x3b, 0x72, 0x69, 0x6e, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x58, 0x58,
0xaa, 0x02, 0x07, 0x52, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x07, 0x52, 0x69, 0x6e,
0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x52, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x52, 0x69, 0x6e,
0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x22, 0x00, 0x12, 0x3d, 0x0a, 0x09, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12,
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
0x00, 0x12, 0x3f, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x4d, 0x73,
0x67, 0x12, 0x15, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e,
0x76, 0x31, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x15, 0x2e, 0x72, 0x69,
0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x6f, 0x6e,
0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xa7, 0x01, 0x0a,
0x0b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4d, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x43, 0x61, 0x64, 0x75, 0x63, 0x65, 0x75,
0x73, 0x4d, 0x65, 0x74, 0x61, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63,
0x6f, 0x6c, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f,
0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x72, 0x69, 0x6e,
0x67, 0x2f, 0x76, 0x31, 0x3b, 0x72, 0x69, 0x6e, 0x67, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x58,
0x58, 0xaa, 0x02, 0x07, 0x52, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x07, 0x52, 0x69,
0x6e, 0x67, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x52, 0x69, 0x6e, 0x67, 0x5c, 0x56, 0x31, 0x5c,
0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x52, 0x69,
0x6e, 0x67, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_ring_v1_service_proto_rawDescOnce sync.Once
file_ring_v1_service_proto_rawDescData = file_ring_v1_service_proto_rawDesc
)
func file_ring_v1_service_proto_rawDescGZIP() []byte {
file_ring_v1_service_proto_rawDescOnce.Do(func() {
file_ring_v1_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_ring_v1_service_proto_rawDescData)
})
return file_ring_v1_service_proto_rawDescData
}
var file_ring_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_ring_v1_service_proto_goTypes = []interface{}{
(*v1.TransactionEth)(nil), // 0: base.v1.TransactionEth
(*v1.TransactionStd)(nil), // 1: base.v1.TransactionStd
(*v1.Transaction)(nil), // 2: base.v1.Transaction
(*v1.TransactionBytes)(nil), // 3: base.v1.TransactionBytes
(*NonceRequest)(nil), // 4: ring.v1.NonceRequest
(*SendRawTransactionResponse)(nil), // 5: ring.v1.SendRawTransactionResponse
(*NonceResponse)(nil), // 6: ring.v1.NonceResponse
(*EmptyRequest)(nil), // 0: ring.v1.EmptyRequest
(*EmptyResponse)(nil), // 1: ring.v1.EmptyResponse
(*v1.TransactionEth)(nil), // 2: base.v1.TransactionEth
(*v1.TransactionStd)(nil), // 3: base.v1.TransactionStd
(*v1.Transaction)(nil), // 4: base.v1.Transaction
(*v1.TransactionBytes)(nil), // 5: base.v1.TransactionBytes
(*emptypb.Empty)(nil), // 6: google.protobuf.Empty
(*NonceRequest)(nil), // 7: ring.v1.NonceRequest
(*SendRawTransactionResponse)(nil), // 8: ring.v1.SendRawTransactionResponse
(*NonceResponse)(nil), // 9: ring.v1.NonceResponse
}
var file_ring_v1_service_proto_depIdxs = []int32{
0, // 0: ring.v1.RingService.SendTxAsEth:input_type -> base.v1.TransactionEth
1, // 1: ring.v1.RingService.SendTxAsStd:input_type -> base.v1.TransactionStd
2, // 2: ring.v1.RingService.SendTxAsAny:input_type -> base.v1.Transaction
3, // 3: ring.v1.RingService.SendTxAsBytes:input_type -> base.v1.TransactionBytes
4, // 4: ring.v1.RingService.Nonce:input_type -> ring.v1.NonceRequest
5, // 5: ring.v1.RingService.SendTxAsEth:output_type -> ring.v1.SendRawTransactionResponse
5, // 6: ring.v1.RingService.SendTxAsStd:output_type -> ring.v1.SendRawTransactionResponse
5, // 7: ring.v1.RingService.SendTxAsAny:output_type -> ring.v1.SendRawTransactionResponse
5, // 8: ring.v1.RingService.SendTxAsBytes:output_type -> ring.v1.SendRawTransactionResponse
6, // 9: ring.v1.RingService.Nonce:output_type -> ring.v1.NonceResponse
5, // [5:10] is the sub-list for method output_type
0, // [0:5] is the sub-list for method input_type
2, // 0: ring.v1.RingService.SendTxAsEth:input_type -> base.v1.TransactionEth
3, // 1: ring.v1.RingService.SendTxAsStd:input_type -> base.v1.TransactionStd
4, // 2: ring.v1.RingService.SendTxAsAny:input_type -> base.v1.Transaction
5, // 3: ring.v1.RingService.SendTxAsBytes:input_type -> base.v1.TransactionBytes
6, // 4: ring.v1.RingService.SendEmpty:input_type -> google.protobuf.Empty
0, // 5: ring.v1.RingService.SendEmptyMsg:input_type -> ring.v1.EmptyRequest
7, // 6: ring.v1.RingService.Nonce:input_type -> ring.v1.NonceRequest
8, // 7: ring.v1.RingService.SendTxAsEth:output_type -> ring.v1.SendRawTransactionResponse
8, // 8: ring.v1.RingService.SendTxAsStd:output_type -> ring.v1.SendRawTransactionResponse
8, // 9: ring.v1.RingService.SendTxAsAny:output_type -> ring.v1.SendRawTransactionResponse
8, // 10: ring.v1.RingService.SendTxAsBytes:output_type -> ring.v1.SendRawTransactionResponse
6, // 11: ring.v1.RingService.SendEmpty:output_type -> google.protobuf.Empty
1, // 12: ring.v1.RingService.SendEmptyMsg:output_type -> ring.v1.EmptyResponse
9, // 13: ring.v1.RingService.Nonce:output_type -> ring.v1.NonceResponse
7, // [7:14] is the sub-list for method output_type
0, // [0:7] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
......@@ -105,18 +212,45 @@ func file_ring_v1_service_proto_init() {
}
file_ring_v1_request_response_proto_init()
file_ring_v1_account_req_res_proto_init()
if !protoimpl.UnsafeEnabled {
file_ring_v1_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EmptyRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_ring_v1_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EmptyResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_ring_v1_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ring_v1_service_proto_goTypes,
DependencyIndexes: file_ring_v1_service_proto_depIdxs,
MessageInfos: file_ring_v1_service_proto_msgTypes,
}.Build()
File_ring_v1_service_proto = out.File
file_ring_v1_service_proto_rawDesc = nil
......
......@@ -12,6 +12,7 @@ import (
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
......@@ -28,6 +29,8 @@ type RingServiceClient interface {
SendTxAsStd(ctx context.Context, in *v1.TransactionStd, opts ...grpc.CallOption) (*SendRawTransactionResponse, error)
SendTxAsAny(ctx context.Context, in *v1.Transaction, opts ...grpc.CallOption) (*SendRawTransactionResponse, error)
SendTxAsBytes(ctx context.Context, in *v1.TransactionBytes, opts ...grpc.CallOption) (*SendRawTransactionResponse, error)
SendEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
SendEmptyMsg(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*EmptyResponse, error)
// rpc SendRawTransaction(base.v1.EthTx) returns (SendRawTransactionResponse) {};
Nonce(ctx context.Context, in *NonceRequest, opts ...grpc.CallOption) (*NonceResponse, error)
}
......@@ -76,6 +79,24 @@ func (c *ringServiceClient) SendTxAsBytes(ctx context.Context, in *v1.Transactio
return out, nil
}
func (c *ringServiceClient) SendEmpty(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/ring.v1.RingService/SendEmpty", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) SendEmptyMsg(ctx context.Context, in *EmptyRequest, opts ...grpc.CallOption) (*EmptyResponse, error) {
out := new(EmptyResponse)
err := c.cc.Invoke(ctx, "/ring.v1.RingService/SendEmptyMsg", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *ringServiceClient) Nonce(ctx context.Context, in *NonceRequest, opts ...grpc.CallOption) (*NonceResponse, error) {
out := new(NonceResponse)
err := c.cc.Invoke(ctx, "/ring.v1.RingService/Nonce", in, out, opts...)
......@@ -94,6 +115,8 @@ type RingServiceServer interface {
SendTxAsStd(context.Context, *v1.TransactionStd) (*SendRawTransactionResponse, error)
SendTxAsAny(context.Context, *v1.Transaction) (*SendRawTransactionResponse, error)
SendTxAsBytes(context.Context, *v1.TransactionBytes) (*SendRawTransactionResponse, error)
SendEmpty(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
SendEmptyMsg(context.Context, *EmptyRequest) (*EmptyResponse, error)
// rpc SendRawTransaction(base.v1.EthTx) returns (SendRawTransactionResponse) {};
Nonce(context.Context, *NonceRequest) (*NonceResponse, error)
mustEmbedUnimplementedRingServiceServer()
......@@ -115,6 +138,12 @@ func (UnimplementedRingServiceServer) SendTxAsAny(context.Context, *v1.Transacti
func (UnimplementedRingServiceServer) SendTxAsBytes(context.Context, *v1.TransactionBytes) (*SendRawTransactionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendTxAsBytes not implemented")
}
func (UnimplementedRingServiceServer) SendEmpty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendEmpty not implemented")
}
func (UnimplementedRingServiceServer) SendEmptyMsg(context.Context, *EmptyRequest) (*EmptyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendEmptyMsg not implemented")
}
func (UnimplementedRingServiceServer) Nonce(context.Context, *NonceRequest) (*NonceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Nonce not implemented")
}
......@@ -203,6 +232,42 @@ func _RingService_SendTxAsBytes_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
func _RingService_SendEmpty_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendEmpty(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ring.v1.RingService/SendEmpty",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendEmpty(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_SendEmptyMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EmptyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RingServiceServer).SendEmptyMsg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ring.v1.RingService/SendEmptyMsg",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RingServiceServer).SendEmptyMsg(ctx, req.(*EmptyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _RingService_Nonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NonceRequest)
if err := dec(in); err != nil {
......@@ -244,6 +309,14 @@ var RingService_ServiceDesc = grpc.ServiceDesc{
MethodName: "SendTxAsBytes",
Handler: _RingService_SendTxAsBytes_Handler,
},
{
MethodName: "SendEmpty",
Handler: _RingService_SendEmpty_Handler,
},
{
MethodName: "SendEmptyMsg",
Handler: _RingService_SendEmptyMsg_Handler,
},
{
MethodName: "Nonce",
Handler: _RingService_Nonce_Handler,
......
......@@ -17,12 +17,15 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/protobuf/types/known/anypb"
"google.golang.org/protobuf/types/known/emptypb"
base "github.com/CaduceusMetaverseProtocol/metaprotocol/gen/proto/go/base/v1"
ring "github.com/CaduceusMetaverseProtocol/metaprotocol/gen/proto/go/ring/v1"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"unsafe"
)
var countParallelAsEth int64
......@@ -34,6 +37,14 @@ type RingServer struct {
ring.UnimplementedRingServiceServer
}
func (*RingServer) SendEmptyMsg(context.Context, *ring.EmptyRequest) (*ring.EmptyResponse, error) {
return &ring.EmptyResponse{}, nil
}
func (*RingServer) SendEmpty(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return &emptypb.Empty{}, nil
}
func (*RingServer) SendTxAsEth(ctx context.Context, in *base.TransactionEth) (*ring.SendRawTransactionResponse, error) {
addr := common.Address{}
......@@ -178,10 +189,26 @@ func pricedTransaction(to common.Address, nonce uint64, gaslimit uint64, gaspric
}
// go test -v -run EthTx -bench=. -benchtime=3s
// go test -v -run BenchmarkAnyTxEth -bench BenchmarkAnyTxEth -benchtime=3s -benchmem
// go test -v -run BenchmarkAnyTxStd -bench BenchmarkAnyTxStd -benchtime=3s -benchmem
// go test -v -run BenchmarkEthTx -bench BenchmarkEthTx -benchtime=3s -benchmem
// go test -v -run BenchmarkStdTx -bench BenchmarkStdTx -benchtime=3s -benchmem
// go test -v -run BenchmarkAnyTx -bench BenchmarkAnyTx -benchtime=3s -benchmem
//// go test -v -run BenchmarkAnyTx -bench BenchmarkAnyTx -benchtime=3s -benchmem
// go test -v -run BenchmarkBytesEth -bench BenchmarkBytesEth -benchtime=3s -benchmem
// go test -v -run BenchmarkEmpty -bench BenchmarkEmpty -benchtime=3s -benchmem
// go test -v -run BenchmarkEmptyMsg -bench BenchmarkEmptyMsg -benchtime=3s -benchmem
// go test -v -run BenchmarkAnyTxEth -bench BenchmarkAnyTxEth -benchtime=20000x -benchmem
// go test -v -run BenchmarkAnyTxStd -bench BenchmarkAnyTxStd -benchtime=20000x -benchmem
// go test -v -run BenchmarkEthTx -bench BenchmarkEthTx -benchtime=20000x -benchmem
// go test -v -run BenchmarkStdTx -bench BenchmarkStdTx -benchtime=20000x -benchmem
//// go test -v -run BenchmarkAnyTx -bench BenchmarkAnyTx -benchtime=20000x -benchmem
// go test -v -run BenchmarkBytesEth -bench BenchmarkBytesEth -benchtime=20000x -benchmem
// go test -v -run BenchmarkEmpty -bench BenchmarkEmpty -benchtime=20000x -benchmem
// go test -v -run BenchmarkEmptyMsg -bench BenchmarkEmptyMsg -benchtime=20000x -benchmem
//BenchmarkEmptyMsg
// go test -v -run BenchmarkEthTx -bench BenchmarkEthTx -benchtime=1s
// go test -v -run BenchmarkStdTx -bench BenchmarkStdTx -benchtime=1s
......@@ -216,6 +243,10 @@ var fromAddr common.Address
// var local, remote *ecdsa.PrivateKey
func TestTxSizeOf(t *testing.T) {
fmt.Println(unsafe.Sizeof(*tx)) //88
}
func int() {
local, _ := crypto.HexToECDSA("FD5CC6F5E7E2805E920AC5DC83D5AF1106F9C92F0C04F9D5E1FD4261B4B4464A")
......@@ -233,6 +264,64 @@ var countParallel int64
var onceHash sync.Once
func BenchmarkEmpty(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
conn, err := grpc.Dial("127.0.0.1:9006", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
b.Fatal(err)
}
defer conn.Close()
c := ring.NewRingServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
res, err := c.SendEmpty(ctx, &emptypb.Empty{})
if err != nil {
b.Fatal(err)
}
_ = res
}
})
}
func BenchmarkEmptyMsg(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
conn, err := grpc.Dial("127.0.0.1:9006", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
b.Fatal(err)
}
defer conn.Close()
c := ring.NewRingServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
c.SendEmptyMsg(ctx, &ring.EmptyRequest{})
res, err := c.SendEmpty(ctx, &emptypb.Empty{})
if err != nil {
b.Fatal(err)
}
_ = res
}
})
}
func BenchmarkEthTx(b *testing.B) {
b.Logf("b.N: %d\n", b.N)
......@@ -377,7 +466,7 @@ func BenchmarkStdTx(b *testing.B) {
})
}
func BenchmarkAnyTx(b *testing.B) {
func BenchmarkAnyTxEth(b *testing.B) {
onceFunc := func() {
local, _ := crypto.HexToECDSA("FD5CC6F5E7E2805E920AC5DC83D5AF1106F9C92F0C04F9D5E1FD4261B4B4464A")
......@@ -452,6 +541,81 @@ func BenchmarkAnyTx(b *testing.B) {
})
}
func BenchmarkAnyTxStd(b *testing.B) {
onceFunc := func() {
local, _ := crypto.HexToECDSA("FD5CC6F5E7E2805E920AC5DC83D5AF1106F9C92F0C04F9D5E1FD4261B4B4464A")
publicKey := local.Public()
publicKeyECDSA, _ := publicKey.(*ecdsa.PublicKey)
fromAddr = crypto.PubkeyToAddress(*publicKeyECDSA)
remote, _ := crypto.GenerateKey()
tx = pricedTransaction(crypto.PubkeyToAddress(remote.PublicKey), 0, 100000, big.NewInt(1), local)
}
once.Do(onceFunc)
b.ResetTimer()
// The loop body is executed b.N times total across all goroutines.
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
conn, err := grpc.Dial("127.0.0.1:9006", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
b.Fatal(err)
}
defer conn.Close()
c := ring.NewRingServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
inner := base.StdTxData{
AccountNonce: tx.Nonce(),
Price: tx.GasPrice().Bytes(),
GasLimit: tx.Gas(),
Payload: tx.Data(),
}
v, r, sigs := tx.RawSignatureValues()
inner.V = v.Bytes()
inner.R = r.Bytes()
inner.S = sigs.Bytes()
inner.Amount = tx.Value().Bytes()
addr := base.Address{Address: tx.To().Bytes()}
inner.Recipient = &addr
stdTx := base.StdTx{Inner: &inner}
stdTxAsAny, err := anypb.New(&stdTx)
res, err := c.SendTxAsAny(ctx, &base.Transaction{Tx: stdTxAsAny})
if err != nil {
b.Fatal(err)
}
_ = res
if bytes.Compare(tx.Hash().Bytes(), res.TxHash) != 0 {
b.Fatal(err)
}
onceHash.Do(func() {
b.Logf("response: %x local: %x \n", res.TxHash, tx.Hash().Bytes())
})
}
})
}
func BenchmarkBytesEth(b *testing.B) {
onceFunc := func() {
......
......@@ -7,6 +7,8 @@ import "ring/v1/request_response.proto";
import "ring/v1/account_req_res.proto";
import "base/v1/resource.proto";
// import "google/protobuf/empty.proto";
service RingService{
// account info service
......@@ -18,7 +20,16 @@ service RingService{
rpc SendTxAsBytes(base.v1.TransactionBytes) returns (SendRawTransactionResponse) {};
rpc SendEmpty(google.protobuf.Empty) returns (google.protobuf.Empty) {};
rpc SendEmptyMsg(EmptyRequest) returns (EmptyResponse) {};
//rpc SendRawTransaction(base.v1.EthTx) returns (SendRawTransactionResponse) {};
rpc Nonce(NonceRequest) returns (NonceResponse) {};
}
message EmptyRequest {
}
message EmptyResponse {
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment