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.

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