// Code generated by fastssz. DO NOT EDIT. package fuzz import ( ssz "github.com/ferranbt/fastssz" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" ) // 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(pb.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 } // 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(pb.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(pb.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 }