controller

package
v0.1.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func ReportIBFTStatus(pk string, finished, errorFound bool)

ReportIBFTStatus reports the current iBFT status

Types

type Controller

type Controller struct {
	ValidatorShare *storage.Share
	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

func NewMediator(logger *zap.Logger) Mediator

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

Directories

Path Synopsis
v0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL