selection

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 18 Imported by: 0

README

Selection

Block Generators (a role taken outside of the Provisioner) participate in a non-interactive lottery to be able to forge a candidate block. In order to decide which Block to select among the various candidates, the Block Generators propagate a score associated with their candidate block, which is the result of the lottery run in a non-interactive fashion. Together with the score, the Block Generators publish a zero-knowledge proof of correctness of the score computation according to the rules outlined in the Blind Bid algorithm (LINK HERE).

The Score Selector is the component appointed to collect the scores, verify the zero-knowledge proof thereto associated and to propagate the block hash associated with the highest score observed during a period of time denoted as timeLength. The block hash is then forwarded to the EventBus to be picked up by the Block Reducer

Values

Score Event
Field Type
round uint64
score uint256
proof proof
identity hash uint256
bid list []byte (variable size)
seed BLS signature
candidate block hash uint256

API

  • Launch(eventbus, duration) - creates and launches the selection component, whose responsibility is to validate and select the best score among the blind bidders. The component publishes under the topic BestScoreTopic, once a score is chosen.

Architecture

The Score Selector component follows the event driven paradigm. It is connected to the node's EventBus through a generic EventFilter and it delegates event-specific operations to its EventHandler.

Score Selection Diagram

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Launch

func Launch(eventBroker wire.EventBroker, handler ScoreEventHandler, timeout time.Duration)

Launch 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 LaunchNotification

func LaunchNotification(eventbus wire.EventSubscriber) <-chan *ScoreEvent

func MarshalScoreEvent

func MarshalScoreEvent(r *bytes.Buffer, ev wire.Event) error

MarshalScoreEvent the buffer into a committee Event Field order is the following: * Consensus Header [Round; Step] * Blind Bid Fields [Score, Proof, Z, BidList, Seed, Candidate Block Hash]

func MockSelectionEventBuffer

func MockSelectionEventBuffer(round uint64, hash []byte) *bytes.Buffer

MockSelectionEventBuffer mocks a Selection event, marshals it, and returns the resulting buffer.

func UnmarshalScoreEvent

func UnmarshalScoreEvent(r *bytes.Buffer, ev wire.Event) error

UnmarshalScoreEvent unmarshals the buffer into a Score Event Field order is the following: * Consensus Header [Round; Step] * Score Payload [score, proof, Z, BidList, Seed, Block Candidate Hash]

Types

type ScoreEvent

type ScoreEvent struct {
	// Fields related to the consensus
	Round uint64

	// Fields related to the score
	Score         []byte
	Proof         []byte
	Z             []byte
	BidListSubset []byte
	PrevHash      []byte
	Certificate   *block.Certificate
	Seed          []byte
	VoteHash      []byte
}

ScoreEvent represents the Score Message with the fields consistent with the Blind Bid data structure

func MockSelectionEvent

func MockSelectionEvent(round uint64, hash []byte) *ScoreEvent

MockSelectionEvent mocks a Selection event and returns it.

func (*ScoreEvent) Equal

func (e *ScoreEvent) Equal(ev wire.Event) bool

Equal as specified in the Event interface

func (*ScoreEvent) Sender

func (e *ScoreEvent) Sender() []byte

Sender of a Score event is the anonymous Z

type ScoreEventHandler

type ScoreEventHandler interface {
	consensus.EventHandler
	wire.EventPrioritizer
	UpdateBidList(user.Bid)
	RemoveExpiredBids(uint64)
	ResetThreshold()
	LowerThreshold()
}

ScoreEventHandler extends the consensus.EventHandler interface with methods specific to the handling of score events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL