Documentation ¶
Index ¶
- Constants
- Variables
- func CalcThreshold(size int) int
- func MaskToException(bMask []byte, groupPublicKey []*bls.PublicKey, beNewVer bool) []*bls.PublicKey
- func MaskToExceptionIndexs(bMask []byte, cmLen int) []int
- func ReadableMsgType(m uint32) string
- func VerifySignature(bSign []byte, bMask []byte, data []byte, groupPublicKey []*bls.PublicKey, ...) bool
- type HotStuffApplication
- type HotstuffMessage
- type HotstuffProtocolManager
- func (hsm *HotstuffProtocolManager) DumpView(v *View, asLeader bool)
- func (hsm *HotstuffProtocolManager) HandleMessage(msg *HotstuffMessage) error
- func (hsm *HotstuffProtocolManager) NewView() error
- func (hsm *HotstuffProtocolManager) SignHash(data []byte) []byte
- func (hsm *HotstuffProtocolManager) TryPropose() error
- func (hsm *HotstuffProtocolManager) UpdateKeyPair(sec *bls.SecretKey)
- type QC
- type Quorum
- type SignedState
- type View
Constants ¶
View Source
const ( MsgNewView = iota MsgPrepare MsgVotePrepare MsgPreCommit MsgVotePreCommit MsgCommit MsgVoteCommit MsgDecide // pseudo messages MsgStartNewView // for handling new view from app MsgTryPropose MsgTimer )
View Source
const ( PhasePrepare = iota PhaseTryPropose // pseudo phase, used to describe the phase between onNewView and Propose successfully PhasePreCommit PhaseCommit PhaseDecide PhaseFinal )
Variables ¶
View Source
var ( ErrNewViewFail = fmt.Errorf("hotstuff new view fail") ErrUnhandledMsg = fmt.Errorf("hotstuff unhandled message") ErrViewTimeout = fmt.Errorf("hotstuff view timeout") ErrQCVerification = fmt.Errorf("hotstuff QC not valid") ErrInvalidReplica = fmt.Errorf("hotstuff replica not valid") ErrInvalidQuorumMessage = fmt.Errorf("hotstuff quorum message not valid") ErrInsufficientQC = fmt.Errorf("hotstuff QC insufficient") ErrInvalidHighQC = fmt.Errorf("hotstuff highQC invalid") ErrInvalidPrepareQC = fmt.Errorf("hotstuff prepareQC invalid") ErrInvalidPreCommitQC = fmt.Errorf("hotstuff preCommitQC invalid") ErrInvalidCommitQC = fmt.Errorf("hotstuff commitQC invalid") ErrInvalidProposal = fmt.Errorf("hotstuff proposal invalid") ErrInvalidPublicKey = fmt.Errorf("invalid public key for bls deserialize") ErrViewPhaseNotMatch = fmt.Errorf("hotstuff view phase not match") ErrViewOldPhase = fmt.Errorf("hotstuff old phase ") ErrMissingView = fmt.Errorf("hotstuff view missing") ErrInvalidLeaderView = fmt.Errorf("hotstuff invalid leader view") ErrExistingView = fmt.Errorf("hotstuff view existing") ErrViewIdNotMatch = fmt.Errorf("hotstuff view id not match") ErrOldState = fmt.Errorf("hotstuff view state too old") ErrFutureState = fmt.Errorf("hotstuff view state of future") )
Functions ¶
func CalcThreshold ¶
func MaskToException ¶
func MaskToExceptionIndexs ¶
func ReadableMsgType ¶
Types ¶
type HotStuffApplication ¶
type HotStuffApplication interface { Self() string Write(string, *HotstuffMessage) error Broadcast(*HotstuffMessage) []error GetPublicKey() []*bls.PublicKey OnNewView(currentState []byte, extra [][]byte) error OnPropose(isKeyBlock bool, state []byte, extra []byte) error OnViewDone(kSign *SignedState, tSign *SignedState) error CheckView(currentState []byte) error Propose() (e error, kState []byte, tState []byte, extra []byte) CurrentState() ([]byte, string, uint64) GetExtra() []byte // only for new-view procedure }
type HotstuffMessage ¶
type HotstuffProtocolManager ¶
type HotstuffProtocolManager struct {
// contains filtered or unexported fields
}
func NewHotstuffProtocolManager ¶
func NewHotstuffProtocolManager(a HotStuffApplication, secretKey *bls.SecretKey, publicKey *bls.PublicKey) *HotstuffProtocolManager
func (*HotstuffProtocolManager) DumpView ¶
func (hsm *HotstuffProtocolManager) DumpView(v *View, asLeader bool)
func (*HotstuffProtocolManager) HandleMessage ¶
func (hsm *HotstuffProtocolManager) HandleMessage(msg *HotstuffMessage) error
func (*HotstuffProtocolManager) NewView ¶
func (hsm *HotstuffProtocolManager) NewView() error
for replica
func (*HotstuffProtocolManager) SignHash ¶
func (hsm *HotstuffProtocolManager) SignHash(data []byte) []byte
func (*HotstuffProtocolManager) TryPropose ¶
func (hsm *HotstuffProtocolManager) TryPropose() error
func (*HotstuffProtocolManager) UpdateKeyPair ¶
func (hsm *HotstuffProtocolManager) UpdateKeyPair(sec *bls.SecretKey)
type SignedState ¶
Proposed K or T state with signature and mask, only for OnViewDone() interface
Click to show internal directories.
Click to hide internal directories.