github.com/prysmaticlabs/prysm@v1.4.4/proto/prysm/v2/generated.ssz.go (about) 1 // Code generated by fastssz. DO NOT EDIT. 2 // Hash: 42a90e41ab6d24bff4129db961d34921a0029e66055341893a96eaca9f66eedd 3 package v2 4 5 import ( 6 ssz "github.com/ferranbt/fastssz" 7 github_com_prysmaticlabs_eth2_types "github.com/prysmaticlabs/eth2-types" 8 v1alpha1 "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1" 9 ) 10 11 // MarshalSSZ ssz marshals the SignedBeaconBlockAltair object 12 func (s *SignedBeaconBlockAltair) MarshalSSZ() ([]byte, error) { 13 return ssz.MarshalSSZ(s) 14 } 15 16 // MarshalSSZTo ssz marshals the SignedBeaconBlockAltair object to a target array 17 func (s *SignedBeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { 18 dst = buf 19 offset := int(100) 20 21 // Offset (0) 'Block' 22 dst = ssz.WriteOffset(dst, offset) 23 if s.Block == nil { 24 s.Block = new(BeaconBlockAltair) 25 } 26 offset += s.Block.SizeSSZ() 27 28 // Field (1) 'Signature' 29 if len(s.Signature) != 96 { 30 err = ssz.ErrBytesLength 31 return 32 } 33 dst = append(dst, s.Signature...) 34 35 // Field (0) 'Block' 36 if dst, err = s.Block.MarshalSSZTo(dst); err != nil { 37 return 38 } 39 40 return 41 } 42 43 // UnmarshalSSZ ssz unmarshals the SignedBeaconBlockAltair object 44 func (s *SignedBeaconBlockAltair) UnmarshalSSZ(buf []byte) error { 45 var err error 46 size := uint64(len(buf)) 47 if size < 100 { 48 return ssz.ErrSize 49 } 50 51 tail := buf 52 var o0 uint64 53 54 // Offset (0) 'Block' 55 if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { 56 return ssz.ErrOffset 57 } 58 59 if o0 < 100 { 60 return ssz.ErrInvalidVariableOffset 61 } 62 63 // Field (1) 'Signature' 64 if cap(s.Signature) == 0 { 65 s.Signature = make([]byte, 0, len(buf[4:100])) 66 } 67 s.Signature = append(s.Signature, buf[4:100]...) 68 69 // Field (0) 'Block' 70 { 71 buf = tail[o0:] 72 if s.Block == nil { 73 s.Block = new(BeaconBlockAltair) 74 } 75 if err = s.Block.UnmarshalSSZ(buf); err != nil { 76 return err 77 } 78 } 79 return err 80 } 81 82 // SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockAltair object 83 func (s *SignedBeaconBlockAltair) SizeSSZ() (size int) { 84 size = 100 85 86 // Field (0) 'Block' 87 if s.Block == nil { 88 s.Block = new(BeaconBlockAltair) 89 } 90 size += s.Block.SizeSSZ() 91 92 return 93 } 94 95 // HashTreeRoot ssz hashes the SignedBeaconBlockAltair object 96 func (s *SignedBeaconBlockAltair) HashTreeRoot() ([32]byte, error) { 97 return ssz.HashWithDefaultHasher(s) 98 } 99 100 // HashTreeRootWith ssz hashes the SignedBeaconBlockAltair object with a hasher 101 func (s *SignedBeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { 102 indx := hh.Index() 103 104 // Field (0) 'Block' 105 if err = s.Block.HashTreeRootWith(hh); err != nil { 106 return 107 } 108 109 // Field (1) 'Signature' 110 if len(s.Signature) != 96 { 111 err = ssz.ErrBytesLength 112 return 113 } 114 hh.PutBytes(s.Signature) 115 116 hh.Merkleize(indx) 117 return 118 } 119 120 // MarshalSSZ ssz marshals the BeaconBlockAltair object 121 func (b *BeaconBlockAltair) MarshalSSZ() ([]byte, error) { 122 return ssz.MarshalSSZ(b) 123 } 124 125 // MarshalSSZTo ssz marshals the BeaconBlockAltair object to a target array 126 func (b *BeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { 127 dst = buf 128 offset := int(84) 129 130 // Field (0) 'Slot' 131 dst = ssz.MarshalUint64(dst, uint64(b.Slot)) 132 133 // Field (1) 'ProposerIndex' 134 dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex)) 135 136 // Field (2) 'ParentRoot' 137 if len(b.ParentRoot) != 32 { 138 err = ssz.ErrBytesLength 139 return 140 } 141 dst = append(dst, b.ParentRoot...) 142 143 // Field (3) 'StateRoot' 144 if len(b.StateRoot) != 32 { 145 err = ssz.ErrBytesLength 146 return 147 } 148 dst = append(dst, b.StateRoot...) 149 150 // Offset (4) 'Body' 151 dst = ssz.WriteOffset(dst, offset) 152 if b.Body == nil { 153 b.Body = new(BeaconBlockBodyAltair) 154 } 155 offset += b.Body.SizeSSZ() 156 157 // Field (4) 'Body' 158 if dst, err = b.Body.MarshalSSZTo(dst); err != nil { 159 return 160 } 161 162 return 163 } 164 165 // UnmarshalSSZ ssz unmarshals the BeaconBlockAltair object 166 func (b *BeaconBlockAltair) UnmarshalSSZ(buf []byte) error { 167 var err error 168 size := uint64(len(buf)) 169 if size < 84 { 170 return ssz.ErrSize 171 } 172 173 tail := buf 174 var o4 uint64 175 176 // Field (0) 'Slot' 177 b.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8])) 178 179 // Field (1) 'ProposerIndex' 180 b.ProposerIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) 181 182 // Field (2) 'ParentRoot' 183 if cap(b.ParentRoot) == 0 { 184 b.ParentRoot = make([]byte, 0, len(buf[16:48])) 185 } 186 b.ParentRoot = append(b.ParentRoot, buf[16:48]...) 187 188 // Field (3) 'StateRoot' 189 if cap(b.StateRoot) == 0 { 190 b.StateRoot = make([]byte, 0, len(buf[48:80])) 191 } 192 b.StateRoot = append(b.StateRoot, buf[48:80]...) 193 194 // Offset (4) 'Body' 195 if o4 = ssz.ReadOffset(buf[80:84]); o4 > size { 196 return ssz.ErrOffset 197 } 198 199 if o4 < 84 { 200 return ssz.ErrInvalidVariableOffset 201 } 202 203 // Field (4) 'Body' 204 { 205 buf = tail[o4:] 206 if b.Body == nil { 207 b.Body = new(BeaconBlockBodyAltair) 208 } 209 if err = b.Body.UnmarshalSSZ(buf); err != nil { 210 return err 211 } 212 } 213 return err 214 } 215 216 // SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockAltair object 217 func (b *BeaconBlockAltair) SizeSSZ() (size int) { 218 size = 84 219 220 // Field (4) 'Body' 221 if b.Body == nil { 222 b.Body = new(BeaconBlockBodyAltair) 223 } 224 size += b.Body.SizeSSZ() 225 226 return 227 } 228 229 // HashTreeRoot ssz hashes the BeaconBlockAltair object 230 func (b *BeaconBlockAltair) HashTreeRoot() ([32]byte, error) { 231 return ssz.HashWithDefaultHasher(b) 232 } 233 234 // HashTreeRootWith ssz hashes the BeaconBlockAltair object with a hasher 235 func (b *BeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { 236 indx := hh.Index() 237 238 // Field (0) 'Slot' 239 hh.PutUint64(uint64(b.Slot)) 240 241 // Field (1) 'ProposerIndex' 242 hh.PutUint64(uint64(b.ProposerIndex)) 243 244 // Field (2) 'ParentRoot' 245 if len(b.ParentRoot) != 32 { 246 err = ssz.ErrBytesLength 247 return 248 } 249 hh.PutBytes(b.ParentRoot) 250 251 // Field (3) 'StateRoot' 252 if len(b.StateRoot) != 32 { 253 err = ssz.ErrBytesLength 254 return 255 } 256 hh.PutBytes(b.StateRoot) 257 258 // Field (4) 'Body' 259 if err = b.Body.HashTreeRootWith(hh); err != nil { 260 return 261 } 262 263 hh.Merkleize(indx) 264 return 265 } 266 267 // MarshalSSZ ssz marshals the BeaconBlockBodyAltair object 268 func (b *BeaconBlockBodyAltair) MarshalSSZ() ([]byte, error) { 269 return ssz.MarshalSSZ(b) 270 } 271 272 // MarshalSSZTo ssz marshals the BeaconBlockBodyAltair object to a target array 273 func (b *BeaconBlockBodyAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) { 274 dst = buf 275 offset := int(380) 276 277 // Field (0) 'RandaoReveal' 278 if len(b.RandaoReveal) != 96 { 279 err = ssz.ErrBytesLength 280 return 281 } 282 dst = append(dst, b.RandaoReveal...) 283 284 // Field (1) 'Eth1Data' 285 if b.Eth1Data == nil { 286 b.Eth1Data = new(v1alpha1.Eth1Data) 287 } 288 if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil { 289 return 290 } 291 292 // Field (2) 'Graffiti' 293 if len(b.Graffiti) != 32 { 294 err = ssz.ErrBytesLength 295 return 296 } 297 dst = append(dst, b.Graffiti...) 298 299 // Offset (3) 'ProposerSlashings' 300 dst = ssz.WriteOffset(dst, offset) 301 offset += len(b.ProposerSlashings) * 416 302 303 // Offset (4) 'AttesterSlashings' 304 dst = ssz.WriteOffset(dst, offset) 305 for ii := 0; ii < len(b.AttesterSlashings); ii++ { 306 offset += 4 307 offset += b.AttesterSlashings[ii].SizeSSZ() 308 } 309 310 // Offset (5) 'Attestations' 311 dst = ssz.WriteOffset(dst, offset) 312 for ii := 0; ii < len(b.Attestations); ii++ { 313 offset += 4 314 offset += b.Attestations[ii].SizeSSZ() 315 } 316 317 // Offset (6) 'Deposits' 318 dst = ssz.WriteOffset(dst, offset) 319 offset += len(b.Deposits) * 1240 320 321 // Offset (7) 'VoluntaryExits' 322 dst = ssz.WriteOffset(dst, offset) 323 offset += len(b.VoluntaryExits) * 112 324 325 // Field (8) 'SyncAggregate' 326 if b.SyncAggregate == nil { 327 b.SyncAggregate = new(SyncAggregate) 328 } 329 if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil { 330 return 331 } 332 333 // Field (3) 'ProposerSlashings' 334 if len(b.ProposerSlashings) > 16 { 335 err = ssz.ErrListTooBig 336 return 337 } 338 for ii := 0; ii < len(b.ProposerSlashings); ii++ { 339 if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil { 340 return 341 } 342 } 343 344 // Field (4) 'AttesterSlashings' 345 if len(b.AttesterSlashings) > 2 { 346 err = ssz.ErrListTooBig 347 return 348 } 349 { 350 offset = 4 * len(b.AttesterSlashings) 351 for ii := 0; ii < len(b.AttesterSlashings); ii++ { 352 dst = ssz.WriteOffset(dst, offset) 353 offset += b.AttesterSlashings[ii].SizeSSZ() 354 } 355 } 356 for ii := 0; ii < len(b.AttesterSlashings); ii++ { 357 if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil { 358 return 359 } 360 } 361 362 // Field (5) 'Attestations' 363 if len(b.Attestations) > 128 { 364 err = ssz.ErrListTooBig 365 return 366 } 367 { 368 offset = 4 * len(b.Attestations) 369 for ii := 0; ii < len(b.Attestations); ii++ { 370 dst = ssz.WriteOffset(dst, offset) 371 offset += b.Attestations[ii].SizeSSZ() 372 } 373 } 374 for ii := 0; ii < len(b.Attestations); ii++ { 375 if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil { 376 return 377 } 378 } 379 380 // Field (6) 'Deposits' 381 if len(b.Deposits) > 16 { 382 err = ssz.ErrListTooBig 383 return 384 } 385 for ii := 0; ii < len(b.Deposits); ii++ { 386 if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil { 387 return 388 } 389 } 390 391 // Field (7) 'VoluntaryExits' 392 if len(b.VoluntaryExits) > 16 { 393 err = ssz.ErrListTooBig 394 return 395 } 396 for ii := 0; ii < len(b.VoluntaryExits); ii++ { 397 if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil { 398 return 399 } 400 } 401 402 return 403 } 404 405 // UnmarshalSSZ ssz unmarshals the BeaconBlockBodyAltair object 406 func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error { 407 var err error 408 size := uint64(len(buf)) 409 if size < 380 { 410 return ssz.ErrSize 411 } 412 413 tail := buf 414 var o3, o4, o5, o6, o7 uint64 415 416 // Field (0) 'RandaoReveal' 417 if cap(b.RandaoReveal) == 0 { 418 b.RandaoReveal = make([]byte, 0, len(buf[0:96])) 419 } 420 b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...) 421 422 // Field (1) 'Eth1Data' 423 if b.Eth1Data == nil { 424 b.Eth1Data = new(v1alpha1.Eth1Data) 425 } 426 if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil { 427 return err 428 } 429 430 // Field (2) 'Graffiti' 431 if cap(b.Graffiti) == 0 { 432 b.Graffiti = make([]byte, 0, len(buf[168:200])) 433 } 434 b.Graffiti = append(b.Graffiti, buf[168:200]...) 435 436 // Offset (3) 'ProposerSlashings' 437 if o3 = ssz.ReadOffset(buf[200:204]); o3 > size { 438 return ssz.ErrOffset 439 } 440 441 if o3 < 380 { 442 return ssz.ErrInvalidVariableOffset 443 } 444 445 // Offset (4) 'AttesterSlashings' 446 if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 { 447 return ssz.ErrOffset 448 } 449 450 // Offset (5) 'Attestations' 451 if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 { 452 return ssz.ErrOffset 453 } 454 455 // Offset (6) 'Deposits' 456 if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 { 457 return ssz.ErrOffset 458 } 459 460 // Offset (7) 'VoluntaryExits' 461 if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 { 462 return ssz.ErrOffset 463 } 464 465 // Field (8) 'SyncAggregate' 466 if b.SyncAggregate == nil { 467 b.SyncAggregate = new(SyncAggregate) 468 } 469 if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil { 470 return err 471 } 472 473 // Field (3) 'ProposerSlashings' 474 { 475 buf = tail[o3:o4] 476 num, err := ssz.DivideInt2(len(buf), 416, 16) 477 if err != nil { 478 return err 479 } 480 b.ProposerSlashings = make([]*v1alpha1.ProposerSlashing, num) 481 for ii := 0; ii < num; ii++ { 482 if b.ProposerSlashings[ii] == nil { 483 b.ProposerSlashings[ii] = new(v1alpha1.ProposerSlashing) 484 } 485 if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil { 486 return err 487 } 488 } 489 } 490 491 // Field (4) 'AttesterSlashings' 492 { 493 buf = tail[o4:o5] 494 num, err := ssz.DecodeDynamicLength(buf, 2) 495 if err != nil { 496 return err 497 } 498 b.AttesterSlashings = make([]*v1alpha1.AttesterSlashing, num) 499 err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { 500 if b.AttesterSlashings[indx] == nil { 501 b.AttesterSlashings[indx] = new(v1alpha1.AttesterSlashing) 502 } 503 if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil { 504 return err 505 } 506 return nil 507 }) 508 if err != nil { 509 return err 510 } 511 } 512 513 // Field (5) 'Attestations' 514 { 515 buf = tail[o5:o6] 516 num, err := ssz.DecodeDynamicLength(buf, 128) 517 if err != nil { 518 return err 519 } 520 b.Attestations = make([]*v1alpha1.Attestation, num) 521 err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { 522 if b.Attestations[indx] == nil { 523 b.Attestations[indx] = new(v1alpha1.Attestation) 524 } 525 if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil { 526 return err 527 } 528 return nil 529 }) 530 if err != nil { 531 return err 532 } 533 } 534 535 // Field (6) 'Deposits' 536 { 537 buf = tail[o6:o7] 538 num, err := ssz.DivideInt2(len(buf), 1240, 16) 539 if err != nil { 540 return err 541 } 542 b.Deposits = make([]*v1alpha1.Deposit, num) 543 for ii := 0; ii < num; ii++ { 544 if b.Deposits[ii] == nil { 545 b.Deposits[ii] = new(v1alpha1.Deposit) 546 } 547 if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil { 548 return err 549 } 550 } 551 } 552 553 // Field (7) 'VoluntaryExits' 554 { 555 buf = tail[o7:] 556 num, err := ssz.DivideInt2(len(buf), 112, 16) 557 if err != nil { 558 return err 559 } 560 b.VoluntaryExits = make([]*v1alpha1.SignedVoluntaryExit, num) 561 for ii := 0; ii < num; ii++ { 562 if b.VoluntaryExits[ii] == nil { 563 b.VoluntaryExits[ii] = new(v1alpha1.SignedVoluntaryExit) 564 } 565 if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil { 566 return err 567 } 568 } 569 } 570 return err 571 } 572 573 // SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyAltair object 574 func (b *BeaconBlockBodyAltair) SizeSSZ() (size int) { 575 size = 380 576 577 // Field (3) 'ProposerSlashings' 578 size += len(b.ProposerSlashings) * 416 579 580 // Field (4) 'AttesterSlashings' 581 for ii := 0; ii < len(b.AttesterSlashings); ii++ { 582 size += 4 583 size += b.AttesterSlashings[ii].SizeSSZ() 584 } 585 586 // Field (5) 'Attestations' 587 for ii := 0; ii < len(b.Attestations); ii++ { 588 size += 4 589 size += b.Attestations[ii].SizeSSZ() 590 } 591 592 // Field (6) 'Deposits' 593 size += len(b.Deposits) * 1240 594 595 // Field (7) 'VoluntaryExits' 596 size += len(b.VoluntaryExits) * 112 597 598 return 599 } 600 601 // HashTreeRoot ssz hashes the BeaconBlockBodyAltair object 602 func (b *BeaconBlockBodyAltair) HashTreeRoot() ([32]byte, error) { 603 return ssz.HashWithDefaultHasher(b) 604 } 605 606 // HashTreeRootWith ssz hashes the BeaconBlockBodyAltair object with a hasher 607 func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) { 608 indx := hh.Index() 609 610 // Field (0) 'RandaoReveal' 611 if len(b.RandaoReveal) != 96 { 612 err = ssz.ErrBytesLength 613 return 614 } 615 hh.PutBytes(b.RandaoReveal) 616 617 // Field (1) 'Eth1Data' 618 if err = b.Eth1Data.HashTreeRootWith(hh); err != nil { 619 return 620 } 621 622 // Field (2) 'Graffiti' 623 if len(b.Graffiti) != 32 { 624 err = ssz.ErrBytesLength 625 return 626 } 627 hh.PutBytes(b.Graffiti) 628 629 // Field (3) 'ProposerSlashings' 630 { 631 subIndx := hh.Index() 632 num := uint64(len(b.ProposerSlashings)) 633 if num > 16 { 634 err = ssz.ErrIncorrectListSize 635 return 636 } 637 for i := uint64(0); i < num; i++ { 638 if err = b.ProposerSlashings[i].HashTreeRootWith(hh); err != nil { 639 return 640 } 641 } 642 hh.MerkleizeWithMixin(subIndx, num, 16) 643 } 644 645 // Field (4) 'AttesterSlashings' 646 { 647 subIndx := hh.Index() 648 num := uint64(len(b.AttesterSlashings)) 649 if num > 2 { 650 err = ssz.ErrIncorrectListSize 651 return 652 } 653 for i := uint64(0); i < num; i++ { 654 if err = b.AttesterSlashings[i].HashTreeRootWith(hh); err != nil { 655 return 656 } 657 } 658 hh.MerkleizeWithMixin(subIndx, num, 2) 659 } 660 661 // Field (5) 'Attestations' 662 { 663 subIndx := hh.Index() 664 num := uint64(len(b.Attestations)) 665 if num > 128 { 666 err = ssz.ErrIncorrectListSize 667 return 668 } 669 for i := uint64(0); i < num; i++ { 670 if err = b.Attestations[i].HashTreeRootWith(hh); err != nil { 671 return 672 } 673 } 674 hh.MerkleizeWithMixin(subIndx, num, 128) 675 } 676 677 // Field (6) 'Deposits' 678 { 679 subIndx := hh.Index() 680 num := uint64(len(b.Deposits)) 681 if num > 16 { 682 err = ssz.ErrIncorrectListSize 683 return 684 } 685 for i := uint64(0); i < num; i++ { 686 if err = b.Deposits[i].HashTreeRootWith(hh); err != nil { 687 return 688 } 689 } 690 hh.MerkleizeWithMixin(subIndx, num, 16) 691 } 692 693 // Field (7) 'VoluntaryExits' 694 { 695 subIndx := hh.Index() 696 num := uint64(len(b.VoluntaryExits)) 697 if num > 16 { 698 err = ssz.ErrIncorrectListSize 699 return 700 } 701 for i := uint64(0); i < num; i++ { 702 if err = b.VoluntaryExits[i].HashTreeRootWith(hh); err != nil { 703 return 704 } 705 } 706 hh.MerkleizeWithMixin(subIndx, num, 16) 707 } 708 709 // Field (8) 'SyncAggregate' 710 if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil { 711 return 712 } 713 714 hh.Merkleize(indx) 715 return 716 } 717 718 // MarshalSSZ ssz marshals the SyncAggregate object 719 func (s *SyncAggregate) MarshalSSZ() ([]byte, error) { 720 return ssz.MarshalSSZ(s) 721 } 722 723 // MarshalSSZTo ssz marshals the SyncAggregate object to a target array 724 func (s *SyncAggregate) MarshalSSZTo(buf []byte) (dst []byte, err error) { 725 dst = buf 726 727 // Field (0) 'SyncCommitteeBits' 728 if len(s.SyncCommitteeBits) != 64 { 729 err = ssz.ErrBytesLength 730 return 731 } 732 dst = append(dst, s.SyncCommitteeBits...) 733 734 // Field (1) 'SyncCommitteeSignature' 735 if len(s.SyncCommitteeSignature) != 96 { 736 err = ssz.ErrBytesLength 737 return 738 } 739 dst = append(dst, s.SyncCommitteeSignature...) 740 741 return 742 } 743 744 // UnmarshalSSZ ssz unmarshals the SyncAggregate object 745 func (s *SyncAggregate) UnmarshalSSZ(buf []byte) error { 746 var err error 747 size := uint64(len(buf)) 748 if size != 160 { 749 return ssz.ErrSize 750 } 751 752 // Field (0) 'SyncCommitteeBits' 753 if cap(s.SyncCommitteeBits) == 0 { 754 s.SyncCommitteeBits = make([]byte, 0, len(buf[0:64])) 755 } 756 s.SyncCommitteeBits = append(s.SyncCommitteeBits, buf[0:64]...) 757 758 // Field (1) 'SyncCommitteeSignature' 759 if cap(s.SyncCommitteeSignature) == 0 { 760 s.SyncCommitteeSignature = make([]byte, 0, len(buf[64:160])) 761 } 762 s.SyncCommitteeSignature = append(s.SyncCommitteeSignature, buf[64:160]...) 763 764 return err 765 } 766 767 // SizeSSZ returns the ssz encoded size in bytes for the SyncAggregate object 768 func (s *SyncAggregate) SizeSSZ() (size int) { 769 size = 160 770 return 771 } 772 773 // HashTreeRoot ssz hashes the SyncAggregate object 774 func (s *SyncAggregate) HashTreeRoot() ([32]byte, error) { 775 return ssz.HashWithDefaultHasher(s) 776 } 777 778 // HashTreeRootWith ssz hashes the SyncAggregate object with a hasher 779 func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) { 780 indx := hh.Index() 781 782 // Field (0) 'SyncCommitteeBits' 783 if len(s.SyncCommitteeBits) != 64 { 784 err = ssz.ErrBytesLength 785 return 786 } 787 hh.PutBytes(s.SyncCommitteeBits) 788 789 // Field (1) 'SyncCommitteeSignature' 790 if len(s.SyncCommitteeSignature) != 96 { 791 err = ssz.ErrBytesLength 792 return 793 } 794 hh.PutBytes(s.SyncCommitteeSignature) 795 796 hh.Merkleize(indx) 797 return 798 } 799 800 // MarshalSSZ ssz marshals the SyncCommitteeMessage object 801 func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) { 802 return ssz.MarshalSSZ(s) 803 } 804 805 // MarshalSSZTo ssz marshals the SyncCommitteeMessage object to a target array 806 func (s *SyncCommitteeMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) { 807 dst = buf 808 809 // Field (0) 'Slot' 810 dst = ssz.MarshalUint64(dst, uint64(s.Slot)) 811 812 // Field (1) 'BlockRoot' 813 if len(s.BlockRoot) != 32 { 814 err = ssz.ErrBytesLength 815 return 816 } 817 dst = append(dst, s.BlockRoot...) 818 819 // Field (2) 'ValidatorIndex' 820 dst = ssz.MarshalUint64(dst, uint64(s.ValidatorIndex)) 821 822 // Field (3) 'Signature' 823 if len(s.Signature) != 96 { 824 err = ssz.ErrBytesLength 825 return 826 } 827 dst = append(dst, s.Signature...) 828 829 return 830 } 831 832 // UnmarshalSSZ ssz unmarshals the SyncCommitteeMessage object 833 func (s *SyncCommitteeMessage) UnmarshalSSZ(buf []byte) error { 834 var err error 835 size := uint64(len(buf)) 836 if size != 144 { 837 return ssz.ErrSize 838 } 839 840 // Field (0) 'Slot' 841 s.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8])) 842 843 // Field (1) 'BlockRoot' 844 if cap(s.BlockRoot) == 0 { 845 s.BlockRoot = make([]byte, 0, len(buf[8:40])) 846 } 847 s.BlockRoot = append(s.BlockRoot, buf[8:40]...) 848 849 // Field (2) 'ValidatorIndex' 850 s.ValidatorIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[40:48])) 851 852 // Field (3) 'Signature' 853 if cap(s.Signature) == 0 { 854 s.Signature = make([]byte, 0, len(buf[48:144])) 855 } 856 s.Signature = append(s.Signature, buf[48:144]...) 857 858 return err 859 } 860 861 // SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeMessage object 862 func (s *SyncCommitteeMessage) SizeSSZ() (size int) { 863 size = 144 864 return 865 } 866 867 // HashTreeRoot ssz hashes the SyncCommitteeMessage object 868 func (s *SyncCommitteeMessage) HashTreeRoot() ([32]byte, error) { 869 return ssz.HashWithDefaultHasher(s) 870 } 871 872 // HashTreeRootWith ssz hashes the SyncCommitteeMessage object with a hasher 873 func (s *SyncCommitteeMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) { 874 indx := hh.Index() 875 876 // Field (0) 'Slot' 877 hh.PutUint64(uint64(s.Slot)) 878 879 // Field (1) 'BlockRoot' 880 if len(s.BlockRoot) != 32 { 881 err = ssz.ErrBytesLength 882 return 883 } 884 hh.PutBytes(s.BlockRoot) 885 886 // Field (2) 'ValidatorIndex' 887 hh.PutUint64(uint64(s.ValidatorIndex)) 888 889 // Field (3) 'Signature' 890 if len(s.Signature) != 96 { 891 err = ssz.ErrBytesLength 892 return 893 } 894 hh.PutBytes(s.Signature) 895 896 hh.Merkleize(indx) 897 return 898 } 899 900 // MarshalSSZ ssz marshals the SyncCommitteeContribution object 901 func (s *SyncCommitteeContribution) MarshalSSZ() ([]byte, error) { 902 return ssz.MarshalSSZ(s) 903 } 904 905 // MarshalSSZTo ssz marshals the SyncCommitteeContribution object to a target array 906 func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err error) { 907 dst = buf 908 909 // Field (0) 'Slot' 910 dst = ssz.MarshalUint64(dst, uint64(s.Slot)) 911 912 // Field (1) 'BlockRoot' 913 if len(s.BlockRoot) != 32 { 914 err = ssz.ErrBytesLength 915 return 916 } 917 dst = append(dst, s.BlockRoot...) 918 919 // Field (2) 'SubcommitteeIndex' 920 dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex) 921 922 // Field (3) 'AggregationBits' 923 if len(s.AggregationBits) != 16 { 924 err = ssz.ErrBytesLength 925 return 926 } 927 dst = append(dst, s.AggregationBits...) 928 929 // Field (4) 'Signature' 930 if len(s.Signature) != 96 { 931 err = ssz.ErrBytesLength 932 return 933 } 934 dst = append(dst, s.Signature...) 935 936 return 937 } 938 939 // UnmarshalSSZ ssz unmarshals the SyncCommitteeContribution object 940 func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error { 941 var err error 942 size := uint64(len(buf)) 943 if size != 160 { 944 return ssz.ErrSize 945 } 946 947 // Field (0) 'Slot' 948 s.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8])) 949 950 // Field (1) 'BlockRoot' 951 if cap(s.BlockRoot) == 0 { 952 s.BlockRoot = make([]byte, 0, len(buf[8:40])) 953 } 954 s.BlockRoot = append(s.BlockRoot, buf[8:40]...) 955 956 // Field (2) 'SubcommitteeIndex' 957 s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[40:48]) 958 959 // Field (3) 'AggregationBits' 960 if cap(s.AggregationBits) == 0 { 961 s.AggregationBits = make([]byte, 0, len(buf[48:64])) 962 } 963 s.AggregationBits = append(s.AggregationBits, buf[48:64]...) 964 965 // Field (4) 'Signature' 966 if cap(s.Signature) == 0 { 967 s.Signature = make([]byte, 0, len(buf[64:160])) 968 } 969 s.Signature = append(s.Signature, buf[64:160]...) 970 971 return err 972 } 973 974 // SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object 975 func (s *SyncCommitteeContribution) SizeSSZ() (size int) { 976 size = 160 977 return 978 } 979 980 // HashTreeRoot ssz hashes the SyncCommitteeContribution object 981 func (s *SyncCommitteeContribution) HashTreeRoot() ([32]byte, error) { 982 return ssz.HashWithDefaultHasher(s) 983 } 984 985 // HashTreeRootWith ssz hashes the SyncCommitteeContribution object with a hasher 986 func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error) { 987 indx := hh.Index() 988 989 // Field (0) 'Slot' 990 hh.PutUint64(uint64(s.Slot)) 991 992 // Field (1) 'BlockRoot' 993 if len(s.BlockRoot) != 32 { 994 err = ssz.ErrBytesLength 995 return 996 } 997 hh.PutBytes(s.BlockRoot) 998 999 // Field (2) 'SubcommitteeIndex' 1000 hh.PutUint64(s.SubcommitteeIndex) 1001 1002 // Field (3) 'AggregationBits' 1003 if len(s.AggregationBits) != 16 { 1004 err = ssz.ErrBytesLength 1005 return 1006 } 1007 hh.PutBytes(s.AggregationBits) 1008 1009 // Field (4) 'Signature' 1010 if len(s.Signature) != 96 { 1011 err = ssz.ErrBytesLength 1012 return 1013 } 1014 hh.PutBytes(s.Signature) 1015 1016 hh.Merkleize(indx) 1017 return 1018 } 1019 1020 // MarshalSSZ ssz marshals the ContributionAndProof object 1021 func (c *ContributionAndProof) MarshalSSZ() ([]byte, error) { 1022 return ssz.MarshalSSZ(c) 1023 } 1024 1025 // MarshalSSZTo ssz marshals the ContributionAndProof object to a target array 1026 func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { 1027 dst = buf 1028 1029 // Field (0) 'AggregatorIndex' 1030 dst = ssz.MarshalUint64(dst, uint64(c.AggregatorIndex)) 1031 1032 // Field (1) 'Contribution' 1033 if c.Contribution == nil { 1034 c.Contribution = new(SyncCommitteeContribution) 1035 } 1036 if dst, err = c.Contribution.MarshalSSZTo(dst); err != nil { 1037 return 1038 } 1039 1040 // Field (2) 'SelectionProof' 1041 if len(c.SelectionProof) != 96 { 1042 err = ssz.ErrBytesLength 1043 return 1044 } 1045 dst = append(dst, c.SelectionProof...) 1046 1047 return 1048 } 1049 1050 // UnmarshalSSZ ssz unmarshals the ContributionAndProof object 1051 func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error { 1052 var err error 1053 size := uint64(len(buf)) 1054 if size != 264 { 1055 return ssz.ErrSize 1056 } 1057 1058 // Field (0) 'AggregatorIndex' 1059 c.AggregatorIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8])) 1060 1061 // Field (1) 'Contribution' 1062 if c.Contribution == nil { 1063 c.Contribution = new(SyncCommitteeContribution) 1064 } 1065 if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil { 1066 return err 1067 } 1068 1069 // Field (2) 'SelectionProof' 1070 if cap(c.SelectionProof) == 0 { 1071 c.SelectionProof = make([]byte, 0, len(buf[168:264])) 1072 } 1073 c.SelectionProof = append(c.SelectionProof, buf[168:264]...) 1074 1075 return err 1076 } 1077 1078 // SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object 1079 func (c *ContributionAndProof) SizeSSZ() (size int) { 1080 size = 264 1081 return 1082 } 1083 1084 // HashTreeRoot ssz hashes the ContributionAndProof object 1085 func (c *ContributionAndProof) HashTreeRoot() ([32]byte, error) { 1086 return ssz.HashWithDefaultHasher(c) 1087 } 1088 1089 // HashTreeRootWith ssz hashes the ContributionAndProof object with a hasher 1090 func (c *ContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { 1091 indx := hh.Index() 1092 1093 // Field (0) 'AggregatorIndex' 1094 hh.PutUint64(uint64(c.AggregatorIndex)) 1095 1096 // Field (1) 'Contribution' 1097 if err = c.Contribution.HashTreeRootWith(hh); err != nil { 1098 return 1099 } 1100 1101 // Field (2) 'SelectionProof' 1102 if len(c.SelectionProof) != 96 { 1103 err = ssz.ErrBytesLength 1104 return 1105 } 1106 hh.PutBytes(c.SelectionProof) 1107 1108 hh.Merkleize(indx) 1109 return 1110 } 1111 1112 // MarshalSSZ ssz marshals the SignedContributionAndProof object 1113 func (s *SignedContributionAndProof) MarshalSSZ() ([]byte, error) { 1114 return ssz.MarshalSSZ(s) 1115 } 1116 1117 // MarshalSSZTo ssz marshals the SignedContributionAndProof object to a target array 1118 func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) { 1119 dst = buf 1120 1121 // Field (0) 'Message' 1122 if s.Message == nil { 1123 s.Message = new(ContributionAndProof) 1124 } 1125 if dst, err = s.Message.MarshalSSZTo(dst); err != nil { 1126 return 1127 } 1128 1129 // Field (1) 'Signature' 1130 if len(s.Signature) != 96 { 1131 err = ssz.ErrBytesLength 1132 return 1133 } 1134 dst = append(dst, s.Signature...) 1135 1136 return 1137 } 1138 1139 // UnmarshalSSZ ssz unmarshals the SignedContributionAndProof object 1140 func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error { 1141 var err error 1142 size := uint64(len(buf)) 1143 if size != 360 { 1144 return ssz.ErrSize 1145 } 1146 1147 // Field (0) 'Message' 1148 if s.Message == nil { 1149 s.Message = new(ContributionAndProof) 1150 } 1151 if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil { 1152 return err 1153 } 1154 1155 // Field (1) 'Signature' 1156 if cap(s.Signature) == 0 { 1157 s.Signature = make([]byte, 0, len(buf[264:360])) 1158 } 1159 s.Signature = append(s.Signature, buf[264:360]...) 1160 1161 return err 1162 } 1163 1164 // SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object 1165 func (s *SignedContributionAndProof) SizeSSZ() (size int) { 1166 size = 360 1167 return 1168 } 1169 1170 // HashTreeRoot ssz hashes the SignedContributionAndProof object 1171 func (s *SignedContributionAndProof) HashTreeRoot() ([32]byte, error) { 1172 return ssz.HashWithDefaultHasher(s) 1173 } 1174 1175 // HashTreeRootWith ssz hashes the SignedContributionAndProof object with a hasher 1176 func (s *SignedContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) { 1177 indx := hh.Index() 1178 1179 // Field (0) 'Message' 1180 if err = s.Message.HashTreeRootWith(hh); err != nil { 1181 return 1182 } 1183 1184 // Field (1) 'Signature' 1185 if len(s.Signature) != 96 { 1186 err = ssz.ErrBytesLength 1187 return 1188 } 1189 hh.PutBytes(s.Signature) 1190 1191 hh.Merkleize(indx) 1192 return 1193 }