Documentation ¶
Index ¶
- type ControllerStartInstanceOptions
- type Instance
- func (i *Instance) BroadcastChangeRound() error
- func (i *Instance) BumpRound()
- func (i *Instance) ChangeRoundMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) ChangeRoundMsgValidationPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) ChangeRoundPartialQuorumMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) CommitMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) CommitMsgValidationPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) CommittedAggregatedMsg() (*specqbft.SignedMessage, error)
- func (i *Instance) Containers() map[specqbft.MessageType]msgcont.MessageContainer
- func (i *Instance) DecidedMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) ForceDecide(msg *specqbft.SignedMessage)
- func (i *Instance) GetCommittedAggSSVMessage() (spectypes.SSVMessage, error)
- func (i *Instance) GetStageChan() chan qbft.RoundState
- func (i *Instance) HighestPrepared(round specqbft.Round) (notPrepared bool, highestPrepared *specqbft.RoundChangeData, err error)
- func (i *Instance) Init()
- func (i *Instance) IsLeader() bool
- func (i *Instance) JustifyPrePrepare(round uint64, preparedValue []byte) error
- func (i *Instance) JustifyRoundChange(round specqbft.Round) error
- func (i *Instance) PrePrepareMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) PrepareMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) PreparedAggregatedMsg() (*specqbft.SignedMessage, error)
- func (i *Instance) ProcessMsg(msg *specqbft.SignedMessage) (bool, error)
- func (i *Instance) ProcessStageChange(stage qbft.RoundState)
- func (i *Instance) ResetRoundTimer()
- func (i *Instance) RoundLeader(round specqbft.Round) uint64
- func (i *Instance) SignAndBroadcast(msg *specqbft.Message) error
- func (i *Instance) Start(inputValue []byte) error
- func (i *Instance) State() *qbft.State
- func (i *Instance) Stop()
- func (i *Instance) Stopped() bool
- func (i *Instance) ThisRoundLeader() uint64
- func (i *Instance) UponPrePrepareMsg() pipelines.SignedMessagePipeline
- type Instancer
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControllerStartInstanceOptions ¶
type ControllerStartInstanceOptions struct { Logger *zap.Logger SeqNumber specqbft.Height Value []byte // RequireMinPeers flag to require minimum peers before starting an instance // useful for tests where we want (sometimes) to avoid networking RequireMinPeers bool }
ControllerStartInstanceOptions defines type for Controller instance options
type Instance ¶
type Instance struct { LeaderSelector leader.Selector Config *qbft.InstanceConfig Logger *zap.Logger // contains filtered or unexported fields }
Instance defines the instance attributes
func (*Instance) BroadcastChangeRound ¶
BroadcastChangeRound will broadcast a change round message.
func (*Instance) BumpRound ¶
func (i *Instance) BumpRound()
BumpRound is used to set bump round by 1
func (*Instance) ChangeRoundMsgPipeline ¶
func (i *Instance) ChangeRoundMsgPipeline() pipelines.SignedMessagePipeline
ChangeRoundMsgPipeline - the main change round msg pipeline
func (*Instance) ChangeRoundMsgValidationPipeline ¶
func (i *Instance) ChangeRoundMsgValidationPipeline() pipelines.SignedMessagePipeline
ChangeRoundMsgValidationPipeline - the main change round msg validation pipeline
func (*Instance) ChangeRoundPartialQuorumMsgPipeline ¶
func (i *Instance) ChangeRoundPartialQuorumMsgPipeline() pipelines.SignedMessagePipeline
ChangeRoundPartialQuorumMsgPipeline returns the pipeline which handles partial change ronud quorum
func (*Instance) CommitMsgPipeline ¶
func (i *Instance) CommitMsgPipeline() pipelines.SignedMessagePipeline
CommitMsgPipeline - the main commit msg pipeline
func (*Instance) CommitMsgValidationPipeline ¶
func (i *Instance) CommitMsgValidationPipeline() pipelines.SignedMessagePipeline
CommitMsgValidationPipeline is the main commit msg pipeline
func (*Instance) CommittedAggregatedMsg ¶
func (i *Instance) CommittedAggregatedMsg() (*specqbft.SignedMessage, error)
CommittedAggregatedMsg returns a signed message for the state's committed value with the max known signatures
func (*Instance) Containers ¶ added in v0.3.0
func (i *Instance) Containers() map[specqbft.MessageType]msgcont.MessageContainer
Containers returns map of containers
func (*Instance) DecidedMsgPipeline ¶
func (i *Instance) DecidedMsgPipeline() pipelines.SignedMessagePipeline
DecidedMsgPipeline is the main pipeline for decided msgs
func (*Instance) ForceDecide ¶
func (i *Instance) ForceDecide(msg *specqbft.SignedMessage)
ForceDecide will attempt to decide the instance with provided decided signed msg.
func (*Instance) GetCommittedAggSSVMessage ¶
func (i *Instance) GetCommittedAggSSVMessage() (spectypes.SSVMessage, error)
GetCommittedAggSSVMessage returns ssv msg with message.SSVDecidedMsgType and the agg commit signed msg
func (*Instance) GetStageChan ¶
func (i *Instance) GetStageChan() chan qbft.RoundState
GetStageChan returns a RoundState channel added to the stateChangesChans array
func (*Instance) HighestPrepared ¶
func (i *Instance) HighestPrepared(round specqbft.Round) (notPrepared bool, highestPrepared *specqbft.RoundChangeData, err error)
HighestPrepared is slightly changed to also include a returned flag to indicate if all change round messages have prj = ⊥ ∧ pvj = ⊥
func (*Instance) JustifyPrePrepare ¶
JustifyPrePrepare implements: predicate JustifyPrePrepare(hPRE-PREPARE, λi, round, value)
return round = 1 ∨ received a quorum Qrc of valid <ROUND-CHANGE, λi, round, prj , pvj> messages such that: ∀ <ROUND-CHANGE, λi, round, prj , pvj> ∈ Qrc : prj = ⊥ ∧ prj = ⊥ ∨ received a quorum of valid <PREPARE, λi, pr, value> messages such that: (pr, value) = HighestPrepared(Qrc)
func (*Instance) JustifyRoundChange ¶
JustifyRoundChange see below
func (*Instance) PrePrepareMsgPipeline ¶
func (i *Instance) PrePrepareMsgPipeline() pipelines.SignedMessagePipeline
PrePrepareMsgPipeline is the main pre-prepare msg pipeline
func (*Instance) PrepareMsgPipeline ¶
func (i *Instance) PrepareMsgPipeline() pipelines.SignedMessagePipeline
PrepareMsgPipeline is the main prepare msg pipeline
func (*Instance) PreparedAggregatedMsg ¶
func (i *Instance) PreparedAggregatedMsg() (*specqbft.SignedMessage, error)
PreparedAggregatedMsg returns a signed message for the state's prepared value with the max known signatures
func (*Instance) ProcessMsg ¶
func (i *Instance) ProcessMsg(msg *specqbft.SignedMessage) (bool, error)
ProcessMsg will process the message
func (*Instance) ProcessStageChange ¶
func (i *Instance) ProcessStageChange(stage qbft.RoundState)
ProcessStageChange set the state's round state and pushed the new state into the state channel
func (*Instance) ResetRoundTimer ¶
func (i *Instance) ResetRoundTimer()
ResetRoundTimer ... * "Timer:
In addition to the state variables, each correct process pi also maintains a timer represented by timeri, which is used to trigger a round change when the algorithm does not sufficiently progress. The timer can be in one of two states: running or expired. When set to running, it is also set a time t(ri), which is an exponential function of the round number ri, after which the state changes to expired." ResetRoundTimer will reset the current timer (including stopping the previous one)
func (*Instance) RoundLeader ¶
RoundLeader checks the round leader
func (*Instance) SignAndBroadcast ¶
SignAndBroadcast checks and adds the signed message to the appropriate round state type
func (*Instance) Start ¶
Start implements the Algorithm 1 IBFTController pseudocode for process pi: constants, state variables, and ancillary procedures procedure Start(λ, value)
λi ← λ ri ← 1 pri ← ⊥ pvi ← ⊥ inputV aluei ← value if leader(hi, ri) = pi then broadcast ⟨PRE-PREPARE, λi, ri, inputV aluei⟩ message set timer to running and expire after t(ri)
func (*Instance) Stop ¶
func (i *Instance) Stop()
Stop will trigger a stopped for the entire instance
func (*Instance) ThisRoundLeader ¶
ThisRoundLeader returns the round leader
func (*Instance) UponPrePrepareMsg ¶
func (i *Instance) UponPrePrepareMsg() pipelines.SignedMessagePipeline
UponPrePrepareMsg Algorithm 2 IBFTController pseudocode for process pi: normal case operation upon receiving a valid ⟨PRE-PREPARE, λi, ri, value⟩ message m from leader(λi, round) such that:
JustifyPrePrepare(m) do set timer i to running and expire after t(ri) broadcast ⟨PREPARE, λi, ri, value⟩
type Instancer ¶
type Instancer interface { validation.Pipelines Init() Start(inputValue []byte) error Stop() State() *qbft.State Containers() map[specqbft.MessageType]msgcont.MessageContainer ForceDecide(msg *specqbft.SignedMessage) GetStageChan() chan qbft.RoundState CommittedAggregatedMsg() (*specqbft.SignedMessage, error) GetCommittedAggSSVMessage() (spectypes.SSVMessage, error) ProcessMsg(msg *specqbft.SignedMessage) (bool, error) ResetRoundTimer() // TODO temp solution for race condition with message process BroadcastChangeRound() error // TODO temp solution for race condition with message process }
Instancer represents an iBFT instance (a single sequence number)
func NewInstance ¶
NewInstance is the constructor of Instance
func NewInstanceWithState ¶
NewInstanceWithState used for testing, not PROD!
type Options ¶
type Options struct { Logger *zap.Logger Network protcolp2p.Network LeaderSelector leader.Selector Config *qbft.InstanceConfig Identifier []byte Height specqbft.Height // RequireMinPeers flag to require minimum peers before starting an instance // useful for tests where we want (sometimes) to avoid networking RequireMinPeers bool // Fork sets the current fork to apply on instance Fork forks.Fork SSVSigner spectypes.SSVSigner ChangeRoundStore qbftstorage.ChangeRoundStore }
Options defines option attributes for the Instance
type Result ¶
type Result struct { Decided bool Msg *specqbft.SignedMessage }
Result is a struct holding the result of a single iBFT instance