Documentation ¶
Index ¶
- func GenerateState(opts *Options) *qbft.State
- func UpdateChangeRoundMessage(logger *zap.Logger, changeRoundStorage qbftstorage.ChangeRoundStore, ...) error
- 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) GenerateChangeRoundMessage() (*specqbft.Message, error)
- func (i *Instance) GenerateCommitMessage(value []byte) (*specqbft.Message, error)
- func (i *Instance) GeneratePrepareMessage(value []byte) (*specqbft.Message, error)
- func (i *Instance) GenerateProposalMessage(proposalMsg *specqbft.ProposalData) (specqbft.Message, error)
- func (i *Instance) GetCommittedAggSSVMessage() (spectypes.SSVMessage, error)
- func (i *Instance) GetStageChan() chan qbft.RoundState
- func (i *Instance) GetState() *qbft.State
- func (i *Instance) HighestPrepared(round specqbft.Round) (highestPrepared *specqbft.RoundChangeData, err error)
- func (i *Instance) HighestRoundTimeoutSeconds() time.Duration
- func (i *Instance) Init()
- func (i *Instance) IsLeader() bool
- func (i *Instance) JustifyRoundChange(round specqbft.Round) error
- func (i *Instance) PrepareMsgPipeline() pipelines.SignedMessagePipeline
- func (i *Instance) PrepareMsgValidationPipeline() 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) ProposalMsgPipeline() pipelines.SignedMessagePipeline
- 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) Stop()
- func (i *Instance) Stopped() bool
- func (i *Instance) ThisRoundLeader() uint64
- func (i *Instance) UponProposalMsg() pipelines.SignedMessagePipeline
- type Instancer
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateState ¶ added in v0.3.2
GenerateState return generated state
func UpdateChangeRoundMessage ¶ added in v0.3.0
func UpdateChangeRoundMessage(logger *zap.Logger, changeRoundStorage qbftstorage.ChangeRoundStore, msg *specqbft.SignedMessage) error
UpdateChangeRoundMessage if round for specific signer is higher than local msg
Types ¶
type ControllerStartInstanceOptions ¶
type ControllerStartInstanceOptions struct { Logger *zap.Logger Height 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 { State *qbft.State LeaderSelector leader.Selector Config *qbft.InstanceConfig Logger *zap.Logger SsvSigner spectypes.SSVSigner // messages ContainersMap map[specqbft.MessageType]msgcont.MessageContainer // 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 commit msg validation 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) GenerateChangeRoundMessage ¶ added in v0.3.2
GenerateChangeRoundMessage return change round msg
func (*Instance) GenerateCommitMessage ¶ added in v0.3.2
GenerateCommitMessage returns commit msg
func (*Instance) GeneratePrepareMessage ¶ added in v0.3.2
GeneratePrepareMessage returns prepare msg
func (*Instance) GenerateProposalMessage ¶ added in v0.3.2
func (i *Instance) GenerateProposalMessage(proposalMsg *specqbft.ProposalData) (specqbft.Message, error)
GenerateProposalMessage returns proposal 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) (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) HighestRoundTimeoutSeconds ¶ added in v0.3.2
HighestRoundTimeoutSeconds implements Instancer
func (*Instance) JustifyRoundChange ¶
JustifyRoundChange see below TODO: consider removing
func (*Instance) PrepareMsgPipeline ¶
func (i *Instance) PrepareMsgPipeline() pipelines.SignedMessagePipeline
PrepareMsgPipeline is the main prepare msg pipeline
func (*Instance) PrepareMsgValidationPipeline ¶ added in v0.3.2
func (i *Instance) PrepareMsgValidationPipeline() pipelines.SignedMessagePipeline
PrepareMsgValidationPipeline is the prepare msg validation 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) ProposalMsgPipeline ¶ added in v0.3.2
func (i *Instance) ProposalMsgPipeline() pipelines.SignedMessagePipeline
ProposalMsgPipeline is the main proposal msg pipeline
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 ← ⊥ inputValue i ← value if leader(hi, ri) = pi then broadcast ⟨PROPOSAL, λ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) UponProposalMsg ¶ added in v0.3.2
func (i *Instance) UponProposalMsg() pipelines.SignedMessagePipeline
UponProposalMsg Algorithm 2 IBFTController pseudocode for process pi: normal case operation upon receiving a valid ⟨PROPOSAL, λi, ri, value⟩ message m from leader(λi, round) such that:
JustifyProposal(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() GetState() *qbft.State Containers() map[specqbft.MessageType]msgcont.MessageContainer 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 HighestRoundTimeoutSeconds() time.Duration }
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