Documentation ¶
Index ¶
- func BeaconEntriesForBlock(ctx context.Context, bSchedule Schedule, epoch abi.ChainEpoch, ...) ([]types.BeaconEntry, error)
- func ValidateBlockValues(bSchedule Schedule, h *types.BlockHeader, parentEpoch abi.ChainEpoch, ...) error
- type BeaconPoint
- type DrandBeacon
- type DrandHTTPClient
- type RandomBeacon
- type Response
- type Schedule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeaconEntriesForBlock ¶
func BeaconEntriesForBlock(ctx context.Context, bSchedule Schedule, epoch abi.ChainEpoch, parentEpoch abi.ChainEpoch, prev types.BeaconEntry) ([]types.BeaconEntry, error)
func ValidateBlockValues ¶
func ValidateBlockValues(bSchedule Schedule, h *types.BlockHeader, parentEpoch abi.ChainEpoch, prevEntry *types.BeaconEntry) error
Types ¶
type BeaconPoint ¶
type BeaconPoint struct { Start abi.ChainEpoch Beacon RandomBeacon }
type DrandBeacon ¶
type DrandBeacon struct {
// contains filtered or unexported fields
}
DrandBeacon connects Lotus with a drand network in order to provide randomness to the system in a way that's aligned with Filecoin rounds/epochs.
We connect to drand peers via their public HTTP endpoints. The peers are enumerated in the drandServers variable.
The root trust for the Drand chain is configured from build.DrandChain.
func NewDrandBeacon ¶
func NewDrandBeacon(genTimeStamp, interval uint64, config cfg.DrandConf) (*DrandBeacon, error)
func (*DrandBeacon) Entry ¶
func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan Response
func (*DrandBeacon) MaxBeaconRoundForEpoch ¶
func (db *DrandBeacon) MaxBeaconRoundForEpoch(filEpoch abi.ChainEpoch) uint64
func (*DrandBeacon) VerifyEntry ¶
func (db *DrandBeacon) VerifyEntry(curr types.BeaconEntry, prev types.BeaconEntry) error
type DrandHTTPClient ¶
type DrandHTTPClient interface {
SetUserAgent(string)
}
DrandHTTPClient interface overrides the user agent used by drand
type RandomBeacon ¶
type RandomBeacon interface { Entry(context.Context, uint64) <-chan Response VerifyEntry(types.BeaconEntry, types.BeaconEntry) error MaxBeaconRoundForEpoch(abi.ChainEpoch) uint64 }
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 ¶
type Schedule []BeaconPoint
func DrandConfigSchedule ¶
func NewMockSchedule ¶
func (Schedule) BeaconForEpoch ¶
func (bs Schedule) BeaconForEpoch(e abi.ChainEpoch) RandomBeacon
Click to show internal directories.
Click to hide internal directories.