github.com/prysmaticlabs/prysm@v1.4.4/proto/eth/v1alpha1/generated.ssz.go (about)

     1  // Code generated by fastssz. DO NOT EDIT.
     2  // Hash: a3416de26c1bcfbb8e5db8be7b8bf3b5aa2ee876b633efefc6e1f55acf0cb02b
     3  package eth
     4  
     5  import (
     6  	ssz "github.com/ferranbt/fastssz"
     7  	github_com_prysmaticlabs_eth2_types "github.com/prysmaticlabs/eth2-types"
     8  )
     9  
    10  // MarshalSSZ ssz marshals the Attestation object
    11  func (a *Attestation) MarshalSSZ() ([]byte, error) {
    12  	return ssz.MarshalSSZ(a)
    13  }
    14  
    15  // MarshalSSZTo ssz marshals the Attestation object to a target array
    16  func (a *Attestation) MarshalSSZTo(buf []byte) (dst []byte, err error) {
    17  	dst = buf
    18  	offset := int(228)
    19  
    20  	// Offset (0) 'AggregationBits'
    21  	dst = ssz.WriteOffset(dst, offset)
    22  	offset += len(a.AggregationBits)
    23  
    24  	// Field (1) 'Data'
    25  	if a.Data == nil {
    26  		a.Data = new(AttestationData)
    27  	}
    28  	if dst, err = a.Data.MarshalSSZTo(dst); err != nil {
    29  		return
    30  	}
    31  
    32  	// Field (2) 'Signature'
    33  	if len(a.Signature) != 96 {
    34  		err = ssz.ErrBytesLength
    35  		return
    36  	}
    37  	dst = append(dst, a.Signature...)
    38  
    39  	// Field (0) 'AggregationBits'
    40  	if len(a.AggregationBits) > 2048 {
    41  		err = ssz.ErrBytesLength
    42  		return
    43  	}
    44  	dst = append(dst, a.AggregationBits...)
    45  
    46  	return
    47  }
    48  
    49  // UnmarshalSSZ ssz unmarshals the Attestation object
    50  func (a *Attestation) UnmarshalSSZ(buf []byte) error {
    51  	var err error
    52  	size := uint64(len(buf))
    53  	if size < 228 {
    54  		return ssz.ErrSize
    55  	}
    56  
    57  	tail := buf
    58  	var o0 uint64
    59  
    60  	// Offset (0) 'AggregationBits'
    61  	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
    62  		return ssz.ErrOffset
    63  	}
    64  
    65  	if o0 < 228 {
    66  		return ssz.ErrInvalidVariableOffset
    67  	}
    68  
    69  	// Field (1) 'Data'
    70  	if a.Data == nil {
    71  		a.Data = new(AttestationData)
    72  	}
    73  	if err = a.Data.UnmarshalSSZ(buf[4:132]); err != nil {
    74  		return err
    75  	}
    76  
    77  	// Field (2) 'Signature'
    78  	if cap(a.Signature) == 0 {
    79  		a.Signature = make([]byte, 0, len(buf[132:228]))
    80  	}
    81  	a.Signature = append(a.Signature, buf[132:228]...)
    82  
    83  	// Field (0) 'AggregationBits'
    84  	{
    85  		buf = tail[o0:]
    86  		if err = ssz.ValidateBitlist(buf, 2048); err != nil {
    87  			return err
    88  		}
    89  		if cap(a.AggregationBits) == 0 {
    90  			a.AggregationBits = make([]byte, 0, len(buf))
    91  		}
    92  		a.AggregationBits = append(a.AggregationBits, buf...)
    93  	}
    94  	return err
    95  }
    96  
    97  // SizeSSZ returns the ssz encoded size in bytes for the Attestation object
    98  func (a *Attestation) SizeSSZ() (size int) {
    99  	size = 228
   100  
   101  	// Field (0) 'AggregationBits'
   102  	size += len(a.AggregationBits)
   103  
   104  	return
   105  }
   106  
   107  // HashTreeRoot ssz hashes the Attestation object
   108  func (a *Attestation) HashTreeRoot() ([32]byte, error) {
   109  	return ssz.HashWithDefaultHasher(a)
   110  }
   111  
   112  // HashTreeRootWith ssz hashes the Attestation object with a hasher
   113  func (a *Attestation) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   114  	indx := hh.Index()
   115  
   116  	// Field (0) 'AggregationBits'
   117  	if len(a.AggregationBits) == 0 {
   118  		err = ssz.ErrEmptyBitlist
   119  		return
   120  	}
   121  	hh.PutBitlist(a.AggregationBits, 2048)
   122  
   123  	// Field (1) 'Data'
   124  	if err = a.Data.HashTreeRootWith(hh); err != nil {
   125  		return
   126  	}
   127  
   128  	// Field (2) 'Signature'
   129  	if len(a.Signature) != 96 {
   130  		err = ssz.ErrBytesLength
   131  		return
   132  	}
   133  	hh.PutBytes(a.Signature)
   134  
   135  	hh.Merkleize(indx)
   136  	return
   137  }
   138  
   139  // MarshalSSZ ssz marshals the AggregateAttestationAndProof object
   140  func (a *AggregateAttestationAndProof) MarshalSSZ() ([]byte, error) {
   141  	return ssz.MarshalSSZ(a)
   142  }
   143  
   144  // MarshalSSZTo ssz marshals the AggregateAttestationAndProof object to a target array
   145  func (a *AggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   146  	dst = buf
   147  	offset := int(108)
   148  
   149  	// Field (0) 'AggregatorIndex'
   150  	dst = ssz.MarshalUint64(dst, uint64(a.AggregatorIndex))
   151  
   152  	// Offset (1) 'Aggregate'
   153  	dst = ssz.WriteOffset(dst, offset)
   154  	if a.Aggregate == nil {
   155  		a.Aggregate = new(Attestation)
   156  	}
   157  	offset += a.Aggregate.SizeSSZ()
   158  
   159  	// Field (2) 'SelectionProof'
   160  	if len(a.SelectionProof) != 96 {
   161  		err = ssz.ErrBytesLength
   162  		return
   163  	}
   164  	dst = append(dst, a.SelectionProof...)
   165  
   166  	// Field (1) 'Aggregate'
   167  	if dst, err = a.Aggregate.MarshalSSZTo(dst); err != nil {
   168  		return
   169  	}
   170  
   171  	return
   172  }
   173  
   174  // UnmarshalSSZ ssz unmarshals the AggregateAttestationAndProof object
   175  func (a *AggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error {
   176  	var err error
   177  	size := uint64(len(buf))
   178  	if size < 108 {
   179  		return ssz.ErrSize
   180  	}
   181  
   182  	tail := buf
   183  	var o1 uint64
   184  
   185  	// Field (0) 'AggregatorIndex'
   186  	a.AggregatorIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[0:8]))
   187  
   188  	// Offset (1) 'Aggregate'
   189  	if o1 = ssz.ReadOffset(buf[8:12]); o1 > size {
   190  		return ssz.ErrOffset
   191  	}
   192  
   193  	if o1 < 108 {
   194  		return ssz.ErrInvalidVariableOffset
   195  	}
   196  
   197  	// Field (2) 'SelectionProof'
   198  	if cap(a.SelectionProof) == 0 {
   199  		a.SelectionProof = make([]byte, 0, len(buf[12:108]))
   200  	}
   201  	a.SelectionProof = append(a.SelectionProof, buf[12:108]...)
   202  
   203  	// Field (1) 'Aggregate'
   204  	{
   205  		buf = tail[o1:]
   206  		if a.Aggregate == nil {
   207  			a.Aggregate = new(Attestation)
   208  		}
   209  		if err = a.Aggregate.UnmarshalSSZ(buf); err != nil {
   210  			return err
   211  		}
   212  	}
   213  	return err
   214  }
   215  
   216  // SizeSSZ returns the ssz encoded size in bytes for the AggregateAttestationAndProof object
   217  func (a *AggregateAttestationAndProof) SizeSSZ() (size int) {
   218  	size = 108
   219  
   220  	// Field (1) 'Aggregate'
   221  	if a.Aggregate == nil {
   222  		a.Aggregate = new(Attestation)
   223  	}
   224  	size += a.Aggregate.SizeSSZ()
   225  
   226  	return
   227  }
   228  
   229  // HashTreeRoot ssz hashes the AggregateAttestationAndProof object
   230  func (a *AggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) {
   231  	return ssz.HashWithDefaultHasher(a)
   232  }
   233  
   234  // HashTreeRootWith ssz hashes the AggregateAttestationAndProof object with a hasher
   235  func (a *AggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   236  	indx := hh.Index()
   237  
   238  	// Field (0) 'AggregatorIndex'
   239  	hh.PutUint64(uint64(a.AggregatorIndex))
   240  
   241  	// Field (1) 'Aggregate'
   242  	if err = a.Aggregate.HashTreeRootWith(hh); err != nil {
   243  		return
   244  	}
   245  
   246  	// Field (2) 'SelectionProof'
   247  	if len(a.SelectionProof) != 96 {
   248  		err = ssz.ErrBytesLength
   249  		return
   250  	}
   251  	hh.PutBytes(a.SelectionProof)
   252  
   253  	hh.Merkleize(indx)
   254  	return
   255  }
   256  
   257  // MarshalSSZ ssz marshals the SignedAggregateAttestationAndProof object
   258  func (s *SignedAggregateAttestationAndProof) MarshalSSZ() ([]byte, error) {
   259  	return ssz.MarshalSSZ(s)
   260  }
   261  
   262  // MarshalSSZTo ssz marshals the SignedAggregateAttestationAndProof object to a target array
   263  func (s *SignedAggregateAttestationAndProof) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   264  	dst = buf
   265  	offset := int(100)
   266  
   267  	// Offset (0) 'Message'
   268  	dst = ssz.WriteOffset(dst, offset)
   269  	if s.Message == nil {
   270  		s.Message = new(AggregateAttestationAndProof)
   271  	}
   272  	offset += s.Message.SizeSSZ()
   273  
   274  	// Field (1) 'Signature'
   275  	if len(s.Signature) != 96 {
   276  		err = ssz.ErrBytesLength
   277  		return
   278  	}
   279  	dst = append(dst, s.Signature...)
   280  
   281  	// Field (0) 'Message'
   282  	if dst, err = s.Message.MarshalSSZTo(dst); err != nil {
   283  		return
   284  	}
   285  
   286  	return
   287  }
   288  
   289  // UnmarshalSSZ ssz unmarshals the SignedAggregateAttestationAndProof object
   290  func (s *SignedAggregateAttestationAndProof) UnmarshalSSZ(buf []byte) error {
   291  	var err error
   292  	size := uint64(len(buf))
   293  	if size < 100 {
   294  		return ssz.ErrSize
   295  	}
   296  
   297  	tail := buf
   298  	var o0 uint64
   299  
   300  	// Offset (0) 'Message'
   301  	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
   302  		return ssz.ErrOffset
   303  	}
   304  
   305  	if o0 < 100 {
   306  		return ssz.ErrInvalidVariableOffset
   307  	}
   308  
   309  	// Field (1) 'Signature'
   310  	if cap(s.Signature) == 0 {
   311  		s.Signature = make([]byte, 0, len(buf[4:100]))
   312  	}
   313  	s.Signature = append(s.Signature, buf[4:100]...)
   314  
   315  	// Field (0) 'Message'
   316  	{
   317  		buf = tail[o0:]
   318  		if s.Message == nil {
   319  			s.Message = new(AggregateAttestationAndProof)
   320  		}
   321  		if err = s.Message.UnmarshalSSZ(buf); err != nil {
   322  			return err
   323  		}
   324  	}
   325  	return err
   326  }
   327  
   328  // SizeSSZ returns the ssz encoded size in bytes for the SignedAggregateAttestationAndProof object
   329  func (s *SignedAggregateAttestationAndProof) SizeSSZ() (size int) {
   330  	size = 100
   331  
   332  	// Field (0) 'Message'
   333  	if s.Message == nil {
   334  		s.Message = new(AggregateAttestationAndProof)
   335  	}
   336  	size += s.Message.SizeSSZ()
   337  
   338  	return
   339  }
   340  
   341  // HashTreeRoot ssz hashes the SignedAggregateAttestationAndProof object
   342  func (s *SignedAggregateAttestationAndProof) HashTreeRoot() ([32]byte, error) {
   343  	return ssz.HashWithDefaultHasher(s)
   344  }
   345  
   346  // HashTreeRootWith ssz hashes the SignedAggregateAttestationAndProof object with a hasher
   347  func (s *SignedAggregateAttestationAndProof) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   348  	indx := hh.Index()
   349  
   350  	// Field (0) 'Message'
   351  	if err = s.Message.HashTreeRootWith(hh); err != nil {
   352  		return
   353  	}
   354  
   355  	// Field (1) 'Signature'
   356  	if len(s.Signature) != 96 {
   357  		err = ssz.ErrBytesLength
   358  		return
   359  	}
   360  	hh.PutBytes(s.Signature)
   361  
   362  	hh.Merkleize(indx)
   363  	return
   364  }
   365  
   366  // MarshalSSZ ssz marshals the AttestationData object
   367  func (a *AttestationData) MarshalSSZ() ([]byte, error) {
   368  	return ssz.MarshalSSZ(a)
   369  }
   370  
   371  // MarshalSSZTo ssz marshals the AttestationData object to a target array
   372  func (a *AttestationData) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   373  	dst = buf
   374  
   375  	// Field (0) 'Slot'
   376  	dst = ssz.MarshalUint64(dst, uint64(a.Slot))
   377  
   378  	// Field (1) 'CommitteeIndex'
   379  	dst = ssz.MarshalUint64(dst, uint64(a.CommitteeIndex))
   380  
   381  	// Field (2) 'BeaconBlockRoot'
   382  	if len(a.BeaconBlockRoot) != 32 {
   383  		err = ssz.ErrBytesLength
   384  		return
   385  	}
   386  	dst = append(dst, a.BeaconBlockRoot...)
   387  
   388  	// Field (3) 'Source'
   389  	if a.Source == nil {
   390  		a.Source = new(Checkpoint)
   391  	}
   392  	if dst, err = a.Source.MarshalSSZTo(dst); err != nil {
   393  		return
   394  	}
   395  
   396  	// Field (4) 'Target'
   397  	if a.Target == nil {
   398  		a.Target = new(Checkpoint)
   399  	}
   400  	if dst, err = a.Target.MarshalSSZTo(dst); err != nil {
   401  		return
   402  	}
   403  
   404  	return
   405  }
   406  
   407  // UnmarshalSSZ ssz unmarshals the AttestationData object
   408  func (a *AttestationData) UnmarshalSSZ(buf []byte) error {
   409  	var err error
   410  	size := uint64(len(buf))
   411  	if size != 128 {
   412  		return ssz.ErrSize
   413  	}
   414  
   415  	// Field (0) 'Slot'
   416  	a.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8]))
   417  
   418  	// Field (1) 'CommitteeIndex'
   419  	a.CommitteeIndex = github_com_prysmaticlabs_eth2_types.CommitteeIndex(ssz.UnmarshallUint64(buf[8:16]))
   420  
   421  	// Field (2) 'BeaconBlockRoot'
   422  	if cap(a.BeaconBlockRoot) == 0 {
   423  		a.BeaconBlockRoot = make([]byte, 0, len(buf[16:48]))
   424  	}
   425  	a.BeaconBlockRoot = append(a.BeaconBlockRoot, buf[16:48]...)
   426  
   427  	// Field (3) 'Source'
   428  	if a.Source == nil {
   429  		a.Source = new(Checkpoint)
   430  	}
   431  	if err = a.Source.UnmarshalSSZ(buf[48:88]); err != nil {
   432  		return err
   433  	}
   434  
   435  	// Field (4) 'Target'
   436  	if a.Target == nil {
   437  		a.Target = new(Checkpoint)
   438  	}
   439  	if err = a.Target.UnmarshalSSZ(buf[88:128]); err != nil {
   440  		return err
   441  	}
   442  
   443  	return err
   444  }
   445  
   446  // SizeSSZ returns the ssz encoded size in bytes for the AttestationData object
   447  func (a *AttestationData) SizeSSZ() (size int) {
   448  	size = 128
   449  	return
   450  }
   451  
   452  // HashTreeRoot ssz hashes the AttestationData object
   453  func (a *AttestationData) HashTreeRoot() ([32]byte, error) {
   454  	return ssz.HashWithDefaultHasher(a)
   455  }
   456  
   457  // HashTreeRootWith ssz hashes the AttestationData object with a hasher
   458  func (a *AttestationData) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   459  	indx := hh.Index()
   460  
   461  	// Field (0) 'Slot'
   462  	hh.PutUint64(uint64(a.Slot))
   463  
   464  	// Field (1) 'CommitteeIndex'
   465  	hh.PutUint64(uint64(a.CommitteeIndex))
   466  
   467  	// Field (2) 'BeaconBlockRoot'
   468  	if len(a.BeaconBlockRoot) != 32 {
   469  		err = ssz.ErrBytesLength
   470  		return
   471  	}
   472  	hh.PutBytes(a.BeaconBlockRoot)
   473  
   474  	// Field (3) 'Source'
   475  	if err = a.Source.HashTreeRootWith(hh); err != nil {
   476  		return
   477  	}
   478  
   479  	// Field (4) 'Target'
   480  	if err = a.Target.HashTreeRootWith(hh); err != nil {
   481  		return
   482  	}
   483  
   484  	hh.Merkleize(indx)
   485  	return
   486  }
   487  
   488  // MarshalSSZ ssz marshals the Checkpoint object
   489  func (c *Checkpoint) MarshalSSZ() ([]byte, error) {
   490  	return ssz.MarshalSSZ(c)
   491  }
   492  
   493  // MarshalSSZTo ssz marshals the Checkpoint object to a target array
   494  func (c *Checkpoint) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   495  	dst = buf
   496  
   497  	// Field (0) 'Epoch'
   498  	dst = ssz.MarshalUint64(dst, uint64(c.Epoch))
   499  
   500  	// Field (1) 'Root'
   501  	if len(c.Root) != 32 {
   502  		err = ssz.ErrBytesLength
   503  		return
   504  	}
   505  	dst = append(dst, c.Root...)
   506  
   507  	return
   508  }
   509  
   510  // UnmarshalSSZ ssz unmarshals the Checkpoint object
   511  func (c *Checkpoint) UnmarshalSSZ(buf []byte) error {
   512  	var err error
   513  	size := uint64(len(buf))
   514  	if size != 40 {
   515  		return ssz.ErrSize
   516  	}
   517  
   518  	// Field (0) 'Epoch'
   519  	c.Epoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[0:8]))
   520  
   521  	// Field (1) 'Root'
   522  	if cap(c.Root) == 0 {
   523  		c.Root = make([]byte, 0, len(buf[8:40]))
   524  	}
   525  	c.Root = append(c.Root, buf[8:40]...)
   526  
   527  	return err
   528  }
   529  
   530  // SizeSSZ returns the ssz encoded size in bytes for the Checkpoint object
   531  func (c *Checkpoint) SizeSSZ() (size int) {
   532  	size = 40
   533  	return
   534  }
   535  
   536  // HashTreeRoot ssz hashes the Checkpoint object
   537  func (c *Checkpoint) HashTreeRoot() ([32]byte, error) {
   538  	return ssz.HashWithDefaultHasher(c)
   539  }
   540  
   541  // HashTreeRootWith ssz hashes the Checkpoint object with a hasher
   542  func (c *Checkpoint) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   543  	indx := hh.Index()
   544  
   545  	// Field (0) 'Epoch'
   546  	hh.PutUint64(uint64(c.Epoch))
   547  
   548  	// Field (1) 'Root'
   549  	if len(c.Root) != 32 {
   550  		err = ssz.ErrBytesLength
   551  		return
   552  	}
   553  	hh.PutBytes(c.Root)
   554  
   555  	hh.Merkleize(indx)
   556  	return
   557  }
   558  
   559  // MarshalSSZ ssz marshals the BeaconBlock object
   560  func (b *BeaconBlock) MarshalSSZ() ([]byte, error) {
   561  	return ssz.MarshalSSZ(b)
   562  }
   563  
   564  // MarshalSSZTo ssz marshals the BeaconBlock object to a target array
   565  func (b *BeaconBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   566  	dst = buf
   567  	offset := int(84)
   568  
   569  	// Field (0) 'Slot'
   570  	dst = ssz.MarshalUint64(dst, uint64(b.Slot))
   571  
   572  	// Field (1) 'ProposerIndex'
   573  	dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex))
   574  
   575  	// Field (2) 'ParentRoot'
   576  	if len(b.ParentRoot) != 32 {
   577  		err = ssz.ErrBytesLength
   578  		return
   579  	}
   580  	dst = append(dst, b.ParentRoot...)
   581  
   582  	// Field (3) 'StateRoot'
   583  	if len(b.StateRoot) != 32 {
   584  		err = ssz.ErrBytesLength
   585  		return
   586  	}
   587  	dst = append(dst, b.StateRoot...)
   588  
   589  	// Offset (4) 'Body'
   590  	dst = ssz.WriteOffset(dst, offset)
   591  	if b.Body == nil {
   592  		b.Body = new(BeaconBlockBody)
   593  	}
   594  	offset += b.Body.SizeSSZ()
   595  
   596  	// Field (4) 'Body'
   597  	if dst, err = b.Body.MarshalSSZTo(dst); err != nil {
   598  		return
   599  	}
   600  
   601  	return
   602  }
   603  
   604  // UnmarshalSSZ ssz unmarshals the BeaconBlock object
   605  func (b *BeaconBlock) UnmarshalSSZ(buf []byte) error {
   606  	var err error
   607  	size := uint64(len(buf))
   608  	if size < 84 {
   609  		return ssz.ErrSize
   610  	}
   611  
   612  	tail := buf
   613  	var o4 uint64
   614  
   615  	// Field (0) 'Slot'
   616  	b.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8]))
   617  
   618  	// Field (1) 'ProposerIndex'
   619  	b.ProposerIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
   620  
   621  	// Field (2) 'ParentRoot'
   622  	if cap(b.ParentRoot) == 0 {
   623  		b.ParentRoot = make([]byte, 0, len(buf[16:48]))
   624  	}
   625  	b.ParentRoot = append(b.ParentRoot, buf[16:48]...)
   626  
   627  	// Field (3) 'StateRoot'
   628  	if cap(b.StateRoot) == 0 {
   629  		b.StateRoot = make([]byte, 0, len(buf[48:80]))
   630  	}
   631  	b.StateRoot = append(b.StateRoot, buf[48:80]...)
   632  
   633  	// Offset (4) 'Body'
   634  	if o4 = ssz.ReadOffset(buf[80:84]); o4 > size {
   635  		return ssz.ErrOffset
   636  	}
   637  
   638  	if o4 < 84 {
   639  		return ssz.ErrInvalidVariableOffset
   640  	}
   641  
   642  	// Field (4) 'Body'
   643  	{
   644  		buf = tail[o4:]
   645  		if b.Body == nil {
   646  			b.Body = new(BeaconBlockBody)
   647  		}
   648  		if err = b.Body.UnmarshalSSZ(buf); err != nil {
   649  			return err
   650  		}
   651  	}
   652  	return err
   653  }
   654  
   655  // SizeSSZ returns the ssz encoded size in bytes for the BeaconBlock object
   656  func (b *BeaconBlock) SizeSSZ() (size int) {
   657  	size = 84
   658  
   659  	// Field (4) 'Body'
   660  	if b.Body == nil {
   661  		b.Body = new(BeaconBlockBody)
   662  	}
   663  	size += b.Body.SizeSSZ()
   664  
   665  	return
   666  }
   667  
   668  // HashTreeRoot ssz hashes the BeaconBlock object
   669  func (b *BeaconBlock) HashTreeRoot() ([32]byte, error) {
   670  	return ssz.HashWithDefaultHasher(b)
   671  }
   672  
   673  // HashTreeRootWith ssz hashes the BeaconBlock object with a hasher
   674  func (b *BeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   675  	indx := hh.Index()
   676  
   677  	// Field (0) 'Slot'
   678  	hh.PutUint64(uint64(b.Slot))
   679  
   680  	// Field (1) 'ProposerIndex'
   681  	hh.PutUint64(uint64(b.ProposerIndex))
   682  
   683  	// Field (2) 'ParentRoot'
   684  	if len(b.ParentRoot) != 32 {
   685  		err = ssz.ErrBytesLength
   686  		return
   687  	}
   688  	hh.PutBytes(b.ParentRoot)
   689  
   690  	// Field (3) 'StateRoot'
   691  	if len(b.StateRoot) != 32 {
   692  		err = ssz.ErrBytesLength
   693  		return
   694  	}
   695  	hh.PutBytes(b.StateRoot)
   696  
   697  	// Field (4) 'Body'
   698  	if err = b.Body.HashTreeRootWith(hh); err != nil {
   699  		return
   700  	}
   701  
   702  	hh.Merkleize(indx)
   703  	return
   704  }
   705  
   706  // MarshalSSZ ssz marshals the SignedBeaconBlock object
   707  func (s *SignedBeaconBlock) MarshalSSZ() ([]byte, error) {
   708  	return ssz.MarshalSSZ(s)
   709  }
   710  
   711  // MarshalSSZTo ssz marshals the SignedBeaconBlock object to a target array
   712  func (s *SignedBeaconBlock) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   713  	dst = buf
   714  	offset := int(100)
   715  
   716  	// Offset (0) 'Block'
   717  	dst = ssz.WriteOffset(dst, offset)
   718  	if s.Block == nil {
   719  		s.Block = new(BeaconBlock)
   720  	}
   721  	offset += s.Block.SizeSSZ()
   722  
   723  	// Field (1) 'Signature'
   724  	if len(s.Signature) != 96 {
   725  		err = ssz.ErrBytesLength
   726  		return
   727  	}
   728  	dst = append(dst, s.Signature...)
   729  
   730  	// Field (0) 'Block'
   731  	if dst, err = s.Block.MarshalSSZTo(dst); err != nil {
   732  		return
   733  	}
   734  
   735  	return
   736  }
   737  
   738  // UnmarshalSSZ ssz unmarshals the SignedBeaconBlock object
   739  func (s *SignedBeaconBlock) UnmarshalSSZ(buf []byte) error {
   740  	var err error
   741  	size := uint64(len(buf))
   742  	if size < 100 {
   743  		return ssz.ErrSize
   744  	}
   745  
   746  	tail := buf
   747  	var o0 uint64
   748  
   749  	// Offset (0) 'Block'
   750  	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
   751  		return ssz.ErrOffset
   752  	}
   753  
   754  	if o0 < 100 {
   755  		return ssz.ErrInvalidVariableOffset
   756  	}
   757  
   758  	// Field (1) 'Signature'
   759  	if cap(s.Signature) == 0 {
   760  		s.Signature = make([]byte, 0, len(buf[4:100]))
   761  	}
   762  	s.Signature = append(s.Signature, buf[4:100]...)
   763  
   764  	// Field (0) 'Block'
   765  	{
   766  		buf = tail[o0:]
   767  		if s.Block == nil {
   768  			s.Block = new(BeaconBlock)
   769  		}
   770  		if err = s.Block.UnmarshalSSZ(buf); err != nil {
   771  			return err
   772  		}
   773  	}
   774  	return err
   775  }
   776  
   777  // SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlock object
   778  func (s *SignedBeaconBlock) SizeSSZ() (size int) {
   779  	size = 100
   780  
   781  	// Field (0) 'Block'
   782  	if s.Block == nil {
   783  		s.Block = new(BeaconBlock)
   784  	}
   785  	size += s.Block.SizeSSZ()
   786  
   787  	return
   788  }
   789  
   790  // HashTreeRoot ssz hashes the SignedBeaconBlock object
   791  func (s *SignedBeaconBlock) HashTreeRoot() ([32]byte, error) {
   792  	return ssz.HashWithDefaultHasher(s)
   793  }
   794  
   795  // HashTreeRootWith ssz hashes the SignedBeaconBlock object with a hasher
   796  func (s *SignedBeaconBlock) HashTreeRootWith(hh *ssz.Hasher) (err error) {
   797  	indx := hh.Index()
   798  
   799  	// Field (0) 'Block'
   800  	if err = s.Block.HashTreeRootWith(hh); err != nil {
   801  		return
   802  	}
   803  
   804  	// Field (1) 'Signature'
   805  	if len(s.Signature) != 96 {
   806  		err = ssz.ErrBytesLength
   807  		return
   808  	}
   809  	hh.PutBytes(s.Signature)
   810  
   811  	hh.Merkleize(indx)
   812  	return
   813  }
   814  
   815  // MarshalSSZ ssz marshals the BeaconBlockBody object
   816  func (b *BeaconBlockBody) MarshalSSZ() ([]byte, error) {
   817  	return ssz.MarshalSSZ(b)
   818  }
   819  
   820  // MarshalSSZTo ssz marshals the BeaconBlockBody object to a target array
   821  func (b *BeaconBlockBody) MarshalSSZTo(buf []byte) (dst []byte, err error) {
   822  	dst = buf
   823  	offset := int(220)
   824  
   825  	// Field (0) 'RandaoReveal'
   826  	if len(b.RandaoReveal) != 96 {
   827  		err = ssz.ErrBytesLength
   828  		return
   829  	}
   830  	dst = append(dst, b.RandaoReveal...)
   831  
   832  	// Field (1) 'Eth1Data'
   833  	if b.Eth1Data == nil {
   834  		b.Eth1Data = new(Eth1Data)
   835  	}
   836  	if dst, err = b.Eth1Data.MarshalSSZTo(dst); err != nil {
   837  		return
   838  	}
   839  
   840  	// Field (2) 'Graffiti'
   841  	if len(b.Graffiti) != 32 {
   842  		err = ssz.ErrBytesLength
   843  		return
   844  	}
   845  	dst = append(dst, b.Graffiti...)
   846  
   847  	// Offset (3) 'ProposerSlashings'
   848  	dst = ssz.WriteOffset(dst, offset)
   849  	offset += len(b.ProposerSlashings) * 416
   850  
   851  	// Offset (4) 'AttesterSlashings'
   852  	dst = ssz.WriteOffset(dst, offset)
   853  	for ii := 0; ii < len(b.AttesterSlashings); ii++ {
   854  		offset += 4
   855  		offset += b.AttesterSlashings[ii].SizeSSZ()
   856  	}
   857  
   858  	// Offset (5) 'Attestations'
   859  	dst = ssz.WriteOffset(dst, offset)
   860  	for ii := 0; ii < len(b.Attestations); ii++ {
   861  		offset += 4
   862  		offset += b.Attestations[ii].SizeSSZ()
   863  	}
   864  
   865  	// Offset (6) 'Deposits'
   866  	dst = ssz.WriteOffset(dst, offset)
   867  	offset += len(b.Deposits) * 1240
   868  
   869  	// Offset (7) 'VoluntaryExits'
   870  	dst = ssz.WriteOffset(dst, offset)
   871  	offset += len(b.VoluntaryExits) * 112
   872  
   873  	// Field (3) 'ProposerSlashings'
   874  	if len(b.ProposerSlashings) > 16 {
   875  		err = ssz.ErrListTooBig
   876  		return
   877  	}
   878  	for ii := 0; ii < len(b.ProposerSlashings); ii++ {
   879  		if dst, err = b.ProposerSlashings[ii].MarshalSSZTo(dst); err != nil {
   880  			return
   881  		}
   882  	}
   883  
   884  	// Field (4) 'AttesterSlashings'
   885  	if len(b.AttesterSlashings) > 2 {
   886  		err = ssz.ErrListTooBig
   887  		return
   888  	}
   889  	{
   890  		offset = 4 * len(b.AttesterSlashings)
   891  		for ii := 0; ii < len(b.AttesterSlashings); ii++ {
   892  			dst = ssz.WriteOffset(dst, offset)
   893  			offset += b.AttesterSlashings[ii].SizeSSZ()
   894  		}
   895  	}
   896  	for ii := 0; ii < len(b.AttesterSlashings); ii++ {
   897  		if dst, err = b.AttesterSlashings[ii].MarshalSSZTo(dst); err != nil {
   898  			return
   899  		}
   900  	}
   901  
   902  	// Field (5) 'Attestations'
   903  	if len(b.Attestations) > 128 {
   904  		err = ssz.ErrListTooBig
   905  		return
   906  	}
   907  	{
   908  		offset = 4 * len(b.Attestations)
   909  		for ii := 0; ii < len(b.Attestations); ii++ {
   910  			dst = ssz.WriteOffset(dst, offset)
   911  			offset += b.Attestations[ii].SizeSSZ()
   912  		}
   913  	}
   914  	for ii := 0; ii < len(b.Attestations); ii++ {
   915  		if dst, err = b.Attestations[ii].MarshalSSZTo(dst); err != nil {
   916  			return
   917  		}
   918  	}
   919  
   920  	// Field (6) 'Deposits'
   921  	if len(b.Deposits) > 16 {
   922  		err = ssz.ErrListTooBig
   923  		return
   924  	}
   925  	for ii := 0; ii < len(b.Deposits); ii++ {
   926  		if dst, err = b.Deposits[ii].MarshalSSZTo(dst); err != nil {
   927  			return
   928  		}
   929  	}
   930  
   931  	// Field (7) 'VoluntaryExits'
   932  	if len(b.VoluntaryExits) > 16 {
   933  		err = ssz.ErrListTooBig
   934  		return
   935  	}
   936  	for ii := 0; ii < len(b.VoluntaryExits); ii++ {
   937  		if dst, err = b.VoluntaryExits[ii].MarshalSSZTo(dst); err != nil {
   938  			return
   939  		}
   940  	}
   941  
   942  	return
   943  }
   944  
   945  // UnmarshalSSZ ssz unmarshals the BeaconBlockBody object
   946  func (b *BeaconBlockBody) UnmarshalSSZ(buf []byte) error {
   947  	var err error
   948  	size := uint64(len(buf))
   949  	if size < 220 {
   950  		return ssz.ErrSize
   951  	}
   952  
   953  	tail := buf
   954  	var o3, o4, o5, o6, o7 uint64
   955  
   956  	// Field (0) 'RandaoReveal'
   957  	if cap(b.RandaoReveal) == 0 {
   958  		b.RandaoReveal = make([]byte, 0, len(buf[0:96]))
   959  	}
   960  	b.RandaoReveal = append(b.RandaoReveal, buf[0:96]...)
   961  
   962  	// Field (1) 'Eth1Data'
   963  	if b.Eth1Data == nil {
   964  		b.Eth1Data = new(Eth1Data)
   965  	}
   966  	if err = b.Eth1Data.UnmarshalSSZ(buf[96:168]); err != nil {
   967  		return err
   968  	}
   969  
   970  	// Field (2) 'Graffiti'
   971  	if cap(b.Graffiti) == 0 {
   972  		b.Graffiti = make([]byte, 0, len(buf[168:200]))
   973  	}
   974  	b.Graffiti = append(b.Graffiti, buf[168:200]...)
   975  
   976  	// Offset (3) 'ProposerSlashings'
   977  	if o3 = ssz.ReadOffset(buf[200:204]); o3 > size {
   978  		return ssz.ErrOffset
   979  	}
   980  
   981  	if o3 < 220 {
   982  		return ssz.ErrInvalidVariableOffset
   983  	}
   984  
   985  	// Offset (4) 'AttesterSlashings'
   986  	if o4 = ssz.ReadOffset(buf[204:208]); o4 > size || o3 > o4 {
   987  		return ssz.ErrOffset
   988  	}
   989  
   990  	// Offset (5) 'Attestations'
   991  	if o5 = ssz.ReadOffset(buf[208:212]); o5 > size || o4 > o5 {
   992  		return ssz.ErrOffset
   993  	}
   994  
   995  	// Offset (6) 'Deposits'
   996  	if o6 = ssz.ReadOffset(buf[212:216]); o6 > size || o5 > o6 {
   997  		return ssz.ErrOffset
   998  	}
   999  
  1000  	// Offset (7) 'VoluntaryExits'
  1001  	if o7 = ssz.ReadOffset(buf[216:220]); o7 > size || o6 > o7 {
  1002  		return ssz.ErrOffset
  1003  	}
  1004  
  1005  	// Field (3) 'ProposerSlashings'
  1006  	{
  1007  		buf = tail[o3:o4]
  1008  		num, err := ssz.DivideInt2(len(buf), 416, 16)
  1009  		if err != nil {
  1010  			return err
  1011  		}
  1012  		b.ProposerSlashings = make([]*ProposerSlashing, num)
  1013  		for ii := 0; ii < num; ii++ {
  1014  			if b.ProposerSlashings[ii] == nil {
  1015  				b.ProposerSlashings[ii] = new(ProposerSlashing)
  1016  			}
  1017  			if err = b.ProposerSlashings[ii].UnmarshalSSZ(buf[ii*416 : (ii+1)*416]); err != nil {
  1018  				return err
  1019  			}
  1020  		}
  1021  	}
  1022  
  1023  	// Field (4) 'AttesterSlashings'
  1024  	{
  1025  		buf = tail[o4:o5]
  1026  		num, err := ssz.DecodeDynamicLength(buf, 2)
  1027  		if err != nil {
  1028  			return err
  1029  		}
  1030  		b.AttesterSlashings = make([]*AttesterSlashing, num)
  1031  		err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
  1032  			if b.AttesterSlashings[indx] == nil {
  1033  				b.AttesterSlashings[indx] = new(AttesterSlashing)
  1034  			}
  1035  			if err = b.AttesterSlashings[indx].UnmarshalSSZ(buf); err != nil {
  1036  				return err
  1037  			}
  1038  			return nil
  1039  		})
  1040  		if err != nil {
  1041  			return err
  1042  		}
  1043  	}
  1044  
  1045  	// Field (5) 'Attestations'
  1046  	{
  1047  		buf = tail[o5:o6]
  1048  		num, err := ssz.DecodeDynamicLength(buf, 128)
  1049  		if err != nil {
  1050  			return err
  1051  		}
  1052  		b.Attestations = make([]*Attestation, num)
  1053  		err = ssz.UnmarshalDynamic(buf, num, func(indx int, buf []byte) (err error) {
  1054  			if b.Attestations[indx] == nil {
  1055  				b.Attestations[indx] = new(Attestation)
  1056  			}
  1057  			if err = b.Attestations[indx].UnmarshalSSZ(buf); err != nil {
  1058  				return err
  1059  			}
  1060  			return nil
  1061  		})
  1062  		if err != nil {
  1063  			return err
  1064  		}
  1065  	}
  1066  
  1067  	// Field (6) 'Deposits'
  1068  	{
  1069  		buf = tail[o6:o7]
  1070  		num, err := ssz.DivideInt2(len(buf), 1240, 16)
  1071  		if err != nil {
  1072  			return err
  1073  		}
  1074  		b.Deposits = make([]*Deposit, num)
  1075  		for ii := 0; ii < num; ii++ {
  1076  			if b.Deposits[ii] == nil {
  1077  				b.Deposits[ii] = new(Deposit)
  1078  			}
  1079  			if err = b.Deposits[ii].UnmarshalSSZ(buf[ii*1240 : (ii+1)*1240]); err != nil {
  1080  				return err
  1081  			}
  1082  		}
  1083  	}
  1084  
  1085  	// Field (7) 'VoluntaryExits'
  1086  	{
  1087  		buf = tail[o7:]
  1088  		num, err := ssz.DivideInt2(len(buf), 112, 16)
  1089  		if err != nil {
  1090  			return err
  1091  		}
  1092  		b.VoluntaryExits = make([]*SignedVoluntaryExit, num)
  1093  		for ii := 0; ii < num; ii++ {
  1094  			if b.VoluntaryExits[ii] == nil {
  1095  				b.VoluntaryExits[ii] = new(SignedVoluntaryExit)
  1096  			}
  1097  			if err = b.VoluntaryExits[ii].UnmarshalSSZ(buf[ii*112 : (ii+1)*112]); err != nil {
  1098  				return err
  1099  			}
  1100  		}
  1101  	}
  1102  	return err
  1103  }
  1104  
  1105  // SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockBody object
  1106  func (b *BeaconBlockBody) SizeSSZ() (size int) {
  1107  	size = 220
  1108  
  1109  	// Field (3) 'ProposerSlashings'
  1110  	size += len(b.ProposerSlashings) * 416
  1111  
  1112  	// Field (4) 'AttesterSlashings'
  1113  	for ii := 0; ii < len(b.AttesterSlashings); ii++ {
  1114  		size += 4
  1115  		size += b.AttesterSlashings[ii].SizeSSZ()
  1116  	}
  1117  
  1118  	// Field (5) 'Attestations'
  1119  	for ii := 0; ii < len(b.Attestations); ii++ {
  1120  		size += 4
  1121  		size += b.Attestations[ii].SizeSSZ()
  1122  	}
  1123  
  1124  	// Field (6) 'Deposits'
  1125  	size += len(b.Deposits) * 1240
  1126  
  1127  	// Field (7) 'VoluntaryExits'
  1128  	size += len(b.VoluntaryExits) * 112
  1129  
  1130  	return
  1131  }
  1132  
  1133  // HashTreeRoot ssz hashes the BeaconBlockBody object
  1134  func (b *BeaconBlockBody) HashTreeRoot() ([32]byte, error) {
  1135  	return ssz.HashWithDefaultHasher(b)
  1136  }
  1137  
  1138  // HashTreeRootWith ssz hashes the BeaconBlockBody object with a hasher
  1139  func (b *BeaconBlockBody) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1140  	indx := hh.Index()
  1141  
  1142  	// Field (0) 'RandaoReveal'
  1143  	if len(b.RandaoReveal) != 96 {
  1144  		err = ssz.ErrBytesLength
  1145  		return
  1146  	}
  1147  	hh.PutBytes(b.RandaoReveal)
  1148  
  1149  	// Field (1) 'Eth1Data'
  1150  	if err = b.Eth1Data.HashTreeRootWith(hh); err != nil {
  1151  		return
  1152  	}
  1153  
  1154  	// Field (2) 'Graffiti'
  1155  	if len(b.Graffiti) != 32 {
  1156  		err = ssz.ErrBytesLength
  1157  		return
  1158  	}
  1159  	hh.PutBytes(b.Graffiti)
  1160  
  1161  	// Field (3) 'ProposerSlashings'
  1162  	{
  1163  		subIndx := hh.Index()
  1164  		num := uint64(len(b.ProposerSlashings))
  1165  		if num > 16 {
  1166  			err = ssz.ErrIncorrectListSize
  1167  			return
  1168  		}
  1169  		for i := uint64(0); i < num; i++ {
  1170  			if err = b.ProposerSlashings[i].HashTreeRootWith(hh); err != nil {
  1171  				return
  1172  			}
  1173  		}
  1174  		hh.MerkleizeWithMixin(subIndx, num, 16)
  1175  	}
  1176  
  1177  	// Field (4) 'AttesterSlashings'
  1178  	{
  1179  		subIndx := hh.Index()
  1180  		num := uint64(len(b.AttesterSlashings))
  1181  		if num > 2 {
  1182  			err = ssz.ErrIncorrectListSize
  1183  			return
  1184  		}
  1185  		for i := uint64(0); i < num; i++ {
  1186  			if err = b.AttesterSlashings[i].HashTreeRootWith(hh); err != nil {
  1187  				return
  1188  			}
  1189  		}
  1190  		hh.MerkleizeWithMixin(subIndx, num, 2)
  1191  	}
  1192  
  1193  	// Field (5) 'Attestations'
  1194  	{
  1195  		subIndx := hh.Index()
  1196  		num := uint64(len(b.Attestations))
  1197  		if num > 128 {
  1198  			err = ssz.ErrIncorrectListSize
  1199  			return
  1200  		}
  1201  		for i := uint64(0); i < num; i++ {
  1202  			if err = b.Attestations[i].HashTreeRootWith(hh); err != nil {
  1203  				return
  1204  			}
  1205  		}
  1206  		hh.MerkleizeWithMixin(subIndx, num, 128)
  1207  	}
  1208  
  1209  	// Field (6) 'Deposits'
  1210  	{
  1211  		subIndx := hh.Index()
  1212  		num := uint64(len(b.Deposits))
  1213  		if num > 16 {
  1214  			err = ssz.ErrIncorrectListSize
  1215  			return
  1216  		}
  1217  		for i := uint64(0); i < num; i++ {
  1218  			if err = b.Deposits[i].HashTreeRootWith(hh); err != nil {
  1219  				return
  1220  			}
  1221  		}
  1222  		hh.MerkleizeWithMixin(subIndx, num, 16)
  1223  	}
  1224  
  1225  	// Field (7) 'VoluntaryExits'
  1226  	{
  1227  		subIndx := hh.Index()
  1228  		num := uint64(len(b.VoluntaryExits))
  1229  		if num > 16 {
  1230  			err = ssz.ErrIncorrectListSize
  1231  			return
  1232  		}
  1233  		for i := uint64(0); i < num; i++ {
  1234  			if err = b.VoluntaryExits[i].HashTreeRootWith(hh); err != nil {
  1235  				return
  1236  			}
  1237  		}
  1238  		hh.MerkleizeWithMixin(subIndx, num, 16)
  1239  	}
  1240  
  1241  	hh.Merkleize(indx)
  1242  	return
  1243  }
  1244  
  1245  // MarshalSSZ ssz marshals the ProposerSlashing object
  1246  func (p *ProposerSlashing) MarshalSSZ() ([]byte, error) {
  1247  	return ssz.MarshalSSZ(p)
  1248  }
  1249  
  1250  // MarshalSSZTo ssz marshals the ProposerSlashing object to a target array
  1251  func (p *ProposerSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1252  	dst = buf
  1253  
  1254  	// Field (0) 'Header_1'
  1255  	if p.Header_1 == nil {
  1256  		p.Header_1 = new(SignedBeaconBlockHeader)
  1257  	}
  1258  	if dst, err = p.Header_1.MarshalSSZTo(dst); err != nil {
  1259  		return
  1260  	}
  1261  
  1262  	// Field (1) 'Header_2'
  1263  	if p.Header_2 == nil {
  1264  		p.Header_2 = new(SignedBeaconBlockHeader)
  1265  	}
  1266  	if dst, err = p.Header_2.MarshalSSZTo(dst); err != nil {
  1267  		return
  1268  	}
  1269  
  1270  	return
  1271  }
  1272  
  1273  // UnmarshalSSZ ssz unmarshals the ProposerSlashing object
  1274  func (p *ProposerSlashing) UnmarshalSSZ(buf []byte) error {
  1275  	var err error
  1276  	size := uint64(len(buf))
  1277  	if size != 416 {
  1278  		return ssz.ErrSize
  1279  	}
  1280  
  1281  	// Field (0) 'Header_1'
  1282  	if p.Header_1 == nil {
  1283  		p.Header_1 = new(SignedBeaconBlockHeader)
  1284  	}
  1285  	if err = p.Header_1.UnmarshalSSZ(buf[0:208]); err != nil {
  1286  		return err
  1287  	}
  1288  
  1289  	// Field (1) 'Header_2'
  1290  	if p.Header_2 == nil {
  1291  		p.Header_2 = new(SignedBeaconBlockHeader)
  1292  	}
  1293  	if err = p.Header_2.UnmarshalSSZ(buf[208:416]); err != nil {
  1294  		return err
  1295  	}
  1296  
  1297  	return err
  1298  }
  1299  
  1300  // SizeSSZ returns the ssz encoded size in bytes for the ProposerSlashing object
  1301  func (p *ProposerSlashing) SizeSSZ() (size int) {
  1302  	size = 416
  1303  	return
  1304  }
  1305  
  1306  // HashTreeRoot ssz hashes the ProposerSlashing object
  1307  func (p *ProposerSlashing) HashTreeRoot() ([32]byte, error) {
  1308  	return ssz.HashWithDefaultHasher(p)
  1309  }
  1310  
  1311  // HashTreeRootWith ssz hashes the ProposerSlashing object with a hasher
  1312  func (p *ProposerSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1313  	indx := hh.Index()
  1314  
  1315  	// Field (0) 'Header_1'
  1316  	if err = p.Header_1.HashTreeRootWith(hh); err != nil {
  1317  		return
  1318  	}
  1319  
  1320  	// Field (1) 'Header_2'
  1321  	if err = p.Header_2.HashTreeRootWith(hh); err != nil {
  1322  		return
  1323  	}
  1324  
  1325  	hh.Merkleize(indx)
  1326  	return
  1327  }
  1328  
  1329  // MarshalSSZ ssz marshals the AttesterSlashing object
  1330  func (a *AttesterSlashing) MarshalSSZ() ([]byte, error) {
  1331  	return ssz.MarshalSSZ(a)
  1332  }
  1333  
  1334  // MarshalSSZTo ssz marshals the AttesterSlashing object to a target array
  1335  func (a *AttesterSlashing) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1336  	dst = buf
  1337  	offset := int(8)
  1338  
  1339  	// Offset (0) 'Attestation_1'
  1340  	dst = ssz.WriteOffset(dst, offset)
  1341  	if a.Attestation_1 == nil {
  1342  		a.Attestation_1 = new(IndexedAttestation)
  1343  	}
  1344  	offset += a.Attestation_1.SizeSSZ()
  1345  
  1346  	// Offset (1) 'Attestation_2'
  1347  	dst = ssz.WriteOffset(dst, offset)
  1348  	if a.Attestation_2 == nil {
  1349  		a.Attestation_2 = new(IndexedAttestation)
  1350  	}
  1351  	offset += a.Attestation_2.SizeSSZ()
  1352  
  1353  	// Field (0) 'Attestation_1'
  1354  	if dst, err = a.Attestation_1.MarshalSSZTo(dst); err != nil {
  1355  		return
  1356  	}
  1357  
  1358  	// Field (1) 'Attestation_2'
  1359  	if dst, err = a.Attestation_2.MarshalSSZTo(dst); err != nil {
  1360  		return
  1361  	}
  1362  
  1363  	return
  1364  }
  1365  
  1366  // UnmarshalSSZ ssz unmarshals the AttesterSlashing object
  1367  func (a *AttesterSlashing) UnmarshalSSZ(buf []byte) error {
  1368  	var err error
  1369  	size := uint64(len(buf))
  1370  	if size < 8 {
  1371  		return ssz.ErrSize
  1372  	}
  1373  
  1374  	tail := buf
  1375  	var o0, o1 uint64
  1376  
  1377  	// Offset (0) 'Attestation_1'
  1378  	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
  1379  		return ssz.ErrOffset
  1380  	}
  1381  
  1382  	if o0 < 8 {
  1383  		return ssz.ErrInvalidVariableOffset
  1384  	}
  1385  
  1386  	// Offset (1) 'Attestation_2'
  1387  	if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 {
  1388  		return ssz.ErrOffset
  1389  	}
  1390  
  1391  	// Field (0) 'Attestation_1'
  1392  	{
  1393  		buf = tail[o0:o1]
  1394  		if a.Attestation_1 == nil {
  1395  			a.Attestation_1 = new(IndexedAttestation)
  1396  		}
  1397  		if err = a.Attestation_1.UnmarshalSSZ(buf); err != nil {
  1398  			return err
  1399  		}
  1400  	}
  1401  
  1402  	// Field (1) 'Attestation_2'
  1403  	{
  1404  		buf = tail[o1:]
  1405  		if a.Attestation_2 == nil {
  1406  			a.Attestation_2 = new(IndexedAttestation)
  1407  		}
  1408  		if err = a.Attestation_2.UnmarshalSSZ(buf); err != nil {
  1409  			return err
  1410  		}
  1411  	}
  1412  	return err
  1413  }
  1414  
  1415  // SizeSSZ returns the ssz encoded size in bytes for the AttesterSlashing object
  1416  func (a *AttesterSlashing) SizeSSZ() (size int) {
  1417  	size = 8
  1418  
  1419  	// Field (0) 'Attestation_1'
  1420  	if a.Attestation_1 == nil {
  1421  		a.Attestation_1 = new(IndexedAttestation)
  1422  	}
  1423  	size += a.Attestation_1.SizeSSZ()
  1424  
  1425  	// Field (1) 'Attestation_2'
  1426  	if a.Attestation_2 == nil {
  1427  		a.Attestation_2 = new(IndexedAttestation)
  1428  	}
  1429  	size += a.Attestation_2.SizeSSZ()
  1430  
  1431  	return
  1432  }
  1433  
  1434  // HashTreeRoot ssz hashes the AttesterSlashing object
  1435  func (a *AttesterSlashing) HashTreeRoot() ([32]byte, error) {
  1436  	return ssz.HashWithDefaultHasher(a)
  1437  }
  1438  
  1439  // HashTreeRootWith ssz hashes the AttesterSlashing object with a hasher
  1440  func (a *AttesterSlashing) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1441  	indx := hh.Index()
  1442  
  1443  	// Field (0) 'Attestation_1'
  1444  	if err = a.Attestation_1.HashTreeRootWith(hh); err != nil {
  1445  		return
  1446  	}
  1447  
  1448  	// Field (1) 'Attestation_2'
  1449  	if err = a.Attestation_2.HashTreeRootWith(hh); err != nil {
  1450  		return
  1451  	}
  1452  
  1453  	hh.Merkleize(indx)
  1454  	return
  1455  }
  1456  
  1457  // MarshalSSZ ssz marshals the Deposit object
  1458  func (d *Deposit) MarshalSSZ() ([]byte, error) {
  1459  	return ssz.MarshalSSZ(d)
  1460  }
  1461  
  1462  // MarshalSSZTo ssz marshals the Deposit object to a target array
  1463  func (d *Deposit) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1464  	dst = buf
  1465  
  1466  	// Field (0) 'Proof'
  1467  	if len(d.Proof) != 33 {
  1468  		err = ssz.ErrVectorLength
  1469  		return
  1470  	}
  1471  	for ii := 0; ii < 33; ii++ {
  1472  		if len(d.Proof[ii]) != 32 {
  1473  			err = ssz.ErrBytesLength
  1474  			return
  1475  		}
  1476  		dst = append(dst, d.Proof[ii]...)
  1477  	}
  1478  
  1479  	// Field (1) 'Data'
  1480  	if d.Data == nil {
  1481  		d.Data = new(Deposit_Data)
  1482  	}
  1483  	if dst, err = d.Data.MarshalSSZTo(dst); err != nil {
  1484  		return
  1485  	}
  1486  
  1487  	return
  1488  }
  1489  
  1490  // UnmarshalSSZ ssz unmarshals the Deposit object
  1491  func (d *Deposit) UnmarshalSSZ(buf []byte) error {
  1492  	var err error
  1493  	size := uint64(len(buf))
  1494  	if size != 1240 {
  1495  		return ssz.ErrSize
  1496  	}
  1497  
  1498  	// Field (0) 'Proof'
  1499  	d.Proof = make([][]byte, 33)
  1500  	for ii := 0; ii < 33; ii++ {
  1501  		if cap(d.Proof[ii]) == 0 {
  1502  			d.Proof[ii] = make([]byte, 0, len(buf[0:1056][ii*32:(ii+1)*32]))
  1503  		}
  1504  		d.Proof[ii] = append(d.Proof[ii], buf[0:1056][ii*32:(ii+1)*32]...)
  1505  	}
  1506  
  1507  	// Field (1) 'Data'
  1508  	if d.Data == nil {
  1509  		d.Data = new(Deposit_Data)
  1510  	}
  1511  	if err = d.Data.UnmarshalSSZ(buf[1056:1240]); err != nil {
  1512  		return err
  1513  	}
  1514  
  1515  	return err
  1516  }
  1517  
  1518  // SizeSSZ returns the ssz encoded size in bytes for the Deposit object
  1519  func (d *Deposit) SizeSSZ() (size int) {
  1520  	size = 1240
  1521  	return
  1522  }
  1523  
  1524  // HashTreeRoot ssz hashes the Deposit object
  1525  func (d *Deposit) HashTreeRoot() ([32]byte, error) {
  1526  	return ssz.HashWithDefaultHasher(d)
  1527  }
  1528  
  1529  // HashTreeRootWith ssz hashes the Deposit object with a hasher
  1530  func (d *Deposit) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1531  	indx := hh.Index()
  1532  
  1533  	// Field (0) 'Proof'
  1534  	{
  1535  		if len(d.Proof) != 33 {
  1536  			err = ssz.ErrVectorLength
  1537  			return
  1538  		}
  1539  		subIndx := hh.Index()
  1540  		for _, i := range d.Proof {
  1541  			if len(i) != 32 {
  1542  				err = ssz.ErrBytesLength
  1543  				return
  1544  			}
  1545  			hh.Append(i)
  1546  		}
  1547  		hh.Merkleize(subIndx)
  1548  	}
  1549  
  1550  	// Field (1) 'Data'
  1551  	if err = d.Data.HashTreeRootWith(hh); err != nil {
  1552  		return
  1553  	}
  1554  
  1555  	hh.Merkleize(indx)
  1556  	return
  1557  }
  1558  
  1559  // MarshalSSZ ssz marshals the VoluntaryExit object
  1560  func (v *VoluntaryExit) MarshalSSZ() ([]byte, error) {
  1561  	return ssz.MarshalSSZ(v)
  1562  }
  1563  
  1564  // MarshalSSZTo ssz marshals the VoluntaryExit object to a target array
  1565  func (v *VoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1566  	dst = buf
  1567  
  1568  	// Field (0) 'Epoch'
  1569  	dst = ssz.MarshalUint64(dst, uint64(v.Epoch))
  1570  
  1571  	// Field (1) 'ValidatorIndex'
  1572  	dst = ssz.MarshalUint64(dst, uint64(v.ValidatorIndex))
  1573  
  1574  	return
  1575  }
  1576  
  1577  // UnmarshalSSZ ssz unmarshals the VoluntaryExit object
  1578  func (v *VoluntaryExit) UnmarshalSSZ(buf []byte) error {
  1579  	var err error
  1580  	size := uint64(len(buf))
  1581  	if size != 16 {
  1582  		return ssz.ErrSize
  1583  	}
  1584  
  1585  	// Field (0) 'Epoch'
  1586  	v.Epoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[0:8]))
  1587  
  1588  	// Field (1) 'ValidatorIndex'
  1589  	v.ValidatorIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
  1590  
  1591  	return err
  1592  }
  1593  
  1594  // SizeSSZ returns the ssz encoded size in bytes for the VoluntaryExit object
  1595  func (v *VoluntaryExit) SizeSSZ() (size int) {
  1596  	size = 16
  1597  	return
  1598  }
  1599  
  1600  // HashTreeRoot ssz hashes the VoluntaryExit object
  1601  func (v *VoluntaryExit) HashTreeRoot() ([32]byte, error) {
  1602  	return ssz.HashWithDefaultHasher(v)
  1603  }
  1604  
  1605  // HashTreeRootWith ssz hashes the VoluntaryExit object with a hasher
  1606  func (v *VoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1607  	indx := hh.Index()
  1608  
  1609  	// Field (0) 'Epoch'
  1610  	hh.PutUint64(uint64(v.Epoch))
  1611  
  1612  	// Field (1) 'ValidatorIndex'
  1613  	hh.PutUint64(uint64(v.ValidatorIndex))
  1614  
  1615  	hh.Merkleize(indx)
  1616  	return
  1617  }
  1618  
  1619  // MarshalSSZ ssz marshals the SignedVoluntaryExit object
  1620  func (s *SignedVoluntaryExit) MarshalSSZ() ([]byte, error) {
  1621  	return ssz.MarshalSSZ(s)
  1622  }
  1623  
  1624  // MarshalSSZTo ssz marshals the SignedVoluntaryExit object to a target array
  1625  func (s *SignedVoluntaryExit) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1626  	dst = buf
  1627  
  1628  	// Field (0) 'Exit'
  1629  	if s.Exit == nil {
  1630  		s.Exit = new(VoluntaryExit)
  1631  	}
  1632  	if dst, err = s.Exit.MarshalSSZTo(dst); err != nil {
  1633  		return
  1634  	}
  1635  
  1636  	// Field (1) 'Signature'
  1637  	if len(s.Signature) != 96 {
  1638  		err = ssz.ErrBytesLength
  1639  		return
  1640  	}
  1641  	dst = append(dst, s.Signature...)
  1642  
  1643  	return
  1644  }
  1645  
  1646  // UnmarshalSSZ ssz unmarshals the SignedVoluntaryExit object
  1647  func (s *SignedVoluntaryExit) UnmarshalSSZ(buf []byte) error {
  1648  	var err error
  1649  	size := uint64(len(buf))
  1650  	if size != 112 {
  1651  		return ssz.ErrSize
  1652  	}
  1653  
  1654  	// Field (0) 'Exit'
  1655  	if s.Exit == nil {
  1656  		s.Exit = new(VoluntaryExit)
  1657  	}
  1658  	if err = s.Exit.UnmarshalSSZ(buf[0:16]); err != nil {
  1659  		return err
  1660  	}
  1661  
  1662  	// Field (1) 'Signature'
  1663  	if cap(s.Signature) == 0 {
  1664  		s.Signature = make([]byte, 0, len(buf[16:112]))
  1665  	}
  1666  	s.Signature = append(s.Signature, buf[16:112]...)
  1667  
  1668  	return err
  1669  }
  1670  
  1671  // SizeSSZ returns the ssz encoded size in bytes for the SignedVoluntaryExit object
  1672  func (s *SignedVoluntaryExit) SizeSSZ() (size int) {
  1673  	size = 112
  1674  	return
  1675  }
  1676  
  1677  // HashTreeRoot ssz hashes the SignedVoluntaryExit object
  1678  func (s *SignedVoluntaryExit) HashTreeRoot() ([32]byte, error) {
  1679  	return ssz.HashWithDefaultHasher(s)
  1680  }
  1681  
  1682  // HashTreeRootWith ssz hashes the SignedVoluntaryExit object with a hasher
  1683  func (s *SignedVoluntaryExit) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1684  	indx := hh.Index()
  1685  
  1686  	// Field (0) 'Exit'
  1687  	if err = s.Exit.HashTreeRootWith(hh); err != nil {
  1688  		return
  1689  	}
  1690  
  1691  	// Field (1) 'Signature'
  1692  	if len(s.Signature) != 96 {
  1693  		err = ssz.ErrBytesLength
  1694  		return
  1695  	}
  1696  	hh.PutBytes(s.Signature)
  1697  
  1698  	hh.Merkleize(indx)
  1699  	return
  1700  }
  1701  
  1702  // MarshalSSZ ssz marshals the Eth1Data object
  1703  func (e *Eth1Data) MarshalSSZ() ([]byte, error) {
  1704  	return ssz.MarshalSSZ(e)
  1705  }
  1706  
  1707  // MarshalSSZTo ssz marshals the Eth1Data object to a target array
  1708  func (e *Eth1Data) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1709  	dst = buf
  1710  
  1711  	// Field (0) 'DepositRoot'
  1712  	if len(e.DepositRoot) != 32 {
  1713  		err = ssz.ErrBytesLength
  1714  		return
  1715  	}
  1716  	dst = append(dst, e.DepositRoot...)
  1717  
  1718  	// Field (1) 'DepositCount'
  1719  	dst = ssz.MarshalUint64(dst, e.DepositCount)
  1720  
  1721  	// Field (2) 'BlockHash'
  1722  	if len(e.BlockHash) != 32 {
  1723  		err = ssz.ErrBytesLength
  1724  		return
  1725  	}
  1726  	dst = append(dst, e.BlockHash...)
  1727  
  1728  	return
  1729  }
  1730  
  1731  // UnmarshalSSZ ssz unmarshals the Eth1Data object
  1732  func (e *Eth1Data) UnmarshalSSZ(buf []byte) error {
  1733  	var err error
  1734  	size := uint64(len(buf))
  1735  	if size != 72 {
  1736  		return ssz.ErrSize
  1737  	}
  1738  
  1739  	// Field (0) 'DepositRoot'
  1740  	if cap(e.DepositRoot) == 0 {
  1741  		e.DepositRoot = make([]byte, 0, len(buf[0:32]))
  1742  	}
  1743  	e.DepositRoot = append(e.DepositRoot, buf[0:32]...)
  1744  
  1745  	// Field (1) 'DepositCount'
  1746  	e.DepositCount = ssz.UnmarshallUint64(buf[32:40])
  1747  
  1748  	// Field (2) 'BlockHash'
  1749  	if cap(e.BlockHash) == 0 {
  1750  		e.BlockHash = make([]byte, 0, len(buf[40:72]))
  1751  	}
  1752  	e.BlockHash = append(e.BlockHash, buf[40:72]...)
  1753  
  1754  	return err
  1755  }
  1756  
  1757  // SizeSSZ returns the ssz encoded size in bytes for the Eth1Data object
  1758  func (e *Eth1Data) SizeSSZ() (size int) {
  1759  	size = 72
  1760  	return
  1761  }
  1762  
  1763  // HashTreeRoot ssz hashes the Eth1Data object
  1764  func (e *Eth1Data) HashTreeRoot() ([32]byte, error) {
  1765  	return ssz.HashWithDefaultHasher(e)
  1766  }
  1767  
  1768  // HashTreeRootWith ssz hashes the Eth1Data object with a hasher
  1769  func (e *Eth1Data) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1770  	indx := hh.Index()
  1771  
  1772  	// Field (0) 'DepositRoot'
  1773  	if len(e.DepositRoot) != 32 {
  1774  		err = ssz.ErrBytesLength
  1775  		return
  1776  	}
  1777  	hh.PutBytes(e.DepositRoot)
  1778  
  1779  	// Field (1) 'DepositCount'
  1780  	hh.PutUint64(e.DepositCount)
  1781  
  1782  	// Field (2) 'BlockHash'
  1783  	if len(e.BlockHash) != 32 {
  1784  		err = ssz.ErrBytesLength
  1785  		return
  1786  	}
  1787  	hh.PutBytes(e.BlockHash)
  1788  
  1789  	hh.Merkleize(indx)
  1790  	return
  1791  }
  1792  
  1793  // MarshalSSZ ssz marshals the BeaconBlockHeader object
  1794  func (b *BeaconBlockHeader) MarshalSSZ() ([]byte, error) {
  1795  	return ssz.MarshalSSZ(b)
  1796  }
  1797  
  1798  // MarshalSSZTo ssz marshals the BeaconBlockHeader object to a target array
  1799  func (b *BeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1800  	dst = buf
  1801  
  1802  	// Field (0) 'Slot'
  1803  	dst = ssz.MarshalUint64(dst, uint64(b.Slot))
  1804  
  1805  	// Field (1) 'ProposerIndex'
  1806  	dst = ssz.MarshalUint64(dst, uint64(b.ProposerIndex))
  1807  
  1808  	// Field (2) 'ParentRoot'
  1809  	if len(b.ParentRoot) != 32 {
  1810  		err = ssz.ErrBytesLength
  1811  		return
  1812  	}
  1813  	dst = append(dst, b.ParentRoot...)
  1814  
  1815  	// Field (3) 'StateRoot'
  1816  	if len(b.StateRoot) != 32 {
  1817  		err = ssz.ErrBytesLength
  1818  		return
  1819  	}
  1820  	dst = append(dst, b.StateRoot...)
  1821  
  1822  	// Field (4) 'BodyRoot'
  1823  	if len(b.BodyRoot) != 32 {
  1824  		err = ssz.ErrBytesLength
  1825  		return
  1826  	}
  1827  	dst = append(dst, b.BodyRoot...)
  1828  
  1829  	return
  1830  }
  1831  
  1832  // UnmarshalSSZ ssz unmarshals the BeaconBlockHeader object
  1833  func (b *BeaconBlockHeader) UnmarshalSSZ(buf []byte) error {
  1834  	var err error
  1835  	size := uint64(len(buf))
  1836  	if size != 112 {
  1837  		return ssz.ErrSize
  1838  	}
  1839  
  1840  	// Field (0) 'Slot'
  1841  	b.Slot = github_com_prysmaticlabs_eth2_types.Slot(ssz.UnmarshallUint64(buf[0:8]))
  1842  
  1843  	// Field (1) 'ProposerIndex'
  1844  	b.ProposerIndex = github_com_prysmaticlabs_eth2_types.ValidatorIndex(ssz.UnmarshallUint64(buf[8:16]))
  1845  
  1846  	// Field (2) 'ParentRoot'
  1847  	if cap(b.ParentRoot) == 0 {
  1848  		b.ParentRoot = make([]byte, 0, len(buf[16:48]))
  1849  	}
  1850  	b.ParentRoot = append(b.ParentRoot, buf[16:48]...)
  1851  
  1852  	// Field (3) 'StateRoot'
  1853  	if cap(b.StateRoot) == 0 {
  1854  		b.StateRoot = make([]byte, 0, len(buf[48:80]))
  1855  	}
  1856  	b.StateRoot = append(b.StateRoot, buf[48:80]...)
  1857  
  1858  	// Field (4) 'BodyRoot'
  1859  	if cap(b.BodyRoot) == 0 {
  1860  		b.BodyRoot = make([]byte, 0, len(buf[80:112]))
  1861  	}
  1862  	b.BodyRoot = append(b.BodyRoot, buf[80:112]...)
  1863  
  1864  	return err
  1865  }
  1866  
  1867  // SizeSSZ returns the ssz encoded size in bytes for the BeaconBlockHeader object
  1868  func (b *BeaconBlockHeader) SizeSSZ() (size int) {
  1869  	size = 112
  1870  	return
  1871  }
  1872  
  1873  // HashTreeRoot ssz hashes the BeaconBlockHeader object
  1874  func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error) {
  1875  	return ssz.HashWithDefaultHasher(b)
  1876  }
  1877  
  1878  // HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher
  1879  func (b *BeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1880  	indx := hh.Index()
  1881  
  1882  	// Field (0) 'Slot'
  1883  	hh.PutUint64(uint64(b.Slot))
  1884  
  1885  	// Field (1) 'ProposerIndex'
  1886  	hh.PutUint64(uint64(b.ProposerIndex))
  1887  
  1888  	// Field (2) 'ParentRoot'
  1889  	if len(b.ParentRoot) != 32 {
  1890  		err = ssz.ErrBytesLength
  1891  		return
  1892  	}
  1893  	hh.PutBytes(b.ParentRoot)
  1894  
  1895  	// Field (3) 'StateRoot'
  1896  	if len(b.StateRoot) != 32 {
  1897  		err = ssz.ErrBytesLength
  1898  		return
  1899  	}
  1900  	hh.PutBytes(b.StateRoot)
  1901  
  1902  	// Field (4) 'BodyRoot'
  1903  	if len(b.BodyRoot) != 32 {
  1904  		err = ssz.ErrBytesLength
  1905  		return
  1906  	}
  1907  	hh.PutBytes(b.BodyRoot)
  1908  
  1909  	hh.Merkleize(indx)
  1910  	return
  1911  }
  1912  
  1913  // MarshalSSZ ssz marshals the SignedBeaconBlockHeader object
  1914  func (s *SignedBeaconBlockHeader) MarshalSSZ() ([]byte, error) {
  1915  	return ssz.MarshalSSZ(s)
  1916  }
  1917  
  1918  // MarshalSSZTo ssz marshals the SignedBeaconBlockHeader object to a target array
  1919  func (s *SignedBeaconBlockHeader) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  1920  	dst = buf
  1921  
  1922  	// Field (0) 'Header'
  1923  	if s.Header == nil {
  1924  		s.Header = new(BeaconBlockHeader)
  1925  	}
  1926  	if dst, err = s.Header.MarshalSSZTo(dst); err != nil {
  1927  		return
  1928  	}
  1929  
  1930  	// Field (1) 'Signature'
  1931  	if len(s.Signature) != 96 {
  1932  		err = ssz.ErrBytesLength
  1933  		return
  1934  	}
  1935  	dst = append(dst, s.Signature...)
  1936  
  1937  	return
  1938  }
  1939  
  1940  // UnmarshalSSZ ssz unmarshals the SignedBeaconBlockHeader object
  1941  func (s *SignedBeaconBlockHeader) UnmarshalSSZ(buf []byte) error {
  1942  	var err error
  1943  	size := uint64(len(buf))
  1944  	if size != 208 {
  1945  		return ssz.ErrSize
  1946  	}
  1947  
  1948  	// Field (0) 'Header'
  1949  	if s.Header == nil {
  1950  		s.Header = new(BeaconBlockHeader)
  1951  	}
  1952  	if err = s.Header.UnmarshalSSZ(buf[0:112]); err != nil {
  1953  		return err
  1954  	}
  1955  
  1956  	// Field (1) 'Signature'
  1957  	if cap(s.Signature) == 0 {
  1958  		s.Signature = make([]byte, 0, len(buf[112:208]))
  1959  	}
  1960  	s.Signature = append(s.Signature, buf[112:208]...)
  1961  
  1962  	return err
  1963  }
  1964  
  1965  // SizeSSZ returns the ssz encoded size in bytes for the SignedBeaconBlockHeader object
  1966  func (s *SignedBeaconBlockHeader) SizeSSZ() (size int) {
  1967  	size = 208
  1968  	return
  1969  }
  1970  
  1971  // HashTreeRoot ssz hashes the SignedBeaconBlockHeader object
  1972  func (s *SignedBeaconBlockHeader) HashTreeRoot() ([32]byte, error) {
  1973  	return ssz.HashWithDefaultHasher(s)
  1974  }
  1975  
  1976  // HashTreeRootWith ssz hashes the SignedBeaconBlockHeader object with a hasher
  1977  func (s *SignedBeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  1978  	indx := hh.Index()
  1979  
  1980  	// Field (0) 'Header'
  1981  	if err = s.Header.HashTreeRootWith(hh); err != nil {
  1982  		return
  1983  	}
  1984  
  1985  	// Field (1) 'Signature'
  1986  	if len(s.Signature) != 96 {
  1987  		err = ssz.ErrBytesLength
  1988  		return
  1989  	}
  1990  	hh.PutBytes(s.Signature)
  1991  
  1992  	hh.Merkleize(indx)
  1993  	return
  1994  }
  1995  
  1996  // MarshalSSZ ssz marshals the IndexedAttestation object
  1997  func (i *IndexedAttestation) MarshalSSZ() ([]byte, error) {
  1998  	return ssz.MarshalSSZ(i)
  1999  }
  2000  
  2001  // MarshalSSZTo ssz marshals the IndexedAttestation object to a target array
  2002  func (i *IndexedAttestation) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  2003  	dst = buf
  2004  	offset := int(228)
  2005  
  2006  	// Offset (0) 'AttestingIndices'
  2007  	dst = ssz.WriteOffset(dst, offset)
  2008  	offset += len(i.AttestingIndices) * 8
  2009  
  2010  	// Field (1) 'Data'
  2011  	if i.Data == nil {
  2012  		i.Data = new(AttestationData)
  2013  	}
  2014  	if dst, err = i.Data.MarshalSSZTo(dst); err != nil {
  2015  		return
  2016  	}
  2017  
  2018  	// Field (2) 'Signature'
  2019  	if len(i.Signature) != 96 {
  2020  		err = ssz.ErrBytesLength
  2021  		return
  2022  	}
  2023  	dst = append(dst, i.Signature...)
  2024  
  2025  	// Field (0) 'AttestingIndices'
  2026  	if len(i.AttestingIndices) > 2048 {
  2027  		err = ssz.ErrListTooBig
  2028  		return
  2029  	}
  2030  	for ii := 0; ii < len(i.AttestingIndices); ii++ {
  2031  		dst = ssz.MarshalUint64(dst, i.AttestingIndices[ii])
  2032  	}
  2033  
  2034  	return
  2035  }
  2036  
  2037  // UnmarshalSSZ ssz unmarshals the IndexedAttestation object
  2038  func (i *IndexedAttestation) UnmarshalSSZ(buf []byte) error {
  2039  	var err error
  2040  	size := uint64(len(buf))
  2041  	if size < 228 {
  2042  		return ssz.ErrSize
  2043  	}
  2044  
  2045  	tail := buf
  2046  	var o0 uint64
  2047  
  2048  	// Offset (0) 'AttestingIndices'
  2049  	if o0 = ssz.ReadOffset(buf[0:4]); o0 > size {
  2050  		return ssz.ErrOffset
  2051  	}
  2052  
  2053  	if o0 < 228 {
  2054  		return ssz.ErrInvalidVariableOffset
  2055  	}
  2056  
  2057  	// Field (1) 'Data'
  2058  	if i.Data == nil {
  2059  		i.Data = new(AttestationData)
  2060  	}
  2061  	if err = i.Data.UnmarshalSSZ(buf[4:132]); err != nil {
  2062  		return err
  2063  	}
  2064  
  2065  	// Field (2) 'Signature'
  2066  	if cap(i.Signature) == 0 {
  2067  		i.Signature = make([]byte, 0, len(buf[132:228]))
  2068  	}
  2069  	i.Signature = append(i.Signature, buf[132:228]...)
  2070  
  2071  	// Field (0) 'AttestingIndices'
  2072  	{
  2073  		buf = tail[o0:]
  2074  		num, err := ssz.DivideInt2(len(buf), 8, 2048)
  2075  		if err != nil {
  2076  			return err
  2077  		}
  2078  		i.AttestingIndices = ssz.ExtendUint64(i.AttestingIndices, num)
  2079  		for ii := 0; ii < num; ii++ {
  2080  			i.AttestingIndices[ii] = ssz.UnmarshallUint64(buf[ii*8 : (ii+1)*8])
  2081  		}
  2082  	}
  2083  	return err
  2084  }
  2085  
  2086  // SizeSSZ returns the ssz encoded size in bytes for the IndexedAttestation object
  2087  func (i *IndexedAttestation) SizeSSZ() (size int) {
  2088  	size = 228
  2089  
  2090  	// Field (0) 'AttestingIndices'
  2091  	size += len(i.AttestingIndices) * 8
  2092  
  2093  	return
  2094  }
  2095  
  2096  // HashTreeRoot ssz hashes the IndexedAttestation object
  2097  func (i *IndexedAttestation) HashTreeRoot() ([32]byte, error) {
  2098  	return ssz.HashWithDefaultHasher(i)
  2099  }
  2100  
  2101  // HashTreeRootWith ssz hashes the IndexedAttestation object with a hasher
  2102  func (i *IndexedAttestation) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  2103  	indx := hh.Index()
  2104  
  2105  	// Field (0) 'AttestingIndices'
  2106  	{
  2107  		if len(i.AttestingIndices) > 2048 {
  2108  			err = ssz.ErrListTooBig
  2109  			return
  2110  		}
  2111  		subIndx := hh.Index()
  2112  		for _, i := range i.AttestingIndices {
  2113  			hh.AppendUint64(i)
  2114  		}
  2115  		hh.FillUpTo32()
  2116  		numItems := uint64(len(i.AttestingIndices))
  2117  		hh.MerkleizeWithMixin(subIndx, numItems, ssz.CalculateLimit(2048, numItems, 8))
  2118  	}
  2119  
  2120  	// Field (1) 'Data'
  2121  	if err = i.Data.HashTreeRootWith(hh); err != nil {
  2122  		return
  2123  	}
  2124  
  2125  	// Field (2) 'Signature'
  2126  	if len(i.Signature) != 96 {
  2127  		err = ssz.ErrBytesLength
  2128  		return
  2129  	}
  2130  	hh.PutBytes(i.Signature)
  2131  
  2132  	hh.Merkleize(indx)
  2133  	return
  2134  }
  2135  
  2136  // MarshalSSZ ssz marshals the Deposit_Data object
  2137  func (d *Deposit_Data) MarshalSSZ() ([]byte, error) {
  2138  	return ssz.MarshalSSZ(d)
  2139  }
  2140  
  2141  // MarshalSSZTo ssz marshals the Deposit_Data object to a target array
  2142  func (d *Deposit_Data) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  2143  	dst = buf
  2144  
  2145  	// Field (0) 'PublicKey'
  2146  	if len(d.PublicKey) != 48 {
  2147  		err = ssz.ErrBytesLength
  2148  		return
  2149  	}
  2150  	dst = append(dst, d.PublicKey...)
  2151  
  2152  	// Field (1) 'WithdrawalCredentials'
  2153  	if len(d.WithdrawalCredentials) != 32 {
  2154  		err = ssz.ErrBytesLength
  2155  		return
  2156  	}
  2157  	dst = append(dst, d.WithdrawalCredentials...)
  2158  
  2159  	// Field (2) 'Amount'
  2160  	dst = ssz.MarshalUint64(dst, d.Amount)
  2161  
  2162  	// Field (3) 'Signature'
  2163  	if len(d.Signature) != 96 {
  2164  		err = ssz.ErrBytesLength
  2165  		return
  2166  	}
  2167  	dst = append(dst, d.Signature...)
  2168  
  2169  	return
  2170  }
  2171  
  2172  // UnmarshalSSZ ssz unmarshals the Deposit_Data object
  2173  func (d *Deposit_Data) UnmarshalSSZ(buf []byte) error {
  2174  	var err error
  2175  	size := uint64(len(buf))
  2176  	if size != 184 {
  2177  		return ssz.ErrSize
  2178  	}
  2179  
  2180  	// Field (0) 'PublicKey'
  2181  	if cap(d.PublicKey) == 0 {
  2182  		d.PublicKey = make([]byte, 0, len(buf[0:48]))
  2183  	}
  2184  	d.PublicKey = append(d.PublicKey, buf[0:48]...)
  2185  
  2186  	// Field (1) 'WithdrawalCredentials'
  2187  	if cap(d.WithdrawalCredentials) == 0 {
  2188  		d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80]))
  2189  	}
  2190  	d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...)
  2191  
  2192  	// Field (2) 'Amount'
  2193  	d.Amount = ssz.UnmarshallUint64(buf[80:88])
  2194  
  2195  	// Field (3) 'Signature'
  2196  	if cap(d.Signature) == 0 {
  2197  		d.Signature = make([]byte, 0, len(buf[88:184]))
  2198  	}
  2199  	d.Signature = append(d.Signature, buf[88:184]...)
  2200  
  2201  	return err
  2202  }
  2203  
  2204  // SizeSSZ returns the ssz encoded size in bytes for the Deposit_Data object
  2205  func (d *Deposit_Data) SizeSSZ() (size int) {
  2206  	size = 184
  2207  	return
  2208  }
  2209  
  2210  // HashTreeRoot ssz hashes the Deposit_Data object
  2211  func (d *Deposit_Data) HashTreeRoot() ([32]byte, error) {
  2212  	return ssz.HashWithDefaultHasher(d)
  2213  }
  2214  
  2215  // HashTreeRootWith ssz hashes the Deposit_Data object with a hasher
  2216  func (d *Deposit_Data) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  2217  	indx := hh.Index()
  2218  
  2219  	// Field (0) 'PublicKey'
  2220  	if len(d.PublicKey) != 48 {
  2221  		err = ssz.ErrBytesLength
  2222  		return
  2223  	}
  2224  	hh.PutBytes(d.PublicKey)
  2225  
  2226  	// Field (1) 'WithdrawalCredentials'
  2227  	if len(d.WithdrawalCredentials) != 32 {
  2228  		err = ssz.ErrBytesLength
  2229  		return
  2230  	}
  2231  	hh.PutBytes(d.WithdrawalCredentials)
  2232  
  2233  	// Field (2) 'Amount'
  2234  	hh.PutUint64(d.Amount)
  2235  
  2236  	// Field (3) 'Signature'
  2237  	if len(d.Signature) != 96 {
  2238  		err = ssz.ErrBytesLength
  2239  		return
  2240  	}
  2241  	hh.PutBytes(d.Signature)
  2242  
  2243  	hh.Merkleize(indx)
  2244  	return
  2245  }
  2246  
  2247  // MarshalSSZ ssz marshals the Validator object
  2248  func (v *Validator) MarshalSSZ() ([]byte, error) {
  2249  	return ssz.MarshalSSZ(v)
  2250  }
  2251  
  2252  // MarshalSSZTo ssz marshals the Validator object to a target array
  2253  func (v *Validator) MarshalSSZTo(buf []byte) (dst []byte, err error) {
  2254  	dst = buf
  2255  
  2256  	// Field (0) 'PublicKey'
  2257  	if len(v.PublicKey) != 48 {
  2258  		err = ssz.ErrBytesLength
  2259  		return
  2260  	}
  2261  	dst = append(dst, v.PublicKey...)
  2262  
  2263  	// Field (1) 'WithdrawalCredentials'
  2264  	if len(v.WithdrawalCredentials) != 32 {
  2265  		err = ssz.ErrBytesLength
  2266  		return
  2267  	}
  2268  	dst = append(dst, v.WithdrawalCredentials...)
  2269  
  2270  	// Field (2) 'EffectiveBalance'
  2271  	dst = ssz.MarshalUint64(dst, v.EffectiveBalance)
  2272  
  2273  	// Field (3) 'Slashed'
  2274  	dst = ssz.MarshalBool(dst, v.Slashed)
  2275  
  2276  	// Field (4) 'ActivationEligibilityEpoch'
  2277  	dst = ssz.MarshalUint64(dst, uint64(v.ActivationEligibilityEpoch))
  2278  
  2279  	// Field (5) 'ActivationEpoch'
  2280  	dst = ssz.MarshalUint64(dst, uint64(v.ActivationEpoch))
  2281  
  2282  	// Field (6) 'ExitEpoch'
  2283  	dst = ssz.MarshalUint64(dst, uint64(v.ExitEpoch))
  2284  
  2285  	// Field (7) 'WithdrawableEpoch'
  2286  	dst = ssz.MarshalUint64(dst, uint64(v.WithdrawableEpoch))
  2287  
  2288  	return
  2289  }
  2290  
  2291  // UnmarshalSSZ ssz unmarshals the Validator object
  2292  func (v *Validator) UnmarshalSSZ(buf []byte) error {
  2293  	var err error
  2294  	size := uint64(len(buf))
  2295  	if size != 121 {
  2296  		return ssz.ErrSize
  2297  	}
  2298  
  2299  	// Field (0) 'PublicKey'
  2300  	if cap(v.PublicKey) == 0 {
  2301  		v.PublicKey = make([]byte, 0, len(buf[0:48]))
  2302  	}
  2303  	v.PublicKey = append(v.PublicKey, buf[0:48]...)
  2304  
  2305  	// Field (1) 'WithdrawalCredentials'
  2306  	if cap(v.WithdrawalCredentials) == 0 {
  2307  		v.WithdrawalCredentials = make([]byte, 0, len(buf[48:80]))
  2308  	}
  2309  	v.WithdrawalCredentials = append(v.WithdrawalCredentials, buf[48:80]...)
  2310  
  2311  	// Field (2) 'EffectiveBalance'
  2312  	v.EffectiveBalance = ssz.UnmarshallUint64(buf[80:88])
  2313  
  2314  	// Field (3) 'Slashed'
  2315  	v.Slashed = ssz.UnmarshalBool(buf[88:89])
  2316  
  2317  	// Field (4) 'ActivationEligibilityEpoch'
  2318  	v.ActivationEligibilityEpoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[89:97]))
  2319  
  2320  	// Field (5) 'ActivationEpoch'
  2321  	v.ActivationEpoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[97:105]))
  2322  
  2323  	// Field (6) 'ExitEpoch'
  2324  	v.ExitEpoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[105:113]))
  2325  
  2326  	// Field (7) 'WithdrawableEpoch'
  2327  	v.WithdrawableEpoch = github_com_prysmaticlabs_eth2_types.Epoch(ssz.UnmarshallUint64(buf[113:121]))
  2328  
  2329  	return err
  2330  }
  2331  
  2332  // SizeSSZ returns the ssz encoded size in bytes for the Validator object
  2333  func (v *Validator) SizeSSZ() (size int) {
  2334  	size = 121
  2335  	return
  2336  }
  2337  
  2338  // HashTreeRoot ssz hashes the Validator object
  2339  func (v *Validator) HashTreeRoot() ([32]byte, error) {
  2340  	return ssz.HashWithDefaultHasher(v)
  2341  }
  2342  
  2343  // HashTreeRootWith ssz hashes the Validator object with a hasher
  2344  func (v *Validator) HashTreeRootWith(hh *ssz.Hasher) (err error) {
  2345  	indx := hh.Index()
  2346  
  2347  	// Field (0) 'PublicKey'
  2348  	if len(v.PublicKey) != 48 {
  2349  		err = ssz.ErrBytesLength
  2350  		return
  2351  	}
  2352  	hh.PutBytes(v.PublicKey)
  2353  
  2354  	// Field (1) 'WithdrawalCredentials'
  2355  	if len(v.WithdrawalCredentials) != 32 {
  2356  		err = ssz.ErrBytesLength
  2357  		return
  2358  	}
  2359  	hh.PutBytes(v.WithdrawalCredentials)
  2360  
  2361  	// Field (2) 'EffectiveBalance'
  2362  	hh.PutUint64(v.EffectiveBalance)
  2363  
  2364  	// Field (3) 'Slashed'
  2365  	hh.PutBool(v.Slashed)
  2366  
  2367  	// Field (4) 'ActivationEligibilityEpoch'
  2368  	hh.PutUint64(uint64(v.ActivationEligibilityEpoch))
  2369  
  2370  	// Field (5) 'ActivationEpoch'
  2371  	hh.PutUint64(uint64(v.ActivationEpoch))
  2372  
  2373  	// Field (6) 'ExitEpoch'
  2374  	hh.PutUint64(uint64(v.ExitEpoch))
  2375  
  2376  	// Field (7) 'WithdrawableEpoch'
  2377  	hh.PutUint64(uint64(v.WithdrawableEpoch))
  2378  
  2379  	hh.Merkleize(indx)
  2380  	return
  2381  }