-
Notifications
You must be signed in to change notification settings - Fork 46
/
interface.go
45 lines (40 loc) · 1.12 KB
/
interface.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
package ssz
// Marshaler is the interface implemented by types that can marshal themselves into valid SZZ.
type Marshaler interface {
MarshalSSZTo(dst []byte) ([]byte, error)
MarshalSSZ() ([]byte, error)
SizeSSZ() int
}
// Unmarshaler is the interface implemented by types that can unmarshal a SSZ description of themselves
type Unmarshaler interface {
UnmarshalSSZ(buf []byte) error
}
type HashRoot interface {
GetTree() (*Node, error)
HashTreeRoot() ([32]byte, error)
HashTreeRootWith(hh HashWalker) error
}
type HashRootProof interface {
HashTreeRootWith(hh HashWalker) error
}
type HashWalker interface {
// Intended for testing purposes to know the latest hash generated during merkleize
Hash() []byte
AppendUint8(i uint8)
AppendUint32(i uint32)
AppendUint64(i uint64)
AppendBytes32(b []byte)
PutUint64Array(b []uint64, maxCapacity ...uint64)
PutUint64(i uint64)
PutUint32(i uint32)
PutUint16(i uint16)
PutUint8(i uint8)
FillUpTo32()
Append(i []byte)
PutBitlist(bb []byte, maxSize uint64)
PutBool(b bool)
PutBytes(b []byte)
Index() int
Merkleize(indx int)
MerkleizeWithMixin(indx int, num, limit uint64)
}