mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
5aac06f04e
* begin move * use same import path * imports * regen protos * regen * no rename * generate ssz * gaz * fmt * edit build file * imports * modify * remove generated files * remove protos * edit imports in prysm * beacon chain all builds * edit script * add generated pbs * add replace rules * license for ethereumapis protos * change visibility * fmt * update build files to gaz ignore * use proper form * edit imports * wrap block * revert scripts * revert go mod
133 lines
2.8 KiB
Go
133 lines
2.8 KiB
Go
// Code generated by fastssz. DO NOT EDIT.
|
|
package fuzz
|
|
|
|
import (
|
|
ssz "github.com/ferranbt/fastssz"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/eth/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(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
|
|
}
|