Documentation ¶
Index ¶
- func MarshalBidList(r *bytes.Buffer, bidList BidList) error
- func MarshalProvisioners(r *bytes.Buffer, p *Provisioners) error
- type Bid
- type BidList
- type Member
- type Provisioners
- func (p Provisioners) CreateVotingCommittee(round uint64, step uint8, size int) VotingCommittee
- func (p Provisioners) GenerateCommittees(round uint64, amount, step uint8, size int) []VotingCommittee
- func (p Provisioners) GetMember(pubKeyBLS []byte) *Member
- func (p Provisioners) GetStake(pubKeyBLS []byte) (uint64, error)
- func (p Provisioners) MemberAt(i int) *Member
- func (p Provisioners) SubsetSizeAt(round uint64) int
- func (p *Provisioners) TotalWeight() (totalWeight uint64)
- type Stake
- type VotingCommittee
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalProvisioners ¶ added in v0.2.0
func MarshalProvisioners(r *bytes.Buffer, p *Provisioners) error
Types ¶
type BidList ¶
type BidList []Bid
BidList is a list of bid X values.
func ReconstructBidListSubset ¶
ReconstructBidListSubset will turn a slice of bytes into a BidList.
func (BidList) Subset ¶
Subset will shuffle the BidList, and returns a specified amount of bids from it.
func (BidList) ValidateBids ¶
ValidateBids will check if the passed BidList subset contains valid bids.
type Member ¶
Member contains the bytes of a provisioner's Ed25519 public key, the bytes of his BLS public key, and how much he has staked.
func (*Member) RemoveStake ¶ added in v0.2.0
func (*Member) SubtractFromStake ¶ added in v0.2.0
type Provisioners ¶
Provisioners is a map of Members, and makes up the current set of provisioners.
func NewProvisioners ¶
func NewProvisioners() *Provisioners
func UnmarshalProvisioners ¶ added in v0.2.0
func UnmarshalProvisioners(r *bytes.Buffer) (Provisioners, error)
func (Provisioners) CreateVotingCommittee ¶
func (p Provisioners) CreateVotingCommittee(round uint64, step uint8, size int) VotingCommittee
CreateVotingCommittee will run the deterministic sortition function, which determines who will be in the committee for a given step and round. FIXME: running this with weird setup causes infinite looping (to reproduce, hardcode `3` on MockProvisioners when calling agreement.NewHelper in the agreement tests)
func (Provisioners) GenerateCommittees ¶ added in v0.2.0
func (p Provisioners) GenerateCommittees(round uint64, amount, step uint8, size int) []VotingCommittee
GenerateCommittees pre-generates an `amount` of VotingCommittee of a specified `size` from a given `step`
func (Provisioners) GetMember ¶
func (p Provisioners) GetMember(pubKeyBLS []byte) *Member
GetMember returns a member of the provisioners from its BLS public key.
func (Provisioners) GetStake ¶
func (p Provisioners) GetStake(pubKeyBLS []byte) (uint64, error)
GetStake will find a certain provisioner in the committee by BLS public key, and return their stake.
func (Provisioners) MemberAt ¶
func (p Provisioners) MemberAt(i int) *Member
MemberAt returns the Member at a certain index.
func (Provisioners) SubsetSizeAt ¶ added in v0.2.0
func (p Provisioners) SubsetSizeAt(round uint64) int
SubsetSizeAt returns how many provisioners are active on a given round. This function is used to determine the correct committee size for sortition in the case where one or more provisioner stakes have not yet become active, or have just expired. Note that this function will only give an accurate result if the round given is either identical or close to the current block height, as stakes are removed soon after they expire.
func (*Provisioners) TotalWeight ¶ added in v0.2.0
func (p *Provisioners) TotalWeight() (totalWeight uint64)
type VotingCommittee ¶
VotingCommittee represents a set of provisioners with voting rights at a certain point in the consensus. The set is sorted by the int value of the public key in increasing order (higher last)
func (VotingCommittee) Equal ¶
func (v VotingCommittee) Equal(other *VotingCommittee) bool
Equal checks if two VotingCommittees are the same.
func (VotingCommittee) IsMember ¶
func (v VotingCommittee) IsMember(pubKeyBLS []byte) bool
IsMember checks if `pubKeyBLS` is within the VotingCommittee.
func (VotingCommittee) MemberKeys ¶
func (v VotingCommittee) MemberKeys() [][]byte
MemberKeys returns the BLS public keys of all the members in a VotingCommittee.
func (*VotingCommittee) Remove ¶
func (v *VotingCommittee) Remove(pk []byte) bool
Remove a member from the VotingCommittee by its BLS public key.
func (VotingCommittee) Size ¶
func (v VotingCommittee) Size() int
Size returns how many members there are in a VotingCommittee.