// Code generated by fastssz. DO NOT EDIT.
package eth

import (
	github_com_OffchainLabs_prysm_v6_consensus_types_primitives "github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
	v1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
	ssz "github.com/prysmaticlabs/fastssz"
)

// MarshalSSZ ssz marshals the SignedValidatorRegistrationV1 object
func (s *SignedValidatorRegistrationV1) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(s)
}

// MarshalSSZTo ssz marshals the SignedValidatorRegistrationV1 object to a target array
func (s *SignedValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'Message'
	if s.Message == nil {
		s.Message = new(ValidatorRegistrationV1)
	}
	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 SignedValidatorRegistrationV1 object
func (s *SignedValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 180 {
		return ssz.ErrSize
	}

	// Field (0) 'Message'
	if s.Message == nil {
		s.Message = new(ValidatorRegistrationV1)
	}
	if err = s.Message.UnmarshalSSZ(buf[0:84]); err != nil {
		return err
	}

	// Field (1) 'Signature'
	if cap(s.Signature) == 0 {
		s.Signature = make([]byte, 0, len(buf[84:180]))
	}
	s.Signature = append(s.Signature, buf[84:180]...)

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the SignedValidatorRegistrationV1 object
func (s *SignedValidatorRegistrationV1) SizeSSZ() (size int) {
	size = 180
	return
}

// HashTreeRoot ssz hashes the SignedValidatorRegistrationV1 object
func (s *SignedValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(s)
}

// HashTreeRootWith ssz hashes the SignedValidatorRegistrationV1 object with a hasher
func (s *SignedValidatorRegistrationV1) 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
}

// MarshalSSZ ssz marshals the ValidatorRegistrationV1 object
func (v *ValidatorRegistrationV1) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(v)
}

// MarshalSSZTo ssz marshals the ValidatorRegistrationV1 object to a target array
func (v *ValidatorRegistrationV1) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'FeeRecipient'
	if size := len(v.FeeRecipient); size != 20 {
		err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20)
		return
	}
	dst = append(dst, v.FeeRecipient...)

	// Field (1) 'GasLimit'
	dst = ssz.MarshalUint64(dst, v.GasLimit)

	// Field (2) 'Timestamp'
	dst = ssz.MarshalUint64(dst, v.Timestamp)

	// Field (3) 'Pubkey'
	if size := len(v.Pubkey); size != 48 {
		err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48)
		return
	}
	dst = append(dst, v.Pubkey...)

	return
}

// UnmarshalSSZ ssz unmarshals the ValidatorRegistrationV1 object
func (v *ValidatorRegistrationV1) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 84 {
		return ssz.ErrSize
	}

	// Field (0) 'FeeRecipient'
	if cap(v.FeeRecipient) == 0 {
		v.FeeRecipient = make([]byte, 0, len(buf[0:20]))
	}
	v.FeeRecipient = append(v.FeeRecipient, buf[0:20]...)

	// Field (1) 'GasLimit'
	v.GasLimit = ssz.UnmarshallUint64(buf[20:28])

	// Field (2) 'Timestamp'
	v.Timestamp = ssz.UnmarshallUint64(buf[28:36])

	// Field (3) 'Pubkey'
	if cap(v.Pubkey) == 0 {
		v.Pubkey = make([]byte, 0, len(buf[36:84]))
	}
	v.Pubkey = append(v.Pubkey, buf[36:84]...)

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the ValidatorRegistrationV1 object
func (v *ValidatorRegistrationV1) SizeSSZ() (size int) {
	size = 84
	return
}

// HashTreeRoot ssz hashes the ValidatorRegistrationV1 object
func (v *ValidatorRegistrationV1) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(v)
}

// HashTreeRootWith ssz hashes the ValidatorRegistrationV1 object with a hasher
func (v *ValidatorRegistrationV1) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'FeeRecipient'
	if size := len(v.FeeRecipient); size != 20 {
		err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20)
		return
	}
	hh.PutBytes(v.FeeRecipient)

	// Field (1) 'GasLimit'
	hh.PutUint64(v.GasLimit)

	// Field (2) 'Timestamp'
	hh.PutUint64(v.Timestamp)

	// Field (3) 'Pubkey'
	if size := len(v.Pubkey); size != 48 {
		err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48)
		return
	}
	hh.PutBytes(v.Pubkey)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the SignedBuilderBid object
func (s *SignedBuilderBid) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(s)
}

// MarshalSSZTo ssz marshals the SignedBuilderBid object to a target array
func (s *SignedBuilderBid) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(100)

	// Offset (0) 'Message'
	dst = ssz.WriteOffset(dst, offset)
	if s.Message == nil {
		s.Message = new(BuilderBid)
	}
	offset += s.Message.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) 'Message'
	if dst, err = s.Message.MarshalSSZTo(dst); err != nil {
		return
	}

	return
}

// UnmarshalSSZ ssz unmarshals the SignedBuilderBid object
func (s *SignedBuilderBid) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 100 {
		return ssz.ErrSize
	}

	tail := buf
	var o0 uint64

	// Offset (0) 'Message'
	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) 'Message'
	{
		buf = tail[o0:]
		if s.Message == nil {
			s.Message = new(BuilderBid)
		}
		if err = s.Message.UnmarshalSSZ(buf); err != nil {
			return err
		}
	}
	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the SignedBuilderBid object
func (s *SignedBuilderBid) SizeSSZ() (size int) {
	size = 100

	// Field (0) 'Message'
	if s.Message == nil {
		s.Message = new(BuilderBid)
	}
	size += s.Message.SizeSSZ()

	return
}

// HashTreeRoot ssz hashes the SignedBuilderBid object
func (s *SignedBuilderBid) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(s)
}

// HashTreeRootWith ssz hashes the SignedBuilderBid object with a hasher
func (s *SignedBuilderBid) 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
}

// MarshalSSZ ssz marshals the BuilderBid object
func (b *BuilderBid) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(b)
}

// MarshalSSZTo ssz marshals the BuilderBid object to a target array
func (b *BuilderBid) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(84)

	// Offset (0) 'Header'
	dst = ssz.WriteOffset(dst, offset)
	if b.Header == nil {
		b.Header = new(v1.ExecutionPayloadHeader)
	}
	offset += b.Header.SizeSSZ()

	// Field (1) 'Value'
	if size := len(b.Value); size != 32 {
		err = ssz.ErrBytesLengthFn("--.Value", size, 32)
		return
	}
	dst = append(dst, b.Value...)

	// Field (2) 'Pubkey'
	if size := len(b.Pubkey); size != 48 {
		err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48)
		return
	}
	dst = append(dst, b.Pubkey...)

	// Field (0) 'Header'
	if dst, err = b.Header.MarshalSSZTo(dst); err != nil {
		return
	}

	return
}

// UnmarshalSSZ ssz unmarshals the BuilderBid object
func (b *BuilderBid) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 84 {
		return ssz.ErrSize
	}

	tail := buf
	var o0 uint64

	// Offset (0) 'Header'
	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
		return ssz.ErrOffset
	}

	if o0 != 84 {
		return ssz.ErrInvalidVariableOffset
	}

	// Field (1) 'Value'
	if cap(b.Value) == 0 {
		b.Value = make([]byte, 0, len(buf[4:36]))
	}
	b.Value = append(b.Value, buf[4:36]...)

	// Field (2) 'Pubkey'
	if cap(b.Pubkey) == 0 {
		b.Pubkey = make([]byte, 0, len(buf[36:84]))
	}
	b.Pubkey = append(b.Pubkey, buf[36:84]...)

	// Field (0) 'Header'
	{
		buf = tail[o0:]
		if b.Header == nil {
			b.Header = new(v1.ExecutionPayloadHeader)
		}
		if err = b.Header.UnmarshalSSZ(buf); err != nil {
			return err
		}
	}
	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the BuilderBid object
func (b *BuilderBid) SizeSSZ() (size int) {
	size = 84

	// Field (0) 'Header'
	if b.Header == nil {
		b.Header = new(v1.ExecutionPayloadHeader)
	}
	size += b.Header.SizeSSZ()

	return
}

// HashTreeRoot ssz hashes the BuilderBid object
func (b *BuilderBid) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(b)
}

// HashTreeRootWith ssz hashes the BuilderBid object with a hasher
func (b *BuilderBid) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'Header'
	if err = b.Header.HashTreeRootWith(hh); err != nil {
		return
	}

	// Field (1) 'Value'
	if size := len(b.Value); size != 32 {
		err = ssz.ErrBytesLengthFn("--.Value", size, 32)
		return
	}
	hh.PutBytes(b.Value)

	// Field (2) 'Pubkey'
	if size := len(b.Pubkey); size != 48 {
		err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48)
		return
	}
	hh.PutBytes(b.Pubkey)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the BeaconBlocksByRangeRequest object
