quorum

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decider

type Decider interface {
	SignatureReader
	Policy() Policy
	IsQuorumAchieved(Phase) bool
	QuorumThreshold() int64
	IsRewardThresholdAchieved() bool
}

Decider ..

func NewDecider

func NewDecider(p Policy) Decider

NewDecider ..

type ParticipantTracker

type ParticipantTracker interface {
	Participants() []*bls.PublicKey
	IndexOf(*bls.PublicKey) int
	ParticipantsCount() int64
	NextAfter(*bls.PublicKey) (bool, *bls.PublicKey)
	UpdateParticipants(pubKeys []*bls.PublicKey)
	DumpParticipants() []string
}

ParticipantTracker ..

type Phase

type Phase byte

Phase is a phase that needs quorum to proceed

const (
	// Prepare ..
	Prepare Phase = iota
	// Commit ..
	Commit
	// ViewChange ..
	ViewChange
)

type Policy

type Policy byte

Policy is the rule we used to decide is quorum achieved

const (
	// SuperMajorityVote is a 2/3s voting mechanism, pre-PoS
	SuperMajorityVote Policy = iota
	// SuperMajorityStake is 2/3s of total staked amount for epoch
	SuperMajorityStake
)

type SignatoryTracker

type SignatoryTracker interface {
	ParticipantTracker
	AddSignature(p Phase, PubKey *bls.PublicKey, sig *bls.Sign)
	// Caller assumes concurrency protection
	SignatoriesCount(Phase) int64
	Reset([]Phase)
}

SignatoryTracker ..

type SignatureReader

type SignatureReader interface {
	SignatoryTracker
	ReadAllSignatures(Phase) []*bls.Sign
	ReadSignature(p Phase, PubKey *bls.PublicKey) *bls.Sign
}

SignatureReader ..

Jump to

Keyboard shortcuts

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