-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.go
63 lines (59 loc) · 1.57 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
60
61
62
63
package types
import "fmt"
func (u *LightClientUpdate) ValidateBasic() error {
if u == nil {
return fmt.Errorf("light client update cannot be nil")
}
if u.AttestedHeader == nil {
return fmt.Errorf("attested header cannot be nil")
}
if u.FinalizedHeader == nil {
return fmt.Errorf("finalized header cannot be nil")
}
if u.FinalizedHeaderBranch == nil {
return fmt.Errorf("finalized header branch cannot be nil")
}
if u.FinalizedExecutionRoot == nil {
return fmt.Errorf("finalized execution root cannot be nil")
}
if u.FinalizedExecutionBranch == nil {
return fmt.Errorf("finalized execution branch cannot be nil")
}
if u.SyncAggregate == nil {
return fmt.Errorf("sync aggregate cannot be nil")
}
if u.SignatureSlot == 0 {
return fmt.Errorf("signature slot cannot be zero")
}
return nil
}
func (u *AccountUpdate) ValidateBasic() error {
if u == nil {
return fmt.Errorf("account update cannot be nil")
}
if u.AccountProof == nil {
return fmt.Errorf("account proof cannot be nil")
}
if u.AccountStorageRoot == nil {
return fmt.Errorf("account storage root cannot be nil")
}
return nil
}
func (u *ExecutionUpdate) ValidateBasic() error {
if u == nil {
return fmt.Errorf("execution update cannot be nil")
}
if u.StateRoot == nil {
return fmt.Errorf("state root cannot be nil")
}
if u.StateRootBranch == nil {
return fmt.Errorf("state root branch cannot be nil")
}
if u.BlockNumber == 0 {
return fmt.Errorf("block number cannot be zero")
}
if u.BlockNumberBranch == nil {
return fmt.Errorf("block number branch cannot be nil")
}
return nil
}