-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuilder_encoding.go
91 lines (68 loc) · 2.19 KB
/
builder_encoding.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
91
// Code generated by fastssz. DO NOT EDIT.
// Hash: 60c1a274a556ac9f9ed1cc9e50fdb5cf4e6c97d297106e385648c8306d4cb095
// Version: 0.1.3
package http
import (
ssz "github.com/ferranbt/fastssz"
)
// MarshalSSZ ssz marshals the RegisterValidatorRequest object
func (r *RegisterValidatorRequest) MarshalSSZ() ([]byte, error) {
return ssz.MarshalSSZ(r)
}
// MarshalSSZTo ssz marshals the RegisterValidatorRequest object to a target array
func (r *RegisterValidatorRequest) MarshalSSZTo(buf []byte) (dst []byte, err error) {
dst = buf
// Field (0) 'FeeRecipient'
dst = append(dst, r.FeeRecipient[:]...)
// Field (1) 'GasLimit'
dst = ssz.MarshalUint64(dst, r.GasLimit)
// Field (2) 'Timestamp'
dst = ssz.MarshalUint64(dst, r.Timestamp)
// Field (3) 'Pubkey'
dst = append(dst, r.Pubkey[:]...)
return
}
// UnmarshalSSZ ssz unmarshals the RegisterValidatorRequest object
func (r *RegisterValidatorRequest) UnmarshalSSZ(buf []byte) error {
var err error
size := uint64(len(buf))
if size != 84 {
return ssz.ErrSize
}
// Field (0) 'FeeRecipient'
copy(r.FeeRecipient[:], buf[0:20])
// Field (1) 'GasLimit'
r.GasLimit = ssz.UnmarshallUint64(buf[20:28])
// Field (2) 'Timestamp'
r.Timestamp = ssz.UnmarshallUint64(buf[28:36])
// Field (3) 'Pubkey'
copy(r.Pubkey[:], buf[36:84])
return err
}
// SizeSSZ returns the ssz encoded size in bytes for the RegisterValidatorRequest object
func (r *RegisterValidatorRequest) SizeSSZ() (size int) {
size = 84
return
}
// HashTreeRoot ssz hashes the RegisterValidatorRequest object
func (r *RegisterValidatorRequest) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(r)
}
// HashTreeRootWith ssz hashes the RegisterValidatorRequest object with a hasher
func (r *RegisterValidatorRequest) HashTreeRootWith(hh ssz.HashWalker) (err error) {
indx := hh.Index()
// Field (0) 'FeeRecipient'
hh.PutBytes(r.FeeRecipient[:])
// Field (1) 'GasLimit'
hh.PutUint64(r.GasLimit)
// Field (2) 'Timestamp'
hh.PutUint64(r.Timestamp)
// Field (3) 'Pubkey'
hh.PutBytes(r.Pubkey[:])
hh.Merkleize(indx)
return
}
// GetTree ssz hashes the RegisterValidatorRequest object
func (r *RegisterValidatorRequest) GetTree() (*ssz.Node, error) {
return ssz.ProofTree(r)
}