func (b *BeaconBlocksByRangeRequest) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(b)
}

// MarshalSSZTo ssz marshals the BeaconBlocksByRangeRequest object to a target array
func (b *BeaconBlocksByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'StartSlot'
	dst = ssz.MarshalUint64(dst, uint64(b.StartSlot))

	// Field (1) 'Count'
	dst = ssz.MarshalUint64(dst, b.Count)

	// Field (2) 'Step'
	dst = ssz.MarshalUint64(dst, b.Step)

	return
}

// UnmarshalSSZ ssz unmarshals the BeaconBlocksByRangeRequest object
func (b *BeaconBlocksByRangeRequest) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 24 {
		return ssz.ErrSize
	}

	// Field (0) 'StartSlot'
	b.StartSlot = github_com_OffchainLabs_prysm_v6_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))

	// Field (1) 'Count'
	b.Count = ssz.UnmarshallUint64(buf[8:16])

	// Field (2) 'Step'
	b.Step = ssz.UnmarshallUint64(buf[16:24])

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the BeaconBlocksByRangeRequest object
func (b *BeaconBlocksByRangeRequest) SizeSSZ() (size int) {
	size = 24
	return
}

// HashTreeRoot ssz hashes the BeaconBlocksByRangeRequest object
func (b *BeaconBlocksByRangeRequest) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(b)
}

// HashTreeRootWith ssz hashes the BeaconBlocksByRangeRequest object with a hasher
func (b *BeaconBlocksByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'StartSlot'
	hh.PutUint64(uint64(b.StartSlot))

	// Field (1) 'Count'
	hh.PutUint64(b.Count)

	// Field (2) 'Step'
	hh.PutUint64(b.Step)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the MetaDataV0 object
func (m *MetaDataV0) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(m)
}

// MarshalSSZTo ssz marshals the MetaDataV0 object to a target array
func (m *MetaDataV0) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'SeqNumber'
	dst = ssz.MarshalUint64(dst, m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	dst = append(dst, m.Attnets...)

	return
}

// UnmarshalSSZ ssz unmarshals the MetaDataV0 object
func (m *MetaDataV0) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 16 {
		return ssz.ErrSize
	}

	// Field (0) 'SeqNumber'
	m.SeqNumber = ssz.UnmarshallUint64(buf[0:8])

	// Field (1) 'Attnets'
	if cap(m.Attnets) == 0 {
		m.Attnets = make([]byte, 0, len(buf[8:16]))
	}
	m.Attnets = append(m.Attnets, buf[8:16]...)

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV0 object
func (m *MetaDataV0) SizeSSZ() (size int) {
	size = 16
	return
}

// HashTreeRoot ssz hashes the MetaDataV0 object
func (m *MetaDataV0) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(m)
}

// HashTreeRootWith ssz hashes the MetaDataV0 object with a hasher
func (m *MetaDataV0) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'SeqNumber'
	hh.PutUint64(m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	hh.PutBytes(m.Attnets)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the MetaDataV1 object
func (m *MetaDataV1) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(m)
}

// MarshalSSZTo ssz marshals the MetaDataV1 object to a target array
func (m *MetaDataV1) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'SeqNumber'
	dst = ssz.MarshalUint64(dst, m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	dst = append(dst, m.Attnets...)

	// Field (2) 'Syncnets'
	if size := len(m.Syncnets); size != 1 {
		err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1)
		return
	}
	dst = append(dst, m.Syncnets...)

	return
}

// UnmarshalSSZ ssz unmarshals the MetaDataV1 object
func (m *MetaDataV1) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 17 {
		return ssz.ErrSize
	}

	// Field (0) 'SeqNumber'
	m.SeqNumber = ssz.UnmarshallUint64(buf[0:8])

	// Field (1) 'Attnets'
	if cap(m.Attnets) == 0 {
		m.Attnets = make([]byte, 0, len(buf[8:16]))
	}
	m.Attnets = append(m.Attnets, buf[8:16]...)

	// Field (2) 'Syncnets'
	if cap(m.Syncnets) == 0 {
		m.Syncnets = make([]byte, 0, len(buf[16:17]))
	}
	m.Syncnets = append(m.Syncnets, buf[16:17]...)

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV1 object
func (m *MetaDataV1) SizeSSZ() (size int) {
	size = 17
	return
}

