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.

617 lines
14 KiB

  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: crypto/merkle/merkle.proto
  3. package merkle
  4. import (
  5. fmt "fmt"
  6. _ "github.com/gogo/protobuf/gogoproto"
  7. proto "github.com/gogo/protobuf/proto"
  8. io "io"
  9. math "math"
  10. math_bits "math/bits"
  11. )
  12. // Reference imports to suppress errors if they are not otherwise used.
  13. var _ = proto.Marshal
  14. var _ = fmt.Errorf
  15. var _ = math.Inf
  16. // This is a compile-time assertion to ensure that this generated file
  17. // is compatible with the proto package it is being compiled against.
  18. // A compilation error at this line likely means your copy of the
  19. // proto package needs to be updated.
  20. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
  21. // ProofOp defines an operation used for calculating Merkle root
  22. // The data could be arbitrary format, providing nessecary data
  23. // for example neighbouring node hash
  24. type ProofOp struct {
  25. Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
  26. Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
  27. Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
  28. }
  29. func (m *ProofOp) Reset() { *m = ProofOp{} }
  30. func (m *ProofOp) String() string { return proto.CompactTextString(m) }
  31. func (*ProofOp) ProtoMessage() {}
  32. func (*ProofOp) Descriptor() ([]byte, []int) {
  33. return fileDescriptor_9c1c2162d560d38e, []int{0}
  34. }
  35. func (m *ProofOp) XXX_Unmarshal(b []byte) error {
  36. return m.Unmarshal(b)
  37. }
  38. func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  39. if deterministic {
  40. return xxx_messageInfo_ProofOp.Marshal(b, m, deterministic)
  41. } else {
  42. b = b[:cap(b)]
  43. n, err := m.MarshalToSizedBuffer(b)
  44. if err != nil {
  45. return nil, err
  46. }
  47. return b[:n], nil
  48. }
  49. }
  50. func (m *ProofOp) XXX_Merge(src proto.Message) {
  51. xxx_messageInfo_ProofOp.Merge(m, src)
  52. }
  53. func (m *ProofOp) XXX_Size() int {
  54. return m.Size()
  55. }
  56. func (m *ProofOp) XXX_DiscardUnknown() {
  57. xxx_messageInfo_ProofOp.DiscardUnknown(m)
  58. }
  59. var xxx_messageInfo_ProofOp proto.InternalMessageInfo
  60. func (m *ProofOp) GetType() string {
  61. if m != nil {
  62. return m.Type
  63. }
  64. return ""
  65. }
  66. func (m *ProofOp) GetKey() []byte {
  67. if m != nil {
  68. return m.Key
  69. }
  70. return nil
  71. }
  72. func (m *ProofOp) GetData() []byte {
  73. if m != nil {
  74. return m.Data
  75. }
  76. return nil
  77. }
  78. // Proof is Merkle proof defined by the list of ProofOps
  79. type Proof struct {
  80. Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"`
  81. }
  82. func (m *Proof) Reset() { *m = Proof{} }
  83. func (m *Proof) String() string { return proto.CompactTextString(m) }
  84. func (*Proof) ProtoMessage() {}
  85. func (*Proof) Descriptor() ([]byte, []int) {
  86. return fileDescriptor_9c1c2162d560d38e, []int{1}
  87. }
  88. func (m *Proof) XXX_Unmarshal(b []byte) error {
  89. return m.Unmarshal(b)
  90. }
  91. func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
  92. if deterministic {
  93. return xxx_messageInfo_Proof.Marshal(b, m, deterministic)
  94. } else {
  95. b = b[:cap(b)]
  96. n, err := m.MarshalToSizedBuffer(b)
  97. if err != nil {
  98. return nil, err
  99. }
  100. return b[:n], nil
  101. }
  102. }
  103. func (m *Proof) XXX_Merge(src proto.Message) {
  104. xxx_messageInfo_Proof.Merge(m, src)
  105. }
  106. func (m *Proof) XXX_Size() int {
  107. return m.Size()
  108. }
  109. func (m *Proof) XXX_DiscardUnknown() {
  110. xxx_messageInfo_Proof.DiscardUnknown(m)
  111. }
  112. var xxx_messageInfo_Proof proto.InternalMessageInfo
  113. func (m *Proof) GetOps() []ProofOp {
  114. if m != nil {
  115. return m.Ops
  116. }
  117. return nil
  118. }
  119. func init() {
  120. proto.RegisterType((*ProofOp)(nil), "tendermint.crypto.merkle.ProofOp")
  121. proto.RegisterType((*Proof)(nil), "tendermint.crypto.merkle.Proof")
  122. }
  123. func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_9c1c2162d560d38e) }
  124. var fileDescriptor_9c1c2162d560d38e = []byte{
  125. // 234 bytes of a gzipped FileDescriptorProto
  126. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c,
  127. 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25,
  128. 0xf9, 0x42, 0x12, 0x25, 0xa9, 0x79, 0x29, 0xa9, 0x45, 0xb9, 0x99, 0x79, 0x25, 0x7a, 0x10, 0x65,
  129. 0x7a, 0x10, 0x79, 0x29, 0xb5, 0x92, 0x8c, 0xcc, 0xa2, 0x94, 0xf8, 0x82, 0xc4, 0xa2, 0x92, 0x4a,
  130. 0x7d, 0xb0, 0x62, 0xfd, 0xf4, 0xfc, 0xf4, 0x7c, 0x04, 0x0b, 0x62, 0x82, 0x92, 0x33, 0x17, 0x7b,
  131. 0x40, 0x51, 0x7e, 0x7e, 0x9a, 0x7f, 0x81, 0x90, 0x10, 0x17, 0x4b, 0x49, 0x65, 0x41, 0xaa, 0x04,
  132. 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, 0x2d, 0x24, 0xc0, 0xc5, 0x9c, 0x9d, 0x5a, 0x29, 0xc1,
  133. 0xa4, 0xc0, 0xa8, 0xc1, 0x13, 0x04, 0x62, 0x82, 0x54, 0xa5, 0x24, 0x96, 0x24, 0x4a, 0x30, 0x83,
  134. 0x85, 0xc0, 0x6c, 0x25, 0x27, 0x2e, 0x56, 0xb0, 0x21, 0x42, 0x96, 0x5c, 0xcc, 0xf9, 0x05, 0xc5,
  135. 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0x8a, 0x7a, 0xb8, 0x5c, 0xa7, 0x07, 0xb5, 0xd2, 0x89,
  136. 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0x90, 0x1e, 0x27, 0x8f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c,
  137. 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e,
  138. 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5,
  139. 0x47, 0x98, 0x88, 0xcc, 0x44, 0x09, 0xa1, 0x24, 0x36, 0xb0, 0xcf, 0x8c, 0x01, 0x01, 0x00, 0x00,
  140. 0xff, 0xff, 0x39, 0xc0, 0xa3, 0x13, 0x39, 0x01, 0x00, 0x00,
  141. }
  142. func (m *ProofOp) Marshal() (dAtA []byte, err error) {
  143. size := m.Size()
  144. dAtA = make([]byte, size)
  145. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  146. if err != nil {
  147. return nil, err
  148. }
  149. return dAtA[:n], nil
  150. }
  151. func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) {
  152. size := m.Size()
  153. return m.MarshalToSizedBuffer(dAtA[:size])
  154. }
  155. func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  156. i := len(dAtA)
  157. _ = i
  158. var l int
  159. _ = l
  160. if len(m.Data) > 0 {
  161. i -= len(m.Data)
  162. copy(dAtA[i:], m.Data)
  163. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data)))
  164. i--
  165. dAtA[i] = 0x1a
  166. }
  167. if len(m.Key) > 0 {
  168. i -= len(m.Key)
  169. copy(dAtA[i:], m.Key)
  170. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key)))
  171. i--
  172. dAtA[i] = 0x12
  173. }
  174. if len(m.Type) > 0 {
  175. i -= len(m.Type)
  176. copy(dAtA[i:], m.Type)
  177. i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type)))
  178. i--
  179. dAtA[i] = 0xa
  180. }
  181. return len(dAtA) - i, nil
  182. }
  183. func (m *Proof) Marshal() (dAtA []byte, err error) {
  184. size := m.Size()
  185. dAtA = make([]byte, size)
  186. n, err := m.MarshalToSizedBuffer(dAtA[:size])
  187. if err != nil {
  188. return nil, err
  189. }
  190. return dAtA[:n], nil
  191. }
  192. func (m *Proof) MarshalTo(dAtA []byte) (int, error) {
  193. size := m.Size()
  194. return m.MarshalToSizedBuffer(dAtA[:size])
  195. }
  196. func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) {
  197. i := len(dAtA)
  198. _ = i
  199. var l int
  200. _ = l
  201. if len(m.Ops) > 0 {
  202. for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- {
  203. {
  204. size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i])
  205. if err != nil {
  206. return 0, err
  207. }
  208. i -= size
  209. i = encodeVarintMerkle(dAtA, i, uint64(size))
  210. }
  211. i--
  212. dAtA[i] = 0xa
  213. }
  214. }
  215. return len(dAtA) - i, nil
  216. }
  217. func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int {
  218. offset -= sovMerkle(v)
  219. base := offset
  220. for v >= 1<<7 {
  221. dAtA[offset] = uint8(v&0x7f | 0x80)
  222. v >>= 7
  223. offset++
  224. }
  225. dAtA[offset] = uint8(v)
  226. return base
  227. }
  228. func (m *ProofOp) Size() (n int) {
  229. if m == nil {
  230. return 0
  231. }
  232. var l int
  233. _ = l
  234. l = len(m.Type)
  235. if l > 0 {
  236. n += 1 + l + sovMerkle(uint64(l))
  237. }
  238. l = len(m.Key)
  239. if l > 0 {
  240. n += 1 + l + sovMerkle(uint64(l))
  241. }
  242. l = len(m.Data)
  243. if l > 0 {
  244. n += 1 + l + sovMerkle(uint64(l))
  245. }
  246. return n
  247. }
  248. func (m *Proof) Size() (n int) {
  249. if m == nil {
  250. return 0
  251. }
  252. var l int
  253. _ = l
  254. if len(m.Ops) > 0 {
  255. for _, e := range m.Ops {
  256. l = e.Size()
  257. n += 1 + l + sovMerkle(uint64(l))
  258. }
  259. }
  260. return n
  261. }
  262. func sovMerkle(x uint64) (n int) {
  263. return (math_bits.Len64(x|1) + 6) / 7
  264. }
  265. func sozMerkle(x uint64) (n int) {
  266. return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  267. }
  268. func (m *ProofOp) Unmarshal(dAtA []byte) error {
  269. l := len(dAtA)
  270. iNdEx := 0
  271. for iNdEx < l {
  272. preIndex := iNdEx
  273. var wire uint64
  274. for shift := uint(0); ; shift += 7 {
  275. if shift >= 64 {
  276. return ErrIntOverflowMerkle
  277. }
  278. if iNdEx >= l {
  279. return io.ErrUnexpectedEOF
  280. }
  281. b := dAtA[iNdEx]
  282. iNdEx++
  283. wire |= uint64(b&0x7F) << shift
  284. if b < 0x80 {
  285. break
  286. }
  287. }
  288. fieldNum := int32(wire >> 3)
  289. wireType := int(wire & 0x7)
  290. if wireType == 4 {
  291. return fmt.Errorf("proto: ProofOp: wiretype end group for non-group")
  292. }
  293. if fieldNum <= 0 {
  294. return fmt.Errorf("proto: ProofOp: illegal tag %d (wire type %d)", fieldNum, wire)
  295. }
  296. switch fieldNum {
  297. case 1:
  298. if wireType != 2 {
  299. return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
  300. }
  301. var stringLen uint64
  302. for shift := uint(0); ; shift += 7 {
  303. if shift >= 64 {
  304. return ErrIntOverflowMerkle
  305. }
  306. if iNdEx >= l {
  307. return io.ErrUnexpectedEOF
  308. }
  309. b := dAtA[iNdEx]
  310. iNdEx++
  311. stringLen |= uint64(b&0x7F) << shift
  312. if b < 0x80 {
  313. break
  314. }
  315. }
  316. intStringLen := int(stringLen)
  317. if intStringLen < 0 {
  318. return ErrInvalidLengthMerkle
  319. }
  320. postIndex := iNdEx + intStringLen
  321. if postIndex < 0 {
  322. return ErrInvalidLengthMerkle
  323. }
  324. if postIndex > l {
  325. return io.ErrUnexpectedEOF
  326. }
  327. m.Type = string(dAtA[iNdEx:postIndex])
  328. iNdEx = postIndex
  329. case 2:
  330. if wireType != 2 {
  331. return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
  332. }
  333. var byteLen int
  334. for shift := uint(0); ; shift += 7 {
  335. if shift >= 64 {
  336. return ErrIntOverflowMerkle
  337. }
  338. if iNdEx >= l {
  339. return io.ErrUnexpectedEOF
  340. }
  341. b := dAtA[iNdEx]
  342. iNdEx++
  343. byteLen |= int(b&0x7F) << shift
  344. if b < 0x80 {
  345. break
  346. }
  347. }
  348. if byteLen < 0 {
  349. return ErrInvalidLengthMerkle
  350. }
  351. postIndex := iNdEx + byteLen
  352. if postIndex < 0 {
  353. return ErrInvalidLengthMerkle
  354. }
  355. if postIndex > l {
  356. return io.ErrUnexpectedEOF
  357. }
  358. m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...)
  359. if m.Key == nil {
  360. m.Key = []byte{}
  361. }
  362. iNdEx = postIndex
  363. case 3:
  364. if wireType != 2 {
  365. return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
  366. }
  367. var byteLen int
  368. for shift := uint(0); ; shift += 7 {
  369. if shift >= 64 {
  370. return ErrIntOverflowMerkle
  371. }
  372. if iNdEx >= l {
  373. return io.ErrUnexpectedEOF
  374. }
  375. b := dAtA[iNdEx]
  376. iNdEx++
  377. byteLen |= int(b&0x7F) << shift
  378. if b < 0x80 {
  379. break
  380. }
  381. }
  382. if byteLen < 0 {
  383. return ErrInvalidLengthMerkle
  384. }
  385. postIndex := iNdEx + byteLen
  386. if postIndex < 0 {
  387. return ErrInvalidLengthMerkle
  388. }
  389. if postIndex > l {
  390. return io.ErrUnexpectedEOF
  391. }
  392. m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
  393. if m.Data == nil {
  394. m.Data = []byte{}
  395. }
  396. iNdEx = postIndex
  397. default:
  398. iNdEx = preIndex
  399. skippy, err := skipMerkle(dAtA[iNdEx:])
  400. if err != nil {
  401. return err
  402. }
  403. if skippy < 0 {
  404. return ErrInvalidLengthMerkle
  405. }
  406. if (iNdEx + skippy) < 0 {
  407. return ErrInvalidLengthMerkle
  408. }
  409. if (iNdEx + skippy) > l {
  410. return io.ErrUnexpectedEOF
  411. }
  412. iNdEx += skippy
  413. }
  414. }
  415. if iNdEx > l {
  416. return io.ErrUnexpectedEOF
  417. }
  418. return nil
  419. }
  420. func (m *Proof) Unmarshal(dAtA []byte) error {
  421. l := len(dAtA)
  422. iNdEx := 0
  423. for iNdEx < l {
  424. preIndex := iNdEx
  425. var wire uint64
  426. for shift := uint(0); ; shift += 7 {
  427. if shift >= 64 {
  428. return ErrIntOverflowMerkle
  429. }
  430. if iNdEx >= l {
  431. return io.ErrUnexpectedEOF
  432. }
  433. b := dAtA[iNdEx]
  434. iNdEx++
  435. wire |= uint64(b&0x7F) << shift
  436. if b < 0x80 {
  437. break
  438. }
  439. }
  440. fieldNum := int32(wire >> 3)
  441. wireType := int(wire & 0x7)
  442. if wireType == 4 {
  443. return fmt.Errorf("proto: Proof: wiretype end group for non-group")
  444. }
  445. if fieldNum <= 0 {
  446. return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire)
  447. }
  448. switch fieldNum {
  449. case 1:
  450. if wireType != 2 {
  451. return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType)
  452. }
  453. var msglen int
  454. for shift := uint(0); ; shift += 7 {
  455. if shift >= 64 {
  456. return ErrIntOverflowMerkle
  457. }
  458. if iNdEx >= l {
  459. return io.ErrUnexpectedEOF
  460. }
  461. b := dAtA[iNdEx]
  462. iNdEx++
  463. msglen |= int(b&0x7F) << shift
  464. if b < 0x80 {
  465. break
  466. }
  467. }
  468. if msglen < 0 {
  469. return ErrInvalidLengthMerkle
  470. }
  471. postIndex := iNdEx + msglen
  472. if postIndex < 0 {
  473. return ErrInvalidLengthMerkle
  474. }
  475. if postIndex > l {
  476. return io.ErrUnexpectedEOF
  477. }
  478. m.Ops = append(m.Ops, ProofOp{})
  479. if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
  480. return err
  481. }
  482. iNdEx = postIndex
  483. default:
  484. iNdEx = preIndex
  485. skippy, err := skipMerkle(dAtA[iNdEx:])
  486. if err != nil {
  487. return err
  488. }
  489. if skippy < 0 {
  490. return ErrInvalidLengthMerkle
  491. }
  492. if (iNdEx + skippy) < 0 {
  493. return ErrInvalidLengthMerkle
  494. }
  495. if (iNdEx + skippy) > l {
  496. return io.ErrUnexpectedEOF
  497. }
  498. iNdEx += skippy
  499. }
  500. }
  501. if iNdEx > l {
  502. return io.ErrUnexpectedEOF
  503. }
  504. return nil
  505. }
  506. func skipMerkle(dAtA []byte) (n int, err error) {
  507. l := len(dAtA)
  508. iNdEx := 0
  509. depth := 0
  510. for iNdEx < l {
  511. var wire uint64
  512. for shift := uint(0); ; shift += 7 {
  513. if shift >= 64 {
  514. return 0, ErrIntOverflowMerkle
  515. }
  516. if iNdEx >= l {
  517. return 0, io.ErrUnexpectedEOF
  518. }
  519. b := dAtA[iNdEx]
  520. iNdEx++
  521. wire |= (uint64(b) & 0x7F) << shift
  522. if b < 0x80 {
  523. break
  524. }
  525. }
  526. wireType := int(wire & 0x7)
  527. switch wireType {
  528. case 0:
  529. for shift := uint(0); ; shift += 7 {
  530. if shift >= 64 {
  531. return 0, ErrIntOverflowMerkle
  532. }
  533. if iNdEx >= l {
  534. return 0, io.ErrUnexpectedEOF
  535. }
  536. iNdEx++
  537. if dAtA[iNdEx-1] < 0x80 {
  538. break
  539. }
  540. }
  541. case 1:
  542. iNdEx += 8
  543. case 2:
  544. var length int
  545. for shift := uint(0); ; shift += 7 {
  546. if shift >= 64 {
  547. return 0, ErrIntOverflowMerkle
  548. }
  549. if iNdEx >= l {
  550. return 0, io.ErrUnexpectedEOF
  551. }
  552. b := dAtA[iNdEx]
  553. iNdEx++
  554. length |= (int(b) & 0x7F) << shift
  555. if b < 0x80 {
  556. break
  557. }
  558. }
  559. if length < 0 {
  560. return 0, ErrInvalidLengthMerkle
  561. }
  562. iNdEx += length
  563. case 3:
  564. depth++
  565. case 4:
  566. if depth == 0 {
  567. return 0, ErrUnexpectedEndOfGroupMerkle
  568. }
  569. depth--
  570. case 5:
  571. iNdEx += 4
  572. default:
  573. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  574. }
  575. if iNdEx < 0 {
  576. return 0, ErrInvalidLengthMerkle
  577. }
  578. if depth == 0 {
  579. return iNdEx, nil
  580. }
  581. }
  582. return 0, io.ErrUnexpectedEOF
  583. }
  584. var (
  585. ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling")
  586. ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow")
  587. ErrUnexpectedEndOfGroupMerkle = fmt.Errorf("proto: unexpected end of group")
  588. )