Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeVRF(ctx context.Context, sign SignFunc, worker address.Address, sigInput []byte) ([]byte, error)
- func DefaultProofVerifier() ffiwrapper.Verifier
- func GetMinerWorkerRaw(ctx context.Context, stateID cid.Cid, bstore blockstore.Blockstore, ...) (address.Address, error)
- func IsRoundWinner(ctx context.Context, ts *block.TipSet, round abi.ChainEpoch, ...) (*block.ElectionProof, error)
- func MakeFakeTicketForTest() block.Ticket
- func MakeFakeVRFProofForTest() []byte
- func RequireNewTipSet(require *require.Assertions, blks ...*block.Block) *block.TipSet
- func VerifyElectionPoStVRF(ctx context.Context, worker address.Address, rand []byte, evrf []byte) error
- func VerifyVRF(ctx context.Context, worker address.Address, vrfBase, vrfproof []byte) error
- type ApplicationResult
- type ApplyMessageResult
- type BlockSemanticValidator
- type BlockSyntaxValidator
- type BlockValidator
- type ChainRandomness
- type ChainSampler
- type ChainSelector
- type DefaultBlockValidator
- func (dv *DefaultBlockValidator) NotFutureBlock(b *block.Block) error
- func (dv *DefaultBlockValidator) ValidateHeaderSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error
- func (dv *DefaultBlockValidator) ValidateMessagesSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error
- func (dv *DefaultBlockValidator) ValidateSyntax(ctx context.Context, blk *block.Block) (err error)
- type DefaultMessageSyntaxValidator
- type DefaultProcessor
- func (p *DefaultProcessor) ProcessImplicitMessage(ctx context.Context, msg *types.UnsignedMessage, vmOption vm.VmOption) (ret *vm.Ret, err error)
- func (p *DefaultProcessor) ProcessTipSet(ctx context.Context, parent, ts *block.TipSet, msgs []block.BlockMessagesInfo, ...) (cid.Cid, []types.MessageReceipt, error)
- func (p *DefaultProcessor) ProcessUnsignedMessage(ctx context.Context, msg types.ChainMsg, vmOption vm.VmOption) (ret *vm.Ret, err error)
- type DefaultStateViewer
- type Expected
- func (c *Expected) BlockTime() time.Duration
- func (c *Expected) Call(ctx context.Context, msg *types.UnsignedMessage, ts *block.TipSet) (*vm.Ret, error)
- func (c *Expected) CallWithGas(ctx context.Context, msg *types.UnsignedMessage, priorMsgs []types.ChainMsg, ...) (*vm.Ret, error)
- func (c *Expected) GetLookbackTipSetForRound(ctx context.Context, ts *block.TipSet, round abi.ChainEpoch) (*block.TipSet, cid.Cid, error)
- func (c *Expected) MinerEligibleToMine(ctx context.Context, addr address.Address, parentStateRoot cid.Cid, ...) (bool, error)
- func (c *Expected) RunStateTransition(ctx context.Context, ts *block.TipSet, parentStateRoot cid.Cid) (cid.Cid, []types.MessageReceipt, error)
- func (c *Expected) ValidateBlockBeacon(blk *block.Block, parentEpoch abi.ChainEpoch, prevEntry *block.BeaconEntry) error
- func (c *Expected) ValidateBlockWinner(ctx context.Context, waddr address.Address, lbTs *block.TipSet, lbRoot cid.Cid, ...) error
- func (c *Expected) ValidateMining(ctx context.Context, parent, ts *block.TipSet, parentWeight big.Int, ...) error
- func (c *Expected) ValidateMsgMeta(fblk *block.FullBlock) error
- func (c *Expected) VerifyWinningPoStProof(ctx context.Context, nv network.Version, blk *block.Block, ...) error
- type FailingTicketValidator
- type FakeChainRandomness
- type FakeConsensusStateViewer
- type FakeMessageValidator
- type FakeSampler
- type FakeTicketMachine
- type HeadRandomness
- type MessagePenaltyChecker
- type MessageSignatureValidator
- type MessageSyntaxValidator
- type MiningCheckAPI
- type Processor
- type ProofVerifier
- type Protocol
- type Randness
- type SectorsStateView
- type SignFunc
- type StateViewer
- type SyntaxValidator
- type TestElectionPoster
- type TicketMachine
- type TicketValidator
- type WrappedSyntaxValidator
Constants ¶
const AllowableClockDriftSecs = uint64(1)
const WRatioDen = uint64(2)
const WRatioNum = int64(1)
todo gather const variable
Variables ¶
var ( ErrExpensiveFork = errors.New("refusing explicit call due to state fork at epoch") // 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") )
var ErrTemporal = errors.New("temporal error")
Functions ¶
func ComputeVRF ¶
func DefaultProofVerifier ¶
func DefaultProofVerifier() ffiwrapper.Verifier
func GetMinerWorkerRaw ¶
func GetMinerWorkerRaw(ctx context.Context, stateID cid.Cid, bstore blockstore.Blockstore, addr address.Address) (address.Address, error)
todo to be a member function ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
func IsRoundWinner ¶
func IsRoundWinner(ctx context.Context, ts *block.TipSet, round abi.ChainEpoch, miner address.Address, brand block.BeaconEntry, mbi *block.MiningBaseInfo, a MiningCheckAPI) (*block.ElectionProof, error)
func MakeFakeTicketForTest ¶
MakeFakeTicketForTest creates a fake ticket
func MakeFakeVRFProofForTest ¶
func MakeFakeVRFProofForTest() []byte
MakeFakeVRFProofForTest creates a fake election proof
func RequireNewTipSet ¶
RequireNewTipSet instantiates and returns a new tipset of the given blocks and requires that the setup validation succeed.
func VerifyElectionPoStVRF ¶
Types ¶
type ApplicationResult ¶
type ApplicationResult struct { Receipt *types.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 { ValidateHeaderSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error ValidateMessagesSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error }
BlockSemanticValidator defines an interface used to validate a blocks semantics.
type BlockSyntaxValidator ¶
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) ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) }
type ChainSampler ¶
type ChainSelector ¶
type ChainSelector struct {
// contains filtered or unexported fields
}
ChainSelector weighs and compares chains.
func NewChainSelector ¶
func NewChainSelector(cs cbor.IpldStore, state StateViewer) *ChainSelector
NewChainSelector is the constructor for Chain selection module.
func (*ChainSelector) IsHeavier ¶
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.
type DefaultBlockValidator ¶
type DefaultBlockValidator struct { clock.ChainEpochClock // contains filtered or unexported fields }
DefaultBlockValidator implements the BlockValidator interface.
func NewDefaultBlockValidator ¶
func NewDefaultBlockValidator(c clock.ChainEpochClock, m messageStore, cs chainState, gasPriceSchedule *gas.PricesSchedule) *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) ValidateHeaderSemantic ¶
func (dv *DefaultBlockValidator) ValidateHeaderSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error
ValidateHeaderSemantic checks validation conditions on a header that can be checked given only the parent header.
func (*DefaultBlockValidator) ValidateMessagesSemantic ¶
func (dv *DefaultBlockValidator) ValidateMessagesSemantic(ctx context.Context, child *block.Block, parents *block.TipSet) error
ValidateFullSemantic checks validation conditions on a block's messages that don't require message execution.
func (*DefaultBlockValidator) ValidateSyntax ¶
ValidateSyntax validates a single block is correctly formed.
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) *DefaultProcessor
NewConfiguredProcessor creates a default processor with custom validation and rewards.
func NewDefaultProcessor ¶
func NewDefaultProcessor(syscalls vm.SyscallsImpl) *DefaultProcessor
NewDefaultProcessor creates a default processor from the given state tree and vms.
func (*DefaultProcessor) ProcessImplicitMessage ¶
func (p *DefaultProcessor) ProcessImplicitMessage(ctx context.Context, msg *types.UnsignedMessage, vmOption vm.VmOption) (ret *vm.Ret, err error)
func (*DefaultProcessor) ProcessTipSet ¶
func (p *DefaultProcessor) ProcessTipSet(ctx context.Context, parent, ts *block.TipSet, msgs []block.BlockMessagesInfo, vmOption vm.VmOption, ) (cid.Cid, []types.MessageReceipt, error)
ProcessTipSet computes the state transition specified by the messages in all blocks in a TipSet.
type DefaultStateViewer ¶
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) appstate.FaultStateView
FaultStateView returns a fault state view for a state root.
func (*DefaultStateViewer) PowerStateView ¶
func (v *DefaultStateViewer) PowerStateView(root cid.Cid) appstate.PowerStateView
PowerStateView returns a power state view for a state root.
type Expected ¶
type Expected struct { // TicketValidator validates ticket generation TicketValidator // contains filtered or unexported fields }
Expected implements expected consensus.
func NewExpected ¶
func NewExpected(cs cbor.IpldStore, bs blockstore.Blockstore, state StateViewer, bt time.Duration, tv TicketValidator, pv ProofVerifier, chainState chainReader, clock clock.ChainEpochClock, drand beacon.Schedule, rnd Randness, messageStore *chain.MessageStore, fork fork.IFork, config *config.NetworkParamsConfig, gasPirceSchedule *gas.PricesSchedule, proofVerifier ffiwrapper.Verifier, ) *Expected
NewExpected is the constructor for the Expected consenus.Protocol module.
func (*Expected) CallWithGas ¶
func (*Expected) GetLookbackTipSetForRound ¶
func (c *Expected) GetLookbackTipSetForRound(ctx context.Context, ts *block.TipSet, round abi.ChainEpoch) (*block.TipSet, cid.Cid, error)
TODO think about a better position to impl this function
func (*Expected) MinerEligibleToMine ¶
func (*Expected) RunStateTransition ¶
func (c *Expected) RunStateTransition(ctx context.Context, ts *block.TipSet, parentStateRoot cid.Cid, ) (cid.Cid, []types.MessageReceipt, 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.
func (*Expected) ValidateBlockBeacon ¶
func (c *Expected) ValidateBlockBeacon(blk *block.Block, parentEpoch abi.ChainEpoch, prevEntry *block.BeaconEntry) error
func (*Expected) ValidateBlockWinner ¶
func (*Expected) ValidateMining ¶
func (c *Expected) ValidateMining(ctx context.Context, parent, ts *block.TipSet, parentWeight big.Int, parentReceiptRoot cid.Cid) error
validateMining checks validity of the ticket, proof, signature and miner address of every block in the tipset.
func (*Expected) ValidateMsgMeta ¶
ValidateMsgMeta performs structural and content hash validation of the messages within this block. If validation passes, it stores the messages in the underlying IPLD block store.
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 *block.BeaconEntry, 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) ChainGetRandomnessFromBeacon ¶
func (s *FakeChainRandomness) ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
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) state.FaultStateView
FaultStateView returns the state view for a root.
func (*FakeConsensusStateViewer) PowerStateView ¶
func (f *FakeConsensusStateViewer) PowerStateView(root cid.Cid) state.PowerStateView
PowerStateView returns the state view for a root.
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 *block.BeaconEntry, 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 *block.BeaconEntry, newPeriod bool, worker address.Address, signer types.Signer) (block.Ticket, error)
MakeTicket returns a fake ticket
type HeadRandomness ¶
type HeadRandomness struct { Chain ChainRandomness Head block.TipSetKey }
A Chain randomness source with a fixed Head tipset key.
func (*HeadRandomness) GetRandomnessFromBeacon ¶
func (h *HeadRandomness) GetRandomnessFromBeacon(ctx context.Context, tag acrypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
func (*HeadRandomness) Randomness ¶
func (h *HeadRandomness) Randomness(ctx context.Context, tag acrypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
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 ¶
func (v *MessageSignatureValidator) Validate(ctx context.Context, smsg *types.SignedMessage) error
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 MiningCheckAPI ¶
type MiningCheckAPI interface { ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) ChainGetRandomnessFromTickets(ctx context.Context, tsk block.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) MinerGetBaseInfo(context.Context, address.Address, abi.ChainEpoch, block.TipSetKey) (block.MiningBaseInfo, error) WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error) }
type Processor ¶
type Processor interface { // ProcessTipSet processes all messages in a tip set. ProcessTipSet(context.Context, *block.TipSet, *block.TipSet, []block.BlockMessagesInfo, vm.VmOption) (cid.Cid, []types.MessageReceipt, error) ProcessUnsignedMessage(context.Context, types.ChainMsg, vm.VmOption) (*vm.Ret, error) ProcessImplicitMessage(context.Context, *types.UnsignedMessage, vm.VmOption) (*vm.Ret, error) }
A Processor processes all the messages in a block or tip set.
type ProofVerifier ¶
type ProofVerifier interface { VerifySeal(info proof2.SealVerifyInfo) (bool, error) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) }
Interface to PoSt verification, modify by force EPoStVerifier -> ProofVerifier
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, parentStateRoot cid.Cid) (root cid.Cid, receipts []types.MessageReceipt, err error) // BlockTime returns the block time used by the consensus protocol. BlockTime() time.Duration Call(ctx context.Context, msg *types.UnsignedMessage, ts *block.TipSet) (*vm.Ret, error) CallWithGas(ctx context.Context, msg *types.UnsignedMessage, priorMsgs []types.ChainMsg, ts *block.TipSet) (*vm.Ret, error) //Validation ValidateMining(ctx context.Context, parent, ts *block.TipSet, parentWeight big.Int, parentReceiptRoot cid.Cid) error ValidateMsgMeta(fblk *block.FullBlock) error //should remove GetLookbackTipSetForRound(ctx context.Context, ts *block.TipSet, round abi.ChainEpoch) (*block.TipSet, cid.Cid, error) MinerEligibleToMine(ctx context.Context, addr address.Address, parentStateRoot cid.Cid, parentHeight abi.ChainEpoch, lookbackTs *block.TipSet) (bool, error) }
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 Randness ¶
type Randness interface { SampleChainRandomness(ctx context.Context, head block.TipSetKey, tag acrypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) }
type SectorsStateView ¶
type SectorsStateView interface {
MinerSectorInfo(ctx context.Context, maddr address.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, error)
}
type StateViewer ¶
type StateViewer interface { PowerStateView(root cid.Cid) appstate.PowerStateView FaultStateView(root cid.Cid) appstate.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 []builtin.SectorInfo, randomness abi.PoStRandomness) ([]builtin.PoStProof, error)
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, tipsetLoader tipsetLoader) *TicketMachine
func (TicketMachine) IsValidTicket ¶
func (tm TicketMachine) IsValidTicket(ctx context.Context, base block.TipSetKey, entry *block.BeaconEntry, bSmokeHeight 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 *block.BeaconEntry, 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 *block.BeaconEntry, 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