From 9a02a6119d20986652ec6d3b54859f4e31b406c0 Mon Sep 17 00:00:00 2001 From: Songwong Tasneeyapant Date: Thu, 27 Jan 2022 18:36:10 +0700 Subject: [PATCH 1/2] add result --- packet/packet.pb.go | 112 +-- proto/oracle/v1/{ => packet}/packet.proto | 2 +- proto/oracle/v1/types/types.proto | 51 ++ types/types.pb.go | 797 ++++++++++++++++++++++ 4 files changed, 905 insertions(+), 57 deletions(-) rename proto/oracle/v1/{ => packet}/packet.proto (99%) create mode 100644 proto/oracle/v1/types/types.proto create mode 100644 types/types.pb.go diff --git a/packet/packet.pb.go b/packet/packet.pb.go index a4e4373..5046b21 100644 --- a/packet/packet.pb.go +++ b/packet/packet.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/v1/packet.proto +// source: oracle/v1/packet/packet.proto package packet @@ -60,7 +60,7 @@ func (x ResolveStatus) String() string { } func (ResolveStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9094f190a55b1bcf, []int{0} + return fileDescriptor_e92cbf7fa321f89a, []int{0} } // OracleRequestPacketData encodes an oracle request sent from other blockchains @@ -96,7 +96,7 @@ func (m *OracleRequestPacketData) Reset() { *m = OracleRequestPacketData func (m *OracleRequestPacketData) String() string { return proto.CompactTextString(m) } func (*OracleRequestPacketData) ProtoMessage() {} func (*OracleRequestPacketData) Descriptor() ([]byte, []int) { - return fileDescriptor_9094f190a55b1bcf, []int{0} + return fileDescriptor_e92cbf7fa321f89a, []int{0} } func (m *OracleRequestPacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -192,7 +192,7 @@ func (m *OracleRequestPacketAcknowledgement) Reset() { *m = OracleReques func (m *OracleRequestPacketAcknowledgement) String() string { return proto.CompactTextString(m) } func (*OracleRequestPacketAcknowledgement) ProtoMessage() {} func (*OracleRequestPacketAcknowledgement) Descriptor() ([]byte, []int) { - return fileDescriptor_9094f190a55b1bcf, []int{1} + return fileDescriptor_e92cbf7fa321f89a, []int{1} } func (m *OracleRequestPacketAcknowledgement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +248,7 @@ type OracleResponsePacketData struct { ResolveTime int64 `protobuf:"varint,5,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` // ResolveStatus is the status of this oracle request, which can be OK, // FAILURE, or EXPIRED. - ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.ResolveStatus" json:"resolve_status,omitempty"` + ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.packet.ResolveStatus" json:"resolve_status,omitempty"` // Result is the final aggregated value encoded in OBI format. Only available // if status if OK. Result []byte `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` @@ -258,7 +258,7 @@ func (m *OracleResponsePacketData) Reset() { *m = OracleResponsePacketDa func (m *OracleResponsePacketData) String() string { return proto.CompactTextString(m) } func (*OracleResponsePacketData) ProtoMessage() {} func (*OracleResponsePacketData) Descriptor() ([]byte, []int) { - return fileDescriptor_9094f190a55b1bcf, []int{2} + return fileDescriptor_e92cbf7fa321f89a, []int{2} } func (m *OracleResponsePacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -337,59 +337,59 @@ func (m *OracleResponsePacketData) GetResult() []byte { } func init() { - proto.RegisterEnum("oracle.v1.ResolveStatus", ResolveStatus_name, ResolveStatus_value) - proto.RegisterType((*OracleRequestPacketData)(nil), "oracle.v1.OracleRequestPacketData") - proto.RegisterType((*OracleRequestPacketAcknowledgement)(nil), "oracle.v1.OracleRequestPacketAcknowledgement") - proto.RegisterType((*OracleResponsePacketData)(nil), "oracle.v1.OracleResponsePacketData") + proto.RegisterEnum("oracle.v1.packet.ResolveStatus", ResolveStatus_name, ResolveStatus_value) + proto.RegisterType((*OracleRequestPacketData)(nil), "oracle.v1.packet.OracleRequestPacketData") + proto.RegisterType((*OracleRequestPacketAcknowledgement)(nil), "oracle.v1.packet.OracleRequestPacketAcknowledgement") + proto.RegisterType((*OracleResponsePacketData)(nil), "oracle.v1.packet.OracleResponsePacketData") } -func init() { proto.RegisterFile("oracle/v1/packet.proto", fileDescriptor_9094f190a55b1bcf) } +func init() { proto.RegisterFile("oracle/v1/packet/packet.proto", fileDescriptor_e92cbf7fa321f89a) } -var fileDescriptor_9094f190a55b1bcf = []byte{ - // 680 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x3f, 0x6f, 0xd3, 0x4c, - 0x18, 0x8f, 0x93, 0x34, 0x6f, 0x72, 0x4d, 0xa3, 0xc8, 0xef, 0xab, 0xd6, 0x6f, 0x90, 0xec, 0xd0, - 0x29, 0x20, 0x6a, 0xd3, 0x22, 0x31, 0xa0, 0x4a, 0xa8, 0x49, 0xdc, 0xca, 0x52, 0xd5, 0x46, 0xe7, - 0x06, 0x55, 0x2c, 0xd6, 0xc5, 0xbe, 0xa6, 0x56, 0x6c, 0x5f, 0xf0, 0x5d, 0x0a, 0x7c, 0x03, 0xd4, - 0x89, 0x2f, 0x50, 0x09, 0x89, 0x8d, 0x9d, 0xef, 0xd0, 0xb1, 0x23, 0x53, 0x40, 0xe9, 0xc2, 0x77, - 0x60, 0x41, 0xbe, 0xbb, 0x54, 0x2d, 0x0a, 0x0c, 0x4c, 0xc9, 0xf3, 0xfb, 0x77, 0xd6, 0xf3, 0xd3, - 0x1d, 0x58, 0x25, 0x29, 0xf2, 0x23, 0x6c, 0x9d, 0x6d, 0x5a, 0x63, 0xe4, 0x8f, 0x30, 0x33, 0xc7, - 0x29, 0x61, 0x44, 0xad, 0x08, 0xdc, 0x3c, 0xdb, 0x6c, 0xfc, 0x37, 0x24, 0x43, 0xc2, 0x51, 0x2b, - 0xfb, 0x27, 0x04, 0x0d, 0xdd, 0x27, 0x34, 0x26, 0xd4, 0x1a, 0x20, 0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, 0xa0, 0x94, 0x62, 0x3a, 0x89, 0x18, - 0xaf, 0xad, 0x0a, 0xe5, 0x24, 0xf6, 0xf6, 0xf0, 0x87, 0x02, 0x56, 0xee, 0xd8, 0xd5, 0x6d, 0x60, - 0x40, 0xdb, 0x3d, 0xdc, 0x7f, 0x61, 0x7b, 0xee, 0xd1, 0xce, 0x51, 0xdf, 0xf5, 0x0e, 0x7b, 0xf6, - 0x81, 0xd7, 0x3f, 0x70, 0x7b, 0x76, 0xc7, 0xd9, 0x75, 0xec, 0x6e, 0x3d, 0xd7, 0x58, 0x3b, 0xbf, - 0x68, 0xfe, 0xbb, 0x40, 0xa6, 0x3e, 0x05, 0xab, 0xbf, 0xc0, 0x6e, 0xbf, 0xd3, 0xb1, 0x5d, 0xb7, - 0xae, 0x34, 0x1a, 0xe7, 0x17, 0xcd, 0xdf, 0xb0, 0x0b, 0x7c, 0xbb, 0x3b, 0xce, 0x7e, 0x1f, 0xda, - 0xf5, 0xfc, 0x42, 0x9f, 0x64, 0x17, 0xf8, 0xec, 0xe3, 0x9e, 0x03, 0xed, 0x6e, 0xbd, 0xb0, 0xd0, - 0x27, 0xd9, 0x46, 0xf1, 0xdd, 0x47, 0x3d, 0xd7, 0x76, 0x2e, 0x67, 0xba, 0x72, 0x35, 0xd3, 0x95, - 0x6f, 0x33, 0x5d, 0x79, 0x7f, 0xad, 0xe7, 0xae, 0xae, 0xf5, 0xdc, 0x97, 0x6b, 0x3d, 0xf7, 0xd2, - 0xba, 0x75, 0x4b, 0x06, 0x28, 0x09, 0xf8, 0x63, 0xe2, 0x93, 0x88, 0x0f, 0xfe, 0x29, 0x0a, 0x93, - 0x0d, 0xf1, 0x4e, 0xc9, 0xe7, 0x6a, 0x50, 0xe2, 0x8a, 0x27, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0x81, 0x7e, 0xfb, 0xbf, 0xc9, 0x04, 0x00, 0x00, +var fileDescriptor_e92cbf7fa321f89a = []byte{ + // 681 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6e, 0xd3, 0x4a, + 0x18, 0x8f, 0x93, 0x34, 0x2f, 0x99, 0xa6, 0x51, 0xe4, 0xf7, 0xd4, 0xe6, 0x05, 0x61, 0x87, 0xae, + 0x02, 0xa2, 0x36, 0x2d, 0x12, 0x0b, 0xd4, 0x4d, 0x93, 0xb8, 0x95, 0xa5, 0xaa, 0x8d, 0xc6, 0x0d, + 0xaa, 0xd8, 0x58, 0x13, 0x7b, 0x9a, 0x5a, 0xb1, 0x3d, 0xc6, 0x33, 0x29, 0x70, 0x03, 0xd4, 0x15, + 0x17, 0xa8, 0x84, 0xc4, 0x8e, 0x33, 0x70, 0x80, 0x2e, 0xbb, 0x64, 0x15, 0x50, 0xba, 0xe1, 0x0e, + 0x6c, 0x90, 0x67, 0x26, 0xa8, 0xad, 0x02, 0x0b, 0x56, 0xf6, 0xf7, 0xfb, 0x37, 0xd6, 0xf7, 0x93, + 0x07, 0xdc, 0x27, 0x29, 0xf2, 0x42, 0x6c, 0x9e, 0x6d, 0x9a, 0x09, 0xf2, 0xc6, 0x98, 0xc9, 0x87, + 0x91, 0xa4, 0x84, 0x11, 0xb5, 0x2e, 0x68, 0xe3, 0x6c, 0xd3, 0x10, 0x78, 0xf3, 0xbf, 0x11, 0x19, + 0x11, 0x4e, 0x9a, 0xd9, 0x9b, 0xd0, 0x35, 0x35, 0x8f, 0xd0, 0x88, 0x50, 0x73, 0x88, 0x68, 0x96, + 0x35, 0xc4, 0x0c, 0x6d, 0x9a, 0x1e, 0x09, 0x62, 0xc1, 0xaf, 0x9f, 0x17, 0xc0, 0xda, 0x21, 0x8f, + 0x82, 0xf8, 0xd5, 0x04, 0x53, 0xd6, 0xe7, 0x69, 0x3d, 0xc4, 0x90, 0xfa, 0x10, 0x54, 0xbc, 0x30, + 0xc0, 0x31, 0x73, 0x03, 0xbf, 0xa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, 0x3b, 0x38, 0x70, 0xfa, 0x56, 0xd7, 0xde, 0xb5, 0xad, 0x5e, 0x3d, 0xd7, + 0x5c, 0x3b, 0xbf, 0x68, 0xfd, 0xbb, 0x40, 0xa6, 0x3e, 0x03, 0xab, 0x77, 0x60, 0x67, 0xd0, 0xed, + 0x5a, 0x8e, 0x53, 0x57, 0x9a, 0xcd, 0xf3, 0x8b, 0xd6, 0x6f, 0xd8, 0x05, 0xbe, 0xdd, 0x1d, 0x7b, + 0x7f, 0x00, 0xad, 0x7a, 0x7e, 0xa1, 0x4f, 0xb2, 0x0b, 0x7c, 0xd6, 0x71, 0xdf, 0x86, 0x56, 0xaf, + 0x5e, 0x58, 0xe8, 0x93, 0x6c, 0xb3, 0xf8, 0xee, 0xa3, 0x96, 0xeb, 0xd8, 0x97, 0x33, 0x4d, 0xb9, + 0x9a, 0x69, 0xca, 0xb7, 0x99, 0xa6, 0xbc, 0xbf, 0xd6, 0x72, 0x57, 0xd7, 0x5a, 0xee, 0xcb, 0xb5, + 0x96, 0x7b, 0x69, 0xde, 0xf8, 0x59, 0x86, 0x28, 0xf6, 0xf9, 0x9d, 0xe2, 0x91, 0x90, 0x0f, 0xde, + 0x29, 0x0a, 0xe2, 0x8d, 0x5b, 0x97, 0xd7, 0xb0, 0xc4, 0x15, 0x4f, 0x7f, 0x06, 0x00, 0x00, 0xff, + 0xff, 0xdd, 0x19, 0x9b, 0x08, 0xde, 0x04, 0x00, 0x00, } func (this *OracleRequestPacketData) Equal(that interface{}) bool { diff --git a/proto/oracle/v1/packet.proto b/proto/oracle/v1/packet/packet.proto similarity index 99% rename from proto/oracle/v1/packet.proto rename to proto/oracle/v1/packet/packet.proto index b99752d..244445b 100644 --- a/proto/oracle/v1/packet.proto +++ b/proto/oracle/v1/packet/packet.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package oracle.v1; +package oracle.v1.packet; option go_package = "github.com/bandprotocol/bandchain-packet/packet"; diff --git a/proto/oracle/v1/types/types.proto b/proto/oracle/v1/types/types.proto new file mode 100644 index 0000000..f463439 --- /dev/null +++ b/proto/oracle/v1/types/types.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +package oracle.v1.types; + +option go_package = "github.com/bandprotocol/bandchain-packet/types"; + +import "gogoproto/gogo.proto"; +import "oracle/v1/packet/packet.proto"; + +// Result encodes a result of request and store in chain +message Result { + option (gogoproto.equal) = true; + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + string client_id = 1 [ (gogoproto.customname) = "ClientID" ]; + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + uint64 oracle_script_id = 2 [ + (gogoproto.customname) = "OracleScriptID", + (gogoproto.casttype) = "OracleScriptID" + ]; + // Calldata is the calldata bytes available for oracle executor to read. + bytes calldata = 3; + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + uint64 ask_count = 4; + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + uint64 min_count = 5; + // RequestID is BandChain's unique identifier for this oracle request. + uint64 request_id = 6 [ + (gogoproto.customname) = "RequestID", + (gogoproto.casttype) = "RequestID" + ]; + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + uint64 ans_count = 7; + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + int64 request_time = 8; + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + int64 resolve_time = 9; + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + packet.ResolveStatus resolve_status = 10; + // Result is the final aggregated value only available if status if OK. + bytes result = 11; +} diff --git a/types/types.pb.go b/types/types.pb.go new file mode 100644 index 0000000..330f3b5 --- /dev/null +++ b/types/types.pb.go @@ -0,0 +1,797 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/v1/types/types.proto + +package types + +import ( + bytes "bytes" + fmt "fmt" + packet "github.com/bandprotocol/bandchain-packet/packet" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Result encodes a result of request and store in chain +type Result struct { + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptID OracleScriptID `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3,casttype=OracleScriptID" json:"oracle_script_id,omitempty"` + // Calldata is the calldata bytes available for oracle executor to read. + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // RequestID is BandChain's unique identifier for this oracle request. + RequestID RequestID `protobuf:"varint,6,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + AnsCount uint64 `protobuf:"varint,7,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + RequestTime int64 `protobuf:"varint,8,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + ResolveTime int64 `protobuf:"varint,9,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus packet.ResolveStatus `protobuf:"varint,10,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.packet.ResolveStatus" json:"resolve_status,omitempty"` + // Result is the final aggregated value only available if status if OK. + Result []byte `protobuf:"bytes,11,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *Result) Reset() { *m = Result{} } +func (m *Result) String() string { return proto.CompactTextString(m) } +func (*Result) ProtoMessage() {} +func (*Result) Descriptor() ([]byte, []int) { + return fileDescriptor_88f9ab87504e4f43, []int{0} +} +func (m *Result) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_Result.Merge(m, src) +} +func (m *Result) XXX_Size() int { + return m.Size() +} +func (m *Result) XXX_DiscardUnknown() { + xxx_messageInfo_Result.DiscardUnknown(m) +} + +var xxx_messageInfo_Result proto.InternalMessageInfo + +func (m *Result) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *Result) GetOracleScriptID() OracleScriptID { + if m != nil { + return m.OracleScriptID + } + return 0 +} + +func (m *Result) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +func (m *Result) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *Result) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *Result) GetRequestID() RequestID { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *Result) GetAnsCount() uint64 { + if m != nil { + return m.AnsCount + } + return 0 +} + +func (m *Result) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *Result) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *Result) GetResolveStatus() packet.ResolveStatus { + if m != nil { + return m.ResolveStatus + } + return packet.RESOLVE_STATUS_OPEN +} + +func (m *Result) GetResult() []byte { + if m != nil { + return m.Result + } + return nil +} + +func init() { + proto.RegisterType((*Result)(nil), "oracle.v1.types.Result") +} + +func init() { proto.RegisterFile("oracle/v1/types/types.proto", fileDescriptor_88f9ab87504e4f43) } + +var fileDescriptor_88f9ab87504e4f43 = []byte{ + // 424 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xb1, 0x8e, 0xd3, 0x40, + 0x10, 0x86, 0xb3, 0x24, 0x04, 0x7b, 0x2f, 0x04, 0x64, 0x21, 0x64, 0xe5, 0x84, 0x6d, 0x10, 0x85, + 0x29, 0x70, 0x74, 0x50, 0x41, 0x99, 0x3b, 0x21, 0xdc, 0x80, 0xb4, 0x47, 0x45, 0x13, 0x6d, 0xd6, + 0xab, 0xdc, 0x2a, 0xf6, 0xae, 0xf1, 0xae, 0x23, 0xf1, 0x16, 0x3c, 0x02, 0x8f, 0x43, 0x79, 0x25, + 0x0d, 0x11, 0x72, 0x1a, 0x9e, 0x81, 0x0a, 0x79, 0x76, 0x43, 0x4e, 0xba, 0x26, 0xf1, 0xff, 0xff, + 0x9f, 0x67, 0x46, 0x9e, 0xc1, 0xa7, 0xaa, 0xa1, 0xac, 0xe4, 0xf3, 0xed, 0xd9, 0xdc, 0x7c, 0xad, + 0xb9, 0xb6, 0xbf, 0x59, 0xdd, 0x28, 0xa3, 0x82, 0x07, 0x36, 0xcc, 0xb6, 0x67, 0x19, 0xd8, 0xb3, + 0x47, 0x6b, 0xb5,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xfb, 0x24, 0x2a, 0x6e, 0x11, 0xad, 0xca, + 0x2d, 0xb7, 0x88, 0x7f, 0x40, 0xc0, 0x03, 0xe4, 0x1d, 0x9e, 0x1e, 0x10, 0x6d, 0xa8, 0x69, 0x75, + 0x88, 0x13, 0x94, 0x4e, 0x5f, 0xc5, 0xd9, 0x71, 0xb1, 0x6e, 0x55, 0xc4, 0x72, 0x97, 0x80, 0x91, + 0xfb, 0xcd, 0x4d, 0x19, 0x3c, 0xc6, 0xe3, 0x06, 0x16, 0x18, 0x9e, 0xc0, 0x97, 0x73, 0xea, 0xed, + 0xe8, 0xcf, 0xf7, 0x18, 0x2d, 0xde, 0xff, 0xe8, 0x22, 0x74, 0xdd, 0x45, 0xe8, 0x77, 0x17, 0xa1, + 0x6f, 0xfb, 0x68, 0x70, 0xbd, 0x8f, 0x06, 0x3f, 0xf7, 0xd1, 0xe0, 0x73, 0xb6, 0x16, 0xe6, 0xaa, + 0x5d, 0x65, 0x4c, 0x55, 0xf3, 0x15, 0x95, 0x05, 0xdc, 0x03, 0x53, 0x25, 0x08, 0x76, 0x45, 0x85, + 0x7c, 0xe9, 0x0e, 0x06, 0xce, 0x6b, 0x35, 0x06, 0xe0, 0xf5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x3a, 0x7d, 0x45, 0xc6, 0x95, 0x02, 0x00, 0x00, +} + +func (this *Result) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Result) + if !ok { + that2, ok := that.(Result) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if this.AskCount != that1.AskCount { + return false + } + if this.MinCount != that1.MinCount { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.AnsCount != that1.AnsCount { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ResolveTime != that1.ResolveTime { + return false + } + if this.ResolveStatus != that1.ResolveStatus { + return false + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + return true +} +func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x5a + } + if m.ResolveStatus != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveStatus)) + i-- + dAtA[i] = 0x50 + } + if m.ResolveTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x48 + } + if m.RequestTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x40 + } + if m.AnsCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AnsCount)) + i-- + dAtA[i] = 0x38 + } + if m.RequestID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x30 + } + if m.MinCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.OracleScriptID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Result) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.OracleScriptID != 0 { + n += 1 + sovTypes(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.AskCount != 0 { + n += 1 + sovTypes(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovTypes(uint64(m.MinCount)) + } + if m.RequestID != 0 { + n += 1 + sovTypes(uint64(m.RequestID)) + } + if m.AnsCount != 0 { + n += 1 + sovTypes(uint64(m.AnsCount)) + } + if m.RequestTime != 0 { + n += 1 + sovTypes(uint64(m.RequestTime)) + } + if m.ResolveTime != 0 { + n += 1 + sovTypes(uint64(m.ResolveTime)) + } + if m.ResolveStatus != 0 { + n += 1 + sovTypes(uint64(m.ResolveStatus)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Result) 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 ErrIntOverflowTypes + } + 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: Result: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= OracleScriptID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= RequestID(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) + } + m.AnsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) + } + m.ResolveStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveStatus |= packet.ResolveStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) From 3ec3af2f5f5da973b12e7e11eeac7646da057e6b Mon Sep 17 00:00:00 2001 From: Songwong Tasneeyapant Date: Tue, 1 Feb 2022 14:49:24 +0700 Subject: [PATCH 2/2] fix structure --- go.mod | 1 + packet/{packet.pb.go => types.pb.go} | 938 +++++++++++++++--- .../v1/{packet/packet.proto => types.proto} | 40 +- proto/oracle/v1/types/types.proto | 51 - types/types.pb.go | 797 --------------- 5 files changed, 827 insertions(+), 1000 deletions(-) rename packet/{packet.pb.go => types.pb.go} (55%) rename proto/oracle/v1/{packet/packet.proto => types.proto} (68%) delete mode 100644 proto/oracle/v1/types/types.proto delete mode 100644 types/types.pb.go diff --git a/go.mod b/go.mod index 8735656..3a13ee6 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/cosmos/cosmos-sdk v0.43.0 github.com/cosmos/ibc-go v1.0.0 github.com/gogo/protobuf v1.3.3 + github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/stretchr/testify v1.7.0 ) diff --git a/packet/packet.pb.go b/packet/types.pb.go similarity index 55% rename from packet/packet.pb.go rename to packet/types.pb.go index 5046b21..764f584 100644 --- a/packet/packet.pb.go +++ b/packet/types.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/v1/packet/packet.proto +// source: oracle/v1/types.proto package packet @@ -60,7 +60,154 @@ func (x ResolveStatus) String() string { } func (ResolveStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e92cbf7fa321f89a, []int{0} + return fileDescriptor_b54af2de77c923e3, []int{0} +} + +// Result encodes a result of request and store in chain +type Result struct { + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + OracleScriptID uint64 `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3" json:"oracle_script_id,omitempty"` + // Calldata is the calldata bytes available for oracle executor to read. + Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` + // RequestID is BandChain's unique identifier for this oracle request. + RequestID uint64 `protobuf:"varint,6,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + AnsCount uint64 `protobuf:"varint,7,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + RequestTime int64 `protobuf:"varint,8,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + ResolveTime int64 `protobuf:"varint,9,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus ResolveStatus `protobuf:"varint,10,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.ResolveStatus" json:"resolve_status,omitempty"` + // Result is the final aggregated value only available if status if OK. + Result []byte `protobuf:"bytes,11,opt,name=result,proto3" json:"result,omitempty"` +} + +func (m *Result) Reset() { *m = Result{} } +func (m *Result) String() string { return proto.CompactTextString(m) } +func (*Result) ProtoMessage() {} +func (*Result) Descriptor() ([]byte, []int) { + return fileDescriptor_b54af2de77c923e3, []int{0} +} +func (m *Result) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_Result.Merge(m, src) +} +func (m *Result) XXX_Size() int { + return m.Size() +} +func (m *Result) XXX_DiscardUnknown() { + xxx_messageInfo_Result.DiscardUnknown(m) +} + +var xxx_messageInfo_Result proto.InternalMessageInfo + +func (m *Result) GetClientID() string { + if m != nil { + return m.ClientID + } + return "" +} + +func (m *Result) GetOracleScriptID() uint64 { + if m != nil { + return m.OracleScriptID + } + return 0 +} + +func (m *Result) GetCalldata() []byte { + if m != nil { + return m.Calldata + } + return nil +} + +func (m *Result) GetAskCount() uint64 { + if m != nil { + return m.AskCount + } + return 0 +} + +func (m *Result) GetMinCount() uint64 { + if m != nil { + return m.MinCount + } + return 0 +} + +func (m *Result) GetRequestID() uint64 { + if m != nil { + return m.RequestID + } + return 0 +} + +func (m *Result) GetAnsCount() uint64 { + if m != nil { + return m.AnsCount + } + return 0 +} + +func (m *Result) GetRequestTime() int64 { + if m != nil { + return m.RequestTime + } + return 0 +} + +func (m *Result) GetResolveTime() int64 { + if m != nil { + return m.ResolveTime + } + return 0 +} + +func (m *Result) GetResolveStatus() ResolveStatus { + if m != nil { + return m.ResolveStatus + } + return RESOLVE_STATUS_OPEN +} + +func (m *Result) GetResult() []byte { + if m != nil { + return m.Result + } + return nil } // OracleRequestPacketData encodes an oracle request sent from other blockchains @@ -96,7 +243,7 @@ func (m *OracleRequestPacketData) Reset() { *m = OracleRequestPacketData func (m *OracleRequestPacketData) String() string { return proto.CompactTextString(m) } func (*OracleRequestPacketData) ProtoMessage() {} func (*OracleRequestPacketData) Descriptor() ([]byte, []int) { - return fileDescriptor_e92cbf7fa321f89a, []int{0} + return fileDescriptor_b54af2de77c923e3, []int{1} } func (m *OracleRequestPacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -192,7 +339,7 @@ func (m *OracleRequestPacketAcknowledgement) Reset() { *m = OracleReques func (m *OracleRequestPacketAcknowledgement) String() string { return proto.CompactTextString(m) } func (*OracleRequestPacketAcknowledgement) ProtoMessage() {} func (*OracleRequestPacketAcknowledgement) Descriptor() ([]byte, []int) { - return fileDescriptor_e92cbf7fa321f89a, []int{1} + return fileDescriptor_b54af2de77c923e3, []int{2} } func (m *OracleRequestPacketAcknowledgement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -248,7 +395,7 @@ type OracleResponsePacketData struct { ResolveTime int64 `protobuf:"varint,5,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` // ResolveStatus is the status of this oracle request, which can be OK, // FAILURE, or EXPIRED. - ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.packet.ResolveStatus" json:"resolve_status,omitempty"` + ResolveStatus ResolveStatus `protobuf:"varint,6,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.ResolveStatus" json:"resolve_status,omitempty"` // Result is the final aggregated value encoded in OBI format. Only available // if status if OK. Result []byte `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` @@ -258,7 +405,7 @@ func (m *OracleResponsePacketData) Reset() { *m = OracleResponsePacketDa func (m *OracleResponsePacketData) String() string { return proto.CompactTextString(m) } func (*OracleResponsePacketData) ProtoMessage() {} func (*OracleResponsePacketData) Descriptor() ([]byte, []int) { - return fileDescriptor_e92cbf7fa321f89a, []int{2} + return fileDescriptor_b54af2de77c923e3, []int{3} } func (m *OracleResponsePacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -337,61 +484,119 @@ func (m *OracleResponsePacketData) GetResult() []byte { } func init() { - proto.RegisterEnum("oracle.v1.packet.ResolveStatus", ResolveStatus_name, ResolveStatus_value) - proto.RegisterType((*OracleRequestPacketData)(nil), "oracle.v1.packet.OracleRequestPacketData") - proto.RegisterType((*OracleRequestPacketAcknowledgement)(nil), "oracle.v1.packet.OracleRequestPacketAcknowledgement") - proto.RegisterType((*OracleResponsePacketData)(nil), "oracle.v1.packet.OracleResponsePacketData") -} - -func init() { proto.RegisterFile("oracle/v1/packet/packet.proto", fileDescriptor_e92cbf7fa321f89a) } - -var fileDescriptor_e92cbf7fa321f89a = []byte{ - // 681 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4f, 0x6e, 0xd3, 0x4a, - 0x18, 0x8f, 0x93, 0x34, 0x2f, 0x99, 0xa6, 0x51, 0xe4, 0xf7, 0xd4, 0xe6, 0x05, 0x61, 0x87, 0xae, - 0x02, 0xa2, 0x36, 0x2d, 0x12, 0x0b, 0xd4, 0x4d, 0x93, 0xb8, 0x95, 0xa5, 0xaa, 0x8d, 0xc6, 0x0d, - 0xaa, 0xd8, 0x58, 0x13, 0x7b, 0x9a, 0x5a, 0xb1, 0x3d, 0xc6, 0x33, 0x29, 0x70, 0x03, 0xd4, 0x15, - 0x17, 0xa8, 0x84, 0xc4, 0x8e, 0x33, 0x70, 0x80, 0x2e, 0xbb, 0x64, 0x15, 0x50, 0xba, 0xe1, 0x0e, - 0x6c, 0x90, 0x67, 0x26, 0xa8, 0xad, 0x02, 0x0b, 0x56, 0xf6, 0xf7, 0xfb, 0x37, 0xd6, 0xf7, 0x93, - 0x07, 0xdc, 0x27, 0x29, 0xf2, 0x42, 0x6c, 0x9e, 0x6d, 0x9a, 0x09, 0xf2, 0xc6, 0x98, 0xc9, 0x87, - 0x91, 0xa4, 0x84, 0x11, 0xb5, 0x2e, 0x68, 0xe3, 0x6c, 0xd3, 0x10, 0x78, 0xf3, 0xbf, 0x11, 0x19, - 0x11, 0x4e, 0x9a, 0xd9, 0x9b, 0xd0, 0x35, 0x35, 0x8f, 0xd0, 0x88, 0x50, 0x73, 0x88, 0x68, 0x96, - 0x35, 0xc4, 0x0c, 0x6d, 0x9a, 0x1e, 0x09, 0x62, 0xc1, 0xaf, 0x9f, 0x17, 0xc0, 0xda, 0x21, 0x8f, - 0x82, 0xf8, 0xd5, 0x04, 0x53, 0xd6, 0xe7, 0x69, 0x3d, 0xc4, 0x90, 0xfa, 0x10, 0x54, 0xbc, 0x30, - 0xc0, 0x31, 0x73, 0x03, 0xbf, 0xa1, 0xb4, 0x94, 0x76, 0xa5, 0x53, 0x9d, 0x4d, 0xf5, 0x72, 0x97, - 0x83, 0x76, 0x0f, 0x96, 0x05, 0x6d, 0xfb, 0xea, 0x36, 0x90, 0x1f, 0xe4, 0x52, 0x2f, 0x0d, 0x12, - 0xee, 0xc8, 0xb7, 0x94, 0x76, 0xb1, 0xa3, 0xce, 0xa6, 0x7a, 0x4d, 0x9c, 0xe0, 0x70, 0xca, 0xee, - 0xc1, 0x1a, 0xb9, 0x39, 0xfb, 0x6a, 0x13, 0x94, 0x3d, 0x14, 0x86, 0x3e, 0x62, 0xa8, 0x51, 0x68, - 0x29, 0xed, 0x2a, 0xfc, 0x35, 0xab, 0xf7, 0x40, 0x05, 0xd1, 0xb1, 0xeb, 0x91, 0x49, 0xcc, 0x1a, - 0xc5, 0x2c, 0x12, 0x96, 0x11, 0x1d, 0x77, 0xb3, 0x39, 0x23, 0xa3, 0x20, 0x96, 0xe4, 0x92, 0x20, - 0xa3, 0x20, 0x16, 0xe4, 0x29, 0xa8, 0x9c, 0x60, 0xec, 0x86, 0x41, 0x14, 0xb0, 0x46, 0xa9, 0x55, - 0x68, 0x2f, 0x6f, 0xfd, 0x6f, 0x88, 0x75, 0x18, 0xd9, 0x3a, 0x0c, 0xb9, 0x0e, 0xa3, 0x4b, 0x82, - 0xb8, 0xf3, 0xe4, 0x72, 0xaa, 0xe7, 0x3e, 0x7d, 0xd5, 0xdb, 0xa3, 0x80, 0x9d, 0x4e, 0x86, 0x86, - 0x47, 0x22, 0x53, 0xee, 0x4e, 0x3c, 0x36, 0xa8, 0x3f, 0x36, 0xd9, 0xdb, 0x04, 0x53, 0x6e, 0xa0, - 0xb0, 0x7c, 0x82, 0xf1, 0x7e, 0x16, 0xae, 0xea, 0x60, 0x39, 0x49, 0x71, 0x82, 0x52, 0xec, 0x8e, - 0x10, 0x6d, 0xfc, 0xc3, 0x3f, 0x04, 0x48, 0x68, 0x0f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0x71, - 0x0f, 0xfb, 0xd6, 0x81, 0x3b, 0x38, 0x70, 0xfa, 0x56, 0xd7, 0xde, 0xb5, 0xad, 0x5e, 0x3d, 0xd7, - 0x5c, 0x3b, 0xbf, 0x68, 0xfd, 0xbb, 0x40, 0xa6, 0x3e, 0x03, 0xab, 0x77, 0x60, 0x67, 0xd0, 0xed, - 0x5a, 0x8e, 0x53, 0x57, 0x9a, 0xcd, 0xf3, 0x8b, 0xd6, 0x6f, 0xd8, 0x05, 0xbe, 0xdd, 0x1d, 0x7b, - 0x7f, 0x00, 0xad, 0x7a, 0x7e, 0xa1, 0x4f, 0xb2, 0x0b, 0x7c, 0xd6, 0x71, 0xdf, 0x86, 0x56, 0xaf, - 0x5e, 0x58, 0xe8, 0x93, 0x6c, 0xb3, 0xf8, 0xee, 0xa3, 0x96, 0xeb, 0xd8, 0x97, 0x33, 0x4d, 0xb9, - 0x9a, 0x69, 0xca, 0xb7, 0x99, 0xa6, 0xbc, 0xbf, 0xd6, 0x72, 0x57, 0xd7, 0x5a, 0xee, 0xcb, 0xb5, - 0x96, 0x7b, 0x69, 0xde, 0xf8, 0x59, 0x86, 0x28, 0xf6, 0xf9, 0x9d, 0xe2, 0x91, 0x90, 0x0f, 0xde, - 0x29, 0x0a, 0xe2, 0x8d, 0x5b, 0x97, 0xd7, 0xb0, 0xc4, 0x15, 0x4f, 0x7f, 0x06, 0x00, 0x00, 0xff, - 0xff, 0xdd, 0x19, 0x9b, 0x08, 0xde, 0x04, 0x00, 0x00, + proto.RegisterEnum("oracle.v1.ResolveStatus", ResolveStatus_name, ResolveStatus_value) + proto.RegisterType((*Result)(nil), "oracle.v1.Result") + proto.RegisterType((*OracleRequestPacketData)(nil), "oracle.v1.OracleRequestPacketData") + proto.RegisterType((*OracleRequestPacketAcknowledgement)(nil), "oracle.v1.OracleRequestPacketAcknowledgement") + proto.RegisterType((*OracleResponsePacketData)(nil), "oracle.v1.OracleResponsePacketData") } +func init() { proto.RegisterFile("oracle/v1/types.proto", fileDescriptor_b54af2de77c923e3) } + +var fileDescriptor_b54af2de77c923e3 = []byte{ + // 721 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x41, 0x4f, 0xdb, 0x48, + 0x18, 0x8d, 0x93, 0x10, 0xe2, 0x09, 0x44, 0x91, 0x77, 0x17, 0xbc, 0x59, 0xc9, 0xf6, 0x72, 0xca, + 0xae, 0x16, 0x7b, 0xa1, 0x52, 0x0f, 0x15, 0x52, 0x45, 0x12, 0x83, 0x2c, 0x21, 0x88, 0x6c, 0x52, + 0xa1, 0x5e, 0xac, 0x89, 0x3d, 0x04, 0x2b, 0xb6, 0x27, 0xf5, 0x38, 0xb4, 0xfd, 0x07, 0x15, 0xa7, + 0xfe, 0x01, 0xa4, 0x4a, 0xbd, 0xf5, 0x5e, 0xf5, 0x2f, 0x70, 0xe4, 0xd8, 0x53, 0x5a, 0x85, 0x4b, + 0xff, 0x43, 0x2f, 0x95, 0x67, 0x26, 0x08, 0x4a, 0x5a, 0x5a, 0x6e, 0x3d, 0x39, 0xdf, 0x7b, 0xef, + 0xfb, 0xc6, 0x99, 0xef, 0x3d, 0x19, 0xfc, 0x81, 0x13, 0xe8, 0x85, 0xc8, 0x38, 0x5e, 0x33, 0xd2, + 0xe7, 0x43, 0x44, 0xf4, 0x61, 0x82, 0x53, 0x2c, 0x89, 0x0c, 0xd6, 0x8f, 0xd7, 0xea, 0xbf, 0xf7, + 0x71, 0x1f, 0x53, 0xd4, 0xc8, 0x7e, 0x31, 0x41, 0x5d, 0xf1, 0x30, 0x89, 0x30, 0x31, 0x7a, 0x90, + 0x64, 0xcd, 0x3d, 0x94, 0xc2, 0x35, 0xc3, 0xc3, 0x41, 0xcc, 0xf8, 0x95, 0x77, 0x05, 0x50, 0xb2, + 0x11, 0x19, 0x85, 0xa9, 0xf4, 0x0f, 0x10, 0xbd, 0x30, 0x40, 0x71, 0xea, 0x06, 0xbe, 0x2c, 0x68, + 0x42, 0x43, 0x6c, 0x2e, 0x4c, 0xc6, 0x6a, 0xb9, 0x45, 0x41, 0xab, 0x6d, 0x97, 0x19, 0x6d, 0xf9, + 0xd2, 0x06, 0xa8, 0xb1, 0x83, 0x5d, 0xe2, 0x25, 0xc1, 0x90, 0x76, 0xe4, 0x35, 0xa1, 0x51, 0x6c, + 0x4a, 0x93, 0xb1, 0x5a, 0xdd, 0xa3, 0x9c, 0x43, 0x29, 0xab, 0x6d, 0x57, 0xf1, 0xd5, 0xda, 0x97, + 0xea, 0xa0, 0xec, 0xc1, 0x30, 0xf4, 0x61, 0x0a, 0xe5, 0x82, 0x26, 0x34, 0x16, 0xec, 0xcb, 0x5a, + 0xfa, 0x0b, 0x88, 0x90, 0x0c, 0x5c, 0x0f, 0x8f, 0xe2, 0x54, 0x2e, 0x66, 0x23, 0xed, 0x32, 0x24, + 0x83, 0x56, 0x56, 0x67, 0x64, 0x14, 0xc4, 0x9c, 0x9c, 0x63, 0x64, 0x14, 0xc4, 0x8c, 0xfc, 0x0f, + 0x80, 0x04, 0x3d, 0x19, 0x21, 0x42, 0xdf, 0xa6, 0x44, 0xdf, 0x66, 0x71, 0x32, 0x56, 0x45, 0x9b, + 0xa1, 0x56, 0xdb, 0x16, 0xb9, 0xc0, 0xf2, 0xe9, 0x39, 0x31, 0xe1, 0xa3, 0xe6, 0xf9, 0x39, 0x31, + 0x61, 0xa3, 0xfe, 0x06, 0x0b, 0xd3, 0x51, 0x69, 0x10, 0x21, 0xb9, 0xac, 0x09, 0x8d, 0x82, 0x5d, + 0xe1, 0xd8, 0x7e, 0x10, 0x21, 0x26, 0x21, 0x38, 0x3c, 0x46, 0x4c, 0x22, 0x4e, 0x25, 0x14, 0xa3, + 0x92, 0x87, 0xa0, 0x3a, 0x95, 0x90, 0x14, 0xa6, 0x23, 0x22, 0x03, 0x4d, 0x68, 0x54, 0xd7, 0x65, + 0xfd, 0x72, 0x69, 0xba, 0x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+func (this *Result) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Result) + if !ok { + that2, ok := that.(Result) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ClientID != that1.ClientID { + return false + } + if this.OracleScriptID != that1.OracleScriptID { + return false + } + if !bytes.Equal(this.Calldata, that1.Calldata) { + return false + } + if this.AskCount != that1.AskCount { + return false + } + if this.MinCount != that1.MinCount { + return false + } + if this.RequestID != that1.RequestID { + return false + } + if this.AnsCount != that1.AnsCount { + return false + } + if this.RequestTime != that1.RequestTime { + return false + } + if this.ResolveTime != that1.ResolveTime { + return false + } + if this.ResolveStatus != that1.ResolveStatus { + return false + } + if !bytes.Equal(this.Result, that1.Result) { + return false + } + return true +} func (this *OracleRequestPacketData) Equal(that interface{}) bool { if that == nil { return this == nil @@ -508,6 +713,90 @@ func (this *OracleResponsePacketData) Equal(that interface{}) bool { } return true } +func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x5a + } + if m.ResolveStatus != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveStatus)) + i-- + dAtA[i] = 0x50 + } + if m.ResolveTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveTime)) + i-- + dAtA[i] = 0x48 + } + if m.RequestTime != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RequestTime)) + i-- + dAtA[i] = 0x40 + } + if m.AnsCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AnsCount)) + i-- + dAtA[i] = 0x38 + } + if m.RequestID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.RequestID)) + i-- + dAtA[i] = 0x30 + } + if m.MinCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x28 + } + if m.AskCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AskCount)) + i-- + dAtA[i] = 0x20 + } + if len(m.Calldata) > 0 { + i -= len(m.Calldata) + copy(dAtA[i:], m.Calldata) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Calldata))) + i-- + dAtA[i] = 0x1a + } + if m.OracleScriptID != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.OracleScriptID)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClientID) > 0 { + i -= len(m.ClientID) + copy(dAtA[i:], m.ClientID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *OracleRequestPacketData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -529,12 +818,12 @@ func (m *OracleRequestPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) var l int _ = l if m.ExecuteGas != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.ExecuteGas)) + i = encodeVarintTypes(dAtA, i, uint64(m.ExecuteGas)) i-- dAtA[i] = 0x40 } if m.PrepareGas != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.PrepareGas)) + i = encodeVarintTypes(dAtA, i, uint64(m.PrepareGas)) i-- dAtA[i] = 0x38 } @@ -546,38 +835,38 @@ func (m *OracleRequestPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) return 0, err } i -= size - i = encodeVarintPacket(dAtA, i, uint64(size)) + i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x32 } } if m.MinCount != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.MinCount)) + i = encodeVarintTypes(dAtA, i, uint64(m.MinCount)) i-- dAtA[i] = 0x28 } if m.AskCount != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.AskCount)) + i = encodeVarintTypes(dAtA, i, uint64(m.AskCount)) i-- dAtA[i] = 0x20 } if len(m.Calldata) > 0 { i -= len(m.Calldata) copy(dAtA[i:], m.Calldata) - i = encodeVarintPacket(dAtA, i, uint64(len(m.Calldata))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Calldata))) i-- dAtA[i] = 0x1a } if m.OracleScriptID != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.OracleScriptID)) + i = encodeVarintTypes(dAtA, i, uint64(m.OracleScriptID)) i-- dAtA[i] = 0x10 } if len(m.ClientID) > 0 { i -= len(m.ClientID) copy(dAtA[i:], m.ClientID) - i = encodeVarintPacket(dAtA, i, uint64(len(m.ClientID))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) i-- dAtA[i] = 0xa } @@ -605,7 +894,7 @@ func (m *OracleRequestPacketAcknowledgement) MarshalToSizedBuffer(dAtA []byte) ( var l int _ = l if m.RequestID != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.RequestID)) + i = encodeVarintTypes(dAtA, i, uint64(m.RequestID)) i-- dAtA[i] = 0x8 } @@ -635,47 +924,47 @@ func (m *OracleResponsePacketData) MarshalToSizedBuffer(dAtA []byte) (int, error if len(m.Result) > 0 { i -= len(m.Result) copy(dAtA[i:], m.Result) - i = encodeVarintPacket(dAtA, i, uint64(len(m.Result))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Result))) i-- dAtA[i] = 0x3a } if m.ResolveStatus != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.ResolveStatus)) + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveStatus)) i-- dAtA[i] = 0x30 } if m.ResolveTime != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.ResolveTime)) + i = encodeVarintTypes(dAtA, i, uint64(m.ResolveTime)) i-- dAtA[i] = 0x28 } if m.RequestTime != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.RequestTime)) + i = encodeVarintTypes(dAtA, i, uint64(m.RequestTime)) i-- dAtA[i] = 0x20 } if m.AnsCount != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.AnsCount)) + i = encodeVarintTypes(dAtA, i, uint64(m.AnsCount)) i-- dAtA[i] = 0x18 } if m.RequestID != 0 { - i = encodeVarintPacket(dAtA, i, uint64(m.RequestID)) + i = encodeVarintTypes(dAtA, i, uint64(m.RequestID)) i-- dAtA[i] = 0x10 } if len(m.ClientID) > 0 { i -= len(m.ClientID) copy(dAtA[i:], m.ClientID) - i = encodeVarintPacket(dAtA, i, uint64(len(m.ClientID))) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func encodeVarintPacket(dAtA []byte, offset int, v uint64) int { - offset -= sovPacket(v) +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -685,7 +974,7 @@ func encodeVarintPacket(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *OracleRequestPacketData) Size() (n int) { +func (m *Result) Size() (n int) { if m == nil { return 0 } @@ -693,46 +982,91 @@ func (m *OracleRequestPacketData) Size() (n int) { _ = l l = len(m.ClientID) if l > 0 { - n += 1 + l + sovPacket(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.OracleScriptID != 0 { - n += 1 + sovPacket(uint64(m.OracleScriptID)) + n += 1 + sovTypes(uint64(m.OracleScriptID)) } l = len(m.Calldata) if l > 0 { - n += 1 + l + sovPacket(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.AskCount != 0 { - n += 1 + sovPacket(uint64(m.AskCount)) + n += 1 + sovTypes(uint64(m.AskCount)) } if m.MinCount != 0 { - n += 1 + sovPacket(uint64(m.MinCount)) + n += 1 + sovTypes(uint64(m.MinCount)) } - if len(m.FeeLimit) > 0 { - for _, e := range m.FeeLimit { - l = e.Size() - n += 1 + l + sovPacket(uint64(l)) - } + if m.RequestID != 0 { + n += 1 + sovTypes(uint64(m.RequestID)) } - if m.PrepareGas != 0 { - n += 1 + sovPacket(uint64(m.PrepareGas)) + if m.AnsCount != 0 { + n += 1 + sovTypes(uint64(m.AnsCount)) } - if m.ExecuteGas != 0 { - n += 1 + sovPacket(uint64(m.ExecuteGas)) + if m.RequestTime != 0 { + n += 1 + sovTypes(uint64(m.RequestTime)) + } + if m.ResolveTime != 0 { + n += 1 + sovTypes(uint64(m.ResolveTime)) + } + if m.ResolveStatus != 0 { + n += 1 + sovTypes(uint64(m.ResolveStatus)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) } return n } -func (m *OracleRequestPacketAcknowledgement) Size() (n int) { +func (m *OracleRequestPacketData) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.RequestID != 0 { - n += 1 + sovPacket(uint64(m.RequestID)) + l = len(m.ClientID) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) } - return n + if m.OracleScriptID != 0 { + n += 1 + sovTypes(uint64(m.OracleScriptID)) + } + l = len(m.Calldata) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.AskCount != 0 { + n += 1 + sovTypes(uint64(m.AskCount)) + } + if m.MinCount != 0 { + n += 1 + sovTypes(uint64(m.MinCount)) + } + if len(m.FeeLimit) > 0 { + for _, e := range m.FeeLimit { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.PrepareGas != 0 { + n += 1 + sovTypes(uint64(m.PrepareGas)) + } + if m.ExecuteGas != 0 { + n += 1 + sovTypes(uint64(m.ExecuteGas)) + } + return n +} + +func (m *OracleRequestPacketAcknowledgement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestID != 0 { + n += 1 + sovTypes(uint64(m.RequestID)) + } + return n } func (m *OracleResponsePacketData) Size() (n int) { @@ -743,35 +1077,337 @@ func (m *OracleResponsePacketData) Size() (n int) { _ = l l = len(m.ClientID) if l > 0 { - n += 1 + l + sovPacket(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.RequestID != 0 { - n += 1 + sovPacket(uint64(m.RequestID)) + n += 1 + sovTypes(uint64(m.RequestID)) } if m.AnsCount != 0 { - n += 1 + sovPacket(uint64(m.AnsCount)) + n += 1 + sovTypes(uint64(m.AnsCount)) } if m.RequestTime != 0 { - n += 1 + sovPacket(uint64(m.RequestTime)) + n += 1 + sovTypes(uint64(m.RequestTime)) } if m.ResolveTime != 0 { - n += 1 + sovPacket(uint64(m.ResolveTime)) + n += 1 + sovTypes(uint64(m.ResolveTime)) } if m.ResolveStatus != 0 { - n += 1 + sovPacket(uint64(m.ResolveStatus)) + n += 1 + sovTypes(uint64(m.ResolveStatus)) } l = len(m.Result) if l > 0 { - n += 1 + l + sovPacket(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } return n } -func sovPacket(x uint64) (n int) { +func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozPacket(x uint64) (n int) { - return sovPacket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Result) 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 ErrIntOverflowTypes + } + 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: Result: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) + } + m.OracleScriptID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OracleScriptID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) + if m.Calldata == nil { + m.Calldata = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) + } + m.AskCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AskCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) + } + m.RequestID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) + } + m.AnsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AnsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) + } + m.RequestTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) + } + m.ResolveTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) + } + m.ResolveStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResolveStatus |= ResolveStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) + if m.Result == nil { + m.Result = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -781,7 +1417,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -809,7 +1445,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -823,11 +1459,11 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -841,7 +1477,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { m.OracleScriptID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -860,7 +1496,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -873,11 +1509,11 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -894,7 +1530,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { m.AskCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -913,7 +1549,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { m.MinCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -932,7 +1568,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -945,11 +1581,11 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -966,7 +1602,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { m.PrepareGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -985,7 +1621,7 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { m.ExecuteGas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -999,12 +1635,12 @@ func (m *OracleRequestPacketData) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipPacket(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1026,7 +1662,7 @@ func (m *OracleRequestPacketAcknowledgement) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1054,7 +1690,7 @@ func (m *OracleRequestPacketAcknowledgement) Unmarshal(dAtA []byte) error { m.RequestID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1068,12 +1704,12 @@ func (m *OracleRequestPacketAcknowledgement) Unmarshal(dAtA []byte) error { } default: iNdEx = preIndex - skippy, err := skipPacket(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1095,7 +1731,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1123,7 +1759,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1137,11 +1773,11 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -1155,7 +1791,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { m.RequestID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1174,7 +1810,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { m.AnsCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1193,7 +1829,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { m.RequestTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1212,7 +1848,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { m.ResolveTime = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1231,7 +1867,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { m.ResolveStatus = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1250,7 +1886,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowPacket + return ErrIntOverflowTypes } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1263,11 +1899,11 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF @@ -1279,12 +1915,12 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipPacket(dAtA[iNdEx:]) + skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPacket + return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1298,7 +1934,7 @@ func (m *OracleResponsePacketData) Unmarshal(dAtA []byte) error { } return nil } -func skipPacket(dAtA []byte) (n int, err error) { +func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1306,7 +1942,7 @@ func skipPacket(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPacket + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1323,7 +1959,7 @@ func skipPacket(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPacket + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1339,7 +1975,7 @@ func skipPacket(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowPacket + return 0, ErrIntOverflowTypes } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1352,14 +1988,14 @@ func skipPacket(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthPacket + return 0, ErrInvalidLengthTypes } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPacket + return 0, ErrUnexpectedEndOfGroupTypes } depth-- case 5: @@ -1368,7 +2004,7 @@ func skipPacket(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthPacket + return 0, ErrInvalidLengthTypes } if depth == 0 { return iNdEx, nil @@ -1378,7 +2014,7 @@ func skipPacket(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthPacket = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPacket = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPacket = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") ) diff --git a/proto/oracle/v1/packet/packet.proto b/proto/oracle/v1/types.proto similarity index 68% rename from proto/oracle/v1/packet/packet.proto rename to proto/oracle/v1/types.proto index 244445b..5781019 100644 --- a/proto/oracle/v1/packet/packet.proto +++ b/proto/oracle/v1/types.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package oracle.v1.packet; +package oracle.v1; option go_package = "github.com/bandprotocol/bandchain-packet/packet"; @@ -25,6 +25,44 @@ enum ResolveStatus { [ (gogoproto.enumvalue_customname) = "RESOLVE_STATUS_EXPIRED" ]; } +// Result encodes a result of request and store in chain +message Result { + option (gogoproto.equal) = true; + // ClientID is the unique identifier of this oracle request, as specified by + // the client. This same unique ID will be sent back to the requester with the + // oracle response. + string client_id = 1 [ (gogoproto.customname) = "ClientID" ]; + // OracleScriptID is the unique identifier of the oracle script to be + // executed. + uint64 oracle_script_id = 2 [ (gogoproto.customname) = "OracleScriptID" ]; + // Calldata is the calldata bytes available for oracle executor to read. + bytes calldata = 3; + // AskCount is the number of validators that are requested to respond to this + // oracle request. Higher value means more security, at a higher gas cost. + uint64 ask_count = 4; + // MinCount is the minimum number of validators necessary for the request to + // proceed to the execution phase. Higher value means more security, at the + // cost of liveness. + uint64 min_count = 5; + // RequestID is BandChain's unique identifier for this oracle request. + uint64 request_id = 6 [ (gogoproto.customname) = "RequestID" ]; + // AnsCount is the number of validators among to the asked validators that + // actually responded to this oracle request prior to this oracle request + // being resolved. + uint64 ans_count = 7; + // RequestTime is the UNIX epoch time at which the request was sent to + // BandChain. + int64 request_time = 8; + // ResolveTime is the UNIX epoch time at which the request was resolved to the + // final result. + int64 resolve_time = 9; + // ResolveStatus is the status of this oracle request, which can be OK, + // FAILURE, or EXPIRED. + ResolveStatus resolve_status = 10; + // Result is the final aggregated value only available if status if OK. + bytes result = 11; +} + // OracleRequestPacketData encodes an oracle request sent from other blockchains // to BandChain. message OracleRequestPacketData { diff --git a/proto/oracle/v1/types/types.proto b/proto/oracle/v1/types/types.proto deleted file mode 100644 index f463439..0000000 --- a/proto/oracle/v1/types/types.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; -package oracle.v1.types; - -option go_package = "github.com/bandprotocol/bandchain-packet/types"; - -import "gogoproto/gogo.proto"; -import "oracle/v1/packet/packet.proto"; - -// Result encodes a result of request and store in chain -message Result { - option (gogoproto.equal) = true; - // ClientID is the unique identifier of this oracle request, as specified by - // the client. This same unique ID will be sent back to the requester with the - // oracle response. - string client_id = 1 [ (gogoproto.customname) = "ClientID" ]; - // OracleScriptID is the unique identifier of the oracle script to be - // executed. - uint64 oracle_script_id = 2 [ - (gogoproto.customname) = "OracleScriptID", - (gogoproto.casttype) = "OracleScriptID" - ]; - // Calldata is the calldata bytes available for oracle executor to read. - bytes calldata = 3; - // AskCount is the number of validators that are requested to respond to this - // oracle request. Higher value means more security, at a higher gas cost. - uint64 ask_count = 4; - // MinCount is the minimum number of validators necessary for the request to - // proceed to the execution phase. Higher value means more security, at the - // cost of liveness. - uint64 min_count = 5; - // RequestID is BandChain's unique identifier for this oracle request. - uint64 request_id = 6 [ - (gogoproto.customname) = "RequestID", - (gogoproto.casttype) = "RequestID" - ]; - // AnsCount is the number of validators among to the asked validators that - // actually responded to this oracle request prior to this oracle request - // being resolved. - uint64 ans_count = 7; - // RequestTime is the UNIX epoch time at which the request was sent to - // BandChain. - int64 request_time = 8; - // ResolveTime is the UNIX epoch time at which the request was resolved to the - // final result. - int64 resolve_time = 9; - // ResolveStatus is the status of this oracle request, which can be OK, - // FAILURE, or EXPIRED. - packet.ResolveStatus resolve_status = 10; - // Result is the final aggregated value only available if status if OK. - bytes result = 11; -} diff --git a/types/types.pb.go b/types/types.pb.go deleted file mode 100644 index 330f3b5..0000000 --- a/types/types.pb.go +++ /dev/null @@ -1,797 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/v1/types/types.proto - -package types - -import ( - bytes "bytes" - fmt "fmt" - packet "github.com/bandprotocol/bandchain-packet/packet" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Result encodes a result of request and store in chain -type Result struct { - // ClientID is the unique identifier of this oracle request, as specified by - // the client. This same unique ID will be sent back to the requester with the - // oracle response. - ClientID string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - // OracleScriptID is the unique identifier of the oracle script to be - // executed. - OracleScriptID OracleScriptID `protobuf:"varint,2,opt,name=oracle_script_id,json=oracleScriptId,proto3,casttype=OracleScriptID" json:"oracle_script_id,omitempty"` - // Calldata is the calldata bytes available for oracle executor to read. - Calldata []byte `protobuf:"bytes,3,opt,name=calldata,proto3" json:"calldata,omitempty"` - // AskCount is the number of validators that are requested to respond to this - // oracle request. Higher value means more security, at a higher gas cost. - AskCount uint64 `protobuf:"varint,4,opt,name=ask_count,json=askCount,proto3" json:"ask_count,omitempty"` - // MinCount is the minimum number of validators necessary for the request to - // proceed to the execution phase. Higher value means more security, at the - // cost of liveness. - MinCount uint64 `protobuf:"varint,5,opt,name=min_count,json=minCount,proto3" json:"min_count,omitempty"` - // RequestID is BandChain's unique identifier for this oracle request. - RequestID RequestID `protobuf:"varint,6,opt,name=request_id,json=requestId,proto3,casttype=RequestID" json:"request_id,omitempty"` - // AnsCount is the number of validators among to the asked validators that - // actually responded to this oracle request prior to this oracle request - // being resolved. - AnsCount uint64 `protobuf:"varint,7,opt,name=ans_count,json=ansCount,proto3" json:"ans_count,omitempty"` - // RequestTime is the UNIX epoch time at which the request was sent to - // BandChain. - RequestTime int64 `protobuf:"varint,8,opt,name=request_time,json=requestTime,proto3" json:"request_time,omitempty"` - // ResolveTime is the UNIX epoch time at which the request was resolved to the - // final result. - ResolveTime int64 `protobuf:"varint,9,opt,name=resolve_time,json=resolveTime,proto3" json:"resolve_time,omitempty"` - // ResolveStatus is the status of this oracle request, which can be OK, - // FAILURE, or EXPIRED. - ResolveStatus packet.ResolveStatus `protobuf:"varint,10,opt,name=resolve_status,json=resolveStatus,proto3,enum=oracle.v1.packet.ResolveStatus" json:"resolve_status,omitempty"` - // Result is the final aggregated value only available if status if OK. - Result []byte `protobuf:"bytes,11,opt,name=result,proto3" json:"result,omitempty"` -} - -func (m *Result) Reset() { *m = Result{} } -func (m *Result) String() string { return proto.CompactTextString(m) } -func (*Result) ProtoMessage() {} -func (*Result) Descriptor() ([]byte, []int) { - return fileDescriptor_88f9ab87504e4f43, []int{0} -} -func (m *Result) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { - xxx_messageInfo_Result.Merge(m, src) -} -func (m *Result) XXX_Size() int { - return m.Size() -} -func (m *Result) XXX_DiscardUnknown() { - xxx_messageInfo_Result.DiscardUnknown(m) -} - -var xxx_messageInfo_Result proto.InternalMessageInfo - -func (m *Result) GetClientID() string { - if m != nil { - return m.ClientID - } - return "" -} - -func (m *Result) GetOracleScriptID() OracleScriptID { - if m != nil { - return m.OracleScriptID - } - return 0 -} - -func (m *Result) GetCalldata() []byte { - if m != nil { - return m.Calldata - } - return nil -} - -func (m *Result) GetAskCount() uint64 { - if m != nil { - return m.AskCount - } - return 0 -} - -func (m *Result) GetMinCount() uint64 { - if m != nil { - return m.MinCount - } - return 0 -} - -func (m *Result) GetRequestID() RequestID { - if m != nil { - return m.RequestID - } - return 0 -} - -func (m *Result) GetAnsCount() uint64 { - if m != nil { - return m.AnsCount - } - return 0 -} - -func (m *Result) GetRequestTime() int64 { - if m != nil { - return m.RequestTime - } - return 0 -} - -func (m *Result) GetResolveTime() int64 { - if m != nil { - return m.ResolveTime - } - return 0 -} - -func (m *Result) GetResolveStatus() packet.ResolveStatus { - if m != nil { - return m.ResolveStatus - } - return packet.RESOLVE_STATUS_OPEN -} - -func (m *Result) GetResult() []byte { - if m != nil { - return m.Result - } - return nil -} - -func init() { - proto.RegisterType((*Result)(nil), "oracle.v1.types.Result") -} - -func init() { proto.RegisterFile("oracle/v1/types/types.proto", fileDescriptor_88f9ab87504e4f43) } - -var fileDescriptor_88f9ab87504e4f43 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x92, 0xb1, 0x8e, 0xd3, 0x40, - 0x10, 0x86, 0xb3, 0x24, 0x04, 0x7b, 0x2f, 0x04, 0x64, 0x21, 0x64, 0xe5, 0x84, 0x6d, 0x10, 0x85, - 0x29, 0x70, 0x74, 0x50, 0x41, 0x99, 0x3b, 0x21, 0xdc, 0x80, 0xb4, 0x47, 0x45, 0x13, 0x6d, 0xd6, - 0xab, 0xdc, 0x2a, 0xf6, 0xae, 0xf1, 0xae, 0x23, 0xf1, 0x16, 0x3c, 0x02, 0x8f, 0x43, 0x79, 0x25, - 0x0d, 0x11, 0x72, 0x1a, 0x9e, 0x81, 0x0a, 0x79, 0x76, 0x43, 0x4e, 0xba, 0x26, 0xf1, 0xff, 0xff, - 0x9f, 0x67, 0x46, 0x9e, 0xc1, 0xa7, 0xaa, 0xa1, 0xac, 0xe4, 0xf3, 0xed, 0xd9, 0xdc, 0x7c, 0xad, - 0xb9, 0xb6, 0xbf, 0x59, 0xdd, 0x28, 0xa3, 0x82, 0x07, 0x36, 0x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x51, 0xf1, 0xd0, 0x4b, 0x50, 0x3a, 0x24, 0x27, 0xce, 0xfb, 0x24, 0x2a, 0x6e, 0x11, 0xad, 0xca, - 0x2d, 0xb7, 0x88, 0x7f, 0x40, 0xc0, 0x03, 0xe4, 0x1d, 0x9e, 0x1e, 0x10, 0x6d, 0xa8, 0x69, 0x75, - 0x88, 0x13, 0x94, 0x4e, 0x5f, 0xc5, 0xd9, 0x71, 0xb1, 0x6e, 0x55, 0xc4, 0x72, 0x97, 0x80, 0x91, - 0xfb, 0xcd, 0x4d, 0x19, 0x3c, 0xc6, 0xe3, 0x06, 0x16, 0x18, 0x9e, 0xc0, 0x97, 0x73, 0xea, 0xed, - 0xe8, 0xcf, 0xf7, 0x18, 0x2d, 0xde, 0xff, 0xe8, 0x22, 0x74, 0xdd, 0x45, 0xe8, 0x77, 0x17, 0xa1, - 0x6f, 0xfb, 0x68, 0x70, 0xbd, 0x8f, 0x06, 0x3f, 0xf7, 0xd1, 0xe0, 0x73, 0xb6, 0x16, 0xe6, 0xaa, - 0x5d, 0x65, 0x4c, 0x55, 0xf3, 0x15, 0x95, 0x05, 0xdc, 0x03, 0x53, 0x25, 0x08, 0x76, 0x45, 0x85, - 0x7c, 0xe9, 0x0e, 0x06, 0xce, 0x6b, 0x35, 0x06, 0xe0, 0xf5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x3a, 0x7d, 0x45, 0xc6, 0x95, 0x02, 0x00, 0x00, -} - -func (this *Result) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Result) - if !ok { - that2, ok := that.(Result) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ClientID != that1.ClientID { - return false - } - if this.OracleScriptID != that1.OracleScriptID { - return false - } - if !bytes.Equal(this.Calldata, that1.Calldata) { - return false - } - if this.AskCount != that1.AskCount { - return false - } - if this.MinCount != that1.MinCount { - return false - } - if this.RequestID != that1.RequestID { - return false - } - if this.AnsCount != that1.AnsCount { - return false - } - if this.RequestTime != that1.RequestTime { - return false - } - if this.ResolveTime != that1.ResolveTime { - return false - } - if this.ResolveStatus != that1.ResolveStatus { - return false - } - if !bytes.Equal(this.Result, that1.Result) { - return false - } - return true -} -func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Result) > 0 { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Result))) - i-- - dAtA[i] = 0x5a - } - if m.ResolveStatus != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ResolveStatus)) - i-- - dAtA[i] = 0x50 - } - if m.ResolveTime != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ResolveTime)) - i-- - dAtA[i] = 0x48 - } - if m.RequestTime != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.RequestTime)) - i-- - dAtA[i] = 0x40 - } - if m.AnsCount != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.AnsCount)) - i-- - dAtA[i] = 0x38 - } - if m.RequestID != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.RequestID)) - i-- - dAtA[i] = 0x30 - } - if m.MinCount != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.MinCount)) - i-- - dAtA[i] = 0x28 - } - if m.AskCount != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.AskCount)) - i-- - dAtA[i] = 0x20 - } - if len(m.Calldata) > 0 { - i -= len(m.Calldata) - copy(dAtA[i:], m.Calldata) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Calldata))) - i-- - dAtA[i] = 0x1a - } - if m.OracleScriptID != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.OracleScriptID)) - i-- - dAtA[i] = 0x10 - } - if len(m.ClientID) > 0 { - i -= len(m.ClientID) - copy(dAtA[i:], m.ClientID) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ClientID))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClientID) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.OracleScriptID != 0 { - n += 1 + sovTypes(uint64(m.OracleScriptID)) - } - l = len(m.Calldata) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.AskCount != 0 { - n += 1 + sovTypes(uint64(m.AskCount)) - } - if m.MinCount != 0 { - n += 1 + sovTypes(uint64(m.MinCount)) - } - if m.RequestID != 0 { - n += 1 + sovTypes(uint64(m.RequestID)) - } - if m.AnsCount != 0 { - n += 1 + sovTypes(uint64(m.AnsCount)) - } - if m.RequestTime != 0 { - n += 1 + sovTypes(uint64(m.RequestTime)) - } - if m.ResolveTime != 0 { - n += 1 + sovTypes(uint64(m.ResolveTime)) - } - if m.ResolveStatus != 0 { - n += 1 + sovTypes(uint64(m.ResolveStatus)) - } - l = len(m.Result) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Result) 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 ErrIntOverflowTypes - } - 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: Result: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OracleScriptID", wireType) - } - m.OracleScriptID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.OracleScriptID |= OracleScriptID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Calldata", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Calldata = append(m.Calldata[:0], dAtA[iNdEx:postIndex]...) - if m.Calldata == nil { - m.Calldata = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AskCount", wireType) - } - m.AskCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AskCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) - } - m.MinCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestID", wireType) - } - m.RequestID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestID |= RequestID(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AnsCount", wireType) - } - m.AnsCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AnsCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestTime", wireType) - } - m.RequestTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResolveTime", wireType) - } - m.ResolveTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResolveTime |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResolveStatus", wireType) - } - m.ResolveStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResolveStatus |= packet.ResolveStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Result = append(m.Result[:0], dAtA[iNdEx:postIndex]...) - if m.Result == nil { - m.Result = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTypes(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTypes - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTypes - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTypes - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTypes - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") -)