// HashTreeRoot ssz hashes the MetaDataV1 object
func (m *MetaDataV1) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(m)
}

// HashTreeRootWith ssz hashes the MetaDataV1 object with a hasher
func (m *MetaDataV1) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'SeqNumber'
	hh.PutUint64(m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	hh.PutBytes(m.Attnets)

	// Field (2) 'Syncnets'
	if size := len(m.Syncnets); size != 1 {
		err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1)
		return
	}
	hh.PutBytes(m.Syncnets)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the MetaDataV2 object
func (m *MetaDataV2) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(m)
}

// MarshalSSZTo ssz marshals the MetaDataV2 object to a target array
func (m *MetaDataV2) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'SeqNumber'
	dst = ssz.MarshalUint64(dst, m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	dst = append(dst, m.Attnets...)

	// Field (2) 'Syncnets'
	if size := len(m.Syncnets); size != 1 {
		err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1)
		return
	}
	dst = append(dst, m.Syncnets...)

	// Field (3) 'CustodyGroupCount'
	dst = ssz.MarshalUint64(dst, m.CustodyGroupCount)

	return
}

// UnmarshalSSZ ssz unmarshals the MetaDataV2 object
func (m *MetaDataV2) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 25 {
		return ssz.ErrSize
	}

	// Field (0) 'SeqNumber'
	m.SeqNumber = ssz.UnmarshallUint64(buf[0:8])

	// Field (1) 'Attnets'
	if cap(m.Attnets) == 0 {
		m.Attnets = make([]byte, 0, len(buf[8:16]))
	}
	m.Attnets = append(m.Attnets, buf[8:16]...)

	// Field (2) 'Syncnets'
	if cap(m.Syncnets) == 0 {
		m.Syncnets = make([]byte, 0, len(buf[16:17]))
	}
	m.Syncnets = append(m.Syncnets, buf[16:17]...)

	// Field (3) 'CustodyGroupCount'
	m.CustodyGroupCount = ssz.UnmarshallUint64(buf[17:25])

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV2 object
func (m *MetaDataV2) SizeSSZ() (size int) {
	size = 25
	return
}

// HashTreeRoot ssz hashes the MetaDataV2 object
func (m *MetaDataV2) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(m)
}

// HashTreeRootWith ssz hashes the MetaDataV2 object with a hasher
func (m *MetaDataV2) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'SeqNumber'
	hh.PutUint64(m.SeqNumber)

	// Field (1) 'Attnets'
	if size := len(m.Attnets); size != 8 {
		err = ssz.ErrBytesLengthFn("--.Attnets", size, 8)
		return
	}
	hh.PutBytes(m.Attnets)

	// Field (2) 'Syncnets'
	if size := len(m.Syncnets); size != 1 {
		err = ssz.ErrBytesLengthFn("--.Syncnets", size, 1)
		return
	}
	hh.PutBytes(m.Syncnets)

	// Field (3) 'CustodyGroupCount'
	hh.PutUint64(m.CustodyGroupCount)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the BlobSidecarsByRangeRequest object
func (b *BlobSidecarsByRangeRequest) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(b)
}

// MarshalSSZTo ssz marshals the BlobSidecarsByRangeRequest object to a target array
func (b *BlobSidecarsByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf

	// Field (0) 'StartSlot'
	dst = ssz.MarshalUint64(dst, uint64(b.StartSlot))

	// Field (1) 'Count'
	dst = ssz.MarshalUint64(dst, b.Count)

	return
}

// UnmarshalSSZ ssz unmarshals the BlobSidecarsByRangeRequest object
func (b *BlobSidecarsByRangeRequest) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size != 16 {
		return ssz.ErrSize
	}

	// Field (0) 'StartSlot'
	b.StartSlot = github_com_OffchainLabs_prysm_v6_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))

	// Field (1) 'Count'
	b.Count = ssz.UnmarshallUint64(buf[8:16])

	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the BlobSidecarsByRangeRequest object
func (b *BlobSidecarsByRangeRequest) SizeSSZ() (size int) {
	size = 16
	return
}

// HashTreeRoot ssz hashes the BlobSidecarsByRangeRequest object
func (b *BlobSidecarsByRangeRequest) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(b)
}

