forked from algorand/go-algorand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommittee.go
53 lines (46 loc) · 1.78 KB
/
committee.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
// Copyright (C) 2019 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.
package committee
import (
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/protocol"
)
// A Selector deterministically defines a cryptographic sortition committee. It
// contains both the input to the sortition VRF and the size of the sortition
// committee.
type Selector interface {
// The hash of a struct which implements Selector is used as the input
// to the VRF.
crypto.Hashable
// CommitteeSize returns the size of the committee determined by this
// Selector.
CommitteeSize(config.ConsensusParams) uint64
}
// Membership encodes the parameters used to verify membership in a committee.
type Membership struct {
Record basics.BalanceRecord
Selector Selector
TotalMoney basics.MicroAlgos
}
// A Seed contains cryptographic entropy which can be used to determine a
// committee.
type Seed [32]byte
// ToBeHashed implements the crypto.Hashable interface
func (s Seed) ToBeHashed() (protocol.HashID, []byte) {
return protocol.Seed, s[:]
}