Back to

Package oracle

Latest Go to latest

The highest tagged major version is .

Published: Apr 17, 2020 | License: MIT | Module:


type BlockEligibilityValidator

type BlockEligibilityValidator struct {
	// contains filtered or unexported fields

BlockEligibilityValidator holds all the dependencies for validating block eligibility.

func NewBlockEligibilityValidator

func NewBlockEligibilityValidator(committeeSize, genesisActiveSetSize uint32, layersPerEpoch uint16, activationDb activationDB,
	beaconProvider *EpochBeaconProvider, validateVRF VRFValidationFunction, log log.Log) *BlockEligibilityValidator

NewBlockEligibilityValidator returns a new BlockEligibilityValidator.

func (BlockEligibilityValidator) BlockSignedAndEligible

func (v BlockEligibilityValidator) BlockSignedAndEligible(block *types.Block) (bool, error)

BlockSignedAndEligible checks that a given block is signed and eligible. It returns true with no error or false and an error that explains why validation failed.

type EpochBeaconProvider

type EpochBeaconProvider struct{}

EpochBeaconProvider holds all the dependencies for generating an epoch beacon. There are currently none.

func (*EpochBeaconProvider) GetBeacon

func (p *EpochBeaconProvider) GetBeacon(epochNumber types.EpochID) []byte

GetBeacon returns a beacon given an epoch ID. The current implementation returns the epoch ID in byte format.

type MinerBlockOracle

type MinerBlockOracle struct {
	// contains filtered or unexported fields

MinerBlockOracle is the oracle that provides block eligibility proofs for the miner.

func NewMinerBlockOracle

func NewMinerBlockOracle(committeeSize uint32, genesisActiveSetSize uint32, layersPerEpoch uint16, atxDB activationDB, beaconProvider *EpochBeaconProvider, vrfSigner signer, nodeID types.NodeID, isSynced func() bool, log log.Log) *MinerBlockOracle

NewMinerBlockOracle returns a new MinerBlockOracle.

func (*MinerBlockOracle) BlockEligible

func (bo *MinerBlockOracle) BlockEligible(layerID types.LayerID) (types.ATXID, []types.BlockEligibilityProof, error)

BlockEligible returns the ATXID and list of block eligibility proofs for the given layer. It caches proofs for a single epoch and only refreshes the cache if eligibility is queried for a different epoch.

func (*MinerBlockOracle) GetEligibleLayers

func (bo *MinerBlockOracle) GetEligibleLayers() []types.LayerID

GetEligibleLayers returns a list of layers in which the miner is eligible for at least one block. The list is returned in arbitrary order.

type VRFValidationFunction

type VRFValidationFunction func(message, signature, publicKey []byte) (bool, error)

VRFValidationFunction is the VRF validation function.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier