eligibility

package
v0.2.1-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon added in v0.1.11

type Beacon struct {
	log.Log
	// contains filtered or unexported fields
}

Beacon provides the value that is under consensus as defined by the hare.

func NewBeacon

func NewBeacon(beaconGetter blocks.BeaconGetter, confidenceParam uint32, logger log.Log) *Beacon

NewBeacon returns a new beacon confidenceParam is the number of layers that the Beacon assumes for consensus view.

func (*Beacon) Value added in v0.1.11

func (b *Beacon) Value(ctx context.Context, epochID types.EpochID) (uint32, error)

Value returns the beacon value for an epoch Note: Value is concurrency-safe but not concurrency-optimized

type Oracle

type Oracle struct {
	log.Log
	// contains filtered or unexported fields
}

Oracle is the hare eligibility oracle

func New

func New(
	beacon valueProvider,
	atxdb atxProvider,
	meshdb meshProvider,
	vrfVerifier verifierFunc,
	vrfSigner signer,
	layersPerEpoch uint32,
	cfg eCfg.Config,
	logger log.Log) *Oracle

New returns a new eligibility oracle instance.

func (*Oracle) CalcEligibility added in v1.0.0

func (o *Oracle) CalcEligibility(ctx context.Context, layer types.LayerID, round uint32, committeeSize int,
	id types.NodeID, vrfSig []byte) (uint16, error)

CalcEligibility calculates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.

func (*Oracle) IsIdentityActiveOnConsensusView

func (o *Oracle) IsIdentityActiveOnConsensusView(ctx context.Context, edID string, layer types.LayerID) (bool, error)

IsIdentityActiveOnConsensusView returns true if the provided identity is active on the consensus view derived from the specified layer, false otherwise.

func (*Oracle) Proof

func (o *Oracle) Proof(ctx context.Context, layer types.LayerID, round uint32) ([]byte, error)

Proof returns the role proof for the current Layer & Round

func (*Oracle) Validate added in v1.0.0

func (o *Oracle) Validate(ctx context.Context, layer types.LayerID, round uint32, committeeSize int, id types.NodeID, sig []byte, eligibilityCount uint16) (bool, error)

Validate validates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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