eligibility

package
v0.2.20-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	// HarePreRound ...
	HarePreRound uint32 = math.MaxUint32
	// CertifyRound is not part of the hare protocol, but it shares the same oracle for eligibility.
	CertifyRound uint32 = math.MaxUint32 >> 1
)
View Source
const (
	// HareStatusRound ...
	HareStatusRound uint32 = iota
	// HareProposalRound ...
	HareProposalRound
	// HareCommitRound ...
	HareCommitRound
	// HareNotifyRound ...
	HareNotifyRound
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Oracle

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

Oracle is the hare eligibility oracle.

func New

func New(
	beacons system.BeaconGetter,
	db *datastore.CachedDB,
	vrfVerifier verifierFunc,
	vrfSigner *signing.VRFSigner,
	layersPerEpoch uint32,
	cfg config.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 types.NodeID, 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.

type VrfMessage added in v1.0.0

type VrfMessage struct {
	Beacon uint32
	Round  uint32
	Layer  types.LayerID
}

VrfMessage is a verification message.

func (*VrfMessage) DecodeScale added in v1.0.0

func (t *VrfMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*VrfMessage) EncodeScale added in v1.0.0

func (t *VrfMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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