// HashTreeRootWith ssz hashes the BlobSidecarsByRangeRequest object with a hasher
func (b *BlobSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'StartSlot'
	hh.PutUint64(uint64(b.StartSlot))

	// Field (1) 'Count'
	hh.PutUint64(b.Count)

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the DataColumnSidecarsByRangeRequest object
func (d *DataColumnSidecarsByRangeRequest) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(d)
}

// MarshalSSZTo ssz marshals the DataColumnSidecarsByRangeRequest object to a target array
func (d *DataColumnSidecarsByRangeRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(20)

	// Field (0) 'StartSlot'
	dst = ssz.MarshalUint64(dst, uint64(d.StartSlot))

	// Field (1) 'Count'
	dst = ssz.MarshalUint64(dst, d.Count)

	// Offset (2) 'Columns'
	dst = ssz.WriteOffset(dst, offset)
	offset += len(d.Columns) * 8

	// Field (2) 'Columns'
	if size := len(d.Columns); size > 128 {
		err = ssz.ErrListTooBigFn("--.Columns", size, 128)
		return
	}
	for ii := 0; ii < len(d.Columns); ii++ {
		dst = ssz.MarshalUint64(dst, d.Columns[ii])
	}

	return
}

// UnmarshalSSZ ssz unmarshals the DataColumnSidecarsByRangeRequest object
func (d *DataColumnSidecarsByRangeRequest) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 20 {
		return ssz.ErrSize
	}

	tail := buf
	var o2 uint64

	// Field (0) 'StartSlot'
	d.StartSlot = github_com_OffchainLabs_prysm_v6_consensus_types_primitives.Slot(ssz.UnmarshallUint64(buf[0:8]))

	// Field (1) 'Count'
	d.Count = ssz.UnmarshallUint64(buf[8:16])

	// Offset (2) 'Columns'
	if o2 = ssz.ReadOffset(buf[16:20]); o2 > size {
		return ssz.ErrOffset
	}

	if o2 != 20 {
		return ssz.ErrInvalidVariableOffset
	}

	// Field (2) 'Columns'
	{
		buf = tail[o2:]
		num, err := ssz.DivideInt2(len(buf), 8, 128)
		if err != nil {
			return err
		}
		d.Columns = ssz.ExtendUint64(d.Columns, num)
		for ii := 0; ii < num; ii++ {
			d.Columns[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
		}
	}
	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the DataColumnSidecarsByRangeRequest object
func (d *DataColumnSidecarsByRangeRequest) SizeSSZ() (size int) {
	size = 20

	// Field (2) 'Columns'
	size += len(d.Columns) * 8

	return
}

// HashTreeRoot ssz hashes the DataColumnSidecarsByRangeRequest object
func (d *DataColumnSidecarsByRangeRequest) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(d)
}

// HashTreeRootWith ssz hashes the DataColumnSidecarsByRangeRequest object with a hasher
func (d *DataColumnSidecarsByRangeRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'StartSlot'
	hh.PutUint64(uint64(d.StartSlot))

	// Field (1) 'Count'
	hh.PutUint64(d.Count)

	// Field (2) 'Columns'
	{
		if size := len(d.Columns); size > 128 {
			err = ssz.ErrListTooBigFn("--.Columns", size, 128)
			return
		}
		subIndx := hh.Index()
		for _, i := range d.Columns {
			hh.AppendUint64(i)
		}
		hh.FillUpTo32()

		numItems := uint64(len(d.Columns))
		hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(128, numItems, 8))
	}

	hh.Merkleize(indx)
	return
}

// MarshalSSZ ssz marshals the DepositSnapshot object
func (d *DepositSnapshot) MarshalSSZ() ([]byte, error) {
	return ssz.MarshalSSZ(d)
}

// MarshalSSZTo ssz marshals the DepositSnapshot object to a target array
func (d *DepositSnapshot) MarshalSSZTo(buf []byte) (dst []byte, err error) {
	dst = buf
	offset := int(84)

	// Offset (0) 'Finalized'
	dst = ssz.WriteOffset(dst, offset)
	offset += len(d.Finalized) * 32

	// Field (1) 'DepositRoot'
	if size := len(d.DepositRoot); size != 32 {
		err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32)
		return
	}
	dst = append(dst, d.DepositRoot...)

	// Field (2) 'DepositCount'
	dst = ssz.MarshalUint64(dst, d.DepositCount)

	// Field (3) 'ExecutionHash'
	if size := len(d.ExecutionHash); size != 32 {
		err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32)
		return
	}
	dst = append(dst, d.ExecutionHash...)

	// Field (4) 'ExecutionDepth'
	dst = ssz.MarshalUint64(dst, d.ExecutionDepth)

	// Field (0) 'Finalized'
	if size := len(d.Finalized); size > 32 {
		err = ssz.ErrListTooBigFn("--.Finalized", size, 32)
		return
	}
	for ii := 0; ii < len(d.Finalized); ii++ {
		if size := len(d.Finalized[ii]); size != 32 {
			err = ssz.ErrBytesLengthFn("--.Finalized[ii]", size, 32)
			return
		}
		dst = append(dst, d.Finalized[ii]...)
	}

	return
}

