beacon

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0, MIT Imports: 12 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeaconEntriesForBlock

func BeaconEntriesForBlock(ctx context.Context, bSchedule Schedule, nv network.Version, epoch abi.ChainEpoch, parentEpoch abi.ChainEpoch, prev types.BeaconEntry) ([]types.BeaconEntry, error)

func ValidateBlockValues

func ValidateBlockValues(bSchedule Schedule, nv network.Version, h *types.BlockHeader, parentEpoch abi.ChainEpoch,
	prevEntry types.BeaconEntry) error

Types

type BeaconPoint added in v0.7.0

type BeaconPoint struct {
	Start  abi.ChainEpoch
	Beacon RandomBeacon
}

type MockBeacon added in v1.29.2

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

MockBeacon assumes that filecoin rounds are 1:1 mapped with the beacon rounds

func (*MockBeacon) Entry added in v1.29.2

func (mb *MockBeacon) Entry(ctx context.Context, index uint64) <-chan Response

func (*MockBeacon) IsChained added in v1.29.2

func (mb *MockBeacon) IsChained() bool

func (*MockBeacon) MaxBeaconRoundForEpoch added in v1.29.2

func (mb *MockBeacon) MaxBeaconRoundForEpoch(nv network.Version, epoch abi.ChainEpoch) uint64

func (*MockBeacon) RoundTime added in v1.29.2

func (mb *MockBeacon) RoundTime() time.Duration

func (*MockBeacon) SetMaxIndex added in v1.29.2

func (mb *MockBeacon) SetMaxIndex(maxIndex int, blockTillNoneWaiting bool)

SetMaxIndex sets the maximum index that the beacon will return, and optionally blocks until all waiting requests are satisfied. If maxIndex is -1, the beacon will return entries indefinitely.

func (*MockBeacon) VerifyEntry added in v1.29.2

func (mb *MockBeacon) VerifyEntry(from types.BeaconEntry, _prevEntrySig []byte) error

func (*MockBeacon) WaitingOnEntryCount added in v1.29.2

func (mb *MockBeacon) WaitingOnEntryCount() int

WaitingOnEntryCount returns the number of requests that are currently waiting for an entry. Where maxIndex has not been set, this will always return 0 as beacon entries are generated on demand.

type RandomBeacon

type RandomBeacon interface {
	Entry(context.Context, uint64) <-chan Response
	VerifyEntry(entry types.BeaconEntry, prevEntrySig []byte) error
	MaxBeaconRoundForEpoch(network.Version, abi.ChainEpoch) uint64
	IsChained() bool
}

RandomBeacon represents a system that provides randomness to Lotus. Other components interrogate the RandomBeacon to acquire randomness that's valid for a specific chain epoch. Also to verify beacon entries that have been posted on chain.

func NewMockBeacon

func NewMockBeacon(interval time.Duration) RandomBeacon

type Response

type Response struct {
	Entry types.BeaconEntry
	Err   error
}

type Schedule added in v0.7.0

type Schedule []BeaconPoint

func (Schedule) BeaconForEpoch added in v0.7.0

func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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