eligibility

package
v0.2.17-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package eligibility defines fixed size oracle used for node testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FixedRolacle

type FixedRolacle struct {
	// contains filtered or unexported fields
}

FixedRolacle is an eligibility simulator with pre-determined honest and faulty participants.

func New

func New(logger log.Log) *FixedRolacle

New initializes the oracle with no participants.

func (*FixedRolacle) CalcEligibility added in v1.0.0

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

CalcEligibility returns 1 if the miner is eligible in given layer, and 0 otherwise.

func (*FixedRolacle) Export

func (fo *FixedRolacle) Export(id uint32, committeeSize int) map[types.NodeID]struct{}

Export creates a map with the eligible participants for id and committee size.

func (*FixedRolacle) IsIdentityActiveOnConsensusView

func (fo *FixedRolacle) IsIdentityActiveOnConsensusView(ctx context.Context, edID types.NodeID, layer types.LayerID) (bool, error)

IsIdentityActiveOnConsensusView is use to satisfy the API, currently always returns true.

func (*FixedRolacle) Proof

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

Proof generates a proof for the round. used to satisfy interface.

func (*FixedRolacle) Register

func (fo *FixedRolacle) Register(isHonest bool, client types.NodeID)

Register adds a participant to the eligibility map. can be honest or faulty.

func (*FixedRolacle) Unregister

func (fo *FixedRolacle) Unregister(isHonest bool, client types.NodeID)

Unregister removes a participant from the eligibility map. can be honest or faulty. TODO: just remove from both instead of specifying.

func (*FixedRolacle) Validate added in v1.0.0

Validate is required to conform to the Rolacle interface, but should never be called.

Jump to

Keyboard shortcuts

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