-
Notifications
You must be signed in to change notification settings - Fork 179
/
rand.go
30 lines (26 loc) · 1.15 KB
/
rand.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
package indices
var (
// ProtocolConsensusLeaderSelection is the indices for consensus leader selection
ProtocolConsensusLeaderSelection = []uint32{0, 1, 1}
// ProtocolVerificationChunkAssignment is the indices for verification nodes determines chunk assignment
ProtocolVerificationChunkAssignment = []uint32{0, 2, 0}
)
// list of customizers used for different sub-protocol PRNGs.
// These customizers help instanciate different PRNGs from the
// same source of randomness.
//
// TODO: the seed input is already diversified using the indices above.
// The customizers below are enough to diversify the PRNGs and we can
// remove the indices.
var (
ConsensusLeaderSelectionCustomizer = []byte("leader_selec")
ChunkAssignmentCustomizer = []byte("chunk_assign")
)
// ProtocolCollectorClusterLeaderSelection returns the indices for the leader selection for the i-th collector cluster
func ProtocolCollectorClusterLeaderSelection(clusterIndex uint) []uint32 {
return append([]uint32{0, 0}, uint32(clusterIndex))
}
// ExecutionChunk returns the indices for i-th chunk
func ExecutionChunk(chunkIndex uint32) []uint32 {
return append([]uint32{1}, chunkIndex)
}