You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

838 lines
19 KiB

  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: crypto/merkle/merkle.proto
  3. package merkle
  4. import (
  5. bytes "bytes"
  6. fmt "fmt"
  7. _ "github.com/gogo/protobuf/gogoproto"
  8. proto "github.com/gogo/protobuf/proto"
  9. io "io"
  10. math "math"
  11. math_bits "math/bits"
  12. )
  13. // Reference imports to suppress errors if they are not otherwise used.
  14. var _ = proto.Marshal
  15. var _ = fmt.Errorf
  16. var _ = math.Inf
  17. // This is a compile-time assertion to ensure that this generated file
  18. // is compatible with the proto package it is being compiled against.
  19. // A compilation error at this line likely means your copy of the
  20. // proto package needs to be updated.
  21. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
  22. // ProofOp defines an operation used for calculating Merkle root
  23. // The data could be arbitrary format, providing nessecary data
  24. // for example neighbouring node hash
  25. type ProofOp struct {
  26. Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
  27. Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
  28. Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
  29. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  30. XXX_unrecognized []byte `json:"-"`
  31. XXX_sizecache int32 `json:"-"`
  32. }
  33. func (m *ProofOp) Reset() { *m = ProofOp{} }
  34. func (m *ProofOp) String() string { return proto.CompactTextString(m) }
  35. func (*ProofOp) ProtoMessage() {}
  36. func (*ProofOp) Descriptor() ([]byte, []int) {
  37. return fileDescriptor_9c1c2162d560d38e, []int{0}
  38. }
  39. func (m *ProofOp) XXX_Unmarshal(b []byte) error {
  40. return m.Unmarshal(b)
  41. }
  42. func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  43. if deterministic {
  44. return xxx_messageInfo_ProofOp.Marshal(b, m, deterministic)
  45. } else {
  46. b = b[:cap(b)]
  47. n, err := m.MarshalToSizedBuffer(b)
  48. if err != nil {
  49. return nil, err
  50. }
  51. return b[:n], nil
  52. }
  53. }
  54. func (m *ProofOp) XXX_Merge(src proto.Message) {
  55. xxx_messageInfo_ProofOp.Merge(m, src)
  56. }
  57. func (m *ProofOp) XXX_Size() int {
  58. return m.Size()
  59. }
  60. func (m *ProofOp) XXX_DiscardUnknown() {
  61. xxx_messageInfo_ProofOp.DiscardUnknown(m)
  62. }
  63. var xxx_messageInfo_ProofOp proto.InternalMessageInfo
  64. func (m *ProofOp) GetType() string {
  65. if m != nil {
  66. return m.Type
  67. }
  68. return ""
  69. }
  70. func (m *ProofOp) GetKey() []byte {
  71. if m != nil {
  72. return m.Key
  73. }
  74. return nil
  75. }
  76. func (m *ProofOp) GetData() []byte {
  77. if m != nil {
  78. return m.Data
  79. }
  80. return nil
  81. }
  82. // Proof is Merkle proof defined by the list of ProofOps
  83. type Proof struct {
  84. Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"`
  85. XXX_NoUnkeyedLiteral struct{} `json:"-"`
  86. XXX_unrecognized []byte `json:"-"`
  87. XXX_sizecache int32 `json:"-"`
  88. }
  89. func (m *Proof) Reset() { *m = Proof{} }
  90. func (m *Proof) String() string { return proto.CompactTextString(m) }
  91. func (*Proof) ProtoMessage() {}
  92. func (*Proof) Descriptor() ([]byte, []int) {
  93. return fileDescriptor_9c1c2162d560d38e, []int{1}
  94. }
  95. func (m *Proof) XXX_Unmarshal(b []byte) error {
  96. return m.Unmarshal(b)
  97. }
  98. func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  99. if deterministic {
  100. return xxx_messageInfo_Proof.Marshal(b, m, deterministic)
  101. } else {
  102. b = b[:cap(b)]
  103. n, err := m.MarshalToSizedBuffer(b)
  104. if err != nil {
  105. return nil, err
  106. }
  107. return b[:n], nil
  108. }
  109. }
  110. func (m *Proof) XXX_Merge(src proto.Message) {
  111. xxx_messageInfo_Proof.Merge(m, src)
  112. }
  113. func (m *Proof) XXX_Size() int {
  114. return m.Size()
  115. }
  116. func (m *Proof) XXX_DiscardUnknown() {
  117. xxx_messageInfo_Proof.DiscardUnknown(m)
  118. }
  119. var xxx_messageInfo_Proof proto.InternalMessageInfo
  120. func (m *Proof) GetOps() []ProofOp {
  121. if m != nil {
  122. return m.Ops
  123. }
  124. return nil
  125. }
  126. func init() {
  127. proto.RegisterType((*ProofOp)(nil), "tendermint.crypto.merkle.ProofOp")
  128. proto.RegisterType((*Proof)(nil), "tendermint.crypto.merkle.Proof")
  129. }
  130. func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_9c1c2162d560d38e) }
  131. var fileDescriptor_9c1c2162d560d38e = []byte{
  132. // 226 bytes of a gzipped FileDescriptorProto
  133. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c,
  134. 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25,
  135. 0xf9, 0x42, 0x12, 0x25, 0xa9, 0x79, 0x29, 0xa9, 0x45, 0xb9, 0x99, 0x79, 0x25, 0x7a, 0x10, 0x65,
  136. 0x7a, 0x10, 0x79, 0x29, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd,
  137. 0xf4, 0xfc, 0xf4, 0x7c, 0x7d, 0xb0, 0x86, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20,
  138. 0x06, 0x29, 0x39, 0x73, 0xb1, 0x07, 0x14, 0xe5, 0xe7, 0xa7, 0xf9, 0x17, 0x08, 0x09, 0x71, 0xb1,
  139. 0x94, 0x54, 0x16, 0xa4, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x02, 0x5c,
  140. 0xcc, 0xd9, 0xa9, 0x95, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x20, 0x26, 0x48, 0x55, 0x4a,
  141. 0x62, 0x49, 0xa2, 0x04, 0x33, 0x58, 0x08, 0xcc, 0x56, 0x72, 0xe2, 0x62, 0x05, 0x1b, 0x22, 0x64,
  142. 0xc9, 0xc5, 0x9c, 0x5f, 0x50, 0x2c, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa8, 0x87, 0xcb,
  143. 0x91, 0x7a, 0x50, 0x2b, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x02, 0xe9, 0x71, 0x72, 0xf9,
  144. 0xf1, 0x50, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63,
  145. 0x7c, 0xf0, 0x48, 0x8e, 0x31, 0x4a, 0x0f, 0xc9, 0x37, 0x08, 0xd3, 0x90, 0x99, 0x28, 0x81, 0x94,
  146. 0xc4, 0x06, 0xf6, 0x95, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x95, 0x22, 0x4e, 0x3c, 0x01,
  147. 0x00, 0x00,
  148. }
  149. func (this *ProofOp) Equal(that interface{}) bool {
  150. if that == nil {
  151. return this == nil
  152. }
  153. that1, ok := that.(*ProofOp)
  154. if !ok {
  155. that2, ok := that.(ProofOp)
  156. if ok {
  157. that1 = &that2
  158. } else {
  159. return false
  160. }
  161. }
  162. if that1 == nil {
  163. return this == nil
  164. } else if this == nil {
  165. return false
  166. }
  167. if this.Type != that1.Type {
  168. return false
  169. }
  170. if !bytes.Equal(this.Key, that1.Key) {
  171. return false
  172. }
  173. if !bytes.Equal(this.Data, that1.Data) {
  174. return false
  175. }
  176. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  177. return false
  178. }
  179. return true
  180. }
  181. func (this *Proof) Equal(that interface{}) bool {
  182. if that == nil {
  183. return this == nil
  184. }
  185. that1, ok := that.(*Proof)
  186. if !ok {
  187. that2, ok := that.(Proof)
  188. if ok {
  189. that1 = &that2
  190. } else {
  191. return false
  192. }
  193. }
  194. if that1 == nil {
  195. return this == nil
  196. } else if this == nil {
  197. return false
  198. }
  199. if len(this.Ops) != len(that1.Ops) {
  200. return false
  201. }
  202. for i := range this.Ops {
  203. if !this.Ops[i].Equal(&that1.Ops[i]) {
  204. return false
  205. }
  206. }
  207. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  208. return false
  209. }
  210. return true
  211. }
  212. func (m *ProofOp) Marshal() (dAtA []byte, err error) {
  213. size := m.Size()
  214. dAtA = make([]byte, size)
  215. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  216. if err != nil {
  217. return nil, err
  218. }
  219. return dAtA[:n], nil
  220. }
  221. func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) {
  222. size := m.Size()
  223. return m.MarshalToSizedBuffer(dAtA[:size])
  224. }
  225. func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  226. i := len(dAtA)
  227. _ = i
  228. var l int
  229. _ = l
  230. if m.XXX_unrecognized != nil {
  231. i -= len(m.XXX_unrecognized)
  232. copy(dAtA[i:], m.XXX_unrecognized)
  233. }
  234. if len(m.Data) > 0 {
  235. i -= len(m.Data)
  236. copy(dAtA[i:], m.Data)
  237. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data)))
  238. i--
  239. dAtA[i] = 0x1a
  240. }
  241. if len(m.Key) > 0 {
  242. i -= len(m.Key)
  243. copy(dAtA[i:], m.Key)
  244. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key)))
  245. i--
  246. dAtA[i] = 0x12
  247. }
  248. if len(m.Type) > 0 {
  249. i -= len(m.Type)
  250. copy(dAtA[i:], m.Type)
  251. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type)))
  252. i--
  253. dAtA[i] = 0xa
  254. }
  255. return len(dAtA) - i, nil
  256. }
  257. func (m *Proof) Marshal() (dAtA []byte, err error) {
  258. size := m.Size()
  259. dAtA = make([]byte, size)
  260. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  261. if err != nil {
  262. return nil, err
  263. }
  264. return dAtA[:n], nil
  265. }
  266. func (m *Proof) MarshalTo(dAtA []byte) (int, error) {
  267. size := m.Size()
  268. return m.MarshalToSizedBuffer(dAtA[:size])
  269. }
  270. func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  271. i := len(dAtA)
  272. _ = i
  273. var l int
  274. _ = l
  275. if m.XXX_unrecognized != nil {
  276. i -= len(m.XXX_unrecognized)
  277. copy(dAtA[i:], m.XXX_unrecognized)
  278. }
  279. if len(m.Ops) > 0 {
  280. for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- {
  281. {
  282. size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i])
  283. if err != nil {
  284. return 0, err
  285. }
  286. i -= size
  287. i = encodeVarintMerkle(dAtA, i, uint64(size))
  288. }
  289. i--
  290. dAtA[i] = 0xa
  291. }
  292. }
  293. return len(dAtA) - i, nil
  294. }
  295. func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int {
  296. offset -= sovMerkle(v)
  297. base := offset
  298. for v >= 1<<7 {
  299. dAtA[offset] = uint8(v&0x7f | 0x80)
  300. v >>= 7
  301. offset++
  302. }
  303. dAtA[offset] = uint8(v)
  304. return base
  305. }
  306. func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp {
  307. this := &ProofOp{}
  308. this.Type = string(randStringMerkle(r))
  309. v1 := r.Intn(100)
  310. this.Key = make([]byte, v1)
  311. for i := 0; i < v1; i++ {
  312. this.Key[i] = byte(r.Intn(256))
  313. }
  314. v2 := r.Intn(100)
  315. this.Data = make([]byte, v2)
  316. for i := 0; i < v2; i++ {
  317. this.Data[i] = byte(r.Intn(256))
  318. }
  319. if !easy && r.Intn(10) != 0 {
  320. this.XXX_unrecognized = randUnrecognizedMerkle(r, 4)
  321. }
  322. return this
  323. }
  324. func NewPopulatedProof(r randyMerkle, easy bool) *Proof {
  325. this := &Proof{}
  326. if r.Intn(5) != 0 {
  327. v3 := r.Intn(5)
  328. this.Ops = make([]ProofOp, v3)
  329. for i := 0; i < v3; i++ {
  330. v4 := NewPopulatedProofOp(r, easy)
  331. this.Ops[i] = *v4
  332. }
  333. }
  334. if !easy && r.Intn(10) != 0 {
  335. this.XXX_unrecognized = randUnrecognizedMerkle(r, 2)
  336. }
  337. return this
  338. }
  339. type randyMerkle interface {
  340. Float32() float32
  341. Float64() float64
  342. Int63() int64
  343. Int31() int32
  344. Uint32() uint32
  345. Intn(n int) int
  346. }
  347. func randUTF8RuneMerkle(r randyMerkle) rune {
  348. ru := r.Intn(62)
  349. if ru < 10 {
  350. return rune(ru + 48)
  351. } else if ru < 36 {
  352. return rune(ru + 55)
  353. }
  354. return rune(ru + 61)
  355. }
  356. func randStringMerkle(r randyMerkle) string {
  357. v5 := r.Intn(100)
  358. tmps := make([]rune, v5)
  359. for i := 0; i < v5; i++ {
  360. tmps[i] = randUTF8RuneMerkle(r)
  361. }
  362. return string(tmps)
  363. }
  364. func randUnrecognizedMerkle(r randyMerkle, maxFieldNumber int) (dAtA []byte) {
  365. l := r.Intn(5)
  366. for i := 0; i < l; i++ {
  367. wire := r.Intn(4)
  368. if wire == 3 {
  369. wire = 5
  370. }
  371. fieldNumber := maxFieldNumber + r.Intn(100)
  372. dAtA = randFieldMerkle(dAtA, r, fieldNumber, wire)
  373. }
  374. return dAtA
  375. }
  376. func randFieldMerkle(dAtA []byte, r randyMerkle, fieldNumber int, wire int) []byte {
  377. key := uint32(fieldNumber)<<3 | uint32(wire)
  378. switch wire {
  379. case 0:
  380. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key))
  381. v6 := r.Int63()
  382. if r.Intn(2) == 0 {
  383. v6 *= -1
  384. }
  385. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(v6))
  386. case 1:
  387. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key))
  388. dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  389. case 2:
  390. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key))
  391. ll := r.Intn(100)
  392. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(ll))
  393. for j := 0; j < ll; j++ {
  394. dAtA = append(dAtA, byte(r.Intn(256)))
  395. }
  396. default:
  397. dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key))
  398. dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  399. }
  400. return dAtA
  401. }
  402. func encodeVarintPopulateMerkle(dAtA []byte, v uint64) []byte {
  403. for v >= 1<<7 {
  404. dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
  405. v >>= 7
  406. }
  407. dAtA = append(dAtA, uint8(v))
  408. return dAtA
  409. }
  410. func (m *ProofOp) Size() (n int) {
  411. if m == nil {
  412. return 0
  413. }
  414. var l int
  415. _ = l
  416. l = len(m.Type)
  417. if l > 0 {
  418. n += 1 + l + sovMerkle(uint64(l))
  419. }
  420. l = len(m.Key)
  421. if l > 0 {
  422. n += 1 + l + sovMerkle(uint64(l))
  423. }
  424. l = len(m.Data)
  425. if l > 0 {
  426. n += 1 + l + sovMerkle(uint64(l))
  427. }
  428. if m.XXX_unrecognized != nil {
  429. n += len(m.XXX_unrecognized)
  430. }
  431. return n
  432. }
  433. func (m *Proof) Size() (n int) {
  434. if m == nil {
  435. return 0
  436. }
  437. var l int
  438. _ = l
  439. if len(m.Ops) > 0 {
  440. for _, e := range m.Ops {
  441. l = e.Size()
  442. n += 1 + l + sovMerkle(uint64(l))
  443. }
  444. }
  445. if m.XXX_unrecognized != nil {
  446. n += len(m.XXX_unrecognized)
  447. }
  448. return n
  449. }
  450. func sovMerkle(x uint64) (n int) {
  451. return (math_bits.Len64(x|1) + 6) / 7
  452. }
  453. func sozMerkle(x uint64) (n int) {
  454. return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  455. }
  456. func (m *ProofOp) Unmarshal(dAtA []byte) error {
  457. l := len(dAtA)
  458. iNdEx := 0
  459. for iNdEx < l {
  460. preIndex := iNdEx
  461. var wire uint64
  462. for shift := uint(0); ; shift += 7 {
  463. if shift >= 64 {
  464. return ErrIntOverflowMerkle
  465. }
  466. if iNdEx >= l {
  467. return io.ErrUnexpectedEOF
  468. }
  469. b := dAtA[iNdEx]
  470. iNdEx++
  471. wire |= uint64(b&0x7F) << shift
  472. if b < 0x80 {
  473. break
  474. }
  475. }
  476. fieldNum := int32(wire >> 3)
  477. wireType := int(wire & 0x7)
  478. if wireType == 4 {
  479. return fmt.Errorf("proto: ProofOp: wiretype end group for non-group")
  480. }
  481. if fieldNum <= 0 {
  482. return fmt.Errorf("proto: ProofOp: illegal tag %d (wire type %d)", fieldNum, wire)
  483. }
  484. switch fieldNum {
  485. case 1:
  486. if wireType != 2 {
  487. return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
  488. }
  489. var stringLen uint64
  490. for shift := uint(0); ; shift += 7 {
  491. if shift >= 64 {
  492. return ErrIntOverflowMerkle
  493. }
  494. if iNdEx >= l {
  495. return io.ErrUnexpectedEOF
  496. }
  497. b := dAtA[iNdEx]
  498. iNdEx++
  499. stringLen |= uint64(b&0x7F) << shift
  500. if b < 0x80 {
  501. break
  502. }
  503. }
  504. intStringLen := int(stringLen)
  505. if intStringLen < 0 {
  506. return ErrInvalidLengthMerkle
  507. }
  508. postIndex := iNdEx + intStringLen
  509. if postIndex < 0 {
  510. return ErrInvalidLengthMerkle
  511. }
  512. if postIndex > l {
  513. return io.ErrUnexpectedEOF
  514. }
  515. m.Type = string(dAtA[iNdEx:postIndex])
  516. iNdEx = postIndex
  517. case 2:
  518. if wireType != 2 {
  519. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  520. }
  521. var byteLen int
  522. for shift := uint(0); ; shift += 7 {
  523. if shift >= 64 {
  524. return ErrIntOverflowMerkle
  525. }
  526. if iNdEx >= l {
  527. return io.ErrUnexpectedEOF
  528. }
  529. b := dAtA[iNdEx]
  530. iNdEx++
  531. byteLen |= int(b&0x7F) << shift
  532. if b < 0x80 {
  533. break
  534. }
  535. }
  536. if byteLen < 0 {
  537. return ErrInvalidLengthMerkle
  538. }
  539. postIndex := iNdEx + byteLen
  540. if postIndex < 0 {
  541. return ErrInvalidLengthMerkle
  542. }
  543. if postIndex > l {
  544. return io.ErrUnexpectedEOF
  545. }
  546. m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
  547. if m.Key == nil {
  548. m.Key = []byte{}
  549. }
  550. iNdEx = postIndex
  551. case 3:
  552. if wireType != 2 {
  553. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  554. }
  555. var byteLen int
  556. for shift := uint(0); ; shift += 7 {
  557. if shift >= 64 {
  558. return ErrIntOverflowMerkle
  559. }
  560. if iNdEx >= l {
  561. return io.ErrUnexpectedEOF
  562. }
  563. b := dAtA[iNdEx]
  564. iNdEx++
  565. byteLen |= int(b&0x7F) << shift
  566. if b < 0x80 {
  567. break
  568. }
  569. }
  570. if byteLen < 0 {
  571. return ErrInvalidLengthMerkle
  572. }
  573. postIndex := iNdEx + byteLen
  574. if postIndex < 0 {
  575. return ErrInvalidLengthMerkle
  576. }
  577. if postIndex > l {
  578. return io.ErrUnexpectedEOF
  579. }
  580. m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
  581. if m.Data == nil {
  582. m.Data = []byte{}
  583. }
  584. iNdEx = postIndex
  585. default:
  586. iNdEx = preIndex
  587. skippy, err := skipMerkle(dAtA[iNdEx:])
  588. if err != nil {
  589. return err
  590. }
  591. if skippy < 0 {
  592. return ErrInvalidLengthMerkle
  593. }
  594. if (iNdEx + skippy) < 0 {
  595. return ErrInvalidLengthMerkle
  596. }
  597. if (iNdEx + skippy) > l {
  598. return io.ErrUnexpectedEOF
  599. }
  600. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  601. iNdEx += skippy
  602. }
  603. }
  604. if iNdEx > l {
  605. return io.ErrUnexpectedEOF
  606. }
  607. return nil
  608. }
  609. func (m *Proof) Unmarshal(dAtA []byte) error {
  610. l := len(dAtA)
  611. iNdEx := 0
  612. for iNdEx < l {
  613. preIndex := iNdEx
  614. var wire uint64
  615. for shift := uint(0); ; shift += 7 {
  616. if shift >= 64 {
  617. return ErrIntOverflowMerkle
  618. }
  619. if iNdEx >= l {
  620. return io.ErrUnexpectedEOF
  621. }
  622. b := dAtA[iNdEx]
  623. iNdEx++
  624. wire |= uint64(b&0x7F) << shift
  625. if b < 0x80 {
  626. break
  627. }
  628. }
  629. fieldNum := int32(wire >> 3)
  630. wireType := int(wire & 0x7)
  631. if wireType == 4 {
  632. return fmt.Errorf("proto: Proof: wiretype end group for non-group")
  633. }
  634. if fieldNum <= 0 {
  635. return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
  636. }
  637. switch fieldNum {
  638. case 1:
  639. if wireType != 2 {
  640. return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType)
  641. }
  642. var msglen int
  643. for shift := uint(0); ; shift += 7 {
  644. if shift >= 64 {
  645. return ErrIntOverflowMerkle
  646. }
  647. if iNdEx >= l {
  648. return io.ErrUnexpectedEOF
  649. }
  650. b := dAtA[iNdEx]
  651. iNdEx++
  652. msglen |= int(b&0x7F) << shift
  653. if b < 0x80 {
  654. break
  655. }
  656. }
  657. if msglen < 0 {
  658. return ErrInvalidLengthMerkle
  659. }
  660. postIndex := iNdEx + msglen
  661. if postIndex < 0 {
  662. return ErrInvalidLengthMerkle
  663. }
  664. if postIndex > l {
  665. return io.ErrUnexpectedEOF
  666. }
  667. m.Ops = append(m.Ops, ProofOp{})
  668. if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  669. return err
  670. }
  671. iNdEx = postIndex
  672. default:
  673. iNdEx = preIndex
  674. skippy, err := skipMerkle(dAtA[iNdEx:])
  675. if err != nil {
  676. return err
  677. }
  678. if skippy < 0 {
  679. return ErrInvalidLengthMerkle
  680. }
  681. if (iNdEx + skippy) < 0 {
  682. return ErrInvalidLengthMerkle
  683. }
  684. if (iNdEx + skippy) > l {
  685. return io.ErrUnexpectedEOF
  686. }
  687. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  688. iNdEx += skippy
  689. }
  690. }
  691. if iNdEx > l {
  692. return io.ErrUnexpectedEOF
  693. }
  694. return nil
  695. }
  696. func skipMerkle(dAtA []byte) (n int, err error) {
  697. l := len(dAtA)
  698. iNdEx := 0
  699. for iNdEx < l {
  700. var wire uint64
  701. for shift := uint(0); ; shift += 7 {
  702. if shift >= 64 {
  703. return 0, ErrIntOverflowMerkle
  704. }
  705. if iNdEx >= l {
  706. return 0, io.ErrUnexpectedEOF
  707. }
  708. b := dAtA[iNdEx]
  709. iNdEx++
  710. wire |= (uint64(b) & 0x7F) << shift
  711. if b < 0x80 {
  712. break
  713. }
  714. }
  715. wireType := int(wire & 0x7)
  716. switch wireType {
  717. case 0:
  718. for shift := uint(0); ; shift += 7 {
  719. if shift >= 64 {
  720. return 0, ErrIntOverflowMerkle
  721. }
  722. if iNdEx >= l {
  723. return 0, io.ErrUnexpectedEOF
  724. }
  725. iNdEx++
  726. if dAtA[iNdEx-1] < 0x80 {
  727. break
  728. }
  729. }
  730. return iNdEx, nil
  731. case 1:
  732. iNdEx += 8
  733. return iNdEx, nil
  734. case 2:
  735. var length int
  736. for shift := uint(0); ; shift += 7 {
  737. if shift >= 64 {
  738. return 0, ErrIntOverflowMerkle
  739. }
  740. if iNdEx >= l {
  741. return 0, io.ErrUnexpectedEOF
  742. }
  743. b := dAtA[iNdEx]
  744. iNdEx++
  745. length |= (int(b) & 0x7F) << shift
  746. if b < 0x80 {
  747. break
  748. }
  749. }
  750. if length < 0 {
  751. return 0, ErrInvalidLengthMerkle
  752. }
  753. iNdEx += length
  754. if iNdEx < 0 {
  755. return 0, ErrInvalidLengthMerkle
  756. }
  757. return iNdEx, nil
  758. case 3:
  759. for {
  760. var innerWire uint64
  761. var start int = iNdEx
  762. for shift := uint(0); ; shift += 7 {
  763. if shift >= 64 {
  764. return 0, ErrIntOverflowMerkle
  765. }
  766. if iNdEx >= l {
  767. return 0, io.ErrUnexpectedEOF
  768. }
  769. b := dAtA[iNdEx]
  770. iNdEx++
  771. innerWire |= (uint64(b) & 0x7F) << shift
  772. if b < 0x80 {
  773. break
  774. }
  775. }
  776. innerWireType := int(innerWire & 0x7)
  777. if innerWireType == 4 {
  778. break
  779. }
  780. next, err := skipMerkle(dAtA[start:])
  781. if err != nil {
  782. return 0, err
  783. }
  784. iNdEx = start + next
  785. if iNdEx < 0 {
  786. return 0, ErrInvalidLengthMerkle
  787. }
  788. }
  789. return iNdEx, nil
  790. case 4:
  791. return iNdEx, nil
  792. case 5:
  793. iNdEx += 4
  794. return iNdEx, nil
  795. default:
  796. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  797. }
  798. }
  799. panic("unreachable")
  800. }
  801. var (
  802. ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling")
  803. ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow")
  804. )