quorum

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 12 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
	DependencyInjectionWriter
	slash.Slasher
	WithJSONDump
	ToggleActive(*bls.PublicKey) bool
	SetVoters(shard.SlotList, bool) (*TallyResult, error)
	Policy() Policy
	IsQuorumAchieved(Phase) bool
	IsQuorumAchievedByMask(mask *bls_cosi.Mask, debug bool) bool
	QuorumThreshold() numeric.Dec
	AmIMemberOfCommitee() bool
	IsRewardThresholdAchieved() bool
	ResetPrepareAndCommitVotes()
	ResetViewChangeVotes()
}

Decider ..

func NewDecider

func NewDecider(p Policy) Decider

NewDecider ..

type DependencyInjectionReader added in v1.3.0

type DependencyInjectionReader interface {
	ShardIDProvider() func() (uint32, error)
	MyPublicKey() func() (*bls.PublicKey, error)
}

DependencyInjectionReader ..

type DependencyInjectionWriter added in v1.3.0

type DependencyInjectionWriter interface {
	SetShardIDProvider(func() (uint32, error))
	SetMyPublicKeyProvider(func() (*bls.PublicKey, error))
}

DependencyInjectionWriter ..

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
)

func (Phase) String added in v1.3.0

func (p Phase) String() string

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
)

func (Policy) String added in v1.3.0

func (p Policy) String() string

type SignatoryTracker

type SignatoryTracker interface {
	ParticipantTracker
	AddSignature(p Phase, PubKey *bls.PublicKey, sig *bls.Sign)
	// Caller assumes concurrency protection
	SignersCount(Phase) int64
	// contains filtered or unexported methods
}

SignatoryTracker ..

type SignatureReader

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

SignatureReader ..

type TallyResult added in v1.3.0

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

TallyResult is the result of when we calculate voting power, recall that it happens to us at epoch change

type WithJSONDump added in v1.3.0

type WithJSONDump interface {
	JSON() string
}

WithJSONDump representation dump

Jump to

Keyboard shortcuts

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