func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 228 {
		return ssz.ErrSize
	}
	tail := buf
	var o0 uint64
	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
		return ssz.ErrOffset
	}
	if o0 < 228 {
		return ssz.ErrInvalidVariableOffset
	}
	if i.Data == nil {
		i.Data = new(AttestationData)
	}
	if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil {
		return err
	}
	if cap(i.Signature) == 0 {
		i.Signature = make([]byte, 0, len(buf[132:228]))
	}
	i.Signature = append(i.Signature, buf[132:228]...)
	{
		buf = tail[o0:]
		num, err := ssz.DivideInt2(len(buf), 8, 2048)
		if err != nil {
			return err
		}
		i.AttestationIndices = ssz.ExtendUint64(i.AttestationIndices, num)
		for ii := 0; ii < num; ii++ {
			i.AttestationIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
		}
	}
	return err
}
UnmarshalSSZ ssz unmarshals the IndexedAttestation object
package spectests
import (
	ssz "github.com/ferranbt/fastssz"
	"github.com/ferranbt/fastssz/spectests/external"
	external2Alias "github.com/ferranbt/fastssz/spectests/external2"
)
func (a *AggregateAndProof) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(a)
}
func (a *AggregateAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(108)
	dst = ssz.MarshalUint64(dst, a.Index)
	dst = ssz.WriteOffset(dst, offset)
	if a.Aggregate == nil {
		a.Aggregate = new(Attestation)
	}
	offset += a.Aggregate.SizeSSZ()
	if dst, err = a.SelectionProof.MarshalSSZTo(dst); err != nil {
		return
	}
	if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil {
		return
	}
	return
}
func (a *AggregateAndProof) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 108 {
		return ssz.ErrSize
	}
	tail := buf
	var o1 uint64
	a.Index = ssz.UnmarshallUint64(buf[0:8])
	if o1 = ssz.ReadOffset(buf[8:12]); o1 > size {
		return ssz.ErrOffset
	}
	if o1 < 108 {
		return ssz.ErrInvalidVariableOffset
	}
	if err = a.SelectionProof.UnmarshalSSZ(buf[12:108]); err != nil {
		return err
	}
	{
		buf = tail[o1:]
		if a.Aggregate == nil {
			a.Aggregate = new(Attestation)
		}
		if err = a.Aggregate.UnmarshalSSZ(buf); err != nil {
			return err
		}
	}
	return err
}
func (a *AggregateAndProof) SizeSSZ() (size int) {
	size = 108
	if a.Aggregate == nil {
		a.Aggregate = new(Attestation)
	}
	size += a.Aggregate.SizeSSZ()
	return
}
func (a *AggregateAndProof) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(a)
}
func (a *AggregateAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	hh.PutUint64(a.Index)
	if err = a.Aggregate.HashTreeRootWith(hh); err != nil {
		return
	}
	if err = a.SelectionProof.HashTreeRootWith(hh); err != nil {
		return
	}
	hh.Merkleize(indx)
	return
}
func (c *Checkpoint) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(c)
}
func (c *Checkpoint) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	dst = ssz.MarshalUint64(dst, uint64(c.Epoch))
	if len(c.Root) != 32 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, c.Root...)
	return
}
func (c *Checkpoint) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 40 {
		return ssz.ErrSize
	}
	c.Epoch = external2Alias.EpochAlias(ssz.UnmarshallUint64(buf[0:8]))
	if cap(c.Root) == 0 {
		c.Root = make([]byte, 0, len(buf[8:40]))
	}
	c.Root = append(c.Root, buf[8:40]...)
	return err
}
func (c *Checkpoint) SizeSSZ() (size int) {
	size = 40
	return
}
func (c *Checkpoint) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(c)
}
func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	hh.PutUint64(uint64(c.Epoch))
	if len(c.Root) != 32 {
		err = ssz.ErrBytesLength
		return
	}
	hh.PutBytes(c.Root)
	hh.Merkleize(indx)
	return
}
func (a *AttestationData) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(a)
}
func (a *AttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	dst = ssz.MarshalUint64(dst, uint64(a.Slot))
	dst = ssz.MarshalUint64(dst, a.Index)
	dst = append(dst, a.BeaconBlockHash[:]...)
	if a.Source == nil {
		a.Source = new(Checkpoint)
	}
	if dst, err = a.Source.MarshalSSZTo(dst); err != nil {
		return
	}
	if a.Target == nil {
		a.Target = new(Checkpoint)
	}
	if dst, err = a.Target.MarshalSSZTo(dst); err != nil {
		return
	}
	return
}
func (a *AttestationData) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 128 {
		return ssz.ErrSize
	}
	a.Slot = Slot(ssz.UnmarshallUint64(buf[0:8]))
	a.Index = ssz.UnmarshallUint64(buf[8:16])
	copy(a.BeaconBlockHash[:], buf[16:48])
	if a.Source == nil {
		a.Source = new(Checkpoint)
	}
	if err = a.Source.UnmarshalSSZ(buf[48:88]); err != nil {
		return err
	}
	if a.Target == nil {
		a.Target = new(Checkpoint)
	}
	if err = a.Target.UnmarshalSSZ(buf[88:128]); err != nil {
		return err
	}
	return err
}
func (a *AttestationData) SizeSSZ() (size int) {
	size = 128
	return
}
func (a *AttestationData) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(a)
}
func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	hh.PutUint64(uint64(a.Slot))
	hh.PutUint64(a.Index)
	hh.PutBytes(a.BeaconBlockHash[:])
	if err = a.Source.HashTreeRootWith(hh); err != nil {
		return
	}
	if err = a.Target.HashTreeRootWith(hh); err != nil {
		return
	}
	hh.Merkleize(indx)
	return
}
func (a *Attestation) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(a)
}
func (a *Attestation) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(228)
	dst = ssz.WriteOffset(dst, offset)
	offset += len(a.AggregationBits)
	if a.Data == nil {
		a.Data = new(AttestationData)
	}
	if dst, err = a.Data.MarshalSSZTo(dst); err != nil {
		return
	}
	if a.Signature == nil {
		a.Signature = new(external.Signature)
	}
	if dst, err = a.Signature.MarshalSSZTo(dst); err != nil {
		return
	}
	if len(a.AggregationBits) > 2048 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, a.AggregationBits...)
	return
}
func (a *Attestation) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 228 {
		return ssz.ErrSize
	}
	tail := buf
	var o0 uint64
	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
		return ssz.ErrOffset
	}
	if o0 < 228 {
		return ssz.ErrInvalidVariableOffset
	}
	if a.Data == nil {
		a.Data = new(AttestationData)
	}
	if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil {
		return err
	}
	if a.Signature == nil {
		a.Signature = new(external.Signature)
	}
	if err = a.Signature.UnmarshalSSZ(buf[132:228]); err != nil {
		return err
	}
	{
		buf = tail[o0:]
		if err = ssz.ValidateBitlist(buf, 2048); err != nil {
			return err
		}
		if cap(a.AggregationBits) == 0 {
			a.AggregationBits = make([]byte, 0, len(buf))
		}
		a.AggregationBits = append(a.AggregationBits, buf...)
	}
	return err
}
func (a *Attestation) SizeSSZ() (size int) {
	size = 228
	size += len(a.AggregationBits)
	return
}
func (a *Attestation) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(a)
}
func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	if len(a.AggregationBits) == 0 {
		err = ssz.ErrEmptyBitlist
		return
	}
	hh.PutBitlist(a.AggregationBits, 2048)
	if err = a.Data.HashTreeRootWith(hh); err != nil {
		return
	}
	if err = a.Signature.HashTreeRootWith(hh); err != nil {
		return
	}
	hh.Merkleize(indx)
	return
}
func (d *DepositData) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(d)
}
func (d *DepositData) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	dst = append(dst, d.Pubkey[:]...)
	dst = append(dst, d.WithdrawalCredentials[:]...)
	dst = ssz.MarshalUint64(dst, d.Amount)
	if len(d.Signature) != 96 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, d.Signature...)
	return
}
func (d *DepositData) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 184 {
		return ssz.ErrSize
	}
	copy(d.Pubkey[:], buf[0:48])
	copy(d.WithdrawalCredentials[:], buf[48:80])
	d.Amount = ssz.UnmarshallUint64(buf[80:88])
	if cap(d.Signature) == 0 {
		d.Signature = make([]byte, 0, len(buf[88:184]))
	}
	d.Signature = append(d.Signature, buf[88:184]...)
	return err
}
func (d *DepositData) SizeSSZ() (size int) {
	size = 184
	return
}
func (d *DepositData) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(d)
}
func (d *DepositData) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	hh.PutBytes(d.Pubkey[:])
	hh.PutBytes(d.WithdrawalCredentials[:])
	hh.PutUint64(d.Amount)
	if len(d.Signature) != 96 {
		err = ssz.ErrBytesLength
		return
	}
	hh.PutBytes(d.Signature)
	hh.Merkleize(indx)
	return
}
func (d *Deposit) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(d)
}
func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	if len(d.Proof) != 33 {
		err = ssz.ErrVectorLength
		return
	}
	for ii := 0; ii < 33; ii++ {
		if len(d.Proof[ii]) != 32 {
			err = ssz.ErrBytesLength
			return
		}
		dst = append(dst, d.Proof[ii]...)
	}
	if d.Data == nil {
		d.Data = new(DepositData)
	}
	if dst, err = d.Data.MarshalSSZTo(dst); err != nil {
		return
	}
	return
}
func (d *Deposit) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 1240 {
		return ssz.ErrSize
	}
	d.Proof = make([][]byte, 33)
	for ii := 0; ii < 33; ii++ {
		if cap(d.Proof[ii]) == 0 {
			d.Proof[ii] = make([]byte, 0, len(buf[0:1056][ii*32:(ii+1)*32]))
		}
		d.Proof[ii] = append(d.Proof[ii], buf[0:1056][ii*32:(ii+1)*32]...)
	}
	if d.Data == nil {
		d.Data = new(DepositData)
	}
	if err = d.Data.UnmarshalSSZ(buf[1056:1240]); err != nil {
		return err
	}
	return err
}
func (d *Deposit) SizeSSZ() (size int) {
	size = 1240
	return
}
func (d *Deposit) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(d)
}
func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	{
		if len(d.Proof) != 33 {
			err = ssz.ErrVectorLength
			return
		}
		subIndx := hh.Index()
		for _, i := range d.Proof {
			if len(i) != 32 {
				err = ssz.ErrBytesLength
				return
			}
			hh.Append(i)
		}
		hh.Merkleize(subIndx)
	}
	if err = d.Data.HashTreeRootWith(hh); err != nil {
		return
	}
	hh.Merkleize(indx)
	return
}
func (d *DepositMessage) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(d)
}
func (d *DepositMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	if len(d.Pubkey) != 48 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, d.Pubkey...)
	if len(d.WithdrawalCredentials) != 32 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, d.WithdrawalCredentials...)
	dst = ssz.MarshalUint64(dst, d.Amount)
	return
}
func (d *DepositMessage) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 88 {
		return ssz.ErrSize
	}
	if cap(d.Pubkey) == 0 {
		d.Pubkey = make([]byte, 0, len(buf[0:48]))
	}
	d.Pubkey = append(d.Pubkey, buf[0:48]...)
	if cap(d.WithdrawalCredentials) == 0 {
		d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80]))
	}
	d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...)
	d.Amount = ssz.UnmarshallUint64(buf[80:88])
	return err
}
func (d *DepositMessage) SizeSSZ() (size int) {
	size = 88
	return
}
func (d *DepositMessage) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(d)
}
func (d *DepositMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()
	if len(d.Pubkey) != 48 {
		err = ssz.ErrBytesLength
		return
	}
	hh.PutBytes(d.Pubkey)
	if len(d.WithdrawalCredentials) != 32 {
		err = ssz.ErrBytesLength
		return
	}
	hh.PutBytes(d.WithdrawalCredentials)
	hh.PutUint64(d.Amount)
	hh.Merkleize(indx)
	return
}
func (i *IndexedAttestation) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(i)
}
func (i *IndexedAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(228)
	dst = ssz.WriteOffset(dst, offset)
	offset += len(i.AttestationIndices) * 8
	if i.Data == nil {
		i.Data = new(AttestationData)
	}
	if dst, err = i.Data.MarshalSSZTo(dst); err != nil {
		return
	}
	if len(i.Signature) != 96 {
		err = ssz.ErrBytesLength
		return
	}
	dst = append(dst, i.Signature...)
	if len(i.AttestationIndices) > 2048 {
		err = ssz.ErrListTooBig
		return
	}
	for ii := 0; ii < len(i.AttestationIndices); ii++ {
		dst = ssz.MarshalUint64(dst, i.AttestationIndices[ii])
	}
	return
}