Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProvisionerNr = 10
ProvisionerNr is the default amount of Provisioners utilized in the selection tests. This nr is just used to create the RoundUpdate and bares no importance in the selection step.
Functions ¶
This section is empty.
Types ¶
type Handler ¶ added in v0.2.0
type Handler interface { Verify(context.Context, uint64, uint8, message.Score) error ResetThreshold() LowerThreshold() Priority(message.Score, message.Score) bool }
Handler is an abstraction of the selection component event handler. It is primarily used for testing purposes, to bypass the zkproof verification.
type Helper ¶ added in v0.2.0
type Helper struct { *consensus.Emitter Round uint64 Step uint8 P *user.Provisioners // contains filtered or unexported fields }
Helper for reducing selection test boilerplate.
func (*Helper) RoundUpdate ¶ added in v0.4.0
func (h *Helper) RoundUpdate() consensus.RoundUpdate
RoundUpdate mocks a round update with the Round and Step embedded in the Helper.
type Phase ¶ added in v0.4.0
Phase is the implementation of the Selection step component.
func New ¶ added in v0.4.0
func New(next consensus.Phase, g blockgenerator.BlockGenerator, e *consensus.Emitter, timeout time.Duration, db database.DB) *Phase
New creates and launches the component which responsibility is to validate and select the best score among the blind bidders. The component publishes under the topic BestScoreTopic.
func (*Phase) Initialize ¶ added in v0.4.0
func (p *Phase) Initialize(_ consensus.InternalPacket) consensus.PhaseFn
Initialize returns the Phase state function for the next phase, and initializes it with the result from this phase.
type ScoreHandler ¶ added in v0.2.0
type ScoreHandler struct {
// contains filtered or unexported fields
}
ScoreHandler manages the score threshold, performs verification of message.Score, keeps tab of the highest score so far.
func NewScoreHandler ¶ added in v0.2.0
func NewScoreHandler(scoreVerifier transactions.Provisioner) *ScoreHandler
NewScoreHandler returns a new instance if ScoreHandler.
func (*ScoreHandler) LowerThreshold ¶ added in v0.2.0
func (sh *ScoreHandler) LowerThreshold()
LowerThreshold lowers the threshold after a timespan when no BlockGenerator could send a valid score.
func (*ScoreHandler) Priority ¶ added in v0.2.0
func (sh *ScoreHandler) Priority(first, second message.Score) bool
Priority returns true if the first element has priority over the second, false otherwise.
func (*ScoreHandler) ResetThreshold ¶ added in v0.2.0
func (sh *ScoreHandler) ResetThreshold()
ResetThreshold resets the score threshold that sets the absolute minimum for a score to be eligible for sending.