-
Notifications
You must be signed in to change notification settings - Fork 59
/
versionedsignedvalidatorregistration_ssz.go
90 lines (73 loc) · 2.39 KB
/
versionedsignedvalidatorregistration_ssz.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Code generated by fastssz. DO NOT EDIT.
// Hash: 08636ad5a6add4599e6b010f2318fc2d68a65ba8f1b4397b0424fa97b0cbc352
// Version: 0.1.3
package api
import (
apiv1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec"
ssz "github.com/ferranbt/fastssz"
)
// MarshalSSZ ssz marshals the VersionedSignedValidatorRegistration object
func (v *VersionedSignedValidatorRegistration) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(v)
}
// MarshalSSZTo ssz marshals the VersionedSignedValidatorRegistration object to a target array
func (v *VersionedSignedValidatorRegistration) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'Version'
dst = ssz.MarshalUint64(dst, uint64(v.Version))
// Field (1) 'V1'
if v.V1 == nil {
v.V1 = new(apiv1.SignedValidatorRegistration)
}
if dst, err = v.V1.MarshalSSZTo(dst); err != nil {
return
}
return
}
// UnmarshalSSZ ssz unmarshals the VersionedSignedValidatorRegistration object
func (v *VersionedSignedValidatorRegistration) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 188 {
return ssz.ErrSize
}
// Field (0) 'Version'
v.Version = spec.BuilderVersion(ssz.UnmarshallUint64(buf[0:8]))
// Field (1) 'V1'
if v.V1 == nil {
v.V1 = new(apiv1.SignedValidatorRegistration)
}
if err = v.V1.UnmarshalSSZ(buf[8:188]); err != nil {
return err
}
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the VersionedSignedValidatorRegistration object
func (v *VersionedSignedValidatorRegistration) SizeSSZ() (size int) {
size = 188
return
}
// HashTreeRoot ssz hashes the VersionedSignedValidatorRegistration object
func (v *VersionedSignedValidatorRegistration) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(v)
}
// HashTreeRootWith ssz hashes the VersionedSignedValidatorRegistration object with a hasher
func (v *VersionedSignedValidatorRegistration) HashTreeRootWith(hh ssz.HashWalker) (err error) {
indx := hh.Index()
// Field (0) 'Version'
hh.PutUint64(uint64(v.Version))
// Field (1) 'V1'
if v.V1 == nil {
v.V1 = new(apiv1.SignedValidatorRegistration)
}
if err = v.V1.HashTreeRootWith(hh); err != nil {
return
}
hh.Merkleize(indx)
return
}
// GetTree ssz hashes the VersionedSignedValidatorRegistration object
func (v *VersionedSignedValidatorRegistration) GetTree() (*ssz.Node, error) {
return ssz.ProofTree(v)
}