ceremony

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: LGPL-3.0 Imports: 38 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LotterySeedLag                      = 100
	MaxFlipKeysPackageBroadcastDelaySec = 120
	MaxShortAnswersBroadcastDelaySec    = 30
	// Flip keys will stop syncing with peers in FlipKeysSyncTimeFrame seconds after short session start
	FlipKeysSyncTimeFrame            = 60 * 4 // seconds
	ClientTypeDesktop                = 1
	ClientTypeDesktopWithBuiltInNode = 2
)
View Source
const (
	CandidatesPerAuthor = 13
)

Variables

This section is empty.

Functions

func GeneratePairsFromVrfHash added in v0.24.1

func GeneratePairsFromVrfHash(hash [32]byte, firstIndex, dictionarySize, pairCount int) (nums []int)

func GetAuthorsDistribution

func GetAuthorsDistribution(shards map[common.ShardId]*candidatesOfShard, seed []byte, shortFlipsCount int) map[common.ShardId]*shardAuthors

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(authorRnd uint64, firstIndex, dictionarySize, pairCount, pairIndex int) (word1, word2 int, err error)

func NewQualification

func NewQualification(config *config.Config, 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) types.TotalValidationResult

func (*ValidationCeremony) FlipKeyWordPairs

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

func (*ValidationCeremony) GeneratePairs

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

func (*ValidationCeremony) GetDecryptedFlip added in v0.23.1

func (vc *ValidationCeremony) GetDecryptedFlip(key []byte) (publicPart []byte, privatePart []byte, err error)

func (*ValidationCeremony) GetFlipKeys added in v0.23.1

func (vc *ValidationCeremony) GetFlipKeys(addr common.Address, cidBytes []byte) (publicKey []byte, encryptedPrivateKey []byte, err error)

func (*ValidationCeremony) GetFlipWords

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

func (*ValidationCeremony) GetLongFlipsToSolve

func (vc *ValidationCeremony) GetLongFlipsToSolve(address common.Address, shardId common.ShardId) [][]byte

func (*ValidationCeremony) GetShortFlipsToSolve

func (vc *ValidationCeremony) GetShortFlipsToSolve(address common.Address, shardId common.ShardId) [][]byte

func (*ValidationCeremony) GetWordDictionaryRange added in v0.27.0

func (vc *ValidationCeremony) GetWordDictionaryRange() (firstIndex, size int)

func (*ValidationCeremony) Initialize

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

func (*ValidationCeremony) IsFlipInMemory added in v0.23.1

func (vc *ValidationCeremony) IsFlipInMemory(key []byte) bool

func (*ValidationCeremony) IsFlipReadyToSolve added in v0.23.1

func (vc *ValidationCeremony) IsFlipReadyToSolve(key []byte) bool

func (*ValidationCeremony) IsValidationReady added in v0.23.1

func (vc *ValidationCeremony) IsValidationReady() bool

func (*ValidationCeremony) PrivateEncryptionKeyCandidates added in v0.23.1

func (vc *ValidationCeremony) PrivateEncryptionKeyCandidates(addr common.Address) ([][]byte, error)

func (*ValidationCeremony) SendPrivateEncryptionKeysPackage added in v0.23.1

func (vc *ValidationCeremony) SendPrivateEncryptionKeysPackage(data *types.PrivateFlipKeysPackage) error

func (*ValidationCeremony) SendPublicEncryptionKey added in v0.23.1

func (vc *ValidationCeremony) SendPublicEncryptionKey(key *types.PublicFlipKey) error

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