// Code generated by fastssz. DO NOT EDIT. package enginev1 import ( github_com_OffchainLabs_prysm_v7_consensus_types_primitives "github.com/OffchainLabs/prysm/v7/consensus-types/primitives" ssz "github.com/prysmaticlabs/fastssz" ) // MarshalSSZ ssz marshals the WithdrawalRequest object func (w *WithdrawalRequest) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(w) } // MarshalSSZTo ssz marshals the WithdrawalRequest object to a target array func (w *WithdrawalRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf // Field (0) 'SourceAddress' if size := len(w.SourceAddress); size != 20 { err = ssz.ErrBytesLengthFn("--.SourceAddress", size, 20) return } dst = append(dst, w.SourceAddress...) // Field (1) 'ValidatorPubkey' if size := len(w.ValidatorPubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.ValidatorPubkey", size, 48) return } dst = append(dst, w.ValidatorPubkey...) // Field (2) 'Amount' dst = ssz.MarshalUint64(dst, w.Amount) return } // UnmarshalSSZ ssz unmarshals the WithdrawalRequest object func (w *WithdrawalRequest) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size != 76 { return ssz.ErrSize } // Field (0) 'SourceAddress' if cap(w.SourceAddress) == 0 { w.SourceAddress = make([]byte, 0, len(buf[0:20])) } w.SourceAddress = append(w.SourceAddress, buf[0:20]...) // Field (1) 'ValidatorPubkey' if cap(w.ValidatorPubkey) == 0 { w.ValidatorPubkey = make([]byte, 0, len(buf[20:68])) } w.ValidatorPubkey = append(w.ValidatorPubkey, buf[20:68]...) // Field (2) 'Amount' w.Amount = ssz.UnmarshallUint64(buf[68:76]) return err } // SizeSSZ returns the ssz encoded size in bytes for the WithdrawalRequest object func (w *WithdrawalRequest) SizeSSZ() (size int) { size = 76 return } // HashTreeRoot ssz hashes the WithdrawalRequest object func (w *WithdrawalRequest) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(w) } // HashTreeRootWith ssz hashes the WithdrawalRequest object with a hasher func (w *WithdrawalRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'SourceAddress' if size := len(w.SourceAddress); size != 20 { err = ssz.ErrBytesLengthFn("--.SourceAddress", size, 20) return } hh.PutBytes(w.SourceAddress) // Field (1) 'ValidatorPubkey' if size := len(w.ValidatorPubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.ValidatorPubkey", size, 48) return } hh.PutBytes(w.ValidatorPubkey) // Field (2) 'Amount' hh.PutUint64(w.Amount) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the DepositRequest object func (d *DepositRequest) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(d) } // MarshalSSZTo ssz marshals the DepositRequest object to a target array func (d *DepositRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf // Field (0) 'Pubkey' if size := len(d.Pubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) return } dst = append(dst, d.Pubkey...) // Field (1) 'WithdrawalCredentials' if size := len(d.WithdrawalCredentials); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) return } dst = append(dst, d.WithdrawalCredentials...) // Field (2) 'Amount' dst = ssz.MarshalUint64(dst, d.Amount) // Field (3) 'Signature' if size := len(d.Signature); size != 96 { err = ssz.ErrBytesLengthFn("--.Signature", size, 96) return } dst = append(dst, d.Signature...) // Field (4) 'Index' dst = ssz.MarshalUint64(dst, d.Index) return } // UnmarshalSSZ ssz unmarshals the DepositRequest object func (d *DepositRequest) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size != 192 { return ssz.ErrSize } // Field (0) 'Pubkey' if cap(d.Pubkey) == 0 { d.Pubkey = make([]byte, 0, len(buf[0:48])) } d.Pubkey = append(d.Pubkey, buf[0:48]...) // Field (1) 'WithdrawalCredentials' if cap(d.WithdrawalCredentials) == 0 { d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80])) } d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...) // Field (2) 'Amount' d.Amount = ssz.UnmarshallUint64(buf[80:88]) // Field (3) 'Signature' if cap(d.Signature) == 0 { d.Signature = make([]byte, 0, len(buf[88:184])) } d.Signature = append(d.Signature, buf[88:184]...) // Field (4) 'Index' d.Index = ssz.UnmarshallUint64(buf[184:192]) return err } // SizeSSZ returns the ssz encoded size in bytes for the DepositRequest object func (d *DepositRequest) SizeSSZ() (size int) { size = 192 return } // HashTreeRoot ssz hashes the DepositRequest object func (d *DepositRequest) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(d) } // HashTreeRootWith ssz hashes the DepositRequest object with a hasher func (d *DepositRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'Pubkey' if size := len(d.Pubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.Pubkey", size, 48) return } hh.PutBytes(d.Pubkey) // Field (1) 'WithdrawalCredentials' if size := len(d.WithdrawalCredentials); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalCredentials", size, 32) return } hh.PutBytes(d.WithdrawalCredentials) // Field (2) 'Amount' hh.PutUint64(d.Amount) // Field (3) 'Signature' if size := len(d.Signature); size != 96 { err = ssz.ErrBytesLengthFn("--.Signature", size, 96) return } hh.PutBytes(d.Signature) // Field (4) 'Index' hh.PutUint64(d.Index) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ConsolidationRequest object func (c *ConsolidationRequest) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(c) } // MarshalSSZTo ssz marshals the ConsolidationRequest object to a target array func (c *ConsolidationRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf // Field (0) 'SourceAddress' if size := len(c.SourceAddress); size != 20 { err = ssz.ErrBytesLengthFn("--.SourceAddress", size, 20) return } dst = append(dst, c.SourceAddress...) // Field (1) 'SourcePubkey' if size := len(c.SourcePubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.SourcePubkey", size, 48) return } dst = append(dst, c.SourcePubkey...) // Field (2) 'TargetPubkey' if size := len(c.TargetPubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.TargetPubkey", size, 48) return } dst = append(dst, c.TargetPubkey...) return } // UnmarshalSSZ ssz unmarshals the ConsolidationRequest object func (c *ConsolidationRequest) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size != 116 { return ssz.ErrSize } // Field (0) 'SourceAddress' if cap(c.SourceAddress) == 0 { c.SourceAddress = make([]byte, 0, len(buf[0:20])) } c.SourceAddress = append(c.SourceAddress, buf[0:20]...) // Field (1) 'SourcePubkey' if cap(c.SourcePubkey) == 0 { c.SourcePubkey = make([]byte, 0, len(buf[20:68])) } c.SourcePubkey = append(c.SourcePubkey, buf[20:68]...) // Field (2) 'TargetPubkey' if cap(c.TargetPubkey) == 0 { c.TargetPubkey = make([]byte, 0, len(buf[68:116])) } c.TargetPubkey = append(c.TargetPubkey, buf[68:116]...) return err } // SizeSSZ returns the ssz encoded size in bytes for the ConsolidationRequest object func (c *ConsolidationRequest) SizeSSZ() (size int) { size = 116 return } // HashTreeRoot ssz hashes the ConsolidationRequest object func (c *ConsolidationRequest) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(c) } // HashTreeRootWith ssz hashes the ConsolidationRequest object with a hasher func (c *ConsolidationRequest) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'SourceAddress' if size := len(c.SourceAddress); size != 20 { err = ssz.ErrBytesLengthFn("--.SourceAddress", size, 20) return } hh.PutBytes(c.SourceAddress) // Field (1) 'SourcePubkey' if size := len(c.SourcePubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.SourcePubkey", size, 48) return } hh.PutBytes(c.SourcePubkey) // Field (2) 'TargetPubkey' if size := len(c.TargetPubkey); size != 48 { err = ssz.ErrBytesLengthFn("--.TargetPubkey", size, 48) return } hh.PutBytes(c.TargetPubkey) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionRequests object func (e *ExecutionRequests) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionRequests object to a target array func (e *ExecutionRequests) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(12) // Offset (0) 'Deposits' dst = ssz.WriteOffset(dst, offset) offset += len(e.Deposits) * 192 // Offset (1) 'Withdrawals' dst = ssz.WriteOffset(dst, offset) offset += len(e.Withdrawals) * 76 // Offset (2) 'Consolidations' dst = ssz.WriteOffset(dst, offset) offset += len(e.Consolidations) * 116 // Field (0) 'Deposits' if size := len(e.Deposits); size > 8192 { err = ssz.ErrListTooBigFn("--.Deposits", size, 8192) return } for ii := 0; ii < len(e.Deposits); ii++ { if dst, err = e.Deposits[ii].MarshalSSZTo(dst); err != nil { return } } // Field (1) 'Withdrawals' if size := len(e.Withdrawals); size > 16 { err = ssz.ErrListTooBigFn("--.Withdrawals", size, 16) return } for ii := 0; ii < len(e.Withdrawals); ii++ { if dst, err = e.Withdrawals[ii].MarshalSSZTo(dst); err != nil { return } } // Field (2) 'Consolidations' if size := len(e.Consolidations); size > 2 { err = ssz.ErrListTooBigFn("--.Consolidations", size, 2) return } for ii := 0; ii < len(e.Consolidations); ii++ { if dst, err = e.Consolidations[ii].MarshalSSZTo(dst); err != nil { return } } return } // UnmarshalSSZ ssz unmarshals the ExecutionRequests object func (e *ExecutionRequests) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 12 { return ssz.ErrSize } tail := buf var o0, o1, o2 uint64 // Offset (0) 'Deposits' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } if o0 != 12 { return ssz.ErrInvalidVariableOffset } // Offset (1) 'Withdrawals' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset } // Offset (2) 'Consolidations' if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { return ssz.ErrOffset } // Field (0) 'Deposits' { buf = tail[o0:o1] num, err := ssz.DivideInt2(len(buf), 192, 8192) if err != nil { return err } e.Deposits = make([]*DepositRequest, num) for ii := 0; ii < num; ii++ { if e.Deposits[ii] == nil { e.Deposits[ii] = new(DepositRequest) } if err = e.Deposits[ii].UnmarshalSSZ(buf[ii*192 : (ii+1)*192]); err != nil { return err } } } // Field (1) 'Withdrawals' { buf = tail[o1:o2] num, err := ssz.DivideInt2(len(buf), 76, 16) if err != nil { return err } e.Withdrawals = make([]*WithdrawalRequest, num) for ii := 0; ii < num; ii++ { if e.Withdrawals[ii] == nil { e.Withdrawals[ii] = new(WithdrawalRequest) } if err = e.Withdrawals[ii].UnmarshalSSZ(buf[ii*76 : (ii+1)*76]); err != nil { return err } } } // Field (2) 'Consolidations' { buf = tail[o2:] num, err := ssz.DivideInt2(len(buf), 116, 2) if err != nil { return err } e.Consolidations = make([]*ConsolidationRequest, num) for ii := 0; ii < num; ii++ { if e.Consolidations[ii] == nil { e.Consolidations[ii] = new(ConsolidationRequest) } if err = e.Consolidations[ii].UnmarshalSSZ(buf[ii*116 : (ii+1)*116]); err != nil { return err } } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionRequests object func (e *ExecutionRequests) SizeSSZ() (size int) { size = 12 // Field (0) 'Deposits' size += len(e.Deposits) * 192 // Field (1) 'Withdrawals' size += len(e.Withdrawals) * 76 // Field (2) 'Consolidations' size += len(e.Consolidations) * 116 return } // HashTreeRoot ssz hashes the ExecutionRequests object func (e *ExecutionRequests) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionRequests object with a hasher func (e *ExecutionRequests) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'Deposits' { subIndx := hh.Index() num := uint64(len(e.Deposits)) if num > 8192 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Deposits { if err = elem.HashTreeRootWith(hh); err != nil { return } } hh.MerkleizeWithMixin(subIndx, num, 8192) } // Field (1) 'Withdrawals' { subIndx := hh.Index() num := uint64(len(e.Withdrawals)) if num > 16 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Withdrawals { if err = elem.HashTreeRootWith(hh); err != nil { return } } hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (2) 'Consolidations' { subIndx := hh.Index() num := uint64(len(e.Consolidations)) if num > 2 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Consolidations { if err = elem.HashTreeRootWith(hh); err != nil { return } } hh.MerkleizeWithMixin(subIndx, num, 2) } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayload object func (e *ExecutionPayload) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayload object to a target array func (e *ExecutionPayload) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(508) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Offset (13) 'Transactions' dst = ssz.WriteOffset(dst, offset) for ii := 0; ii < len(e.Transactions); ii++ { offset += 4 offset += len(e.Transactions[ii]) } // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) // Field (13) 'Transactions' if size := len(e.Transactions); size > 1048576 { err = ssz.ErrListTooBigFn("--.Transactions", size, 1048576) return } { offset = 4 * len(e.Transactions) for ii := 0; ii < len(e.Transactions); ii++ { dst = ssz.WriteOffset(dst, offset) offset += len(e.Transactions[ii]) } } for ii := 0; ii < len(e.Transactions); ii++ { if size := len(e.Transactions[ii]); size > 1073741824 { err = ssz.ErrBytesLengthFn("--.Transactions[ii]", size, 1073741824) return } dst = append(dst, e.Transactions[ii]...) } return } // UnmarshalSSZ ssz unmarshals the ExecutionPayload object func (e *ExecutionPayload) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 508 { return ssz.ErrSize } tail := buf var o10, o13 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 508 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Offset (13) 'Transactions' if o13 = ssz.ReadOffset(buf[504:508]); o13 > size || o10 > o13 { return ssz.ErrOffset } // Field (10) 'ExtraData' { buf = tail[o10:o13] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } // Field (13) 'Transactions' { buf = tail[o13:] num, err := ssz.DecodeDynamicLength(buf, 1048576) if err != nil { return err } e.Transactions = make([][]byte, num) err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { if len(buf) > 1073741824 { return ssz.ErrBytesLength } if cap(e.Transactions[indx]) == 0 { e.Transactions[indx] = make([]byte, 0, len(buf)) } e.Transactions[indx] = append(e.Transactions[indx], buf...) return nil }) if err != nil { return err } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayload object func (e *ExecutionPayload) SizeSSZ() (size int) { size = 508 // Field (10) 'ExtraData' size += len(e.ExtraData) // Field (13) 'Transactions' for ii := 0; ii < len(e.Transactions); ii++ { size += 4 size += len(e.Transactions[ii]) } return } // HashTreeRoot ssz hashes the ExecutionPayload object func (e *ExecutionPayload) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayload object with a hasher func (e *ExecutionPayload) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'Transactions' { subIndx := hh.Index() num := uint64(len(e.Transactions)) if num > 1048576 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Transactions { { elemIndx := hh.Index() byteLen := uint64(len(elem)) if byteLen > 1073741824 { err = ssz.ErrIncorrectListSize return } hh.AppendBytes32(elem) hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } hh.MerkleizeWithMixin(subIndx, num, 1048576) } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadCapella object func (e *ExecutionPayloadCapella) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadCapella object to a target array func (e *ExecutionPayloadCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(512) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Offset (13) 'Transactions' dst = ssz.WriteOffset(dst, offset) for ii := 0; ii < len(e.Transactions); ii++ { offset += 4 offset += len(e.Transactions[ii]) } // Offset (14) 'Withdrawals' dst = ssz.WriteOffset(dst, offset) offset += len(e.Withdrawals) * 44 // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) // Field (13) 'Transactions' if size := len(e.Transactions); size > 1048576 { err = ssz.ErrListTooBigFn("--.Transactions", size, 1048576) return } { offset = 4 * len(e.Transactions) for ii := 0; ii < len(e.Transactions); ii++ { dst = ssz.WriteOffset(dst, offset) offset += len(e.Transactions[ii]) } } for ii := 0; ii < len(e.Transactions); ii++ { if size := len(e.Transactions[ii]); size > 1073741824 { err = ssz.ErrBytesLengthFn("--.Transactions[ii]", size, 1073741824) return } dst = append(dst, e.Transactions[ii]...) } // Field (14) 'Withdrawals' if size := len(e.Withdrawals); size > 16 { err = ssz.ErrListTooBigFn("--.Withdrawals", size, 16) return } for ii := 0; ii < len(e.Withdrawals); ii++ { if dst, err = e.Withdrawals[ii].MarshalSSZTo(dst); err != nil { return } } return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadCapella object func (e *ExecutionPayloadCapella) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 512 { return ssz.ErrSize } tail := buf var o10, o13, o14 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 512 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Offset (13) 'Transactions' if o13 = ssz.ReadOffset(buf[504:508]); o13 > size || o10 > o13 { return ssz.ErrOffset } // Offset (14) 'Withdrawals' if o14 = ssz.ReadOffset(buf[508:512]); o14 > size || o13 > o14 { return ssz.ErrOffset } // Field (10) 'ExtraData' { buf = tail[o10:o13] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } // Field (13) 'Transactions' { buf = tail[o13:o14] num, err := ssz.DecodeDynamicLength(buf, 1048576) if err != nil { return err } e.Transactions = make([][]byte, num) err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { if len(buf) > 1073741824 { return ssz.ErrBytesLength } if cap(e.Transactions[indx]) == 0 { e.Transactions[indx] = make([]byte, 0, len(buf)) } e.Transactions[indx] = append(e.Transactions[indx], buf...) return nil }) if err != nil { return err } } // Field (14) 'Withdrawals' { buf = tail[o14:] num, err := ssz.DivideInt2(len(buf), 44, 16) if err != nil { return err } e.Withdrawals = make([]*Withdrawal, num) for ii := 0; ii < num; ii++ { if e.Withdrawals[ii] == nil { e.Withdrawals[ii] = new(Withdrawal) } if err = e.Withdrawals[ii].UnmarshalSSZ(buf[ii*44 : (ii+1)*44]); err != nil { return err } } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadCapella object func (e *ExecutionPayloadCapella) SizeSSZ() (size int) { size = 512 // Field (10) 'ExtraData' size += len(e.ExtraData) // Field (13) 'Transactions' for ii := 0; ii < len(e.Transactions); ii++ { size += 4 size += len(e.Transactions[ii]) } // Field (14) 'Withdrawals' size += len(e.Withdrawals) * 44 return } // HashTreeRoot ssz hashes the ExecutionPayloadCapella object func (e *ExecutionPayloadCapella) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadCapella object with a hasher func (e *ExecutionPayloadCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'Transactions' { subIndx := hh.Index() num := uint64(len(e.Transactions)) if num > 1048576 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Transactions { { elemIndx := hh.Index() byteLen := uint64(len(elem)) if byteLen > 1073741824 { err = ssz.ErrIncorrectListSize return } hh.AppendBytes32(elem) hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } hh.MerkleizeWithMixin(subIndx, num, 1048576) } // Field (14) 'Withdrawals' { subIndx := hh.Index() num := uint64(len(e.Withdrawals)) if num > 16 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Withdrawals { if err = elem.HashTreeRootWith(hh); err != nil { return } } hh.MerkleizeWithMixin(subIndx, num, 16) } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadDeneb object func (e *ExecutionPayloadDeneb) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadDeneb object to a target array func (e *ExecutionPayloadDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(528) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Offset (13) 'Transactions' dst = ssz.WriteOffset(dst, offset) for ii := 0; ii < len(e.Transactions); ii++ { offset += 4 offset += len(e.Transactions[ii]) } // Offset (14) 'Withdrawals' dst = ssz.WriteOffset(dst, offset) offset += len(e.Withdrawals) * 44 // Field (15) 'BlobGasUsed' dst = ssz.MarshalUint64(dst, e.BlobGasUsed) // Field (16) 'ExcessBlobGas' dst = ssz.MarshalUint64(dst, e.ExcessBlobGas) // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) // Field (13) 'Transactions' if size := len(e.Transactions); size > 1048576 { err = ssz.ErrListTooBigFn("--.Transactions", size, 1048576) return } { offset = 4 * len(e.Transactions) for ii := 0; ii < len(e.Transactions); ii++ { dst = ssz.WriteOffset(dst, offset) offset += len(e.Transactions[ii]) } } for ii := 0; ii < len(e.Transactions); ii++ { if size := len(e.Transactions[ii]); size > 1073741824 { err = ssz.ErrBytesLengthFn("--.Transactions[ii]", size, 1073741824) return } dst = append(dst, e.Transactions[ii]...) } // Field (14) 'Withdrawals' if size := len(e.Withdrawals); size > 16 { err = ssz.ErrListTooBigFn("--.Withdrawals", size, 16) return } for ii := 0; ii < len(e.Withdrawals); ii++ { if dst, err = e.Withdrawals[ii].MarshalSSZTo(dst); err != nil { return } } return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadDeneb object func (e *ExecutionPayloadDeneb) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 528 { return ssz.ErrSize } tail := buf var o10, o13, o14 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 528 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Offset (13) 'Transactions' if o13 = ssz.ReadOffset(buf[504:508]); o13 > size || o10 > o13 { return ssz.ErrOffset } // Offset (14) 'Withdrawals' if o14 = ssz.ReadOffset(buf[508:512]); o14 > size || o13 > o14 { return ssz.ErrOffset } // Field (15) 'BlobGasUsed' e.BlobGasUsed = ssz.UnmarshallUint64(buf[512:520]) // Field (16) 'ExcessBlobGas' e.ExcessBlobGas = ssz.UnmarshallUint64(buf[520:528]) // Field (10) 'ExtraData' { buf = tail[o10:o13] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } // Field (13) 'Transactions' { buf = tail[o13:o14] num, err := ssz.DecodeDynamicLength(buf, 1048576) if err != nil { return err } e.Transactions = make([][]byte, num) err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) { if len(buf) > 1073741824 { return ssz.ErrBytesLength } if cap(e.Transactions[indx]) == 0 { e.Transactions[indx] = make([]byte, 0, len(buf)) } e.Transactions[indx] = append(e.Transactions[indx], buf...) return nil }) if err != nil { return err } } // Field (14) 'Withdrawals' { buf = tail[o14:] num, err := ssz.DivideInt2(len(buf), 44, 16) if err != nil { return err } e.Withdrawals = make([]*Withdrawal, num) for ii := 0; ii < num; ii++ { if e.Withdrawals[ii] == nil { e.Withdrawals[ii] = new(Withdrawal) } if err = e.Withdrawals[ii].UnmarshalSSZ(buf[ii*44 : (ii+1)*44]); err != nil { return err } } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadDeneb object func (e *ExecutionPayloadDeneb) SizeSSZ() (size int) { size = 528 // Field (10) 'ExtraData' size += len(e.ExtraData) // Field (13) 'Transactions' for ii := 0; ii < len(e.Transactions); ii++ { size += 4 size += len(e.Transactions[ii]) } // Field (14) 'Withdrawals' size += len(e.Withdrawals) * 44 return } // HashTreeRoot ssz hashes the ExecutionPayloadDeneb object func (e *ExecutionPayloadDeneb) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadDeneb object with a hasher func (e *ExecutionPayloadDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'Transactions' { subIndx := hh.Index() num := uint64(len(e.Transactions)) if num > 1048576 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Transactions { { elemIndx := hh.Index() byteLen := uint64(len(elem)) if byteLen > 1073741824 { err = ssz.ErrIncorrectListSize return } hh.AppendBytes32(elem) hh.MerkleizeWithMixin(elemIndx, byteLen, (1073741824+31)/32) } } hh.MerkleizeWithMixin(subIndx, num, 1048576) } // Field (14) 'Withdrawals' { subIndx := hh.Index() num := uint64(len(e.Withdrawals)) if num > 16 { err = ssz.ErrIncorrectListSize return } for _, elem := range e.Withdrawals { if err = elem.HashTreeRootWith(hh); err != nil { return } } hh.MerkleizeWithMixin(subIndx, num, 16) } // Field (15) 'BlobGasUsed' hh.PutUint64(e.BlobGasUsed) // Field (16) 'ExcessBlobGas' hh.PutUint64(e.ExcessBlobGas) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadDenebAndBlobsBundle object func (e *ExecutionPayloadDenebAndBlobsBundle) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadDenebAndBlobsBundle object to a target array func (e *ExecutionPayloadDenebAndBlobsBundle) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(8) // Offset (0) 'Payload' dst = ssz.WriteOffset(dst, offset) if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } offset += e.Payload.SizeSSZ() // Offset (1) 'BlobsBundle' dst = ssz.WriteOffset(dst, offset) if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundle) } offset += e.BlobsBundle.SizeSSZ() // Field (0) 'Payload' if dst, err = e.Payload.MarshalSSZTo(dst); err != nil { return } // Field (1) 'BlobsBundle' if dst, err = e.BlobsBundle.MarshalSSZTo(dst); err != nil { return } return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadDenebAndBlobsBundle object func (e *ExecutionPayloadDenebAndBlobsBundle) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 8 { return ssz.ErrSize } tail := buf var o0, o1 uint64 // Offset (0) 'Payload' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } if o0 != 8 { return ssz.ErrInvalidVariableOffset } // Offset (1) 'BlobsBundle' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset } // Field (0) 'Payload' { buf = tail[o0:o1] if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } if err = e.Payload.UnmarshalSSZ(buf); err != nil { return err } } // Field (1) 'BlobsBundle' { buf = tail[o1:] if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundle) } if err = e.BlobsBundle.UnmarshalSSZ(buf); err != nil { return err } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadDenebAndBlobsBundle object func (e *ExecutionPayloadDenebAndBlobsBundle) SizeSSZ() (size int) { size = 8 // Field (0) 'Payload' if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } size += e.Payload.SizeSSZ() // Field (1) 'BlobsBundle' if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundle) } size += e.BlobsBundle.SizeSSZ() return } // HashTreeRoot ssz hashes the ExecutionPayloadDenebAndBlobsBundle object func (e *ExecutionPayloadDenebAndBlobsBundle) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadDenebAndBlobsBundle object with a hasher func (e *ExecutionPayloadDenebAndBlobsBundle) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'Payload' if err = e.Payload.HashTreeRootWith(hh); err != nil { return } // Field (1) 'BlobsBundle' if err = e.BlobsBundle.HashTreeRootWith(hh); err != nil { return } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadDenebAndBlobsBundleV2 object func (e *ExecutionPayloadDenebAndBlobsBundleV2) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadDenebAndBlobsBundleV2 object to a target array func (e *ExecutionPayloadDenebAndBlobsBundleV2) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(8) // Offset (0) 'Payload' dst = ssz.WriteOffset(dst, offset) if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } offset += e.Payload.SizeSSZ() // Offset (1) 'BlobsBundle' dst = ssz.WriteOffset(dst, offset) if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundleV2) } offset += e.BlobsBundle.SizeSSZ() // Field (0) 'Payload' if dst, err = e.Payload.MarshalSSZTo(dst); err != nil { return } // Field (1) 'BlobsBundle' if dst, err = e.BlobsBundle.MarshalSSZTo(dst); err != nil { return } return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadDenebAndBlobsBundleV2 object func (e *ExecutionPayloadDenebAndBlobsBundleV2) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 8 { return ssz.ErrSize } tail := buf var o0, o1 uint64 // Offset (0) 'Payload' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } if o0 != 8 { return ssz.ErrInvalidVariableOffset } // Offset (1) 'BlobsBundle' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset } // Field (0) 'Payload' { buf = tail[o0:o1] if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } if err = e.Payload.UnmarshalSSZ(buf); err != nil { return err } } // Field (1) 'BlobsBundle' { buf = tail[o1:] if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundleV2) } if err = e.BlobsBundle.UnmarshalSSZ(buf); err != nil { return err } } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadDenebAndBlobsBundleV2 object func (e *ExecutionPayloadDenebAndBlobsBundleV2) SizeSSZ() (size int) { size = 8 // Field (0) 'Payload' if e.Payload == nil { e.Payload = new(ExecutionPayloadDeneb) } size += e.Payload.SizeSSZ() // Field (1) 'BlobsBundle' if e.BlobsBundle == nil { e.BlobsBundle = new(BlobsBundleV2) } size += e.BlobsBundle.SizeSSZ() return } // HashTreeRoot ssz hashes the ExecutionPayloadDenebAndBlobsBundleV2 object func (e *ExecutionPayloadDenebAndBlobsBundleV2) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadDenebAndBlobsBundleV2 object with a hasher func (e *ExecutionPayloadDenebAndBlobsBundleV2) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'Payload' if err = e.Payload.HashTreeRootWith(hh); err != nil { return } // Field (1) 'BlobsBundle' if err = e.BlobsBundle.HashTreeRootWith(hh); err != nil { return } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadHeader object func (e *ExecutionPayloadHeader) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadHeader object to a target array func (e *ExecutionPayloadHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(536) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } dst = append(dst, e.TransactionsRoot...) // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadHeader object func (e *ExecutionPayloadHeader) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 536 { return ssz.ErrSize } tail := buf var o10 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 536 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Field (13) 'TransactionsRoot' if cap(e.TransactionsRoot) == 0 { e.TransactionsRoot = make([]byte, 0, len(buf[504:536])) } e.TransactionsRoot = append(e.TransactionsRoot, buf[504:536]...) // Field (10) 'ExtraData' { buf = tail[o10:] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadHeader object func (e *ExecutionPayloadHeader) SizeSSZ() (size int) { size = 536 // Field (10) 'ExtraData' size += len(e.ExtraData) return } // HashTreeRoot ssz hashes the ExecutionPayloadHeader object func (e *ExecutionPayloadHeader) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadHeader object with a hasher func (e *ExecutionPayloadHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } hh.PutBytes(e.TransactionsRoot) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadHeaderCapella object func (e *ExecutionPayloadHeaderCapella) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadHeaderCapella object to a target array func (e *ExecutionPayloadHeaderCapella) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(568) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } dst = append(dst, e.TransactionsRoot...) // Field (14) 'WithdrawalsRoot' if size := len(e.WithdrawalsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalsRoot", size, 32) return } dst = append(dst, e.WithdrawalsRoot...) // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadHeaderCapella object func (e *ExecutionPayloadHeaderCapella) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 568 { return ssz.ErrSize } tail := buf var o10 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 568 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Field (13) 'TransactionsRoot' if cap(e.TransactionsRoot) == 0 { e.TransactionsRoot = make([]byte, 0, len(buf[504:536])) } e.TransactionsRoot = append(e.TransactionsRoot, buf[504:536]...) // Field (14) 'WithdrawalsRoot' if cap(e.WithdrawalsRoot) == 0 { e.WithdrawalsRoot = make([]byte, 0, len(buf[536:568])) } e.WithdrawalsRoot = append(e.WithdrawalsRoot, buf[536:568]...) // Field (10) 'ExtraData' { buf = tail[o10:] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadHeaderCapella object func (e *ExecutionPayloadHeaderCapella) SizeSSZ() (size int) { size = 568 // Field (10) 'ExtraData' size += len(e.ExtraData) return } // HashTreeRoot ssz hashes the ExecutionPayloadHeaderCapella object func (e *ExecutionPayloadHeaderCapella) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadHeaderCapella object with a hasher func (e *ExecutionPayloadHeaderCapella) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } hh.PutBytes(e.TransactionsRoot) // Field (14) 'WithdrawalsRoot' if size := len(e.WithdrawalsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalsRoot", size, 32) return } hh.PutBytes(e.WithdrawalsRoot) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the ExecutionPayloadHeaderDeneb object func (e *ExecutionPayloadHeaderDeneb) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(e) } // MarshalSSZTo ssz marshals the ExecutionPayloadHeaderDeneb object to a target array func (e *ExecutionPayloadHeaderDeneb) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(584) // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } dst = append(dst, e.ParentHash...) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } dst = append(dst, e.FeeRecipient...) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } dst = append(dst, e.StateRoot...) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } dst = append(dst, e.ReceiptsRoot...) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } dst = append(dst, e.LogsBloom...) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } dst = append(dst, e.PrevRandao...) // Field (6) 'BlockNumber' dst = ssz.MarshalUint64(dst, e.BlockNumber) // Field (7) 'GasLimit' dst = ssz.MarshalUint64(dst, e.GasLimit) // Field (8) 'GasUsed' dst = ssz.MarshalUint64(dst, e.GasUsed) // Field (9) 'Timestamp' dst = ssz.MarshalUint64(dst, e.Timestamp) // Offset (10) 'ExtraData' dst = ssz.WriteOffset(dst, offset) offset += len(e.ExtraData) // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } dst = append(dst, e.BaseFeePerGas...) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } dst = append(dst, e.BlockHash...) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } dst = append(dst, e.TransactionsRoot...) // Field (14) 'WithdrawalsRoot' if size := len(e.WithdrawalsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalsRoot", size, 32) return } dst = append(dst, e.WithdrawalsRoot...) // Field (15) 'BlobGasUsed' dst = ssz.MarshalUint64(dst, e.BlobGasUsed) // Field (16) 'ExcessBlobGas' dst = ssz.MarshalUint64(dst, e.ExcessBlobGas) // Field (10) 'ExtraData' if size := len(e.ExtraData); size > 32 { err = ssz.ErrBytesLengthFn("--.ExtraData", size, 32) return } dst = append(dst, e.ExtraData...) return } // UnmarshalSSZ ssz unmarshals the ExecutionPayloadHeaderDeneb object func (e *ExecutionPayloadHeaderDeneb) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 584 { return ssz.ErrSize } tail := buf var o10 uint64 // Field (0) 'ParentHash' if cap(e.ParentHash) == 0 { e.ParentHash = make([]byte, 0, len(buf[0:32])) } e.ParentHash = append(e.ParentHash, buf[0:32]...) // Field (1) 'FeeRecipient' if cap(e.FeeRecipient) == 0 { e.FeeRecipient = make([]byte, 0, len(buf[32:52])) } e.FeeRecipient = append(e.FeeRecipient, buf[32:52]...) // Field (2) 'StateRoot' if cap(e.StateRoot) == 0 { e.StateRoot = make([]byte, 0, len(buf[52:84])) } e.StateRoot = append(e.StateRoot, buf[52:84]...) // Field (3) 'ReceiptsRoot' if cap(e.ReceiptsRoot) == 0 { e.ReceiptsRoot = make([]byte, 0, len(buf[84:116])) } e.ReceiptsRoot = append(e.ReceiptsRoot, buf[84:116]...) // Field (4) 'LogsBloom' if cap(e.LogsBloom) == 0 { e.LogsBloom = make([]byte, 0, len(buf[116:372])) } e.LogsBloom = append(e.LogsBloom, buf[116:372]...) // Field (5) 'PrevRandao' if cap(e.PrevRandao) == 0 { e.PrevRandao = make([]byte, 0, len(buf[372:404])) } e.PrevRandao = append(e.PrevRandao, buf[372:404]...) // Field (6) 'BlockNumber' e.BlockNumber = ssz.UnmarshallUint64(buf[404:412]) // Field (7) 'GasLimit' e.GasLimit = ssz.UnmarshallUint64(buf[412:420]) // Field (8) 'GasUsed' e.GasUsed = ssz.UnmarshallUint64(buf[420:428]) // Field (9) 'Timestamp' e.Timestamp = ssz.UnmarshallUint64(buf[428:436]) // Offset (10) 'ExtraData' if o10 = ssz.ReadOffset(buf[436:440]); o10 > size { return ssz.ErrOffset } if o10 != 584 { return ssz.ErrInvalidVariableOffset } // Field (11) 'BaseFeePerGas' if cap(e.BaseFeePerGas) == 0 { e.BaseFeePerGas = make([]byte, 0, len(buf[440:472])) } e.BaseFeePerGas = append(e.BaseFeePerGas, buf[440:472]...) // Field (12) 'BlockHash' if cap(e.BlockHash) == 0 { e.BlockHash = make([]byte, 0, len(buf[472:504])) } e.BlockHash = append(e.BlockHash, buf[472:504]...) // Field (13) 'TransactionsRoot' if cap(e.TransactionsRoot) == 0 { e.TransactionsRoot = make([]byte, 0, len(buf[504:536])) } e.TransactionsRoot = append(e.TransactionsRoot, buf[504:536]...) // Field (14) 'WithdrawalsRoot' if cap(e.WithdrawalsRoot) == 0 { e.WithdrawalsRoot = make([]byte, 0, len(buf[536:568])) } e.WithdrawalsRoot = append(e.WithdrawalsRoot, buf[536:568]...) // Field (15) 'BlobGasUsed' e.BlobGasUsed = ssz.UnmarshallUint64(buf[568:576]) // Field (16) 'ExcessBlobGas' e.ExcessBlobGas = ssz.UnmarshallUint64(buf[576:584]) // Field (10) 'ExtraData' { buf = tail[o10:] if len(buf) > 32 { return ssz.ErrBytesLength } if cap(e.ExtraData) == 0 { e.ExtraData = make([]byte, 0, len(buf)) } e.ExtraData = append(e.ExtraData, buf...) } return err } // SizeSSZ returns the ssz encoded size in bytes for the ExecutionPayloadHeaderDeneb object func (e *ExecutionPayloadHeaderDeneb) SizeSSZ() (size int) { size = 584 // Field (10) 'ExtraData' size += len(e.ExtraData) return } // HashTreeRoot ssz hashes the ExecutionPayloadHeaderDeneb object func (e *ExecutionPayloadHeaderDeneb) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(e) } // HashTreeRootWith ssz hashes the ExecutionPayloadHeaderDeneb object with a hasher func (e *ExecutionPayloadHeaderDeneb) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'ParentHash' if size := len(e.ParentHash); size != 32 { err = ssz.ErrBytesLengthFn("--.ParentHash", size, 32) return } hh.PutBytes(e.ParentHash) // Field (1) 'FeeRecipient' if size := len(e.FeeRecipient); size != 20 { err = ssz.ErrBytesLengthFn("--.FeeRecipient", size, 20) return } hh.PutBytes(e.FeeRecipient) // Field (2) 'StateRoot' if size := len(e.StateRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.StateRoot", size, 32) return } hh.PutBytes(e.StateRoot) // Field (3) 'ReceiptsRoot' if size := len(e.ReceiptsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.ReceiptsRoot", size, 32) return } hh.PutBytes(e.ReceiptsRoot) // Field (4) 'LogsBloom' if size := len(e.LogsBloom); size != 256 { err = ssz.ErrBytesLengthFn("--.LogsBloom", size, 256) return } hh.PutBytes(e.LogsBloom) // Field (5) 'PrevRandao' if size := len(e.PrevRandao); size != 32 { err = ssz.ErrBytesLengthFn("--.PrevRandao", size, 32) return } hh.PutBytes(e.PrevRandao) // Field (6) 'BlockNumber' hh.PutUint64(e.BlockNumber) // Field (7) 'GasLimit' hh.PutUint64(e.GasLimit) // Field (8) 'GasUsed' hh.PutUint64(e.GasUsed) // Field (9) 'Timestamp' hh.PutUint64(e.Timestamp) // Field (10) 'ExtraData' { elemIndx := hh.Index() byteLen := uint64(len(e.ExtraData)) if byteLen > 32 { err = ssz.ErrIncorrectListSize return } hh.PutBytes(e.ExtraData) hh.MerkleizeWithMixin(elemIndx, byteLen, (32+31)/32) } // Field (11) 'BaseFeePerGas' if size := len(e.BaseFeePerGas); size != 32 { err = ssz.ErrBytesLengthFn("--.BaseFeePerGas", size, 32) return } hh.PutBytes(e.BaseFeePerGas) // Field (12) 'BlockHash' if size := len(e.BlockHash); size != 32 { err = ssz.ErrBytesLengthFn("--.BlockHash", size, 32) return } hh.PutBytes(e.BlockHash) // Field (13) 'TransactionsRoot' if size := len(e.TransactionsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.TransactionsRoot", size, 32) return } hh.PutBytes(e.TransactionsRoot) // Field (14) 'WithdrawalsRoot' if size := len(e.WithdrawalsRoot); size != 32 { err = ssz.ErrBytesLengthFn("--.WithdrawalsRoot", size, 32) return } hh.PutBytes(e.WithdrawalsRoot) // Field (15) 'BlobGasUsed' hh.PutUint64(e.BlobGasUsed) // Field (16) 'ExcessBlobGas' hh.PutUint64(e.ExcessBlobGas) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the Withdrawal object func (w *Withdrawal) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(w) } // MarshalSSZTo ssz marshals the Withdrawal object to a target array func (w *Withdrawal) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf // Field (0) 'Index' dst = ssz.MarshalUint64(dst, w.Index) // Field (1) 'ValidatorIndex' dst = ssz.MarshalUint64(dst, uint64(w.ValidatorIndex)) // Field (2) 'Address' if size := len(w.Address); size != 20 { err = ssz.ErrBytesLengthFn("--.Address", size, 20) return } dst = append(dst, w.Address...) // Field (3) 'Amount' dst = ssz.MarshalUint64(dst, w.Amount) return } // UnmarshalSSZ ssz unmarshals the Withdrawal object func (w *Withdrawal) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size != 44 { return ssz.ErrSize } // Field (0) 'Index' w.Index = ssz.UnmarshallUint64(buf[0:8]) // Field (1) 'ValidatorIndex' w.ValidatorIndex = github_com_OffchainLabs_prysm_v7_consensus_types_primitives.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16])) // Field (2) 'Address' if cap(w.Address) == 0 { w.Address = make([]byte, 0, len(buf[16:36])) } w.Address = append(w.Address, buf[16:36]...) // Field (3) 'Amount' w.Amount = ssz.UnmarshallUint64(buf[36:44]) return err } // SizeSSZ returns the ssz encoded size in bytes for the Withdrawal object func (w *Withdrawal) SizeSSZ() (size int) { size = 44 return } // HashTreeRoot ssz hashes the Withdrawal object func (w *Withdrawal) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(w) } // HashTreeRootWith ssz hashes the Withdrawal object with a hasher func (w *Withdrawal) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'Index' hh.PutUint64(w.Index) // Field (1) 'ValidatorIndex' hh.PutUint64(uint64(w.ValidatorIndex)) // Field (2) 'Address' if size := len(w.Address); size != 20 { err = ssz.ErrBytesLengthFn("--.Address", size, 20) return } hh.PutBytes(w.Address) // Field (3) 'Amount' hh.PutUint64(w.Amount) hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the BlobsBundle object func (b *BlobsBundle) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(b) } // MarshalSSZTo ssz marshals the BlobsBundle object to a target array func (b *BlobsBundle) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(12) // Offset (0) 'KzgCommitments' dst = ssz.WriteOffset(dst, offset) offset += len(b.KzgCommitments) * 48 // Offset (1) 'Proofs' dst = ssz.WriteOffset(dst, offset) offset += len(b.Proofs) * 48 // Offset (2) 'Blobs' dst = ssz.WriteOffset(dst, offset) offset += len(b.Blobs) * 131072 // Field (0) 'KzgCommitments' if size := len(b.KzgCommitments); size > 4096 { err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) return } for ii := 0; ii < len(b.KzgCommitments); ii++ { if size := len(b.KzgCommitments[ii]); size != 48 { err = ssz.ErrBytesLengthFn("--.KzgCommitments[ii]", size, 48) return } dst = append(dst, b.KzgCommitments[ii]...) } // Field (1) 'Proofs' if size := len(b.Proofs); size > 4096 { err = ssz.ErrListTooBigFn("--.Proofs", size, 4096) return } for ii := 0; ii < len(b.Proofs); ii++ { if size := len(b.Proofs[ii]); size != 48 { err = ssz.ErrBytesLengthFn("--.Proofs[ii]", size, 48) return } dst = append(dst, b.Proofs[ii]...) } // Field (2) 'Blobs' if size := len(b.Blobs); size > 4096 { err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) return } for ii := 0; ii < len(b.Blobs); ii++ { if size := len(b.Blobs[ii]); size != 131072 { err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) return } dst = append(dst, b.Blobs[ii]...) } return } // UnmarshalSSZ ssz unmarshals the BlobsBundle object func (b *BlobsBundle) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 12 { return ssz.ErrSize } tail := buf var o0, o1, o2 uint64 // Offset (0) 'KzgCommitments' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } if o0 != 12 { return ssz.ErrInvalidVariableOffset } // Offset (1) 'Proofs' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset } // Offset (2) 'Blobs' if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { return ssz.ErrOffset } // Field (0) 'KzgCommitments' { buf = tail[o0:o1] num, err := ssz.DivideInt2(len(buf), 48, 4096) if err != nil { return err } b.KzgCommitments = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.KzgCommitments[ii]) == 0 { b.KzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) } b.KzgCommitments[ii] = append(b.KzgCommitments[ii], buf[ii*48:(ii+1)*48]...) } } // Field (1) 'Proofs' { buf = tail[o1:o2] num, err := ssz.DivideInt2(len(buf), 48, 4096) if err != nil { return err } b.Proofs = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.Proofs[ii]) == 0 { b.Proofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) } b.Proofs[ii] = append(b.Proofs[ii], buf[ii*48:(ii+1)*48]...) } } // Field (2) 'Blobs' { buf = tail[o2:] num, err := ssz.DivideInt2(len(buf), 131072, 4096) if err != nil { return err } b.Blobs = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.Blobs[ii]) == 0 { b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) } b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) } } return err } // SizeSSZ returns the ssz encoded size in bytes for the BlobsBundle object func (b *BlobsBundle) SizeSSZ() (size int) { size = 12 // Field (0) 'KzgCommitments' size += len(b.KzgCommitments) * 48 // Field (1) 'Proofs' size += len(b.Proofs) * 48 // Field (2) 'Blobs' size += len(b.Blobs) * 131072 return } // HashTreeRoot ssz hashes the BlobsBundle object func (b *BlobsBundle) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(b) } // HashTreeRootWith ssz hashes the BlobsBundle object with a hasher func (b *BlobsBundle) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'KzgCommitments' { if size := len(b.KzgCommitments); size > 4096 { err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) return } subIndx := hh.Index() for _, i := range b.KzgCommitments { if len(i) != 48 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.KzgCommitments)) hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (1) 'Proofs' { if size := len(b.Proofs); size > 4096 { err = ssz.ErrListTooBigFn("--.Proofs", size, 4096) return } subIndx := hh.Index() for _, i := range b.Proofs { if len(i) != 48 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.Proofs)) hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (2) 'Blobs' { if size := len(b.Blobs); size > 4096 { err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) return } subIndx := hh.Index() for _, i := range b.Blobs { if len(i) != 131072 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.Blobs)) hh.MerkleizeWithMixin(subIndx, numItems, 4096) } hh.Merkleize(indx) return } // MarshalSSZ ssz marshals the BlobsBundleV2 object func (b *BlobsBundleV2) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(b) } // MarshalSSZTo ssz marshals the BlobsBundleV2 object to a target array func (b *BlobsBundleV2) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf offset := int(12) // Offset (0) 'KzgCommitments' dst = ssz.WriteOffset(dst, offset) offset += len(b.KzgCommitments) * 48 // Offset (1) 'Proofs' dst = ssz.WriteOffset(dst, offset) offset += len(b.Proofs) * 48 // Offset (2) 'Blobs' dst = ssz.WriteOffset(dst, offset) offset += len(b.Blobs) * 131072 // Field (0) 'KzgCommitments' if size := len(b.KzgCommitments); size > 4096 { err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) return } for ii := 0; ii < len(b.KzgCommitments); ii++ { if size := len(b.KzgCommitments[ii]); size != 48 { err = ssz.ErrBytesLengthFn("--.KzgCommitments[ii]", size, 48) return } dst = append(dst, b.KzgCommitments[ii]...) } // Field (1) 'Proofs' if size := len(b.Proofs); size > 33554432 { err = ssz.ErrListTooBigFn("--.Proofs", size, 33554432) return } for ii := 0; ii < len(b.Proofs); ii++ { if size := len(b.Proofs[ii]); size != 48 { err = ssz.ErrBytesLengthFn("--.Proofs[ii]", size, 48) return } dst = append(dst, b.Proofs[ii]...) } // Field (2) 'Blobs' if size := len(b.Blobs); size > 4096 { err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) return } for ii := 0; ii < len(b.Blobs); ii++ { if size := len(b.Blobs[ii]); size != 131072 { err = ssz.ErrBytesLengthFn("--.Blobs[ii]", size, 131072) return } dst = append(dst, b.Blobs[ii]...) } return } // UnmarshalSSZ ssz unmarshals the BlobsBundleV2 object func (b *BlobsBundleV2) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size < 12 { return ssz.ErrSize } tail := buf var o0, o1, o2 uint64 // Offset (0) 'KzgCommitments' if o0 = ssz.ReadOffset(buf[0:4]); o0 > size { return ssz.ErrOffset } if o0 != 12 { return ssz.ErrInvalidVariableOffset } // Offset (1) 'Proofs' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset } // Offset (2) 'Blobs' if o2 = ssz.ReadOffset(buf[8:12]); o2 > size || o1 > o2 { return ssz.ErrOffset } // Field (0) 'KzgCommitments' { buf = tail[o0:o1] num, err := ssz.DivideInt2(len(buf), 48, 4096) if err != nil { return err } b.KzgCommitments = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.KzgCommitments[ii]) == 0 { b.KzgCommitments[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) } b.KzgCommitments[ii] = append(b.KzgCommitments[ii], buf[ii*48:(ii+1)*48]...) } } // Field (1) 'Proofs' { buf = tail[o1:o2] num, err := ssz.DivideInt2(len(buf), 48, 33554432) if err != nil { return err } b.Proofs = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.Proofs[ii]) == 0 { b.Proofs[ii] = make([]byte, 0, len(buf[ii*48:(ii+1)*48])) } b.Proofs[ii] = append(b.Proofs[ii], buf[ii*48:(ii+1)*48]...) } } // Field (2) 'Blobs' { buf = tail[o2:] num, err := ssz.DivideInt2(len(buf), 131072, 4096) if err != nil { return err } b.Blobs = make([][]byte, num) for ii := 0; ii < num; ii++ { if cap(b.Blobs[ii]) == 0 { b.Blobs[ii] = make([]byte, 0, len(buf[ii*131072:(ii+1)*131072])) } b.Blobs[ii] = append(b.Blobs[ii], buf[ii*131072:(ii+1)*131072]...) } } return err } // SizeSSZ returns the ssz encoded size in bytes for the BlobsBundleV2 object func (b *BlobsBundleV2) SizeSSZ() (size int) { size = 12 // Field (0) 'KzgCommitments' size += len(b.KzgCommitments) * 48 // Field (1) 'Proofs' size += len(b.Proofs) * 48 // Field (2) 'Blobs' size += len(b.Blobs) * 131072 return } // HashTreeRoot ssz hashes the BlobsBundleV2 object func (b *BlobsBundleV2) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(b) } // HashTreeRootWith ssz hashes the BlobsBundleV2 object with a hasher func (b *BlobsBundleV2) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'KzgCommitments' { if size := len(b.KzgCommitments); size > 4096 { err = ssz.ErrListTooBigFn("--.KzgCommitments", size, 4096) return } subIndx := hh.Index() for _, i := range b.KzgCommitments { if len(i) != 48 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.KzgCommitments)) hh.MerkleizeWithMixin(subIndx, numItems, 4096) } // Field (1) 'Proofs' { if size := len(b.Proofs); size > 33554432 { err = ssz.ErrListTooBigFn("--.Proofs", size, 33554432) return } subIndx := hh.Index() for _, i := range b.Proofs { if len(i) != 48 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.Proofs)) hh.MerkleizeWithMixin(subIndx, numItems, 33554432) } // Field (2) 'Blobs' { if size := len(b.Blobs); size > 4096 { err = ssz.ErrListTooBigFn("--.Blobs", size, 4096) return } subIndx := hh.Index() for _, i := range b.Blobs { if len(i) != 131072 { err = ssz.ErrBytesLength return } hh.PutBytes(i) } numItems := uint64(len(b.Blobs)) hh.MerkleizeWithMixin(subIndx, numItems, 4096) } hh.Merkleize(indx) return }