mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
2789 lines
69 KiB
Go
2789 lines
69 KiB
Go
// Code generated by fastssz. DO NOT EDIT.
|
|
// Hash: 18a07a11eb3d1daaafe0b6b1ac8934e9333ea6eceed7d5ef30166b9c2fb50d39
|
|
package eth
|
|
|
|
import (
|
|
ssz "github.com/prysmaticlabs/fastssz"
|
|
github_com_prysmaticlabs_prysm_v5_consensus_types_primitives "github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
)
|
|
|
|
// MarshalSSZ ssz marshals the BeaconBlockAltair object
|
|
func (b *BeaconBlockAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(b)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the BeaconBlockAltair object to a target array
|
|
func (b *BeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
offset := int(84)
|
|
|
|
// Field (0) 'Slot'
|
|
dst = ssz.MarshalUint64(dst, uint64(b.Slot))
|
|
|
|
// Field (1) 'ProposerIndex'
|
|
dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex))
|
|
|
|
// Field (2) 'ParentRoot'
|
|
if size := len(b.ParentRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.ParentRoot...)
|
|
|
|
// Field (3) 'StateRoot'
|
|
if size := len(b.StateRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.StateRoot...)
|
|
|
|
// Offset (4) 'Body'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
if b.Body == nil {
|
|
b.Body = new(BeaconBlockBodyAltair)
|
|
}
|
|
offset += b.Body.SizeSSZ()
|
|
|
|
// Field (4) 'Body'
|
|
if dst, err = b.Body.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the BeaconBlockAltair object
|
|
func (b *BeaconBlockAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size < 84 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
tail := buf
|
|
var o4 uint64
|
|
|
|
// Field (0) 'Slot'
|
|
b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))
|
|
|
|
// Field (1) 'ProposerIndex'
|
|
b.ProposerIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
|
|
|
|
// Field (2) 'ParentRoot'
|
|
if cap(b.ParentRoot) == 0 {
|
|
b.ParentRoot = make([]byte, 0, len(buf[16:48]))
|
|
}
|
|
b.ParentRoot = append(b.ParentRoot, buf[16:48]...)
|
|
|
|
// Field (3) 'StateRoot'
|
|
if cap(b.StateRoot) == 0 {
|
|
b.StateRoot = make([]byte, 0, len(buf[48:80]))
|
|
}
|
|
b.StateRoot = append(b.StateRoot, buf[48:80]...)
|
|
|
|
// Offset (4) 'Body'
|
|
if o4 = ssz.ReadOffset(buf[80:84]); o4 > size {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
if o4 != 84 {
|
|
return ssz.ErrInvalidVariableOffset
|
|
}
|
|
|
|
// Field (4) 'Body'
|
|
{
|
|
buf = tail[o4:]
|
|
if b.Body == nil {
|
|
b.Body = new(BeaconBlockBodyAltair)
|
|
}
|
|
if err = b.Body.UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockAltair object
|
|
func (b *BeaconBlockAltair) SizeSSZ() (size int) {
|
|
size = 84
|
|
|
|
// Field (4) 'Body'
|
|
if b.Body == nil {
|
|
b.Body = new(BeaconBlockBodyAltair)
|
|
}
|
|
size += b.Body.SizeSSZ()
|
|
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the BeaconBlockAltair object
|
|
func (b *BeaconBlockAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(b)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the BeaconBlockAltair object with a hasher
|
|
func (b *BeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Slot'
|
|
hh.PutUint64(uint64(b.Slot))
|
|
|
|
// Field (1) 'ProposerIndex'
|
|
hh.PutUint64(uint64(b.ProposerIndex))
|
|
|
|
// Field (2) 'ParentRoot'
|
|
if size := len(b.ParentRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.ParentRoot", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(b.ParentRoot)
|
|
|
|
// Field (3) 'StateRoot'
|
|
if size := len(b.StateRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(b.StateRoot)
|
|
|
|
// Field (4) 'Body'
|
|
if err = b.Body.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SignedBeaconBlockAltair object
|
|
func (s *SignedBeaconBlockAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SignedBeaconBlockAltair object to a target array
|
|
func (s *SignedBeaconBlockAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
offset := int(100)
|
|
|
|
// Offset (0) 'Block'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
if s.Block == nil {
|
|
s.Block = new(BeaconBlockAltair)
|
|
}
|
|
offset += s.Block.SizeSSZ()
|
|
|
|
// Field (1) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, s.Signature...)
|
|
|
|
// Field (0) 'Block'
|
|
if dst, err = s.Block.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SignedBeaconBlockAltair object
|
|
func (s *SignedBeaconBlockAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size < 100 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
tail := buf
|
|
var o0 uint64
|
|
|
|
// Offset (0) 'Block'
|
|
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
if o0 != 100 {
|
|
return ssz.ErrInvalidVariableOffset
|
|
}
|
|
|
|
// Field (1) 'Signature'
|
|
if cap(s.Signature) == 0 {
|
|
s.Signature = make([]byte, 0, len(buf[4:100]))
|
|
}
|
|
s.Signature = append(s.Signature, buf[4:100]...)
|
|
|
|
// Field (0) 'Block'
|
|
{
|
|
buf = tail[o0:]
|
|
if s.Block == nil {
|
|
s.Block = new(BeaconBlockAltair)
|
|
}
|
|
if err = s.Block.UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockAltair object
|
|
func (s *SignedBeaconBlockAltair) SizeSSZ() (size int) {
|
|
size = 100
|
|
|
|
// Field (0) 'Block'
|
|
if s.Block == nil {
|
|
s.Block = new(BeaconBlockAltair)
|
|
}
|
|
size += s.Block.SizeSSZ()
|
|
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SignedBeaconBlockAltair object
|
|
func (s *SignedBeaconBlockAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SignedBeaconBlockAltair object with a hasher
|
|
func (s *SignedBeaconBlockAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Block'
|
|
if err = s.Block.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(s.Signature)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the BeaconBlockBodyAltair object
|
|
func (b *BeaconBlockBodyAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(b)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the BeaconBlockBodyAltair object to a target array
|
|
func (b *BeaconBlockBodyAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
offset := int(380)
|
|
|
|
// Field (0) 'RandaoReveal'
|
|
if size := len(b.RandaoReveal); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, b.RandaoReveal...)
|
|
|
|
// Field (1) 'Eth1Data'
|
|
if b.Eth1Data == nil {
|
|
b.Eth1Data = new(Eth1Data)
|
|
}
|
|
if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'Graffiti'
|
|
if size := len(b.Graffiti); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.Graffiti...)
|
|
|
|
// Offset (3) 'ProposerSlashings'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.ProposerSlashings) * 416
|
|
|
|
// Offset (4) 'AttesterSlashings'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
|
offset += 4
|
|
offset += b.AttesterSlashings[ii].SizeSSZ()
|
|
}
|
|
|
|
// Offset (5) 'Attestations'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
for ii := 0; ii < len(b.Attestations); ii++ {
|
|
offset += 4
|
|
offset += b.Attestations[ii].SizeSSZ()
|
|
}
|
|
|
|
// Offset (6) 'Deposits'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.Deposits) * 1240
|
|
|
|
// Offset (7) 'VoluntaryExits'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.VoluntaryExits) * 112
|
|
|
|
// Field (8) 'SyncAggregate'
|
|
if b.SyncAggregate == nil {
|
|
b.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if dst, err = b.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (3) 'ProposerSlashings'
|
|
if size := len(b.ProposerSlashings); size > 16 {
|
|
err = ssz.ErrListTooBigFn("--.ProposerSlashings", size, 16)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.ProposerSlashings); ii++ {
|
|
if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (4) 'AttesterSlashings'
|
|
if size := len(b.AttesterSlashings); size > 2 {
|
|
err = ssz.ErrListTooBigFn("--.AttesterSlashings", size, 2)
|
|
return
|
|
}
|
|
{
|
|
offset = 4 * len(b.AttesterSlashings)
|
|
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += b.AttesterSlashings[ii].SizeSSZ()
|
|
}
|
|
}
|
|
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
|
if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (5) 'Attestations'
|
|
if size := len(b.Attestations); size > 128 {
|
|
err = ssz.ErrListTooBigFn("--.Attestations", size, 128)
|
|
return
|
|
}
|
|
{
|
|
offset = 4 * len(b.Attestations)
|
|
for ii := 0; ii < len(b.Attestations); ii++ {
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += b.Attestations[ii].SizeSSZ()
|
|
}
|
|
}
|
|
for ii := 0; ii < len(b.Attestations); ii++ {
|
|
if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (6) 'Deposits'
|
|
if size := len(b.Deposits); size > 16 {
|
|
err = ssz.ErrListTooBigFn("--.Deposits", size, 16)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.Deposits); ii++ {
|
|
if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (7) 'VoluntaryExits'
|
|
if size := len(b.VoluntaryExits); size > 16 {
|
|
err = ssz.ErrListTooBigFn("--.VoluntaryExits", size, 16)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.VoluntaryExits); ii++ {
|
|
if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the BeaconBlockBodyAltair object
|
|
func (b *BeaconBlockBodyAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size < 380 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
tail := buf
|
|
var o3, o4, o5, o6, o7 uint64
|
|
|
|
// Field (0) 'RandaoReveal'
|
|
if cap(b.RandaoReveal) == 0 {
|
|
b.RandaoReveal = make([]byte, 0, len(buf[0:96]))
|
|
}
|
|
b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...)
|
|
|
|
// Field (1) 'Eth1Data'
|
|
if b.Eth1Data == nil {
|
|
b.Eth1Data = new(Eth1Data)
|
|
}
|
|
if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'Graffiti'
|
|
if cap(b.Graffiti) == 0 {
|
|
b.Graffiti = make([]byte, 0, len(buf[168:200]))
|
|
}
|
|
b.Graffiti = append(b.Graffiti, buf[168:200]...)
|
|
|
|
// Offset (3) 'ProposerSlashings'
|
|
if o3 = ssz.ReadOffset(buf[200:204]); o3 > size {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
if o3 != 380 {
|
|
return ssz.ErrInvalidVariableOffset
|
|
}
|
|
|
|
// Offset (4) 'AttesterSlashings'
|
|
if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Offset (5) 'Attestations'
|
|
if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Offset (6) 'Deposits'
|
|
if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Offset (7) 'VoluntaryExits'
|
|
if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (8) 'SyncAggregate'
|
|
if b.SyncAggregate == nil {
|
|
b.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if err = b.SyncAggregate.UnmarshalSSZ(buf[220:380]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (3) 'ProposerSlashings'
|
|
{
|
|
buf = tail[o3:o4]
|
|
num, err := ssz.DivideInt2(len(buf), 416, 16)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.ProposerSlashings = make([]*ProposerSlashing, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if b.ProposerSlashings[ii] == nil {
|
|
b.ProposerSlashings[ii] = new(ProposerSlashing)
|
|
}
|
|
if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
// Field (4) 'AttesterSlashings'
|
|
{
|
|
buf = tail[o4:o5]
|
|
num, err := ssz.DecodeDynamicLength(buf, 2)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.AttesterSlashings = make([]*AttesterSlashing, num)
|
|
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
|
if b.AttesterSlashings[indx] == nil {
|
|
b.AttesterSlashings[indx] = new(AttesterSlashing)
|
|
}
|
|
if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
// Field (5) 'Attestations'
|
|
{
|
|
buf = tail[o5:o6]
|
|
num, err := ssz.DecodeDynamicLength(buf, 128)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.Attestations = make([]*Attestation, num)
|
|
err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
|
|
if b.Attestations[indx] == nil {
|
|
b.Attestations[indx] = new(Attestation)
|
|
}
|
|
if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
// Field (6) 'Deposits'
|
|
{
|
|
buf = tail[o6:o7]
|
|
num, err := ssz.DivideInt2(len(buf), 1240, 16)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.Deposits = make([]*Deposit, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if b.Deposits[ii] == nil {
|
|
b.Deposits[ii] = new(Deposit)
|
|
}
|
|
if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
// Field (7) 'VoluntaryExits'
|
|
{
|
|
buf = tail[o7:]
|
|
num, err := ssz.DivideInt2(len(buf), 112, 16)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.VoluntaryExits = make([]*SignedVoluntaryExit, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if b.VoluntaryExits[ii] == nil {
|
|
b.VoluntaryExits[ii] = new(SignedVoluntaryExit)
|
|
}
|
|
if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBodyAltair object
|
|
func (b *BeaconBlockBodyAltair) SizeSSZ() (size int) {
|
|
size = 380
|
|
|
|
// Field (3) 'ProposerSlashings'
|
|
size += len(b.ProposerSlashings) * 416
|
|
|
|
// Field (4) 'AttesterSlashings'
|
|
for ii := 0; ii < len(b.AttesterSlashings); ii++ {
|
|
size += 4
|
|
size += b.AttesterSlashings[ii].SizeSSZ()
|
|
}
|
|
|
|
// Field (5) 'Attestations'
|
|
for ii := 0; ii < len(b.Attestations); ii++ {
|
|
size += 4
|
|
size += b.Attestations[ii].SizeSSZ()
|
|
}
|
|
|
|
// Field (6) 'Deposits'
|
|
size += len(b.Deposits) * 1240
|
|
|
|
// Field (7) 'VoluntaryExits'
|
|
size += len(b.VoluntaryExits) * 112
|
|
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the BeaconBlockBodyAltair object
|
|
func (b *BeaconBlockBodyAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(b)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the BeaconBlockBodyAltair object with a hasher
|
|
func (b *BeaconBlockBodyAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'RandaoReveal'
|
|
if size := len(b.RandaoReveal); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.RandaoReveal", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(b.RandaoReveal)
|
|
|
|
// Field (1) 'Eth1Data'
|
|
if err = b.Eth1Data.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'Graffiti'
|
|
if size := len(b.Graffiti); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.Graffiti", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(b.Graffiti)
|
|
|
|
// Field (3) 'ProposerSlashings'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.ProposerSlashings))
|
|
if num > 16 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.ProposerSlashings {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 16)
|
|
}
|
|
|
|
// Field (4) 'AttesterSlashings'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.AttesterSlashings))
|
|
if num > 2 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.AttesterSlashings {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 2)
|
|
}
|
|
|
|
// Field (5) 'Attestations'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.Attestations))
|
|
if num > 128 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.Attestations {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 128)
|
|
}
|
|
|
|
// Field (6) 'Deposits'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.Deposits))
|
|
if num > 16 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.Deposits {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 16)
|
|
}
|
|
|
|
// Field (7) 'VoluntaryExits'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.VoluntaryExits))
|
|
if num > 16 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.VoluntaryExits {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 16)
|
|
}
|
|
|
|
// Field (8) 'SyncAggregate'
|
|
if err = b.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SyncAggregate object
|
|
func (s *SyncAggregate) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SyncAggregate object to a target array
|
|
func (s *SyncAggregate) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'SyncCommitteeBits'
|
|
if size := len(s.SyncCommitteeBits); size != 64 {
|
|
err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64)
|
|
return
|
|
}
|
|
dst = append(dst, s.SyncCommitteeBits...)
|
|
|
|
// Field (1) 'SyncCommitteeSignature'
|
|
if size := len(s.SyncCommitteeSignature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, s.SyncCommitteeSignature...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SyncAggregate object
|
|
func (s *SyncAggregate) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 160 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'SyncCommitteeBits'
|
|
if cap(s.SyncCommitteeBits) == 0 {
|
|
s.SyncCommitteeBits = make([]byte, 0, len(buf[0:64]))
|
|
}
|
|
s.SyncCommitteeBits = append(s.SyncCommitteeBits, buf[0:64]...)
|
|
|
|
// Field (1) 'SyncCommitteeSignature'
|
|
if cap(s.SyncCommitteeSignature) == 0 {
|
|
s.SyncCommitteeSignature = make([]byte, 0, len(buf[64:160]))
|
|
}
|
|
s.SyncCommitteeSignature = append(s.SyncCommitteeSignature, buf[64:160]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregate object
|
|
func (s *SyncAggregate) SizeSSZ() (size int) {
|
|
size = 160
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SyncAggregate object
|
|
func (s *SyncAggregate) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SyncAggregate object with a hasher
|
|
func (s *SyncAggregate) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'SyncCommitteeBits'
|
|
if size := len(s.SyncCommitteeBits); size != 64 {
|
|
err = ssz.ErrBytesLengthFn("--.SyncCommitteeBits", size, 64)
|
|
return
|
|
}
|
|
hh.PutBytes(s.SyncCommitteeBits)
|
|
|
|
// Field (1) 'SyncCommitteeSignature'
|
|
if size := len(s.SyncCommitteeSignature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.SyncCommitteeSignature", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(s.SyncCommitteeSignature)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the BeaconStateAltair object
|
|
func (b *BeaconStateAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(b)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the BeaconStateAltair object to a target array
|
|
func (b *BeaconStateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
offset := int(2736629)
|
|
|
|
// Field (0) 'GenesisTime'
|
|
dst = ssz.MarshalUint64(dst, b.GenesisTime)
|
|
|
|
// Field (1) 'GenesisValidatorsRoot'
|
|
if size := len(b.GenesisValidatorsRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.GenesisValidatorsRoot...)
|
|
|
|
// Field (2) 'Slot'
|
|
dst = ssz.MarshalUint64(dst, uint64(b.Slot))
|
|
|
|
// Field (3) 'Fork'
|
|
if b.Fork == nil {
|
|
b.Fork = new(Fork)
|
|
}
|
|
if dst, err = b.Fork.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'LatestBlockHeader'
|
|
if b.LatestBlockHeader == nil {
|
|
b.LatestBlockHeader = new(BeaconBlockHeader)
|
|
}
|
|
if dst, err = b.LatestBlockHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (5) 'BlockRoots'
|
|
if size := len(b.BlockRoots); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192)
|
|
return
|
|
}
|
|
for ii := 0; ii < 8192; ii++ {
|
|
if size := len(b.BlockRoots[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.BlockRoots[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.BlockRoots[ii]...)
|
|
}
|
|
|
|
// Field (6) 'StateRoots'
|
|
if size := len(b.StateRoots); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192)
|
|
return
|
|
}
|
|
for ii := 0; ii < 8192; ii++ {
|
|
if size := len(b.StateRoots[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.StateRoots[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.StateRoots[ii]...)
|
|
}
|
|
|
|
// Offset (7) 'HistoricalRoots'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.HistoricalRoots) * 32
|
|
|
|
// Field (8) 'Eth1Data'
|
|
if b.Eth1Data == nil {
|
|
b.Eth1Data = new(Eth1Data)
|
|
}
|
|
if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Offset (9) 'Eth1DataVotes'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.Eth1DataVotes) * 72
|
|
|
|
// Field (10) 'Eth1DepositIndex'
|
|
dst = ssz.MarshalUint64(dst, b.Eth1DepositIndex)
|
|
|
|
// Offset (11) 'Validators'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.Validators) * 121
|
|
|
|
// Offset (12) 'Balances'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.Balances) * 8
|
|
|
|
// Field (13) 'RandaoMixes'
|
|
if size := len(b.RandaoMixes); size != 65536 {
|
|
err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536)
|
|
return
|
|
}
|
|
for ii := 0; ii < 65536; ii++ {
|
|
if size := len(b.RandaoMixes[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.RandaoMixes[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.RandaoMixes[ii]...)
|
|
}
|
|
|
|
// Field (14) 'Slashings'
|
|
if size := len(b.Slashings); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192)
|
|
return
|
|
}
|
|
for ii := 0; ii < 8192; ii++ {
|
|
dst = ssz.MarshalUint64(dst, b.Slashings[ii])
|
|
}
|
|
|
|
// Offset (15) 'PreviousEpochParticipation'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.PreviousEpochParticipation)
|
|
|
|
// Offset (16) 'CurrentEpochParticipation'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.CurrentEpochParticipation)
|
|
|
|
// Field (17) 'JustificationBits'
|
|
if size := len(b.JustificationBits); size != 1 {
|
|
err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1)
|
|
return
|
|
}
|
|
dst = append(dst, b.JustificationBits...)
|
|
|
|
// Field (18) 'PreviousJustifiedCheckpoint'
|
|
if b.PreviousJustifiedCheckpoint == nil {
|
|
b.PreviousJustifiedCheckpoint = new(Checkpoint)
|
|
}
|
|
if dst, err = b.PreviousJustifiedCheckpoint.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (19) 'CurrentJustifiedCheckpoint'
|
|
if b.CurrentJustifiedCheckpoint == nil {
|
|
b.CurrentJustifiedCheckpoint = new(Checkpoint)
|
|
}
|
|
if dst, err = b.CurrentJustifiedCheckpoint.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (20) 'FinalizedCheckpoint'
|
|
if b.FinalizedCheckpoint == nil {
|
|
b.FinalizedCheckpoint = new(Checkpoint)
|
|
}
|
|
if dst, err = b.FinalizedCheckpoint.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Offset (21) 'InactivityScores'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
offset += len(b.InactivityScores) * 8
|
|
|
|
// Field (22) 'CurrentSyncCommittee'
|
|
if b.CurrentSyncCommittee == nil {
|
|
b.CurrentSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if dst, err = b.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (23) 'NextSyncCommittee'
|
|
if b.NextSyncCommittee == nil {
|
|
b.NextSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if dst, err = b.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (7) 'HistoricalRoots'
|
|
if size := len(b.HistoricalRoots); size > 16777216 {
|
|
err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.HistoricalRoots); ii++ {
|
|
if size := len(b.HistoricalRoots[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.HistoricalRoots[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, b.HistoricalRoots[ii]...)
|
|
}
|
|
|
|
// Field (9) 'Eth1DataVotes'
|
|
if size := len(b.Eth1DataVotes); size > 2048 {
|
|
err = ssz.ErrListTooBigFn("--.Eth1DataVotes", size, 2048)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.Eth1DataVotes); ii++ {
|
|
if dst, err = b.Eth1DataVotes[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (11) 'Validators'
|
|
if size := len(b.Validators); size > 1099511627776 {
|
|
err = ssz.ErrListTooBigFn("--.Validators", size, 1099511627776)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.Validators); ii++ {
|
|
if dst, err = b.Validators[ii].MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
}
|
|
|
|
// Field (12) 'Balances'
|
|
if size := len(b.Balances); size > 1099511627776 {
|
|
err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.Balances); ii++ {
|
|
dst = ssz.MarshalUint64(dst, b.Balances[ii])
|
|
}
|
|
|
|
// Field (15) 'PreviousEpochParticipation'
|
|
if size := len(b.PreviousEpochParticipation); size > 1099511627776 {
|
|
err = ssz.ErrBytesLengthFn("--.PreviousEpochParticipation", size, 1099511627776)
|
|
return
|
|
}
|
|
dst = append(dst, b.PreviousEpochParticipation...)
|
|
|
|
// Field (16) 'CurrentEpochParticipation'
|
|
if size := len(b.CurrentEpochParticipation); size > 1099511627776 {
|
|
err = ssz.ErrBytesLengthFn("--.CurrentEpochParticipation", size, 1099511627776)
|
|
return
|
|
}
|
|
dst = append(dst, b.CurrentEpochParticipation...)
|
|
|
|
// Field (21) 'InactivityScores'
|
|
if size := len(b.InactivityScores); size > 1099511627776 {
|
|
err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776)
|
|
return
|
|
}
|
|
for ii := 0; ii < len(b.InactivityScores); ii++ {
|
|
dst = ssz.MarshalUint64(dst, b.InactivityScores[ii])
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the BeaconStateAltair object
|
|
func (b *BeaconStateAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size < 2736629 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
tail := buf
|
|
var o7, o9, o11, o12, o15, o16, o21 uint64
|
|
|
|
// Field (0) 'GenesisTime'
|
|
b.GenesisTime = ssz.UnmarshallUint64(buf[0:8])
|
|
|
|
// Field (1) 'GenesisValidatorsRoot'
|
|
if cap(b.GenesisValidatorsRoot) == 0 {
|
|
b.GenesisValidatorsRoot = make([]byte, 0, len(buf[8:40]))
|
|
}
|
|
b.GenesisValidatorsRoot = append(b.GenesisValidatorsRoot, buf[8:40]...)
|
|
|
|
// Field (2) 'Slot'
|
|
b.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[40:48]))
|
|
|
|
// Field (3) 'Fork'
|
|
if b.Fork == nil {
|
|
b.Fork = new(Fork)
|
|
}
|
|
if err = b.Fork.UnmarshalSSZ(buf[48:64]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (4) 'LatestBlockHeader'
|
|
if b.LatestBlockHeader == nil {
|
|
b.LatestBlockHeader = new(BeaconBlockHeader)
|
|
}
|
|
if err = b.LatestBlockHeader.UnmarshalSSZ(buf[64:176]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (5) 'BlockRoots'
|
|
b.BlockRoots = make([][]byte, 8192)
|
|
for ii := 0; ii < 8192; ii++ {
|
|
if cap(b.BlockRoots[ii]) == 0 {
|
|
b.BlockRoots[ii] = make([]byte, 0, len(buf[176:262320][ii*32:(ii+1)*32]))
|
|
}
|
|
b.BlockRoots[ii] = append(b.BlockRoots[ii], buf[176:262320][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Field (6) 'StateRoots'
|
|
b.StateRoots = make([][]byte, 8192)
|
|
for ii := 0; ii < 8192; ii++ {
|
|
if cap(b.StateRoots[ii]) == 0 {
|
|
b.StateRoots[ii] = make([]byte, 0, len(buf[262320:524464][ii*32:(ii+1)*32]))
|
|
}
|
|
b.StateRoots[ii] = append(b.StateRoots[ii], buf[262320:524464][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Offset (7) 'HistoricalRoots'
|
|
if o7 = ssz.ReadOffset(buf[524464:524468]); o7 > size {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
if o7 != 2736629 {
|
|
return ssz.ErrInvalidVariableOffset
|
|
}
|
|
|
|
// Field (8) 'Eth1Data'
|
|
if b.Eth1Data == nil {
|
|
b.Eth1Data = new(Eth1Data)
|
|
}
|
|
if err = b.Eth1Data.UnmarshalSSZ(buf[524468:524540]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Offset (9) 'Eth1DataVotes'
|
|
if o9 = ssz.ReadOffset(buf[524540:524544]); o9 > size || o7 > o9 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (10) 'Eth1DepositIndex'
|
|
b.Eth1DepositIndex = ssz.UnmarshallUint64(buf[524544:524552])
|
|
|
|
// Offset (11) 'Validators'
|
|
if o11 = ssz.ReadOffset(buf[524552:524556]); o11 > size || o9 > o11 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Offset (12) 'Balances'
|
|
if o12 = ssz.ReadOffset(buf[524556:524560]); o12 > size || o11 > o12 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (13) 'RandaoMixes'
|
|
b.RandaoMixes = make([][]byte, 65536)
|
|
for ii := 0; ii < 65536; ii++ {
|
|
if cap(b.RandaoMixes[ii]) == 0 {
|
|
b.RandaoMixes[ii] = make([]byte, 0, len(buf[524560:2621712][ii*32:(ii+1)*32]))
|
|
}
|
|
b.RandaoMixes[ii] = append(b.RandaoMixes[ii], buf[524560:2621712][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Field (14) 'Slashings'
|
|
b.Slashings = ssz.ExtendUint64(b.Slashings, 8192)
|
|
for ii := 0; ii < 8192; ii++ {
|
|
b.Slashings[ii] = ssz.UnmarshallUint64(buf[2621712:2687248][ii*8 : (ii+1)*8])
|
|
}
|
|
|
|
// Offset (15) 'PreviousEpochParticipation'
|
|
if o15 = ssz.ReadOffset(buf[2687248:2687252]); o15 > size || o12 > o15 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Offset (16) 'CurrentEpochParticipation'
|
|
if o16 = ssz.ReadOffset(buf[2687252:2687256]); o16 > size || o15 > o16 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (17) 'JustificationBits'
|
|
if cap(b.JustificationBits) == 0 {
|
|
b.JustificationBits = make([]byte, 0, len(buf[2687256:2687257]))
|
|
}
|
|
b.JustificationBits = append(b.JustificationBits, buf[2687256:2687257]...)
|
|
|
|
// Field (18) 'PreviousJustifiedCheckpoint'
|
|
if b.PreviousJustifiedCheckpoint == nil {
|
|
b.PreviousJustifiedCheckpoint = new(Checkpoint)
|
|
}
|
|
if err = b.PreviousJustifiedCheckpoint.UnmarshalSSZ(buf[2687257:2687297]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (19) 'CurrentJustifiedCheckpoint'
|
|
if b.CurrentJustifiedCheckpoint == nil {
|
|
b.CurrentJustifiedCheckpoint = new(Checkpoint)
|
|
}
|
|
if err = b.CurrentJustifiedCheckpoint.UnmarshalSSZ(buf[2687297:2687337]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (20) 'FinalizedCheckpoint'
|
|
if b.FinalizedCheckpoint == nil {
|
|
b.FinalizedCheckpoint = new(Checkpoint)
|
|
}
|
|
if err = b.FinalizedCheckpoint.UnmarshalSSZ(buf[2687337:2687377]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Offset (21) 'InactivityScores'
|
|
if o21 = ssz.ReadOffset(buf[2687377:2687381]); o21 > size || o16 > o21 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (22) 'CurrentSyncCommittee'
|
|
if b.CurrentSyncCommittee == nil {
|
|
b.CurrentSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if err = b.CurrentSyncCommittee.UnmarshalSSZ(buf[2687381:2712005]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (23) 'NextSyncCommittee'
|
|
if b.NextSyncCommittee == nil {
|
|
b.NextSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if err = b.NextSyncCommittee.UnmarshalSSZ(buf[2712005:2736629]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (7) 'HistoricalRoots'
|
|
{
|
|
buf = tail[o7:o9]
|
|
num, err := ssz.DivideInt2(len(buf), 32, 16777216)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.HistoricalRoots = make([][]byte, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if cap(b.HistoricalRoots[ii]) == 0 {
|
|
b.HistoricalRoots[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32]))
|
|
}
|
|
b.HistoricalRoots[ii] = append(b.HistoricalRoots[ii], buf[ii*32:(ii+1)*32]...)
|
|
}
|
|
}
|
|
|
|
// Field (9) 'Eth1DataVotes'
|
|
{
|
|
buf = tail[o9:o11]
|
|
num, err := ssz.DivideInt2(len(buf), 72, 2048)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.Eth1DataVotes = make([]*Eth1Data, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if b.Eth1DataVotes[ii] == nil {
|
|
b.Eth1DataVotes[ii] = new(Eth1Data)
|
|
}
|
|
if err = b.Eth1DataVotes[ii].UnmarshalSSZ(buf[ii*72 : (ii+1)*72]); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
// Field (11) 'Validators'
|
|
{
|
|
buf = tail[o11:o12]
|
|
num, err := ssz.DivideInt2(len(buf), 121, 1099511627776)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.Validators = make([]*Validator, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
if b.Validators[ii] == nil {
|
|
b.Validators[ii] = new(Validator)
|
|
}
|
|
if err = b.Validators[ii].UnmarshalSSZ(buf[ii*121 : (ii+1)*121]); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
// Field (12) 'Balances'
|
|
{
|
|
buf = tail[o12:o15]
|
|
num, err := ssz.DivideInt2(len(buf), 8, 1099511627776)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.Balances = ssz.ExtendUint64(b.Balances, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
b.Balances[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
|
|
}
|
|
}
|
|
|
|
// Field (15) 'PreviousEpochParticipation'
|
|
{
|
|
buf = tail[o15:o16]
|
|
if len(buf) > 1099511627776 {
|
|
return ssz.ErrBytesLength
|
|
}
|
|
if cap(b.PreviousEpochParticipation) == 0 {
|
|
b.PreviousEpochParticipation = make([]byte, 0, len(buf))
|
|
}
|
|
b.PreviousEpochParticipation = append(b.PreviousEpochParticipation, buf...)
|
|
}
|
|
|
|
// Field (16) 'CurrentEpochParticipation'
|
|
{
|
|
buf = tail[o16:o21]
|
|
if len(buf) > 1099511627776 {
|
|
return ssz.ErrBytesLength
|
|
}
|
|
if cap(b.CurrentEpochParticipation) == 0 {
|
|
b.CurrentEpochParticipation = make([]byte, 0, len(buf))
|
|
}
|
|
b.CurrentEpochParticipation = append(b.CurrentEpochParticipation, buf...)
|
|
}
|
|
|
|
// Field (21) 'InactivityScores'
|
|
{
|
|
buf = tail[o21:]
|
|
num, err := ssz.DivideInt2(len(buf), 8, 1099511627776)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
b.InactivityScores = ssz.ExtendUint64(b.InactivityScores, num)
|
|
for ii := 0; ii < num; ii++ {
|
|
b.InactivityScores[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the BeaconStateAltair object
|
|
func (b *BeaconStateAltair) SizeSSZ() (size int) {
|
|
size = 2736629
|
|
|
|
// Field (7) 'HistoricalRoots'
|
|
size += len(b.HistoricalRoots) * 32
|
|
|
|
// Field (9) 'Eth1DataVotes'
|
|
size += len(b.Eth1DataVotes) * 72
|
|
|
|
// Field (11) 'Validators'
|
|
size += len(b.Validators) * 121
|
|
|
|
// Field (12) 'Balances'
|
|
size += len(b.Balances) * 8
|
|
|
|
// Field (15) 'PreviousEpochParticipation'
|
|
size += len(b.PreviousEpochParticipation)
|
|
|
|
// Field (16) 'CurrentEpochParticipation'
|
|
size += len(b.CurrentEpochParticipation)
|
|
|
|
// Field (21) 'InactivityScores'
|
|
size += len(b.InactivityScores) * 8
|
|
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the BeaconStateAltair object
|
|
func (b *BeaconStateAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(b)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the BeaconStateAltair object with a hasher
|
|
func (b *BeaconStateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'GenesisTime'
|
|
hh.PutUint64(b.GenesisTime)
|
|
|
|
// Field (1) 'GenesisValidatorsRoot'
|
|
if size := len(b.GenesisValidatorsRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.GenesisValidatorsRoot", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(b.GenesisValidatorsRoot)
|
|
|
|
// Field (2) 'Slot'
|
|
hh.PutUint64(uint64(b.Slot))
|
|
|
|
// Field (3) 'Fork'
|
|
if err = b.Fork.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'LatestBlockHeader'
|
|
if err = b.LatestBlockHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (5) 'BlockRoots'
|
|
{
|
|
if size := len(b.BlockRoots); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.BlockRoots", size, 8192)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.BlockRoots {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (6) 'StateRoots'
|
|
{
|
|
if size := len(b.StateRoots); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.StateRoots", size, 8192)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.StateRoots {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (7) 'HistoricalRoots'
|
|
{
|
|
if size := len(b.HistoricalRoots); size > 16777216 {
|
|
err = ssz.ErrListTooBigFn("--.HistoricalRoots", size, 16777216)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.HistoricalRoots {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
|
|
numItems := uint64(len(b.HistoricalRoots))
|
|
hh.MerkleizeWithMixin(subIndx, numItems, 16777216)
|
|
}
|
|
|
|
// Field (8) 'Eth1Data'
|
|
if err = b.Eth1Data.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (9) 'Eth1DataVotes'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.Eth1DataVotes))
|
|
if num > 2048 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.Eth1DataVotes {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 2048)
|
|
}
|
|
|
|
// Field (10) 'Eth1DepositIndex'
|
|
hh.PutUint64(b.Eth1DepositIndex)
|
|
|
|
// Field (11) 'Validators'
|
|
{
|
|
subIndx := hh.Index()
|
|
num := uint64(len(b.Validators))
|
|
if num > 1099511627776 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
for _, elem := range b.Validators {
|
|
if err = elem.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
}
|
|
hh.MerkleizeWithMixin(subIndx, num, 1099511627776)
|
|
}
|
|
|
|
// Field (12) 'Balances'
|
|
{
|
|
if size := len(b.Balances); size > 1099511627776 {
|
|
err = ssz.ErrListTooBigFn("--.Balances", size, 1099511627776)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.Balances {
|
|
hh.AppendUint64(i)
|
|
}
|
|
hh.FillUpTo32()
|
|
|
|
numItems := uint64(len(b.Balances))
|
|
hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8))
|
|
}
|
|
|
|
// Field (13) 'RandaoMixes'
|
|
{
|
|
if size := len(b.RandaoMixes); size != 65536 {
|
|
err = ssz.ErrVectorLengthFn("--.RandaoMixes", size, 65536)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.RandaoMixes {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (14) 'Slashings'
|
|
{
|
|
if size := len(b.Slashings); size != 8192 {
|
|
err = ssz.ErrVectorLengthFn("--.Slashings", size, 8192)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.Slashings {
|
|
hh.AppendUint64(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (15) 'PreviousEpochParticipation'
|
|
{
|
|
elemIndx := hh.Index()
|
|
byteLen := uint64(len(b.PreviousEpochParticipation))
|
|
if byteLen > 1099511627776 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
hh.PutBytes(b.PreviousEpochParticipation)
|
|
hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32)
|
|
}
|
|
|
|
// Field (16) 'CurrentEpochParticipation'
|
|
{
|
|
elemIndx := hh.Index()
|
|
byteLen := uint64(len(b.CurrentEpochParticipation))
|
|
if byteLen > 1099511627776 {
|
|
err = ssz.ErrIncorrectListSize
|
|
return
|
|
}
|
|
hh.PutBytes(b.CurrentEpochParticipation)
|
|
hh.MerkleizeWithMixin(elemIndx, byteLen, (1099511627776+31)/32)
|
|
}
|
|
|
|
// Field (17) 'JustificationBits'
|
|
if size := len(b.JustificationBits); size != 1 {
|
|
err = ssz.ErrBytesLengthFn("--.JustificationBits", size, 1)
|
|
return
|
|
}
|
|
hh.PutBytes(b.JustificationBits)
|
|
|
|
// Field (18) 'PreviousJustifiedCheckpoint'
|
|
if err = b.PreviousJustifiedCheckpoint.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (19) 'CurrentJustifiedCheckpoint'
|
|
if err = b.CurrentJustifiedCheckpoint.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (20) 'FinalizedCheckpoint'
|
|
if err = b.FinalizedCheckpoint.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (21) 'InactivityScores'
|
|
{
|
|
if size := len(b.InactivityScores); size > 1099511627776 {
|
|
err = ssz.ErrListTooBigFn("--.InactivityScores", size, 1099511627776)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range b.InactivityScores {
|
|
hh.AppendUint64(i)
|
|
}
|
|
hh.FillUpTo32()
|
|
|
|
numItems := uint64(len(b.InactivityScores))
|
|
hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(1099511627776, numItems, 8))
|
|
}
|
|
|
|
// Field (22) 'CurrentSyncCommittee'
|
|
if err = b.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (23) 'NextSyncCommittee'
|
|
if err = b.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SyncCommittee object
|
|
func (s *SyncCommittee) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SyncCommittee object to a target array
|
|
func (s *SyncCommittee) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Pubkeys'
|
|
if size := len(s.Pubkeys); size != 512 {
|
|
err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512)
|
|
return
|
|
}
|
|
for ii := 0; ii < 512; ii++ {
|
|
if size := len(s.Pubkeys[ii]); size != 48 {
|
|
err = ssz.ErrBytesLengthFn("--.Pubkeys[ii]", size, 48)
|
|
return
|
|
}
|
|
dst = append(dst, s.Pubkeys[ii]...)
|
|
}
|
|
|
|
// Field (1) 'AggregatePubkey'
|
|
if size := len(s.AggregatePubkey); size != 48 {
|
|
err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48)
|
|
return
|
|
}
|
|
dst = append(dst, s.AggregatePubkey...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SyncCommittee object
|
|
func (s *SyncCommittee) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 24624 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Pubkeys'
|
|
s.Pubkeys = make([][]byte, 512)
|
|
for ii := 0; ii < 512; ii++ {
|
|
if cap(s.Pubkeys[ii]) == 0 {
|
|
s.Pubkeys[ii] = make([]byte, 0, len(buf[0:24576][ii*48:(ii+1)*48]))
|
|
}
|
|
s.Pubkeys[ii] = append(s.Pubkeys[ii], buf[0:24576][ii*48:(ii+1)*48]...)
|
|
}
|
|
|
|
// Field (1) 'AggregatePubkey'
|
|
if cap(s.AggregatePubkey) == 0 {
|
|
s.AggregatePubkey = make([]byte, 0, len(buf[24576:24624]))
|
|
}
|
|
s.AggregatePubkey = append(s.AggregatePubkey, buf[24576:24624]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SyncCommittee object
|
|
func (s *SyncCommittee) SizeSSZ() (size int) {
|
|
size = 24624
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SyncCommittee object
|
|
func (s *SyncCommittee) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SyncCommittee object with a hasher
|
|
func (s *SyncCommittee) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Pubkeys'
|
|
{
|
|
if size := len(s.Pubkeys); size != 512 {
|
|
err = ssz.ErrVectorLengthFn("--.Pubkeys", size, 512)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range s.Pubkeys {
|
|
if len(i) != 48 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.PutBytes(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (1) 'AggregatePubkey'
|
|
if size := len(s.AggregatePubkey); size != 48 {
|
|
err = ssz.ErrBytesLengthFn("--.AggregatePubkey", size, 48)
|
|
return
|
|
}
|
|
hh.PutBytes(s.AggregatePubkey)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SyncAggregatorSelectionData object
|
|
func (s *SyncAggregatorSelectionData) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SyncAggregatorSelectionData object to a target array
|
|
func (s *SyncAggregatorSelectionData) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Slot'
|
|
dst = ssz.MarshalUint64(dst, uint64(s.Slot))
|
|
|
|
// Field (1) 'SubcommitteeIndex'
|
|
dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SyncAggregatorSelectionData object
|
|
func (s *SyncAggregatorSelectionData) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 16 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Slot'
|
|
s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))
|
|
|
|
// Field (1) 'SubcommitteeIndex'
|
|
s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[8:16])
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SyncAggregatorSelectionData object
|
|
func (s *SyncAggregatorSelectionData) SizeSSZ() (size int) {
|
|
size = 16
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SyncAggregatorSelectionData object
|
|
func (s *SyncAggregatorSelectionData) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SyncAggregatorSelectionData object with a hasher
|
|
func (s *SyncAggregatorSelectionData) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Slot'
|
|
hh.PutUint64(uint64(s.Slot))
|
|
|
|
// Field (1) 'SubcommitteeIndex'
|
|
hh.PutUint64(s.SubcommitteeIndex)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the LightClientHeaderAltair object
|
|
func (l *LightClientHeaderAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(l)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the LightClientHeaderAltair object to a target array
|
|
func (l *LightClientHeaderAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Beacon'
|
|
if l.Beacon == nil {
|
|
l.Beacon = new(BeaconBlockHeader)
|
|
}
|
|
if dst, err = l.Beacon.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the LightClientHeaderAltair object
|
|
func (l *LightClientHeaderAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 112 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Beacon'
|
|
if l.Beacon == nil {
|
|
l.Beacon = new(BeaconBlockHeader)
|
|
}
|
|
if err = l.Beacon.UnmarshalSSZ(buf[0:112]); err != nil {
|
|
return err
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the LightClientHeaderAltair object
|
|
func (l *LightClientHeaderAltair) SizeSSZ() (size int) {
|
|
size = 112
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the LightClientHeaderAltair object
|
|
func (l *LightClientHeaderAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(l)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the LightClientHeaderAltair object with a hasher
|
|
func (l *LightClientHeaderAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Beacon'
|
|
if err = l.Beacon.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the LightClientBootstrapAltair object
|
|
func (l *LightClientBootstrapAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(l)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the LightClientBootstrapAltair object to a target array
|
|
func (l *LightClientBootstrapAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Header'
|
|
if l.Header == nil {
|
|
l.Header = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.Header.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'CurrentSyncCommittee'
|
|
if l.CurrentSyncCommittee == nil {
|
|
l.CurrentSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if dst, err = l.CurrentSyncCommittee.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'CurrentSyncCommitteeBranch'
|
|
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
|
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
|
return
|
|
}
|
|
for ii := 0; ii < 5; ii++ {
|
|
if size := len(l.CurrentSyncCommitteeBranch[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.CurrentSyncCommitteeBranch[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, l.CurrentSyncCommitteeBranch[ii]...)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the LightClientBootstrapAltair object
|
|
func (l *LightClientBootstrapAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 24896 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Header'
|
|
if l.Header == nil {
|
|
l.Header = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.Header.UnmarshalSSZ(buf[0:112]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (1) 'CurrentSyncCommittee'
|
|
if l.CurrentSyncCommittee == nil {
|
|
l.CurrentSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if err = l.CurrentSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'CurrentSyncCommitteeBranch'
|
|
l.CurrentSyncCommitteeBranch = make([][]byte, 5)
|
|
for ii := 0; ii < 5; ii++ {
|
|
if cap(l.CurrentSyncCommitteeBranch[ii]) == 0 {
|
|
l.CurrentSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
|
|
}
|
|
l.CurrentSyncCommitteeBranch[ii] = append(l.CurrentSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the LightClientBootstrapAltair object
|
|
func (l *LightClientBootstrapAltair) SizeSSZ() (size int) {
|
|
size = 24896
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the LightClientBootstrapAltair object
|
|
func (l *LightClientBootstrapAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(l)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the LightClientBootstrapAltair object with a hasher
|
|
func (l *LightClientBootstrapAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Header'
|
|
if err = l.Header.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'CurrentSyncCommittee'
|
|
if err = l.CurrentSyncCommittee.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'CurrentSyncCommitteeBranch'
|
|
{
|
|
if size := len(l.CurrentSyncCommitteeBranch); size != 5 {
|
|
err = ssz.ErrVectorLengthFn("--.CurrentSyncCommitteeBranch", size, 5)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range l.CurrentSyncCommitteeBranch {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the LightClientUpdateAltair object
|
|
func (l *LightClientUpdateAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(l)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the LightClientUpdateAltair object to a target array
|
|
func (l *LightClientUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'NextSyncCommittee'
|
|
if l.NextSyncCommittee == nil {
|
|
l.NextSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if dst, err = l.NextSyncCommittee.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'NextSyncCommitteeBranch'
|
|
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
|
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
|
return
|
|
}
|
|
for ii := 0; ii < 5; ii++ {
|
|
if size := len(l.NextSyncCommitteeBranch[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.NextSyncCommitteeBranch[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, l.NextSyncCommitteeBranch[ii]...)
|
|
}
|
|
|
|
// Field (3) 'FinalizedHeader'
|
|
if l.FinalizedHeader == nil {
|
|
l.FinalizedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'FinalityBranch'
|
|
if size := len(l.FinalityBranch); size != 6 {
|
|
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
|
return
|
|
}
|
|
for ii := 0; ii < 6; ii++ {
|
|
if size := len(l.FinalityBranch[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, l.FinalityBranch[ii]...)
|
|
}
|
|
|
|
// Field (5) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (6) 'SignatureSlot'
|
|
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the LightClientUpdateAltair object
|
|
func (l *LightClientUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 25368 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (1) 'NextSyncCommittee'
|
|
if l.NextSyncCommittee == nil {
|
|
l.NextSyncCommittee = new(SyncCommittee)
|
|
}
|
|
if err = l.NextSyncCommittee.UnmarshalSSZ(buf[112:24736]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'NextSyncCommitteeBranch'
|
|
l.NextSyncCommitteeBranch = make([][]byte, 5)
|
|
for ii := 0; ii < 5; ii++ {
|
|
if cap(l.NextSyncCommitteeBranch[ii]) == 0 {
|
|
l.NextSyncCommitteeBranch[ii] = make([]byte, 0, len(buf[24736:24896][ii*32:(ii+1)*32]))
|
|
}
|
|
l.NextSyncCommitteeBranch[ii] = append(l.NextSyncCommitteeBranch[ii], buf[24736:24896][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Field (3) 'FinalizedHeader'
|
|
if l.FinalizedHeader == nil {
|
|
l.FinalizedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.FinalizedHeader.UnmarshalSSZ(buf[24896:25008]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (4) 'FinalityBranch'
|
|
l.FinalityBranch = make([][]byte, 6)
|
|
for ii := 0; ii < 6; ii++ {
|
|
if cap(l.FinalityBranch[ii]) == 0 {
|
|
l.FinalityBranch[ii] = make([]byte, 0, len(buf[25008:25200][ii*32:(ii+1)*32]))
|
|
}
|
|
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[25008:25200][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Field (5) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if err = l.SyncAggregate.UnmarshalSSZ(buf[25200:25360]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (6) 'SignatureSlot'
|
|
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[25360:25368]))
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the LightClientUpdateAltair object
|
|
func (l *LightClientUpdateAltair) SizeSSZ() (size int) {
|
|
size = 25368
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the LightClientUpdateAltair object
|
|
func (l *LightClientUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(l)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the LightClientUpdateAltair object with a hasher
|
|
func (l *LightClientUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'NextSyncCommittee'
|
|
if err = l.NextSyncCommittee.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'NextSyncCommitteeBranch'
|
|
{
|
|
if size := len(l.NextSyncCommitteeBranch); size != 5 {
|
|
err = ssz.ErrVectorLengthFn("--.NextSyncCommitteeBranch", size, 5)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range l.NextSyncCommitteeBranch {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (3) 'FinalizedHeader'
|
|
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'FinalityBranch'
|
|
{
|
|
if size := len(l.FinalityBranch); size != 6 {
|
|
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range l.FinalityBranch {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (5) 'SyncAggregate'
|
|
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (6) 'SignatureSlot'
|
|
hh.PutUint64(uint64(l.SignatureSlot))
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the LightClientFinalityUpdateAltair object
|
|
func (l *LightClientFinalityUpdateAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(l)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the LightClientFinalityUpdateAltair object to a target array
|
|
func (l *LightClientFinalityUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'FinalizedHeader'
|
|
if l.FinalizedHeader == nil {
|
|
l.FinalizedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.FinalizedHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'FinalityBranch'
|
|
if size := len(l.FinalityBranch); size != 6 {
|
|
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
|
return
|
|
}
|
|
for ii := 0; ii < 6; ii++ {
|
|
if size := len(l.FinalityBranch[ii]); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.FinalityBranch[ii]", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, l.FinalityBranch[ii]...)
|
|
}
|
|
|
|
// Field (3) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'SignatureSlot'
|
|
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the LightClientFinalityUpdateAltair object
|
|
func (l *LightClientFinalityUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 584 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (1) 'FinalizedHeader'
|
|
if l.FinalizedHeader == nil {
|
|
l.FinalizedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.FinalizedHeader.UnmarshalSSZ(buf[112:224]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'FinalityBranch'
|
|
l.FinalityBranch = make([][]byte, 6)
|
|
for ii := 0; ii < 6; ii++ {
|
|
if cap(l.FinalityBranch[ii]) == 0 {
|
|
l.FinalityBranch[ii] = make([]byte, 0, len(buf[224:416][ii*32:(ii+1)*32]))
|
|
}
|
|
l.FinalityBranch[ii] = append(l.FinalityBranch[ii], buf[224:416][ii*32:(ii+1)*32]...)
|
|
}
|
|
|
|
// Field (3) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if err = l.SyncAggregate.UnmarshalSSZ(buf[416:576]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (4) 'SignatureSlot'
|
|
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[576:584]))
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the LightClientFinalityUpdateAltair object
|
|
func (l *LightClientFinalityUpdateAltair) SizeSSZ() (size int) {
|
|
size = 584
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the LightClientFinalityUpdateAltair object
|
|
func (l *LightClientFinalityUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(l)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the LightClientFinalityUpdateAltair object with a hasher
|
|
func (l *LightClientFinalityUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'FinalizedHeader'
|
|
if err = l.FinalizedHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'FinalityBranch'
|
|
{
|
|
if size := len(l.FinalityBranch); size != 6 {
|
|
err = ssz.ErrVectorLengthFn("--.FinalityBranch", size, 6)
|
|
return
|
|
}
|
|
subIndx := hh.Index()
|
|
for _, i := range l.FinalityBranch {
|
|
if len(i) != 32 {
|
|
err = ssz.ErrBytesLength
|
|
return
|
|
}
|
|
hh.Append(i)
|
|
}
|
|
hh.Merkleize(subIndx)
|
|
}
|
|
|
|
// Field (3) 'SyncAggregate'
|
|
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (4) 'SignatureSlot'
|
|
hh.PutUint64(uint64(l.SignatureSlot))
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the LightClientOptimisticUpdateAltair object
|
|
func (l *LightClientOptimisticUpdateAltair) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(l)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the LightClientOptimisticUpdateAltair object to a target array
|
|
func (l *LightClientOptimisticUpdateAltair) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if dst, err = l.AttestedHeader.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if dst, err = l.SyncAggregate.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'SignatureSlot'
|
|
dst = ssz.MarshalUint64(dst, uint64(l.SignatureSlot))
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the LightClientOptimisticUpdateAltair object
|
|
func (l *LightClientOptimisticUpdateAltair) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 280 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if l.AttestedHeader == nil {
|
|
l.AttestedHeader = new(LightClientHeaderAltair)
|
|
}
|
|
if err = l.AttestedHeader.UnmarshalSSZ(buf[0:112]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (1) 'SyncAggregate'
|
|
if l.SyncAggregate == nil {
|
|
l.SyncAggregate = new(SyncAggregate)
|
|
}
|
|
if err = l.SyncAggregate.UnmarshalSSZ(buf[112:272]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'SignatureSlot'
|
|
l.SignatureSlot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[272:280]))
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the LightClientOptimisticUpdateAltair object
|
|
func (l *LightClientOptimisticUpdateAltair) SizeSSZ() (size int) {
|
|
size = 280
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the LightClientOptimisticUpdateAltair object
|
|
func (l *LightClientOptimisticUpdateAltair) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(l)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the LightClientOptimisticUpdateAltair object with a hasher
|
|
func (l *LightClientOptimisticUpdateAltair) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'AttestedHeader'
|
|
if err = l.AttestedHeader.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'SyncAggregate'
|
|
if err = l.SyncAggregate.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'SignatureSlot'
|
|
hh.PutUint64(uint64(l.SignatureSlot))
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SyncCommitteeMessage object
|
|
func (s *SyncCommitteeMessage) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SyncCommitteeMessage object to a target array
|
|
func (s *SyncCommitteeMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Slot'
|
|
dst = ssz.MarshalUint64(dst, uint64(s.Slot))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if size := len(s.BlockRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, s.BlockRoot...)
|
|
|
|
// Field (2) 'ValidatorIndex'
|
|
dst = ssz.MarshalUint64(dst, uint64(s.ValidatorIndex))
|
|
|
|
// Field (3) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, s.Signature...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SyncCommitteeMessage object
|
|
func (s *SyncCommitteeMessage) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 144 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Slot'
|
|
s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if cap(s.BlockRoot) == 0 {
|
|
s.BlockRoot = make([]byte, 0, len(buf[8:40]))
|
|
}
|
|
s.BlockRoot = append(s.BlockRoot, buf[8:40]...)
|
|
|
|
// Field (2) 'ValidatorIndex'
|
|
s.ValidatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[40:48]))
|
|
|
|
// Field (3) 'Signature'
|
|
if cap(s.Signature) == 0 {
|
|
s.Signature = make([]byte, 0, len(buf[48:144]))
|
|
}
|
|
s.Signature = append(s.Signature, buf[48:144]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeMessage object
|
|
func (s *SyncCommitteeMessage) SizeSSZ() (size int) {
|
|
size = 144
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SyncCommitteeMessage object
|
|
func (s *SyncCommitteeMessage) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SyncCommitteeMessage object with a hasher
|
|
func (s *SyncCommitteeMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Slot'
|
|
hh.PutUint64(uint64(s.Slot))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if size := len(s.BlockRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(s.BlockRoot)
|
|
|
|
// Field (2) 'ValidatorIndex'
|
|
hh.PutUint64(uint64(s.ValidatorIndex))
|
|
|
|
// Field (3) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(s.Signature)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SyncCommitteeContribution object
|
|
func (s *SyncCommitteeContribution) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SyncCommitteeContribution object to a target array
|
|
func (s *SyncCommitteeContribution) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Slot'
|
|
dst = ssz.MarshalUint64(dst, uint64(s.Slot))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if size := len(s.BlockRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
|
return
|
|
}
|
|
dst = append(dst, s.BlockRoot...)
|
|
|
|
// Field (2) 'SubcommitteeIndex'
|
|
dst = ssz.MarshalUint64(dst, s.SubcommitteeIndex)
|
|
|
|
// Field (3) 'AggregationBits'
|
|
if size := len(s.AggregationBits); size != 16 {
|
|
err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16)
|
|
return
|
|
}
|
|
dst = append(dst, s.AggregationBits...)
|
|
|
|
// Field (4) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, s.Signature...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SyncCommitteeContribution object
|
|
func (s *SyncCommitteeContribution) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 160 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Slot'
|
|
s.Slot = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if cap(s.BlockRoot) == 0 {
|
|
s.BlockRoot = make([]byte, 0, len(buf[8:40]))
|
|
}
|
|
s.BlockRoot = append(s.BlockRoot, buf[8:40]...)
|
|
|
|
// Field (2) 'SubcommitteeIndex'
|
|
s.SubcommitteeIndex = ssz.UnmarshallUint64(buf[40:48])
|
|
|
|
// Field (3) 'AggregationBits'
|
|
if cap(s.AggregationBits) == 0 {
|
|
s.AggregationBits = make([]byte, 0, len(buf[48:64]))
|
|
}
|
|
s.AggregationBits = append(s.AggregationBits, buf[48:64]...)
|
|
|
|
// Field (4) 'Signature'
|
|
if cap(s.Signature) == 0 {
|
|
s.Signature = make([]byte, 0, len(buf[64:160]))
|
|
}
|
|
s.Signature = append(s.Signature, buf[64:160]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SyncCommitteeContribution object
|
|
func (s *SyncCommitteeContribution) SizeSSZ() (size int) {
|
|
size = 160
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SyncCommitteeContribution object
|
|
func (s *SyncCommitteeContribution) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SyncCommitteeContribution object with a hasher
|
|
func (s *SyncCommitteeContribution) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Slot'
|
|
hh.PutUint64(uint64(s.Slot))
|
|
|
|
// Field (1) 'BlockRoot'
|
|
if size := len(s.BlockRoot); size != 32 {
|
|
err = ssz.ErrBytesLengthFn("--.BlockRoot", size, 32)
|
|
return
|
|
}
|
|
hh.PutBytes(s.BlockRoot)
|
|
|
|
// Field (2) 'SubcommitteeIndex'
|
|
hh.PutUint64(s.SubcommitteeIndex)
|
|
|
|
// Field (3) 'AggregationBits'
|
|
if size := len(s.AggregationBits); size != 16 {
|
|
err = ssz.ErrBytesLengthFn("--.AggregationBits", size, 16)
|
|
return
|
|
}
|
|
hh.PutBytes(s.AggregationBits)
|
|
|
|
// Field (4) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(s.Signature)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the ContributionAndProof object
|
|
func (c *ContributionAndProof) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(c)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the ContributionAndProof object to a target array
|
|
func (c *ContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'AggregatorIndex'
|
|
dst = ssz.MarshalUint64(dst, uint64(c.AggregatorIndex))
|
|
|
|
// Field (1) 'Contribution'
|
|
if c.Contribution == nil {
|
|
c.Contribution = new(SyncCommitteeContribution)
|
|
}
|
|
if dst, err = c.Contribution.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'SelectionProof'
|
|
if size := len(c.SelectionProof); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, c.SelectionProof...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the ContributionAndProof object
|
|
func (c *ContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 264 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'AggregatorIndex'
|
|
c.AggregatorIndex = github_com_prysmaticlabs_prysm_v5_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8]))
|
|
|
|
// Field (1) 'Contribution'
|
|
if c.Contribution == nil {
|
|
c.Contribution = new(SyncCommitteeContribution)
|
|
}
|
|
if err = c.Contribution.UnmarshalSSZ(buf[8:168]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (2) 'SelectionProof'
|
|
if cap(c.SelectionProof) == 0 {
|
|
c.SelectionProof = make([]byte, 0, len(buf[168:264]))
|
|
}
|
|
c.SelectionProof = append(c.SelectionProof, buf[168:264]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the ContributionAndProof object
|
|
func (c *ContributionAndProof) SizeSSZ() (size int) {
|
|
size = 264
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the ContributionAndProof object
|
|
func (c *ContributionAndProof) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(c)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the ContributionAndProof object with a hasher
|
|
func (c *ContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'AggregatorIndex'
|
|
hh.PutUint64(uint64(c.AggregatorIndex))
|
|
|
|
// Field (1) 'Contribution'
|
|
if err = c.Contribution.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (2) 'SelectionProof'
|
|
if size := len(c.SelectionProof); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.SelectionProof", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(c.SelectionProof)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|
|
|
|
// MarshalSSZ ssz marshals the SignedContributionAndProof object
|
|
func (s *SignedContributionAndProof) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(s)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the SignedContributionAndProof object to a target array
|
|
func (s *SignedContributionAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
|
|
// Field (0) 'Message'
|
|
if s.Message == nil {
|
|
s.Message = new(ContributionAndProof)
|
|
}
|
|
if dst, err = s.Message.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
dst = append(dst, s.Signature...)
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the SignedContributionAndProof object
|
|
func (s *SignedContributionAndProof) UnmarshalSSZ(buf []byte) error {
|
|
var err error
|
|
size := uint64(len(buf))
|
|
if size != 360 {
|
|
return ssz.ErrSize
|
|
}
|
|
|
|
// Field (0) 'Message'
|
|
if s.Message == nil {
|
|
s.Message = new(ContributionAndProof)
|
|
}
|
|
if err = s.Message.UnmarshalSSZ(buf[0:264]); err != nil {
|
|
return err
|
|
}
|
|
|
|
// Field (1) 'Signature'
|
|
if cap(s.Signature) == 0 {
|
|
s.Signature = make([]byte, 0, len(buf[264:360]))
|
|
}
|
|
s.Signature = append(s.Signature, buf[264:360]...)
|
|
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the SignedContributionAndProof object
|
|
func (s *SignedContributionAndProof) SizeSSZ() (size int) {
|
|
size = 360
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the SignedContributionAndProof object
|
|
func (s *SignedContributionAndProof) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(s)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the SignedContributionAndProof object with a hasher
|
|
func (s *SignedContributionAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'Message'
|
|
if err = s.Message.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'Signature'
|
|
if size := len(s.Signature); size != 96 {
|
|
err = ssz.ErrBytesLengthFn("--.Signature", size, 96)
|
|
return
|
|
}
|
|
hh.PutBytes(s.Signature)
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|