// UnmarshalSSZ ssz unmarshals the DepositSnapshot object
func (d *DepositSnapshot) UnmarshalSSZ(buf []byte) error {
	var err error
	size := uint64(len(buf))
	if size < 84 {
		return ssz.ErrSize
	}

	tail := buf
	var o0 uint64

	// Offset (0) 'Finalized'
	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
		return ssz.ErrOffset
	}

	if o0 != 84 {
		return ssz.ErrInvalidVariableOffset
	}

	// Field (1) 'DepositRoot'
	if cap(d.DepositRoot) == 0 {
		d.DepositRoot = make([]byte, 0, len(buf[4:36]))
	}
	d.DepositRoot = append(d.DepositRoot, buf[4:36]...)

	// Field (2) 'DepositCount'
	d.DepositCount = ssz.UnmarshallUint64(buf[36:44])

	// Field (3) 'ExecutionHash'
	if cap(d.ExecutionHash) == 0 {
		d.ExecutionHash = make([]byte, 0, len(buf[44:76]))
	}
	d.ExecutionHash = append(d.ExecutionHash, buf[44:76]...)

	// Field (4) 'ExecutionDepth'
	d.ExecutionDepth = ssz.UnmarshallUint64(buf[76:84])

	// Field (0) 'Finalized'
	{
		buf = tail[o0:]
		num, err := ssz.DivideInt2(len(buf), 32, 32)
		if err != nil {
			return err
		}
		d.Finalized = make([][]byte, num)
		for ii := 0; ii < num; ii++ {
			if cap(d.Finalized[ii]) == 0 {
				d.Finalized[ii] = make([]byte, 0, len(buf[ii*32:(ii+1)*32]))
			}
			d.Finalized[ii] = append(d.Finalized[ii], buf[ii*32:(ii+1)*32]...)
		}
	}
	return err
}

// SizeSSZ returns the ssz encoded size in bytes for the DepositSnapshot object
func (d *DepositSnapshot) SizeSSZ() (size int) {
	size = 84

	// Field (0) 'Finalized'
	size += len(d.Finalized) * 32

	return
}

// HashTreeRoot ssz hashes the DepositSnapshot object
func (d *DepositSnapshot) HashTreeRoot() ([32]byte, error) {
	return ssz.HashWithDefaultHasher(d)
}

// HashTreeRootWith ssz hashes the DepositSnapshot object with a hasher
func (d *DepositSnapshot) HashTreeRootWith(hh *ssz.Hasher) (err error) {
	indx := hh.Index()

	// Field (0) 'Finalized'
	{
		if size := len(d.Finalized); size > 32 {
			err = ssz.ErrListTooBigFn("--.Finalized", size, 32)
			return
		}
		subIndx := hh.Index()
		for _, i := range d.Finalized {
			if len(i) != 32 {
				err = ssz.ErrBytesLength
				return
			}
			hh.Append(i)
		}

		numItems := uint64(len(d.Finalized))
		hh.MerkleizeWithMixin(subIndx, numItems, 32)
	}

	// Field (1) 'DepositRoot'
	if size := len(d.DepositRoot); size != 32 {
		err = ssz.ErrBytesLengthFn("--.DepositRoot", size, 32)
		return
	}
	hh.PutBytes(d.DepositRoot)

	// Field (2) 'DepositCount'
	hh.PutUint64(d.DepositCount)

	// Field (3) 'ExecutionHash'
	if size := len(d.ExecutionHash); size != 32 {
		err = ssz.ErrBytesLengthFn("--.ExecutionHash", size, 32)
		return
	}
	hh.PutBytes(d.ExecutionHash)

	// Field (4) 'ExecutionDepth'
	hh.PutUint64(d.ExecutionDepth)

	hh.Merkleize(indx)
	return
}
