-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
59 lines (46 loc) · 1.37 KB
/
types.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
package rpbs
import (
"math/big"
ssz "github.com/ferranbt/fastssz"
)
type RPBSCommitMessage struct {
BuilderWalletAddress string `json:"builderWalletAddress"`
Slot uint64 `json:"slot"`
Amount *big.Int `json:"amount"`
PayoutTxBytes string `json:"payoutTxBytes"`
TxBytes []string `json:"txBytes"`
}
type EncodedRPBSSignature struct {
Z1Hat string `json:"z1Hat"`
C1Hat string `json:"c1Hat"`
S1Hat string `json:"s1Hat"`
C2Hat string `json:"c2Hat"`
S2Hat string `json:"s2Hat"`
M1Hat string `json:"m1Hat"`
}
// HashTreeRoot ssz hashes the EncodedRPBSSignature object
func (e *EncodedRPBSSignature) HashTreeRoot() ([32]byte, error) {
return ssz.HashWithDefaultHasher(e)
}
// HashTreeRootWith ssz hashes the EncodedRPBSSignature object with a hasher
func (e *EncodedRPBSSignature) HashTreeRootWith(hh ssz.HashWalker) (err error) {
indx := hh.Index()
// Field (0) 'Z1Hat'
hh.PutBytes([]byte(e.Z1Hat))
// Field (1) 'C1Hat'
hh.PutBytes([]byte(e.C1Hat))
// Field (2) 'S1Hat'
hh.PutBytes([]byte(e.S1Hat))
// Field (3) 'C2Hat'
hh.PutBytes([]byte(e.C2Hat))
// Field (4) 'S2Hat'
hh.PutBytes([]byte(e.S2Hat))
// Field (5) 'M1Hat'
hh.PutBytes([]byte(e.M1Hat))
hh.Merkleize(indx)
return
}
// GetTree ssz hashes the EncodedRPBSSignature object
func (e *EncodedRPBSSignature) GetTree() (*ssz.Node, error) {
return ssz.ProofTree(e)
}