Documentation ¶
Index ¶
Constants ¶
const MaxCommitteeSize = 64
MaxCommitteeSize represents the maximum size of the committee for an Agreement quorum.
Variables ¶
var WorkerAmount = 4
WorkerAmount sets the number of concurrent workers to concurrently verify Agreement messages.
Functions ¶
func AggregatePks ¶ added in v0.4.4
AggregatePks reconstructs an aggregated BLS public key from a subcommittee.
func NewHandler ¶ added in v0.3.0
func NewHandler(keys key.Keys, p user.Provisioners, seed []byte) *handler
NewHandler returns an initialized handler.
Types ¶
type Accumulator ¶ added in v0.2.0
type Accumulator struct { CollectedVotesChan chan []message.Agreement // contains filtered or unexported fields }
Accumulator is an event accumulator, that will accumulate events until it reaches a certain threshold.
func (*Accumulator) Accumulate ¶ added in v0.2.0
func (a *Accumulator) Accumulate()
Accumulate agreements per block hash until a quorum is reached or a stop is detected (by closing the internal event channel). Supposed to run in a goroutine.
func (*Accumulator) CreateWorkers ¶ added in v0.2.0
func (a *Accumulator) CreateWorkers(amount int)
CreateWorkers creates an amount of workers that verify Agreement messages concurrently.
func (*Accumulator) Process ¶ added in v0.2.0
func (a *Accumulator) Process(ev message.Agreement)
Process a received Event, by passing it to a worker in the worker pool (if the event sender is part of the voting committee).
func (*Accumulator) Stop ¶ added in v0.2.0
func (a *Accumulator) Stop()
Stop kills the thread pool and shuts down the Accumulator.
type Handler ¶ added in v0.2.0
type Handler interface { AmMember(uint64, uint8) bool IsMember([]byte, uint64, uint8) bool Committee(uint64, uint8) user.VotingCommittee Quorum(uint64) int VotesFor([]byte, uint64, uint8) int Verify(message.Agreement) error }
Handler interface is handy for tests.
type Helper ¶ added in v0.2.0
type Helper struct { *consensus.Emitter P *user.Provisioners Nr int ProvisionersKeys []key.Keys Round uint64 }
Helper is a struct that facilitates sending semi-real Events with minimum effort.
func (*Helper) RoundUpdate ¶ added in v0.4.0
func (hlp *Helper) RoundUpdate(hash []byte) consensus.RoundUpdate
RoundUpdate creates a valid RoundUpdate for the current round, based on the information passed to this Helper (i.e. round, Provisioners).
type Loop ¶ added in v0.4.0
Loop is the struct holding the state of the Agreement phase which does not change during the consensus loop.
func (*Loop) GetControlFn ¶ added in v0.4.0
GetControlFn is a factory method for the ControlFn. It makes it possible for the consensus loop to mock the agreement.