Documentation
¶
Index ¶
- func RandomGoodValue(r *rand.Rand) process.Value
- func RandomHeight(r *rand.Rand) process.Height
- func RandomPrecommit(r *rand.Rand) process.Precommit
- func RandomPrevote(r *rand.Rand) process.Prevote
- func RandomPropose(r *rand.Rand) process.Propose
- func RandomRound(r *rand.Rand) process.Round
- func RandomState(r *rand.Rand) process.State
- func RandomStep(r *rand.Rand) process.Step
- func RandomValue(r *rand.Rand) process.Value
- type BroadcasterCallbacks
- type CatcherCallbacks
- func (catcher CatcherCallbacks) CatchDoublePrecommit(precommit1 process.Precommit, precommit2 process.Precommit)
- func (catcher CatcherCallbacks) CatchDoublePrevote(prevote1 process.Prevote, prevote2 process.Prevote)
- func (catcher CatcherCallbacks) CatchDoublePropose(propose1 process.Propose, propose2 process.Propose)
- func (catcher CatcherCallbacks) CatchOutOfTurnPropose(propose process.Propose)
- type CommitterCallback
- type MockProposer
- type MockValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomGoodValue ¶ added in v0.4.1
RandomGoodValue consumes a source of randomness and returns a truly random value which is proposed by the proposer, on which consensus can be reached
func RandomHeight ¶
RandomHeight consumes a source of randomness and returns a random height for the consensus mechanism. It returns a truly random height 70% of the times, whereas for the other 30% of the times it returns heights for edge scenarios
func RandomPrecommit ¶
RandomPrecommit consumes a source of randomness and returns a random precommit message. The message is a valid message 70% of the times, and other times this function returns some edge scenarios, including empty message
func RandomPrevote ¶
RandomPrevote consumes a source of randomness and returns a random prevote message. The message is a valid message 70% of the times, and other times this function returns some edge scenarios, including empty message
func RandomPropose ¶
RandomPropose consumes a source of randomness and returns a random propose message. The message is a valid message 70% of the times, and other times this function returns some edge scenarios, including empty message
func RandomRound ¶
RandomRound consumes a source of randomness and returns a random round for the consensus mechanism. It returns a truly random round 70% of the times, whereas for the other 30% of the times it returns rounds for edge scenarios
func RandomState ¶
RandomState consumes a source of randomness and returns a random state of a process in the consensus mechanism.
func RandomStep ¶
RandomStep consumes a source of randomness and returns a random step for the consensus mechanism. A random step could be a valid or invalid step
Types ¶
type BroadcasterCallbacks ¶
type BroadcasterCallbacks struct {
BroadcastProposeCallback func(process.Propose)
BroadcastPrevoteCallback func(process.Prevote)
BroadcastPrecommitCallback func(process.Precommit)
}
BroadcasterCallbacks provide callback functions to test the broadcaster behaviour required by a Process
func (BroadcasterCallbacks) BroadcastPrecommit ¶
func (broadcaster BroadcasterCallbacks) BroadcastPrecommit(precommit process.Precommit)
BroadcastPrecommit passes the precommit message to the precommit callback, if present
func (BroadcasterCallbacks) BroadcastPrevote ¶
func (broadcaster BroadcasterCallbacks) BroadcastPrevote(prevote process.Prevote)
BroadcastPrevote passes the prevote message to the prevote callback, if present
func (BroadcasterCallbacks) BroadcastPropose ¶
func (broadcaster BroadcasterCallbacks) BroadcastPropose(propose process.Propose)
BroadcastPropose passes the propose message to the propose callback, if present
type CatcherCallbacks ¶ added in v0.4.1
type CatcherCallbacks struct {
CatchDoubleProposeCallback func(process.Propose, process.Propose)
CatchDoublePrevoteCallback func(process.Prevote, process.Prevote)
CatchDoublePrecommitCallback func(process.Precommit, process.Precommit)
CatchOutOfTurnProposeCallback func(process.Propose)
}
CatcherCallbacks provide callback functions to test the Catcher interface required by a Process
func (CatcherCallbacks) CatchDoublePrecommit ¶ added in v0.4.1
func (catcher CatcherCallbacks) CatchDoublePrecommit(precommit1 process.Precommit, precommit2 process.Precommit)
CatchDoublePrecommit implements the interface method of handling the event when two different precommit messages were received from the same process. In this case, it simply passes those to the appropriate callback function
func (CatcherCallbacks) CatchDoublePrevote ¶ added in v0.4.1
func (catcher CatcherCallbacks) CatchDoublePrevote(prevote1 process.Prevote, prevote2 process.Prevote)
CatchDoublePrevote implements the interface method of handling the event when two different prevote messages were received from the same process. In this case, it simply passes those to the appropriate callback function
func (CatcherCallbacks) CatchDoublePropose ¶ added in v0.4.1
func (catcher CatcherCallbacks) CatchDoublePropose(propose1 process.Propose, propose2 process.Propose)
CatchDoublePropose implements the interface method of handling the event when two different propose messages were received from the same process. In this case, it simply passes those to the appropriate callback function
func (CatcherCallbacks) CatchOutOfTurnPropose ¶ added in v0.4.1
func (catcher CatcherCallbacks) CatchOutOfTurnPropose(propose process.Propose)
CatchOutOfTurnPropose implements the interface method of handling the event when a process not scheduled to propose for the current height/round broadcasts a propose. In this case, it simply passes those to the appropriate callback function
type CommitterCallback ¶ added in v0.4.1
CommitterCallback provides a callback function to test the Committer behaviour required by a Process
type MockProposer ¶ added in v0.4.1
MockProposer is a mock implementation of the Proposer interface It always proposes the value MockValue
type MockValidator ¶ added in v0.4.1
MockValidator is a mock implementation of the Validator interface It always returns the MockValid value as its validation check
func (MockValidator) Valid ¶ added in v0.4.1
func (v MockValidator) Valid(value process.Value) bool
Valid implements the validation behaviour as required by the Validator interface The MockValidator's valid method does not take into consideration the received propose message, but simply returns the MockValid value as its validation check