committee

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "electionNS"

Namespace to store the result in db

Variables

This section is empty.

Functions

This section is empty.

Types

type CalcBeaconChainHeight

type CalcBeaconChainHeight func(uint64) (uint64, error)

CalcBeaconChainHeight calculates the corresponding beacon chain height for an epoch

type Committee

type Committee interface {
	// Start starts the committee service
	Start(context.Context) error
	// Stop stops the committee service
	Stop(context.Context) error
	// ResultByHeight returns the result on a specific ethereum height
	ResultByHeight(height uint64) (*types.ElectionResult, error)
	// FetchResultByHeight returns the votes
	FetchResultByHeight(height uint64) (*types.ElectionResult, error)
	// HeightByTime returns the nearest result before time
	HeightByTime(timestamp time.Time) (uint64, error)
	// LatestHeight returns the height with latest result
	LatestHeight() uint64
}

Committee defines an interface of an election committee It could be considered as a light state db of beacon chain, that

func NewCommittee

func NewCommittee(kvstore db.KVStore, cfg Config) (Committee, error)

NewCommittee creates a committee

func NewCommitteeWithKVStoreWithNamespace

func NewCommitteeWithKVStoreWithNamespace(kvstore db.KVStoreWithNamespace, cfg Config) (Committee, error)

NewCommitteeWithKVStoreWithNamespace creates a committee with kvstore with namespace

type Config

type Config struct {
	NumOfRetries              uint8    `yaml:"numOfRetries"`
	BeaconChainAPIs           []string `yaml:"beaconChainAPIs"`
	BeaconChainHeightInterval uint64   `yaml:"beaconChainHeightInterval"`
	BeaconChainStartHeight    uint64   `yaml:"beaconChainStartHeight"`
	RegisterContractAddress   string   `yaml:"registerContractAddress"`
	StakingContractAddress    string   `yaml:"stakingContractAddress"`
	PaginationSize            uint8    `yaml:"paginationSize"`
	VoteThreshold             string   `yaml:"voteThreshold"`
	ScoreThreshold            string   `yaml:"scoreThreshold"`
	SelfStakingThreshold      string   `yaml:"selfStakingThreshold"`
	CacheSize                 uint32   `yaml:"cacheSize"`
}

Config defines the config of the committee

Jump to

Keyboard shortcuts

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