consensus

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: Apache-2.0, MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DRANDEpochLookback = 2

DRANDEpochLookback is the past filecoin epoch offset at which DRAND entries in that epoch should be included in a block.

View Source
const ElectionPowerTableLookback = 10

ElectionPowerTableLookback is the past epoch offset for reading the election power values

View Source
const WinningPoStSectorSetLookback = 10

WinningPoStSectorSetLookback is the past epoch offset for reading the winning post sector set

Variables

View Source
var (
	// ErrStateRootMismatch is returned when the computed state root doesn't match the expected result.
	ErrStateRootMismatch = errors.New("blocks state root does not match computed result")
	// ErrUnorderedTipSets is returned when weight and minticket are the same between two tipsets.
	ErrUnorderedTipSets = errors.New("trying to order two identical tipsets")
	// ErrReceiptRootMismatch is returned when the block's receipt root doesn't match the receipt root computed for the parent tipset.
	ErrReceiptRootMismatch = errors.New("blocks receipt root does not match parent tip set")
)

Functions

func MakeFakePoStsForTest

func MakeFakePoStsForTest() []block.PoStProof

MakeFakePoStForTest creates a fake post

func MakeFakeTicketForTest

func MakeFakeTicketForTest() block.Ticket

MakeFakeTicketForTest creates a fake ticket

func MakeFakeVRFProofForTest

func MakeFakeVRFProofForTest() []byte

MakeFakeVRFProofForTest creates a fake election proof

func RequireFakeSectorInfos

func RequireFakeSectorInfos(t *testing.T, numSectors uint64) []abi.SectorInfo

NFakeSectorInfos returns numSectors fake sector infos

func RequireNewTipSet

func RequireNewTipSet(require *require.Assertions, blks ...*block.Block) block.TipSet

RequireNewTipSet instantiates and returns a new tipset of the given blocks and requires that the setup validation succeed.

Types

type ApplicationResult

type ApplicationResult struct {
	Receipt        *vm.MessageReceipt
	ExecutionError error
}

ApplicationResult contains the result of successfully applying one message. ExecutionError might be set and the message can still be applied successfully. See ApplyMessage() for details.

type ApplyMessageResult

type ApplyMessageResult struct {
	ApplicationResult        // Application-level result, if error is nil.
	Failure            error // Failure to apply the message
	FailureIsPermanent bool  // Whether failure is permanent, has no chance of succeeding later.
}

ApplyMessageResult is the result of applying a single message.

type BlockSemanticValidator

type BlockSemanticValidator interface {
	ValidateSemantic(ctx context.Context, child *block.Block, parents block.TipSet) error
}

BlockSemanticValidator defines an interface used to validate a blocks semantics.

type BlockSyntaxValidator

type BlockSyntaxValidator interface {
	ValidateSyntax(ctx context.Context, blk *block.Block) error
}

BlockSyntaxValidator defines an interface used to validate a blocks syntax.

type BlockValidator

type BlockValidator interface {
	BlockSemanticValidator
	BlockSyntaxValidator
}

BlockValidator defines an interface used to validate a blocks syntax and semantics.

type ChainRandomness

