consensus

package
v0.0.0-...-ae125c8 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGenesisBlock

func GenerateGenesisBlock() *pb.Block

GenerateGenesisBlock returns genesis block

Types

type CurProposal

type CurProposal struct {
	Node          *pb.Block
	DocumentHash  []byte
	PrepareVote   []*tcrsa.SigShare
	PreCommitVote []*tcrsa.SigShare
	CommitVote    []*tcrsa.SigShare
	HighQC        []*pb.QuorumCert
}

func NewCurProposal

func NewCurProposal() *CurProposal

type HotStuff

type HotStuff interface {
	Msg(msgType pb.MsgType, node *pb.Block, qc *pb.QuorumCert) *pb.Msg
	VoteMsg(msgType pb.MsgType, node *pb.Block, qc *pb.QuorumCert, justify []byte) *pb.Msg
	CreateLeaf(parentHash []byte, cmds []string, justify *pb.QuorumCert) *pb.Block
	QC(msgType pb.MsgType, sig tcrsa.Signature, blockHash []byte) *pb.QuorumCert
	MatchingMsg(msg *pb.Msg, msgType pb.MsgType) bool
	MatchingQC(qc *pb.QuorumCert, msgType pb.MsgType) bool
	SafeNode(node *pb.Block, qc *pb.QuorumCert) bool
	GetMsgEntrance() chan<- *pb.Msg
	GetSelfInfo() *config.ReplicaInfo
	SafeExit()
}

common hotstuff func defined in the paper

type HotStuffImpl

type HotStuffImpl struct {
	ID            uint32
	BlockStorage  go_hotstuff.BlockStorage
	View          *View
	Config        config.HotStuffConfig
	TimeChan      *go_hotstuff.Timer
	BatchTimeChan *go_hotstuff.Timer
	CurExec       *CurProposal
	CmdSet        go_hotstuff.CmdSet
	HighQC        *pb.QuorumCert
	PrepareQC     *pb.QuorumCert // highQC
	PreCommitQC   *pb.QuorumCert // lockQC
	CommitQC      *pb.QuorumCert
	MsgEntrance   chan *pb.Msg // receive msg
	ProcessMethod func(args string) string
}

func (*HotStuffImpl) Broadcast

func (h *HotStuffImpl) Broadcast(msg *pb.Msg) error

func (*HotStuffImpl) CreateLeaf

func (h *HotStuffImpl) CreateLeaf(parentHash []byte, cmds []string, justify *pb.QuorumCert) *pb.Block

func (*HotStuffImpl) GetLeader

func (h *HotStuffImpl) GetLeader() uint32

GetLeader get the leader replica in view

func (*HotStuffImpl) GetMsgEntrance

func (h *HotStuffImpl) GetMsgEntrance() chan<- *pb.Msg

func (*HotStuffImpl) GetNetworkInfo

func (h *HotStuffImpl) GetNetworkInfo() map[uint32]string

func (*HotStuffImpl) GetSelfInfo

func (h *HotStuffImpl) GetSelfInfo() *config.ReplicaInfo

func (*HotStuffImpl) MatchingMsg

func (h *HotStuffImpl) MatchingMsg(msg *pb.Msg, msgType pb.MsgType) bool

func (*HotStuffImpl) MatchingQC

func (h *HotStuffImpl) MatchingQC(qc *pb.QuorumCert, msgType pb.MsgType) bool

func (*HotStuffImpl) Msg

func (h *HotStuffImpl) Msg(msgType pb.MsgType, node *pb.Block, qc *pb.QuorumCert) *pb.Msg

func (*HotStuffImpl) ProcessProposal

func (h *HotStuffImpl) ProcessProposal(cmds []string)

func (*HotStuffImpl) QC

func (h *HotStuffImpl) QC(msgType pb.MsgType, sig tcrsa.Signature, blockHash []byte) *pb.QuorumCert

func (*HotStuffImpl) SafeExit

func (h *HotStuffImpl) SafeExit()

func (*HotStuffImpl) SafeNode

func (h *HotStuffImpl) SafeNode(node *pb.Block, qc *pb.QuorumCert) bool

func (*HotStuffImpl) Unicast

func (h *HotStuffImpl) Unicast(address string, msg *pb.Msg) error

func (*HotStuffImpl) VoteMsg

func (h *HotStuffImpl) VoteMsg(msgType pb.MsgType, node *pb.Block, qc *pb.QuorumCert, justify []byte) *pb.Msg

type HotStuffService

type HotStuffService struct {
	// contains filtered or unexported fields
}

func NewHotStuffService

func NewHotStuffService(impl HotStuff) *HotStuffService

func (*HotStuffService) GetImpl

func (basic *HotStuffService) GetImpl() HotStuff

func (*HotStuffService) SendMsg

func (basic *HotStuffService) SendMsg(ctx context.Context, in *pb.Msg) (*pb.Empty, error)

func (*HotStuffService) SendReply

func (basic *HotStuffService) SendReply(ctx context.Context, in *pb.Msg) (*pb.Empty, error)

func (*HotStuffService) SendRequest

func (basic *HotStuffService) SendRequest(ctx context.Context, in *pb.Msg) (*pb.Empty, error)

type View

type View struct {
	ViewNum      uint64 // view number
	Primary      uint32 // the leader's id
	ViewChanging bool
}

func NewView

func NewView(viewNum uint64, primary uint32) *View

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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