mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
9145310647
* get rid of v2 in prysm codebase * replace block2 * builds * terence comments * gazelle
138 lines
2.9 KiB
Go
138 lines
2.9 KiB
Go
// Code generated by fastssz. DO NOT EDIT.
|
|
// Hash: b0b105d81609a8e5a77ef34c799063f12138f31507c5781512531b5387511926
|
|
package fuzz
|
|
|
|
import (
|
|
ssz "github.com/ferranbt/fastssz"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
statepb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
)
|
|
|
|
// MarshalSSZ ssz marshals the InputBlockWithPrestate object
|
|
func (i *InputBlockWithPrestate) MarshalSSZ() ([]byte, error) {
|
|
return ssz.MarshalSSZ(i)
|
|
}
|
|
|
|
// MarshalSSZTo ssz marshals the InputBlockWithPrestate object to a target array
|
|
func (i *InputBlockWithPrestate) MarshalSSZTo(buf []byte) (dst []byte, err error) {
|
|
dst = buf
|
|
offset := int(8)
|
|
|
|
// Offset (0) 'State'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
if i.State == nil {
|
|
i.State = new(statepb.BeaconState)
|
|
}
|
|
offset += i.State.SizeSSZ()
|
|
|
|
// Offset (1) 'Block'
|
|
dst = ssz.WriteOffset(dst, offset)
|
|
if i.Block == nil {
|
|
i.Block = new(ethpb.SignedBeaconBlock)
|
|
}
|
|
offset += i.Block.SizeSSZ()
|
|
|
|
// Field (0) 'State'
|
|
if dst, err = i.State.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'Block'
|
|
if dst, err = i.Block.MarshalSSZTo(dst); err != nil {
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// UnmarshalSSZ ssz unmarshals the InputBlockWithPrestate object
|
|
func (i *InputBlockWithPrestate) 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) 'State'
|
|
if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
if o0 < 8 {
|
|
return ssz.ErrInvalidVariableOffset
|
|
}
|
|
|
|
// Offset (1) 'Block'
|
|
if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
|
|
return ssz.ErrOffset
|
|
}
|
|
|
|
// Field (0) 'State'
|
|
{
|
|
buf = tail[o0:o1]
|
|
if i.State == nil {
|
|
i.State = new(statepb.BeaconState)
|
|
}
|
|
if err = i.State.UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
// Field (1) 'Block'
|
|
{
|
|
buf = tail[o1:]
|
|
if i.Block == nil {
|
|
i.Block = new(ethpb.SignedBeaconBlock)
|
|
}
|
|
if err = i.Block.UnmarshalSSZ(buf); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
// SizeSSZ returns the ssz encoded size in bytes for the InputBlockWithPrestate object
|
|
func (i *InputBlockWithPrestate) SizeSSZ() (size int) {
|
|
size = 8
|
|
|
|
// Field (0) 'State'
|
|
if i.State == nil {
|
|
i.State = new(statepb.BeaconState)
|
|
}
|
|
size += i.State.SizeSSZ()
|
|
|
|
// Field (1) 'Block'
|
|
if i.Block == nil {
|
|
i.Block = new(ethpb.SignedBeaconBlock)
|
|
}
|
|
size += i.Block.SizeSSZ()
|
|
|
|
return
|
|
}
|
|
|
|
// HashTreeRoot ssz hashes the InputBlockWithPrestate object
|
|
func (i *InputBlockWithPrestate) HashTreeRoot() ([32]byte, error) {
|
|
return ssz.HashWithDefaultHasher(i)
|
|
}
|
|
|
|
// HashTreeRootWith ssz hashes the InputBlockWithPrestate object with a hasher
|
|
func (i *InputBlockWithPrestate) HashTreeRootWith(hh *ssz.Hasher) (err error) {
|
|
indx := hh.Index()
|
|
|
|
// Field (0) 'State'
|
|
if err = i.State.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
// Field (1) 'Block'
|
|
if err = i.Block.HashTreeRootWith(hh); err != nil {
|
|
return
|
|
}
|
|
|
|
hh.Merkleize(indx)
|
|
return
|
|
}
|