type ChainRandomness interface {
	SampleChainRandomness(ctx context.Context, head block.TipSetKey, tag crypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
}

type ChainSampler

type ChainSampler interface {
	SampleTicket(ctx context.Context, head block.TipSetKey, epoch abi.ChainEpoch) (block.Ticket, error)
}

type ChainSelector

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

ChainSelector weighs and compares chains.

func NewChainSelector

func NewChainSelector(cs cbor.IpldStore, state StateViewer, gCid cid.Cid) *ChainSelector

NewChainSelector is the constructor for chain selection module.

func (*ChainSelector) IsHeavier

func (c *ChainSelector) IsHeavier(ctx context.Context, a, b block.TipSet, aStateID, bStateID cid.Cid) (bool, error)

IsHeavier returns true if tipset a is heavier than tipset b, and false vice versa. In the rare case where two tipsets have the same weight ties are broken by taking the tipset with the smallest ticket. In the event that tickets are the same, IsHeavier will break ties by comparing the concatenation of block cids in the tipset. TODO BLOCK CID CONCAT TIE BREAKER IS NOT IN THE SPEC AND SHOULD BE EVALUATED BEFORE GETTING TO PRODUCTION.

func (*ChainSelector) Weight

func (c *ChainSelector) Weight(ctx context.Context, ts block.TipSet, pStateID cid.Cid) (fbig.Int, error)

Weight returns the EC weight of this TipSet as a filecoin big int.

type DefaultBlockValidator

type DefaultBlockValidator struct {
	clock.ChainEpochClock
}

DefaultBlockValidator implements the BlockValidator interface.

func NewDefaultBlockValidator

func NewDefaultBlockValidator(c clock.ChainEpochClock) *DefaultBlockValidator

NewDefaultBlockValidator returns a new DefaultBlockValidator. It uses `blkTime` to validate blocks and uses the DefaultBlockValidationClock.

func (*DefaultBlockValidator) NotFutureBlock

func (dv *DefaultBlockValidator) NotFutureBlock(b *block.Block) error

NotFutureBlock errors if the block belongs to a future epoch according to the chain clock.

func (*DefaultBlockValidator) TimeMatchesEpoch

func (dv *DefaultBlockValidator) TimeMatchesEpoch(b *block.Block) error

TimeMatchesEpoch errors if the epoch and time don't match according to the chain clock.

func (*DefaultBlockValidator) ValidateSemantic

func (dv *DefaultBlockValidator) ValidateSemantic(ctx context.Context, child *block.Block, parents block.TipSet) error

ValidateSemantic checks validation conditions on a header that can be checked given only the parent header.

func (*DefaultBlockValidator) ValidateSyntax

func (dv *DefaultBlockValidator) ValidateSyntax(ctx context.Context, blk *block.Block) error

ValidateSyntax validates a single block is correctly formed. TODO this is an incomplete implementation #3277

type DefaultMessageSyntaxValidator

type DefaultMessageSyntaxValidator struct{}

DefaultMessageSyntaxValidator checks basic conditions independent of current state

func NewMessageSyntaxValidator

func NewMessageSyntaxValidator() *DefaultMessageSyntaxValidator

func (*DefaultMessageSyntaxValidator) ValidateSignedMessageSyntax

func (v *DefaultMessageSyntaxValidator) ValidateSignedMessageSyntax(ctx context.Context, smsg *types.SignedMessage) error

ValidateSignedMessageSyntax validates signed message syntax and state-independent invariants. Used for incoming messages over pubsub and secp messages included in blocks.

func (*DefaultMessageSyntaxValidator) ValidateUnsignedMessageSyntax

func (v *DefaultMessageSyntaxValidator) ValidateUnsignedMessageSyntax(ctx context.Context, msg *types.UnsignedMessage) error

ValidateUnsignedMessageSyntax validates unisigned message syntax and state-independent invariants. Used for bls messages included in blocks.

type DefaultProcessor

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

DefaultProcessor handles all block processing.

func NewConfiguredProcessor

func NewConfiguredProcessor(actors vm.ActorCodeLoader, syscalls vm.SyscallsImpl, rnd ChainRandomness) *DefaultProcessor

NewConfiguredProcessor creates a default processor with custom validation and rewards.

func NewDefaultProcessor

func NewDefaultProcessor(syscalls vm.SyscallsImpl, rnd ChainRandomness) *DefaultProcessor

NewDefaultProcessor creates a default processor from the given state tree and vms.

func (*DefaultProcessor) ProcessTipSet

func (p *DefaultProcessor) ProcessTipSet(ctx context.Context, st state.Tree, vms vm.Storage, ts block.TipSet, msgs []vm.BlockMessagesInfo) (results []vm.MessageReceipt, err error)

ProcessTipSet computes the state transition specified by the messages in all blocks in a TipSet.

type DefaultStateViewer

type DefaultStateViewer struct {
	*appstate.Viewer
}

DefaultStateViewer a state viewer to the power state view interface.

func AsDefaultStateViewer

func AsDefaultStateViewer(v *appstate.Viewer) DefaultStateViewer

AsDefaultStateViewer adapts a state viewer to a power state viewer.

func (*DefaultStateViewer) FaultStateView

func (v *DefaultStateViewer) FaultStateView(root cid.Cid) FaultStateView

FaultStateView returns a fault state view for a state root.

func (*DefaultStateViewer) PowerStateView

func (v *DefaultStateViewer) PowerStateView(root cid.Cid) PowerStateView

PowerStateView returns a power state view for a state root.

type EPoStVerifier

type EPoStVerifier interface {
	// VerifyWinningPoSt verifies an election PoSt.
	VerifyWinningPoSt(ctx context.Context, post abi.WinningPoStVerifyInfo) (bool, error)
	GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error)
}

