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