prysm-pulse/proto/validator/accounts/v2/generated.ssz.go
Raul Jordan 70f3fcdbd9
Implement Create Account via RPC (#7400)
* add ssz rules

* regenerate protos to include deposit message

* built to match the deposit cli

* derived test

* fix up nil item

* fix up more nil items

* preston suggestion

* comment

* add missing tests to build file

* fix busted tests

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: Victor Farazdagi <simple.square@gmail.com>
2020-10-02 16:35:28 -05:00

98 lines
2.2 KiB
Go
Executable File

// Code generated by fastssz. DO NOT EDIT.
package ethereum_validator_accounts_v2
import (
ssz "github.com/ferranbt/fastssz"
)
// MarshalSSZ ssz marshals the DepositMessage object
func (d *DepositMessage) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(d)
}
// MarshalSSZTo ssz marshals the DepositMessage object to a target array
func (d *DepositMessage) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'Pubkey'
if len(d.Pubkey) != 48 {
err = ssz.ErrBytesLength
return
}
dst = append(dst, d.Pubkey...)
// Field (1) 'WithdrawalCredentials'
if len(d.WithdrawalCredentials) != 32 {
err = ssz.ErrBytesLength
return
}
dst = append(dst, d.WithdrawalCredentials...)
// Field (2) 'Amount'
dst = ssz.MarshalUint64(dst, d.Amount)
return
}
// UnmarshalSSZ ssz unmarshals the DepositMessage object
func (d *DepositMessage) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 88 {
return ssz.ErrSize
}
// Field (0) 'Pubkey'
if cap(d.Pubkey) == 0 {
d.Pubkey = make([]byte, 0, len(buf[0:48]))
}
d.Pubkey = append(d.Pubkey, buf[0:48]...)
// Field (1) 'WithdrawalCredentials'
if cap(d.WithdrawalCredentials) == 0 {
d.WithdrawalCredentials = make([]byte, 0, len(buf[48:80]))
}
d.WithdrawalCredentials = append(d.WithdrawalCredentials, buf[48:80]...)
// Field (2) 'Amount'
d.Amount = ssz.UnmarshallUint64(buf[80:88])
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the DepositMessage object
func (d *DepositMessage) SizeSSZ() (size int) {
size = 88
return
}
// HashTreeRoot ssz hashes the DepositMessage object
func (d *DepositMessage) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(d)
}
// HashTreeRootWith ssz hashes the DepositMessage object with a hasher
func (d *DepositMessage) HashTreeRootWith(hh *ssz.Hasher) (err error) {
indx := hh.Index()
// Field (0) 'Pubkey'
if len(d.Pubkey) != 48 {
err = ssz.ErrBytesLength
return
}
hh.PutBytes(d.Pubkey)
// Field (1) 'WithdrawalCredentials'
if len(d.WithdrawalCredentials) != 32 {
err = ssz.ErrBytesLength
return
}
hh.PutBytes(d.WithdrawalCredentials)
// Field (2) 'Amount'
hh.PutUint64(d.Amount)
hh.Merkleize(indx)
return
}