-
Notifications
You must be signed in to change notification settings - Fork 968
/
types.go
103 lines (96 loc) · 2.08 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
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
92
93
94
95
96
97
98
99
100
101
102
103
package validator
import (
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
)
type Status int8
const (
PendingInitialized Status = iota
PendingQueued
ActiveOngoing
ActiveExiting
ActiveSlashed
ExitedUnslashed
ExitedSlashed
WithdrawalPossible
WithdrawalDone
Active
Pending
Exited
Withdrawal
)
func (s Status) String() string {
switch s {
case PendingInitialized:
return "pending_initialized"
case PendingQueued:
return "pending_queued"
case ActiveOngoing:
return "active_ongoing"
case ActiveExiting:
return "active_exiting"
case ActiveSlashed:
return "active_slashed"
case ExitedUnslashed:
return "exited_unslashed"
case ExitedSlashed:
return "exited_slashed"
case WithdrawalPossible:
return "withdrawal_possible"
case WithdrawalDone:
return "withdrawal_done"
case Active:
return "active"
case Pending:
return "pending"
case Exited:
return "exited"
case Withdrawal:
return "withdrawal"
default:
return "unknown"
}
}
func StatusFromString(s string) (bool, Status) {
switch s {
case "pending_initialized":
return true, PendingInitialized
case "pending_queued":
return true, PendingQueued
case "active_ongoing":
return true, ActiveOngoing
case "active_exiting":
return true, ActiveExiting
case "active_slashed":
return true, ActiveSlashed
case "exited_unslashed":
return true, ExitedUnslashed
case "exited_slashed":
return true, ExitedSlashed
case "withdrawal_possible":
return true, WithdrawalPossible
case "withdrawal_done":
return true, WithdrawalDone
case "active":
return true, Active
case "pending":
return true, Pending
case "exited":
return true, Exited
case "withdrawal":
return true, Withdrawal
default:
return false, -1
}
}
type SyncCommitteeSubscription struct {
ValidatorIndex primitives.ValidatorIndex
SyncCommitteeIndices []uint64
UntilEpoch primitives.Epoch
}
type BeaconCommitteeSubscription struct {
ValidatorIndex primitives.ValidatorIndex
CommitteeIndex primitives.CommitteeIndex
CommitteesAtSlot uint64
Slot primitives.Slot
IsAggregator bool
}