Documentation ¶
Index ¶
- Variables
- func New(role beacon.RoleType, identifier []byte, logger *zap.Logger, ...) ibft.Controller
- func ReportIBFTStatus(pk string, finished, errorFound bool)
- type Controller
- func (i *Controller) GetIBFTCommittee() map[uint64]*proto.Node
- func (i *Controller) GetIdentifier() []byte
- func (i *Controller) Init() error
- func (i *Controller) NextSeqNumber() (uint64, error)
- func (i *Controller) ProcessDecidedMessage(msg *proto.SignedMessage)
- func (i *Controller) ProcessSyncMessage(msg *network.SyncChanObj)
- func (i *Controller) StartInstance(opts ibft.ControllerStartInstanceOptions) (res *ibft.InstanceResult, err error)
- func (i *Controller) SyncIBFT() error
- func (i *Controller) ValidateDecidedMsg(msg *proto.SignedMessage) error
- func (i *Controller) ValidateDecidedMsgV0() pipeline.Pipeline
- type Mediator
- type MediatorReader
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyRunning = errors.New("already running")
ErrAlreadyRunning is used to express that some process is already running, e.g. sync
Functions ¶
func New ¶
func New( role beacon.RoleType, identifier []byte, logger *zap.Logger, storage collections.Iibft, network network.Network, queue *msgqueue.MessageQueue, instanceConfig *proto.InstanceConfig, validatorShare *storage.Share, fork contollerforks.Fork, signer beacon.Signer, syncRateLimit time.Duration, ) ibft.Controller
New is the constructor of Controller
func ReportIBFTStatus ¶ added in v0.1.5
ReportIBFTStatus reports the current iBFT status
Types ¶
type Controller ¶
type Controller struct { Identifier []byte // contains filtered or unexported fields }
Controller implements Controller interface
func (*Controller) GetIBFTCommittee ¶
func (i *Controller) GetIBFTCommittee() map[uint64]*proto.Node
GetIBFTCommittee returns a map of the iBFT committee where the key is the member's id.
func (*Controller) GetIdentifier ¶
func (i *Controller) GetIdentifier() []byte
GetIdentifier returns ibft identifier made of public key and role (type)
func (*Controller) Init ¶
func (i *Controller) Init() error
Init sets all major processes of iBFT while blocking until completed. if init fails to sync
func (*Controller) NextSeqNumber ¶
func (i *Controller) NextSeqNumber() (uint64, error)
NextSeqNumber returns the previous decided instance seq number + 1 In case it's the first instance it returns 0
func (*Controller) ProcessDecidedMessage ¶
func (i *Controller) ProcessDecidedMessage(msg *proto.SignedMessage)
ProcessDecidedMessage is responsible for processing an incoming decided message. If the decided message is known or belong to the current executing instance, do nothing. Else perform a sync operation
From https://arxiv.org/pdf/2002.03613.pdf
We can omit this if we assume some mechanism external to the consensus algorithm that ensures synchronization of decided values. upon receiving a valid hROUND-CHANGE, λi, −, −, −i message from pj ∧ pi has decided by calling Decide(λi,− , Qcommit) do
send Qcommit to process pj
func (*Controller) ProcessSyncMessage ¶
func (i *Controller) ProcessSyncMessage(msg *network.SyncChanObj)
ProcessSyncMessage processes sync messages
func (*Controller) StartInstance ¶
func (i *Controller) StartInstance(opts ibft.ControllerStartInstanceOptions) (res *ibft.InstanceResult, err error)
StartInstance - starts an ibft instance or returns error
func (*Controller) SyncIBFT ¶
func (i *Controller) SyncIBFT() error
SyncIBFT will fetch best known decided message (highest sequence) from the network and sync to it. it will ensure that minimum peers are available on the validator's topic
func (*Controller) ValidateDecidedMsg ¶
func (i *Controller) ValidateDecidedMsg(msg *proto.SignedMessage) error
ValidateDecidedMsg - the main decided msg pipeline
func (*Controller) ValidateDecidedMsgV0 ¶
func (i *Controller) ValidateDecidedMsgV0() pipeline.Pipeline
ValidateDecidedMsgV0 - genesis version 0
type Mediator ¶ added in v0.1.9
type Mediator struct {
// contains filtered or unexported fields
}
Mediator between network and redirect the proper msg to the proper MediatorReader
func NewMediator ¶ added in v0.1.9
NewMediator returns new Mediator
func (*Mediator) AddListener ¶ added in v0.1.9
func (m *Mediator) AddListener(ibftType network.NetworkMsg, ch <-chan *proto.SignedMessage, done func(), handler func(publicKey string) (MediatorReader, bool))
AddListener listen to channel and use redirect func to push to the right place
type MediatorReader ¶ added in v0.1.9
type MediatorReader interface {
GetMsgResolver(networkMsg network.NetworkMsg) func(msg *proto.SignedMessage)
}
MediatorReader is an interface for components that resolving network msg's