util

package
v0.2.21-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrZeroTotalWeight is returned when zero total epoch weight is used when calculating eligible slots.
	ErrZeroTotalWeight = errors.New("zero total weight not allowed")

	ErrBadBallotData = errors.New("bad ballot data")
)

Functions

func CalcEligibleLayer

func CalcEligibleLayer(epochNumber types.EpochID, layersPerEpoch uint32, vrfSig []byte) types.LayerID

CalcEligibleLayer calculates the eligible layer from the VRF signature.

func ComputeWeightPerEligibility

func ComputeWeightPerEligibility(
	cdb *datastore.CachedDB,
	ballot *types.Ballot,
	layerSize,
	layersPerEpoch uint32,
) (*big.Rat, error)

ComputeWeightPerEligibility computes the ballot weight per eligibility w.r.t the active set recorded in its reference ballot.

func GetNumEligibleSlots

func GetNumEligibleSlots(weight, totalWeight uint64, committeeSize uint32, layersPerEpoch uint32) (uint32, error)

GetNumEligibleSlots calculates the number of eligible slots for a smesher in an epoch.

Types

This section is empty.

Jump to

Keyboard shortcuts

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