Documentation ¶
Index ¶
- func CommitMsgValidationPipelineV0(identifier []byte, seq uint64, share *storage.Share) pipeline.Pipeline
- func NewInstance(opts *InstanceOptions) ibft.Instance
- func NewInstanceWithState(state *proto.State) ibft.Instance
- func ProcessLateCommitMsg(msg *proto.SignedMessage, ibftStorage collections.Iibft, share *storage.Share) (*proto.SignedMessage, error)
- type Instance
- func (i *Instance) BumpRound()
- func (i *Instance) ChangeRoundMsgPipeline() pipeline.Pipeline
- func (i *Instance) ChangeRoundMsgPipelineV0() pipeline.Pipeline
- func (i *Instance) ChangeRoundMsgValidationPipeline() pipeline.Pipeline
- func (i *Instance) ChangeRoundMsgValidationPipelineV0() pipeline.Pipeline
- func (i *Instance) ChangeRoundPartialQuorumMsgPipeline() pipeline.Pipeline
- func (i *Instance) CommitMsgPipeline() pipeline.Pipeline
- func (i *Instance) CommitMsgPipelineV0() pipeline.Pipeline
- func (i *Instance) CommitMsgValidationPipeline() pipeline.Pipeline
- func (i *Instance) CommitMsgValidationPipelineV0() pipeline.Pipeline
- func (i *Instance) CommittedAggregatedMsg() (*proto.SignedMessage, error)
- func (i *Instance) DecidedMsgPipeline() pipeline.Pipeline
- func (i *Instance) DecidedMsgPipelineV0() pipeline.Pipeline
- func (i *Instance) ForceDecide(msg *proto.SignedMessage)
- func (i *Instance) GetLastChangeRoundMsg() *proto.SignedMessage
- func (i *Instance) GetStageChan() chan proto.RoundState
- func (i *Instance) HighestPrepared(round uint64) (notPrepared bool, highestPrepared *proto.ChangeRoundData, 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 uint64) error
- func (i *Instance) PrePrepareMsgPipeline() pipeline.Pipeline
- func (i *Instance) PrePrepareMsgPipelineV0() pipeline.Pipeline
- func (i *Instance) PrepareMsgPipeline() pipeline.Pipeline
- func (i *Instance) PrepareMsgPipelineV0() pipeline.Pipeline
- func (i *Instance) PreparedAggregatedMsg() (*proto.SignedMessage, error)
- func (i *Instance) ProcessMessage() (processedMsg bool, err error)
- func (i *Instance) ProcessStageChange(stage proto.RoundState)
- func (i *Instance) RoundLeader(round uint64) uint64
- func (i *Instance) SignAndBroadcast(msg *proto.Message) error
- func (i *Instance) Start(inputValue []byte) error
- func (i *Instance) StartMainEventLoop()
- func (i *Instance) StartMessagePipeline()
- func (i *Instance) State() *proto.State
- func (i *Instance) Stop()
- func (i *Instance) Stopped() bool
- func (i *Instance) ThisRoundLeader() uint64
- func (i *Instance) UponPrePrepareMsg() pipeline.Pipeline
- type InstanceOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitMsgValidationPipelineV0 ¶ added in v0.1.5
func CommitMsgValidationPipelineV0(identifier []byte, seq uint64, share *storage.Share) pipeline.Pipeline
CommitMsgValidationPipelineV0 is version 0 of commit message validation
func NewInstance ¶
func NewInstance(opts *InstanceOptions) ibft.Instance
NewInstance is the constructor of Instance
func NewInstanceWithState ¶
NewInstanceWithState used for testing, not PROD!
func ProcessLateCommitMsg ¶
func ProcessLateCommitMsg(msg *proto.SignedMessage, ibftStorage collections.Iibft, share *storage.Share) (*proto.SignedMessage, error)
ProcessLateCommitMsg tries to aggregate the late commit message to the corresponding decided message
Types ¶
type Instance ¶
type Instance struct { ValueCheck valcheck.ValueCheck LeaderSelector leader.Selector Config *proto.InstanceConfig Logger *zap.Logger // messages MsgQueue *msgqueue.MessageQueue PrePrepareMessages msgcont.MessageContainer PrepareMessages msgcont.MessageContainer CommitMessages msgcont.MessageContainer ChangeRoundMessages msgcont.MessageContainer // contains filtered or unexported fields }
Instance defines the instance attributes
func (*Instance) BumpRound ¶
func (i *Instance) BumpRound()
BumpRound is used to set bump round by 1
func (*Instance) ChangeRoundMsgPipeline ¶
ChangeRoundMsgPipeline - the main change round msg pipeline
func (*Instance) ChangeRoundMsgPipelineV0 ¶
ChangeRoundMsgPipelineV0 - genesis version 0
func (*Instance) ChangeRoundMsgValidationPipeline ¶
ChangeRoundMsgValidationPipeline - the main change round msg validation pipeline
func (*Instance) ChangeRoundMsgValidationPipelineV0 ¶
ChangeRoundMsgValidationPipelineV0 - genesis version 0
func (*Instance) ChangeRoundPartialQuorumMsgPipeline ¶
ChangeRoundPartialQuorumMsgPipeline returns the pipeline which handles partial change ronud quorum
func (*Instance) CommitMsgPipeline ¶
CommitMsgPipeline - the main commit msg pipeline
func (*Instance) CommitMsgPipelineV0 ¶
CommitMsgPipelineV0 - genesis version 0
func (*Instance) CommitMsgValidationPipeline ¶
CommitMsgValidationPipeline is the main commit msg pipeline
func (*Instance) CommitMsgValidationPipelineV0 ¶
CommitMsgValidationPipelineV0 is version 0
func (*Instance) CommittedAggregatedMsg ¶
func (i *Instance) CommittedAggregatedMsg() (*proto.SignedMessage, error)
CommittedAggregatedMsg returns a signed message for the state's committed value with the max known signatures
func (*Instance) DecidedMsgPipeline ¶
DecidedMsgPipeline is the main pipeline for decided msgs
func (*Instance) DecidedMsgPipelineV0 ¶
DecidedMsgPipelineV0 is version 0
func (*Instance) ForceDecide ¶
func (i *Instance) ForceDecide(msg *proto.SignedMessage)
ForceDecide will attempt to decide the instance with provided decided signed msg.
func (*Instance) GetLastChangeRoundMsg ¶
func (i *Instance) GetLastChangeRoundMsg() *proto.SignedMessage
GetLastChangeRoundMsg returns the latest broadcasted msg from the instance
func (*Instance) GetStageChan ¶
func (i *Instance) GetStageChan() chan proto.RoundState
GetStageChan returns a RoundState channel added to the stateChangesChans array
func (*Instance) HighestPrepared ¶
func (i *Instance) HighestPrepared(round uint64) (notPrepared bool, highestPrepared *proto.ChangeRoundData, 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 ¶
PrePrepareMsgPipeline is the main pre-prepare msg pipeline
func (*Instance) PrePrepareMsgPipelineV0 ¶
PrePrepareMsgPipelineV0 is version 0
func (*Instance) PrepareMsgPipeline ¶
PrepareMsgPipeline is the main prepare msg pipeline
func (*Instance) PrepareMsgPipelineV0 ¶
PrepareMsgPipelineV0 is the v0 version
func (*Instance) PreparedAggregatedMsg ¶
func (i *Instance) PreparedAggregatedMsg() (*proto.SignedMessage, error)
PreparedAggregatedMsg returns a signed message for the state's prepared value with the max known signatures
func (*Instance) ProcessMessage ¶
ProcessMessage pulls messages from the queue to be processed sequentially
func (*Instance) ProcessStageChange ¶
func (i *Instance) ProcessStageChange(stage proto.RoundState)
ProcessStageChange set the state's round state and pushed the new state into the state channel
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) StartMainEventLoop ¶
func (i *Instance) StartMainEventLoop()
StartMainEventLoop start the main event loop queue for the iBFT instance which iterates events in the queue, if non found it will wait before trying again.
func (*Instance) StartMessagePipeline ¶
func (i *Instance) StartMessagePipeline()
StartMessagePipeline - the iBFT instance is message driven with an 'upon' logic. each message type has it's own pipeline of checks and actions, called by the networker implementation. Internal chan monitor if the instance reached decision or if a round change is required.
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 ¶
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 InstanceOptions ¶
type InstanceOptions struct { Logger *zap.Logger //Me *proto.Node Network network.Network Queue *msgqueue.MessageQueue ValueCheck valcheck.ValueCheck LeaderSelector leader.Selector Config *proto.InstanceConfig Lambda []byte SeqNumber uint64 // 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 Signer beacon.Signer }
InstanceOptions defines option attributes for the Instance