hotStuff

package
v0.0.0-...-fdc5c16 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConsensusPhases consensusPhase
View Source
var MessageTypes messageType

Functions

This section is empty.

Types

type BasicService

type BasicService struct {
	Config Config

	CurrentPhase enum.Element
	PhaseLock    sync.Mutex

	NewViews     map[string]SignedConsensusData
	VotedMessage map[string]SignedConsensusData

	PrepareQC         *QC //GenericQC for Chained
	LockedQC          *QC
	ViewChangeTrigger *time.Timer
	CurrentView       uint64

	ConsensusProcessor map[string]consensusProcessor
	ExternalProcessor  consensus.ExternalProcessor

	BLeaf *ConsensusData
	// contains filtered or unexported fields
}
var Basic BasicService

func NewHotStuff

func NewHotStuff(hotStuff hotStuff) *BasicService

func (*BasicService) BroadCastMessage

func (b *BasicService) BroadCastMessage(msg message.Message)

func (*BasicService) BroadCastPrepareMessage

func (b *BasicService) BroadCastPrepareMessage(highQC QC) (err error)

func (*BasicService) BuildCommonMessage

func (b *BasicService) BuildCommonMessage(msgType enum.Element, msgPayload []byte) (msg message.Message)

func (*BasicService) BuildCommonPhaseMessage

func (b *BasicService) BuildCommonPhaseMessage(
	phase enum.Element,
	msgType enum.Element,
	votedQC *QC) (msg message.Message, err error)

func (*BasicService) BuildConsensusMessage

func (b *BasicService) BuildConsensusMessage(phase string, payload ConsensusPayload, justify QC, parentId string, viewNumber uint64) (msgPayload []byte, err error)

func (*BasicService) BuildNewViewMessage

func (b *BasicService) BuildNewViewMessage() (msg message.Message, err error)

func (*BasicService) BuildVote

func (b *BasicService) BuildVote(qcData QCData) (vote seal.Entity, err error)

func (*BasicService) BuildVoteMessage

func (b *BasicService) BuildVoteMessage(phase string, payload ConsensusPayload, parentId string, viewNumber uint64) (msg message.Message, err error)

func (*BasicService) ClearBLeaf

func (b *BasicService) ClearBLeaf()

func (*BasicService) ClearNewView

func (b *BasicService) ClearNewView()

func (*BasicService) ClearPrepare

func (b *BasicService) ClearPrepare()

func (*BasicService) Feed

func (b *BasicService) Feed(msg message.Message) (reply *message.Message)

func (*BasicService) GetConsensusCustomerData

func (b *BasicService) GetConsensusCustomerData(msg message.Message) (data []byte, err error)

func (*BasicService) GetExternalProcessor

func (b *BasicService) GetExternalProcessor() (processor consensus.ExternalProcessor)

func (*BasicService) GetLastConsensusCustomerData

func (b *BasicService) GetLastConsensusCustomerData() []byte

func (*BasicService) GetMessageFamily

func (b *BasicService) GetMessageFamily() (family string)

func (*BasicService) GotCommonPhaseMessage

func (b *BasicService) GotCommonPhaseMessage(consensusData SignedConsensusData) (reply *message.Message)

func (*BasicService) GotGeneric

func (b *BasicService) GotGeneric(consensusData SignedConsensusData) (reply *message.Message)

func (*BasicService) GotNewView

func (b *BasicService) GotNewView(consensusData SignedConsensusData) (_ *message.Message)

func (*BasicService) GotPrepare

func (b *BasicService) GotPrepare(consensusData SignedConsensusData) (reply *message.Message)

func (*BasicService) GotVote

func (b *BasicService) GotVote(consensusData SignedConsensusData) (reply *message.Message)

func (*BasicService) HasEnoughVotes

func (b *BasicService) HasEnoughVotes(voteCount int) bool

func (*BasicService) IsCurrentLeader

func (b *BasicService) IsCurrentLeader() (isLeader bool)

func (*BasicService) IsNextViewLeader

func (b *BasicService) IsNextViewLeader(viewNumber uint64, key []byte) (isLeader bool)

func (*BasicService) IsViewLeader

func (b *BasicService) IsViewLeader(viewNumber uint64, key []byte) (isLeader bool)

func (*BasicService) Load

func (b *BasicService) Load(networkService network.IService, processor consensus.ExternalProcessor)

func (*BasicService) NewRound

func (b *BasicService) NewRound()

func (*BasicService) PickHighQC

func (b *BasicService) PickHighQC() (highQC QC)

func (*BasicService) RegisterExternalProcessor

func (b *BasicService) RegisterExternalProcessor(processor consensus.ExternalProcessor)

func (*BasicService) SendMessageToLeader

func (b *BasicService) SendMessageToLeader(msg message.Message)

func (*BasicService) Start

func (b *BasicService) Start(cfg interface{}) (err error)

func (*BasicService) StaticInformation

func (b *BasicService) StaticInformation() interface{}

func (*BasicService) Stop

func (b *BasicService) Stop() (err error)

func (*BasicService) UpdateBLeaf

func (b *BasicService) UpdateBLeaf(consensusData ConsensusData)

func (*BasicService) VerifyQCVotes

func (b *BasicService) VerifyQCVotes(qc QC) (passed bool)

type Config

type Config struct {
	//signer and members
	SelfSigner signerCommon.ISigner

	//member list
	Members []Member

	//timers config
	MemberOnlineCheckInterval time.Duration
	ConsensusTimeout          time.Duration

	//new consensus round interval
	ConsensusInterval time.Duration

	//network
	Network network.Service

	//crypto
	SingerGenerator signers.ISignerGenerator
	HashCalc        hashes.IHashCalculator
}

type ConsensusData

type ConsensusData struct {
	Id         string
	ParentId   string
	ViewNumber uint64
	Phase      string
	Payload    ConsensusPayload
	Justify    QC
}

func (ConsensusData) IsStructureEmpty

func (c ConsensusData) IsStructureEmpty() bool

func (ConsensusData) NodeId

func (c ConsensusData) NodeId() (nodeId string)

type ConsensusPayload

type ConsensusPayload struct {
	Parent       []byte
	CustomerData []byte
}

type Member

type Member struct {
	Signer   signerCommon.ISigner
	FromNode network.Node
	// contains filtered or unexported fields
}

type QC

type QC struct {
	QCData
	NodeId string
	Votes  []seal.Entity
}

type QCData

type QCData struct {
	Phase      string
	ViewNumber uint64
	Payload    ConsensusPayload
}

type SignedConsensusData

type SignedConsensusData struct {
	ConsensusData
	Seal seal.Entity
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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