Interface to PoSt verification.

type ElectionMachine

type ElectionMachine struct{}

ElectionMachine generates and validates PoSt partial tickets and PoSt proofs.

func NewElectionMachine

func NewElectionMachine(_ ChainRandomness) *ElectionMachine

func (ElectionMachine) GenerateElectionProof

func (em ElectionMachine) GenerateElectionProof(ctx context.Context, entry *drand.Entry,
	epoch abi.ChainEpoch, miner address.Address, worker address.Address, signer types.Signer) (crypto.VRFPi, error)

func (ElectionMachine) GenerateWinningPoSt

func (em ElectionMachine) GenerateWinningPoSt(ctx context.Context, entry *drand.Entry, epoch abi.ChainEpoch, ep postgenerator.PoStGenerator, maddr address.Address, sectors SectorsStateView) ([]block.PoStProof, error)

GenerateWinningPoSt creates a PoSt proof over the input miner ID and sector infos.

func (ElectionMachine) IsWinner

func (em ElectionMachine) IsWinner(challengeTicket []byte, minerPower, networkPower abi.StoragePower) bool

IsWinner returns true if the input challengeTicket wins the election

func (ElectionMachine) VerifyElectionProof

func (em ElectionMachine) VerifyElectionProof(_ context.Context, entry *drand.Entry, epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, vrfProof crypto.VRFPi) error

func (ElectionMachine) VerifyWinningPoSt

func (em ElectionMachine) VerifyWinningPoSt(ctx context.Context, ep EPoStVerifier, seedEntry *drand.Entry, epoch abi.ChainEpoch, proofs []block.PoStProof, mIDAddr address.Address, sectors SectorsStateView) (bool, error)

VerifyWinningPoSt verifies a Winning PoSt proof.

type ElectionValidator

type ElectionValidator interface {
	IsWinner(challengeTicket []byte, minerPower, networkPower abi.StoragePower) bool
	VerifyElectionProof(ctx context.Context, entry *drand.Entry, epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, vrfProof crypto.VRFPi) error
	VerifyWinningPoSt(ctx context.Context, ep EPoStVerifier, seedEntry *drand.Entry, epoch abi.ChainEpoch, proofs []block.PoStProof, mIDAddr address.Address, sectors SectorsStateView) (bool, error)
}

ElectionValidator validates that an election fairly produced a winner.

type Expected

type Expected struct {
	// ElectionValidator validates election proofs.
	ElectionValidator

	// TicketValidator validates ticket generation
	TicketValidator
	// contains filtered or unexported fields
}

Expected implements expected consensus.

func NewExpected

func NewExpected(cs cbor.IpldStore, bs blockstore.Blockstore, processor Processor, state StateViewer, bt time.Duration,
	ev ElectionValidator, tv TicketValidator, pv EPoStVerifier, chainState chainReader, clock clock.ChainEpochClock, drand drand.IFace) *Expected

NewExpected is the constructor for the Expected consenus.Protocol module.

func (*Expected) BlockTime

func (c *Expected) BlockTime() time.Duration

BlockTime returns the block time used by the consensus protocol.

func (*Expected) RunStateTransition

func (c *Expected) RunStateTransition(ctx context.Context, ts block.TipSet, blsMessages [][]*types.UnsignedMessage, secpMessages [][]*types.SignedMessage,
	parentWeight big.Int, parentStateRoot cid.Cid, parentReceiptRoot cid.Cid) (root cid.Cid, receipts []vm.MessageReceipt, err error)

RunStateTransition applies the messages in a tipset to a state, and persists that new state. It errors if the tipset was not mined according to the EC rules, or if any of the messages in the tipset results in an error.

type FailingElectionValidator

type FailingElectionValidator struct{}

FailingElectionValidator marks all election candidates as invalid

func (*FailingElectionValidator) IsWinner

func (fev *FailingElectionValidator) IsWinner(challengeTicket []byte, minerPower, networkPower abi.StoragePower) bool

func (*FailingElectionValidator) VerifyElectionProof

func (*FailingElectionValidator) VerifyWinningPoSt

func (fev *FailingElectionValidator) VerifyWinningPoSt(ctx context.Context, ep EPoStVerifier, seedEntry *drand.Entry, epoch abi.ChainEpoch, proofs []block.PoStProof, mIDAddr address.Address, sectors SectorsStateView) (bool, error)

type FailingTicketValidator

type FailingTicketValidator struct{}

FailingTicketValidator marks all tickets as invalid

func (*FailingTicketValidator) IsValidTicket

func (ftv *FailingTicketValidator) IsValidTicket(ctx context.Context, base block.TipSetKey, entry *drand.Entry, newPeriod bool,
	epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, ticket block.Ticket) error

IsValidTicket always returns false

type FakeChainRandomness

type FakeChainRandomness struct {
	Seed uint
}

FakeChainRandomness generates deterministic values that are a function of a seed and the provided tag, epoch, and entropy (but *not* the chain head key).

func (*FakeChainRandomness) SampleChainRandomness

func (s *FakeChainRandomness) SampleChainRandomness(_ context.Context, _ block.TipSetKey, tag acrypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)

type FakeConsensusStateViewer

type FakeConsensusStateViewer struct {
	Views map[cid.Cid]*state.FakeStateView
}

FakeConsensusStateViewer is a fake power state viewer.

func (*FakeConsensusStateViewer) FaultStateView

func (f *FakeConsensusStateViewer) FaultStateView(root cid.Cid) FaultStateView

FaultStateView returns the state view for a root.

func (*FakeConsensusStateViewer) PowerStateView

func (f *FakeConsensusStateViewer) PowerStateView(root cid.Cid) PowerStateView

PowerStateView returns the state view for a root.

type FakeElectionMachine

type FakeElectionMachine struct{}

FakeElectionMachine generates fake election proofs and verifies all proofs

func (*FakeElectionMachine) GenerateElectionProof

GenerateElectionProof returns a fake randomness

func (*FakeElectionMachine) GenerateWinningPoSt

func (fem *FakeElectionMachine) GenerateWinningPoSt(ctx context.Context, entry *drand.Entry, epoch abi.ChainEpoch, ep postgenerator.PoStGenerator, maddr address.Address, sectors SectorsStateView) ([]block.PoStProof, error)

GenerateEPoSt returns a fake post proof

func (*FakeElectionMachine) IsWinner

func (fem *FakeElectionMachine) IsWinner(challengeTicket []byte, minerPower, networkPower abi.StoragePower) bool

func (*FakeElectionMachine) VerifyElectionProof

func (*FakeElectionMachine) VerifyWinningPoSt

func (fem *FakeElectionMachine) VerifyWinningPoSt(ctx context.Context, ep EPoStVerifier, seedEntry *drand.Entry, epoch abi.ChainEpoch, proofs []block.PoStProof, mIDAddr address.Address, sectors SectorsStateView) (bool, error)

type FakeMessageValidator

type FakeMessageValidator struct{}

FakeMessageValidator is a validator that doesn't validate to simplify message creation in tests.

func (*FakeMessageValidator) ValidateSignedMessageSyntax

func (mv *FakeMessageValidator) ValidateSignedMessageSyntax(ctx context.Context, smsg *types.SignedMessage) error

func (*FakeMessageValidator) ValidateUnsignedMessageSyntax

func (mv *FakeMessageValidator) ValidateUnsignedMessageSyntax(ctx context.Context, msg *types.UnsignedMessage) error

type FakeSampler

type FakeSampler struct {
	Seed uint
}

func (*FakeSampler) SampleTicket

func (s *FakeSampler) SampleTicket(_ context.Context, _ block.TipSetKey, epoch abi.ChainEpoch) (block.Ticket, error)

type FakeTicketMachine

type FakeTicketMachine struct{}

FakeTicketMachine generates fake tickets and verifies all tickets

func (*FakeTicketMachine) IsValidTicket

func (ftm *FakeTicketMachine) IsValidTicket(ctx context.Context, base block.TipSetKey, entry *drand.Entry, newPeriod bool,
	epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, ticket block.Ticket) error

IsValidTicket always returns true

func (*FakeTicketMachine) MakeTicket

func (ftm *FakeTicketMachine) MakeTicket(ctx context.Context, base block.TipSetKey, epoch abi.ChainEpoch, miner address.Address, entry *drand.Entry, newPeriod bool, worker address.Address, signer types.Signer) (block.Ticket, error)

MakeTicket returns a fake ticket

type FaultStateView

type FaultStateView interface {
	MinerExists(ctx context.Context, maddr addr.Address) (bool, error)
}

FaultStateView is a view of chain state for adjustment of miner power claims based on changes since the power state's lookback (primarily, the miner ceasing to be registered).

type MessagePenaltyChecker

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

MessageSelectionChecker checks for miner penalties on signed messages

func NewMessagePenaltyChecker

func NewMessagePenaltyChecker(api penaltyCheckerAPI) *MessagePenaltyChecker

func (*MessagePenaltyChecker) PenaltyCheck

func (v *MessagePenaltyChecker) PenaltyCheck(ctx context.Context, msg *types.UnsignedMessage) error

PenaltyCheck checks that a message is semantically valid for processing without causing miner penality. It treats any miner penalty condition as an error.

type MessageSignatureValidator

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

MessageSignatureValidator validates message signatures

func NewMessageSignatureValidator

func NewMessageSignatureValidator(api signatureValidatorAPI) *MessageSignatureValidator

func (*MessageSignatureValidator) Validate

Validate validates the signed message signature. Errors probably mean the

validation failed, but possibly indicate a failure to retrieve state.

type MessageSyntaxValidator

type MessageSyntaxValidator interface {
	ValidateSignedMessageSyntax(ctx context.Context, smsg *types.SignedMessage) error
	ValidateUnsignedMessageSyntax(ctx context.Context, msg *types.UnsignedMessage) error
}

MessageSyntaxValidator defines an interface used to validate a message's syntax.

type PowerStateView

type PowerStateView interface {
	state.AccountStateView
	MinerSectorConfiguration(ctx context.Context, maddr addr.Address) (*state.MinerSectorConfiguration, error)
	MinerControlAddresses(ctx context.Context, maddr addr.Address) (owner, worker addr.Address, err error)
	MinerSectorStates(ctx context.Context, maddr addr.Address) (*state.MinerSectorStates, error)
	MinerGetSector(ctx context.Context, maddr addr.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, bool, error)
	PowerNetworkTotal(ctx context.Context) (*state.NetworkPower, error)
	MinerClaimedPower(ctx context.Context, miner addr.Address) (raw, qa abi.StoragePower, err error)
}

PowerStateView is a view of chain state for election computations, typically at some lookback from the immediate parent state. This type isn't doing much that the state view doesn't already do, consider removing it.

type PowerTableView

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

An interface to the network power table for elections. Elections use the quality-adjusted power, rather than raw byte power.

func NewPowerTableView

func NewPowerTableView(state PowerStateView, faultState FaultStateView) PowerTableView

func (PowerTableView) MinerClaimedPower

func (v PowerTableView) MinerClaimedPower(ctx context.Context, mAddr addr.Address) (abi.StoragePower, error)

Returns a miner's claimed quality-adjusted power.

func (PowerTableView) NetworkTotalPower

func (v PowerTableView) NetworkTotalPower(ctx context.Context) (abi.StoragePower, error)

Returns the network's total quality-adjusted power.

func (PowerTableView) SignerAddress

func (v PowerTableView) SignerAddress(ctx context.Context, a addr.Address) (addr.Address, error)

SignerAddress returns the public key address associated with the given address.

func (PowerTableView) WorkerAddr

func (v PowerTableView) WorkerAddr(ctx context.Context, mAddr addr.Address) (addr.Address, error)

WorkerAddr returns the worker address for a miner actor.

type Processor

type Processor interface {
	// ProcessTipSet processes all messages in a tip set.
	ProcessTipSet(context.Context, state.Tree, vm.Storage, block.TipSet, []vm.BlockMessagesInfo) ([]vm.MessageReceipt, error)
}

A Processor processes all the messages in a block or tip set.

type Protocol

type Protocol interface {
	// RunStateTransition returns the state root CID resulting from applying the input ts to the
	// prior `stateID`.  It returns an error if the transition is invalid.
	RunStateTransition(ctx context.Context, ts block.TipSet, blsMsgs [][]*types.UnsignedMessage, secpMsgs [][]*types.SignedMessage, parentWeight fbig.Int, parentStateRoot cid.Cid, parentReceiptRoot cid.Cid) (cid.Cid, []vm.MessageReceipt, error)

	// BlockTime returns the block time used by the consensus protocol.
	BlockTime() time.Duration
}

Protocol is an interface defining a blockchain consensus protocol. The methods here were arrived at after significant work fitting consensus into the system and the implementation level. The method set is not necessarily the most theoretically obvious or pleasing and should not be considered finalized.

type SectorsStateView added in v0.6.3

type SectorsStateView interface {
	MinerSectorConfiguration(ctx context.Context, maddr address.Address) (*state.MinerSectorConfiguration, error)
	MinerSectorStates(ctx context.Context, maddr address.Address) (*state.MinerSectorStates, error)
	MinerGetSector(ctx context.Context, maddr address.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, bool, error)
}

type StateViewer

type StateViewer interface {
	PowerStateView(root cid.Cid) PowerStateView
	FaultStateView(root cid.Cid) FaultStateView
}

StateViewer provides views into the chain state.

type SyntaxValidator

type SyntaxValidator interface {
	BlockSyntaxValidator
	MessageSyntaxValidator
}

SyntaxValidator defines and interface used to validate block's syntax and the syntax of constituent messages

type TestElectionPoster

type TestElectionPoster struct{}

TestElectionPoster generates and verifies electoin PoSts

func (*TestElectionPoster) GenerateWinningPoSt

func (ep *TestElectionPoster) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error)

GenerateWinningPoSt creates a post proof for a winning block

func (*TestElectionPoster) GenerateWinningPoStSectorChallenge

func (ep *TestElectionPoster) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error)

GenerateWinningPoStSectorChallenge determines the challenges used to create a winning PoSt.

func (*TestElectionPoster) VerifyWinningPoSt

func (ep *TestElectionPoster) VerifyWinningPoSt(_ context.Context, _ abi.WinningPoStVerifyInfo) (bool, error)

VerifyWinningPoSt returns the validity of the input PoSt proof

type TicketMachine

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

TicketMachine uses a VRF and VDF to generate deterministic, unpredictable and time delayed tickets and validates these tickets.

func NewTicketMachine

func NewTicketMachine(sampler ChainSampler) *TicketMachine

func (TicketMachine) IsValidTicket

func (tm TicketMachine) IsValidTicket(ctx context.Context, base block.TipSetKey, entry *drand.Entry, newPeriod bool,
	epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, ticket block.Ticket) error

IsValidTicket verifies that the ticket's proof of randomness is valid with respect to its parent.

func (TicketMachine) MakeTicket

func (tm TicketMachine) MakeTicket(ctx context.Context, base block.TipSetKey, epoch abi.ChainEpoch, miner address.Address, entry *drand.Entry, newPeriod bool, worker address.Address, signer types.Signer) (block.Ticket, error)

MakeTicket creates a new ticket from a chain and target epoch by running a verifiable randomness function on the prior ticket.

type TicketValidator

type TicketValidator interface {
	IsValidTicket(ctx context.Context, base block.TipSetKey, entry *drand.Entry, newPeriod bool, epoch abi.ChainEpoch, miner address.Address, workerSigner address.Address, ticket block.Ticket) error
}

TicketValidator validates that an input ticket is valid.

type WrappedSyntaxValidator

type WrappedSyntaxValidator struct {
	BlockSyntaxValidator
	MessageSyntaxValidator
}

WrappedSyntaxValidator implements syntax validator interface

Jump to

Keyboard shortcuts

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