ceremony

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: LGPL-3.0 Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MinTotalScore       = 0.75
	MinShortScore       = 0.6
	MinLongScore        = 0.75
	MinHumanTotalScore  = 0.92
	MinFlipsForVerified = 13
	MinFlipsForHuman    = 24
	StakeToBalanceCoef  = 0.75
)
View Source
const (
	GeneticRelationLength = 3
	CandidatesPerAuthor   = 13
)
View Source
const (
	LotterySeedLag = 100
)

Variables

This section is empty.

Functions

func GetAuthorsDistribution

func GetAuthorsDistribution(candidates []*candidate, seed []byte, shortFlipsCount int) (authorsPerCandidate map[int][]int, candidatesPerAuthor map[int][]int)

func GetFlipsDistribution

func GetFlipsDistribution(candidatesCount int, authorsPerCandidate map[int][]int, flipsPerAuthor map[int][][]byte, flips [][]byte, seed []byte, shortFlipsCount int) (shortFlipsPerCandidate [][]int, longFlipsPerCandidate [][]int)

func GetWords

func GetWords(seed []byte, proof []byte, pubKeyData []byte, dictionarySize, pairCount, pairIndex int, epoch uint16) (word1, word2 int, err error)

func NewQualification

func NewQualification(epochDb *database.EpochDb) *qualification

Types

type FlipQualification

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

type FlipStatus

type FlipStatus byte
const (
	NotQualified    FlipStatus = 0
	Qualified       FlipStatus = 1
	WeaklyQualified FlipStatus = 2
	QualifiedByNone FlipStatus = 3
)

type Queue

type Queue interface {
	Pop() int
	Push(int)
	Peek() int
	Len() int
}

Queue is a queue

func NewQueue

func NewQueue() Queue

type ValidationCeremony

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

func NewValidationCeremony

func NewValidationCeremony(appState *appstate.AppState, bus eventbus.Bus, flipper *flip.Flipper, secStore *secstore.SecStore, db dbm.DB, mempool *mempool.TxPool,
	chain *blockchain.Blockchain, syncer protocol.Syncer, keysPool *mempool.KeysPool, config *config.Config) *ValidationCeremony

func (*ValidationCeremony) ApplyNewEpoch

func (vc *ValidationCeremony) ApplyNewEpoch(height uint64, appState *appstate.AppState, statsCollector collector.StatsCollector) (identitiesCount int, authors *types.ValidationAuthors, failed bool)

func (*ValidationCeremony) FlipKeyWordPairs

func (vc *ValidationCeremony) FlipKeyWordPairs() []int

func (*ValidationCeremony) GeneratePairs

func (vc *ValidationCeremony) GeneratePairs(seed []byte, dictionarySize, pairCount int, epoch uint16) (nums []int, proof []byte)

func (*ValidationCeremony) GetFlipWords

func (vc *ValidationCeremony) GetFlipWords(cid []byte) (word1, word2 int, err error)

func (*ValidationCeremony) GetLongFlipsToSolve

func (vc *ValidationCeremony) GetLongFlipsToSolve() [][]byte

func (*ValidationCeremony) GetShortFlipsToSolve

func (vc *ValidationCeremony) GetShortFlipsToSolve() [][]byte

func (*ValidationCeremony) Initialize

func (vc *ValidationCeremony) Initialize(currentBlock *types.Block)

func (*ValidationCeremony) LongSessionFlipsCount

func (vc *ValidationCeremony) LongSessionFlipsCount() uint

func (*ValidationCeremony) ShortSessionBeginTime

func (vc *ValidationCeremony) ShortSessionBeginTime() time.Time

func (*ValidationCeremony) ShortSessionFlipsCount

func (vc *ValidationCeremony) ShortSessionFlipsCount() uint

func (*ValidationCeremony) ShortSessionStarted

func (vc *ValidationCeremony) ShortSessionStarted() bool

func (*ValidationCeremony) SubmitLongAnswers

func (vc *ValidationCeremony) SubmitLongAnswers(answers *types.Answers) (common.Hash, error)

func (*ValidationCeremony) SubmitShortAnswers

func (vc *ValidationCeremony) SubmitShortAnswers(answers *types.Answers) (common.Hash, error)

Jump to

Keyboard shortcuts

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