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

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