miner

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: Apache-2.0, MIT Imports: 23 Imported by: 57

Documentation

Index

Constants

View Source
const ChainFinality = abi.ChainEpoch(900)

Epochs after which chain state is final.

View Source
const ElectionLookback = abi.ChainEpoch(1) // PARAM_FINISH

Lookback from the current epoch for state view for leader elections.

View Source
const FaultDeclarationCutoff = WPoStChallengeLookback + 10

Minimum period before a deadline's challenge window opens that a fault must be declared for that deadline. This lookback must not be less than WPoStChallengeLookback lest a malicious miner be able to selectively declare faults after learning the challenge value.

View Source
const FaultMaxAge = WPoStProvingPeriod*14 - 1

The maximum age of a fault before the sector is terminated.

View Source
const MaxSectorExpirationExtension = builtin.EpochsInYear

Maximum number of epochs past the current epoch a sector may be set to expire. The actual maximum extension will be the minimum of CurrEpoch + MaximumSectorExpirationExtension and sector.ActivationEpoch+sealProof.SectorMaximumLifetime()

View Source
const NewSectorsPerPeriodMax = 128 << 10

The maximum number of new sectors that may be staged by a miner during a single proving period.

View Source
const PreCommitChallengeDelay = abi.ChainEpoch(10)

Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn used to ensure it is not predictable by miner.

View Source
const SectorQualityPrecision = 20
View Source
const SectorsMax = 32 << 20 // PARAM_FINISH

The maximum number of sectors that a miner can have simultaneously active. This also bounds the number of faults that can be declared, etc. TODO raise this number, carefully https://github.com/filecoin-project/specs-actors/issues/470

View Source
const WPoStChallengeLookback = abi.ChainEpoch(20)

Lookback from the deadline's challenge window opening from which to sample chain randomness for the challenge seed. This lookback exists so that deadline windows can be non-overlapping (which make the programming simpler) but without making the miner wait for chain stability before being able to start on PoSt computation. The challenge is available this many epochs before the window is actually open to receiving a PoSt.

View Source
const WPoStChallengeWindow = abi.ChainEpoch(40 * 60 / builtin.EpochDurationSeconds) // 40 minutes (36 per day)

The duration of a deadline's challenge window, the period before a deadline when the challenge is available.

View Source
const WPoStPeriodDeadlines = uint64(WPoStProvingPeriod / WPoStChallengeWindow)

The number of non-overlapping PoSt deadlines in each proving period.

View Source
const WPoStProvingPeriod = abi.ChainEpoch(builtin.EpochsInDay) // 24 hours

The period over which all a miner's active sectors will be challenged.

View Source
const WorkerKeyChangeDelay = ChainFinality

Staging period for a miner worker key change. Finality is a harsh delay for a miner who has lost their worker key, as the miner will miss Window PoSts until it can be changed. It's the only safe value, though. We may implement a mitigation mechanism such as a second key or allowing the owner account to submit PoSts while a key change is pending.

Variables

View Source
var DealWeightMultiplier = big.NewInt(11) // PARAM_FINISH
View Source
var DeclaredFaultFactorDenom = big.NewInt(100)
View Source
var DeclaredFaultFactorNum = big.NewInt(214)

FF = (DeclaredFaultFactorNum / DeclaredFaultFactorDenom) * BR(t)

View Source
var InitialPledgeFactor = big.NewInt(20)

IP = InitialPledgeFactor * BR(precommit time)

Maximum duration to allow for the sealing process for seal algorithms. Dependent on algorithm and sector size

View Source
var PledgeVestingSpec = VestSpec{
	InitialDelay: abi.ChainEpoch(7 * builtin.EpochsInDay),
	VestPeriod:   abi.ChainEpoch(7 * builtin.EpochsInDay),
	StepDuration: abi.ChainEpoch(1 * builtin.EpochsInDay),
	Quantization: 12 * builtin.EpochsInHour,
}
View Source
var QualityBaseMultiplier = big.NewInt(10) // PARAM_FINISH

List of proof types which can be used when creating new miner actors

View Source
var UndeclaredFaultFactorDenom = big.NewInt(1)
View Source
var UndeclaredFaultFactorNum = big.NewInt(5)

SP = (UndeclaredFaultFactor / DeclaredFaultFactorDenom) * BR(t)

View Source
var VerifiedDealWeightMultiplier = big.NewInt(100) // PARAM_FINISH

Functions

func AssignNewSectors

func AssignNewSectors(deadlines *Deadlines, partitionSize uint64, newSectors []uint64, seed abi.Randomness) error

Assigns a sequence of sector numbers to deadlines by: - filling any non-full partitions, in round-robin order across the deadlines - repeatedly adding a new partition to the deadline with the fewest partitions When multiple partitions share the minimal sector count, one is chosen at random (from a seed).

func ComputePartitionsSectors

func ComputePartitionsSectors(d *Deadlines, partitionSize uint64, deadlineIndex uint64, partitions []uint64) ([]*abi.BitField, error)

Computes a bitfield of the sector numbers included in a sequence of partitions due at some deadline. Fails if any partition is not due at the provided deadline.

func DeadlineCount

func DeadlineCount(d *Deadlines, partitionSize, deadlineIdx uint64) (partitionCount, sectorCount uint64, err error)

Counts the partitions (including up to one partial) and sectors at a deadline.

func EpochKey

func EpochKey(e abi.ChainEpoch) uint64

func ExpectedDayRewardForPower added in v0.7.0

func ExpectedDayRewardForPower(epochTargetReward abi.TokenAmount, networkQAPower abi.StoragePower, qaSectorPower abi.StoragePower) abi.TokenAmount

This is the BR(t) value of the given sector for the current epoch. It is the expected reward this sector would pay out over a one day period. BR(t) = CurrEpochReward(t) * SectorQualityAdjustedPower * EpochsInDay / TotalNetworkQualityAdjustedPower(t)

func FindDeadline added in v0.7.0

func FindDeadline(deadlines *Deadlines, sectorNum abi.SectorNumber) (uint64, error)

FindDeadline returns the deadline index for a given sector number. It returns an error if the sector number is not tracked by deadlines.

func InitialPledgeForPower added in v0.7.0

func InitialPledgeForPower(qaPower abi.StoragePower, networkQAPower abi.StoragePower, networkTotalPledge abi.TokenAmount, epochTargetReward abi.TokenAmount, networkCirculatingSupply abi.TokenAmount) abi.TokenAmount

Computes the pledge requirement for committing new quality-adjusted power to the network, given the current total power, total pledge commitment, epoch block reward, and circulating token supply. In plain language, the pledge requirement is a multiple of the block reward expected to be earned by the newly-committed power, holding the per-epoch block reward constant (though in reality it will change over time). The network total pledge and circulating supply parameters are currently unused, but may be included in a future calculation.

func PartitionsForDeadline

func PartitionsForDeadline(d *Deadlines, partitionSize, deadlineIdx uint64) (firstPartition, sectorCount uint64, _ error)

Computes the first partition index and number of sectors for a deadline. Partitions are numbered globally for the miner, not per-deadline. If the deadline has no sectors, the first partition index is the index that a partition at that deadline would have, if non-empty (and sectorCount is zero).

func PledgePenaltyForDeclaredFault added in v0.7.0

func PledgePenaltyForDeclaredFault(epochTargetReward abi.TokenAmount, networkQAPower abi.StoragePower, qaSectorPower abi.StoragePower) abi.TokenAmount

This is the FF(t) penalty for a sector expected to be in the fault state either because the fault was declared or because it has been previously detected by the network. FF(t) = DeclaredFaultFactor * BR(t)

func PledgePenaltyForLateUndeclaredFault added in v0.7.2

func PledgePenaltyForLateUndeclaredFault(epochTargetReward abi.TokenAmount, networkQAPower abi.StoragePower, qaSectorPower abi.StoragePower) abi.TokenAmount

This is the SP(t) penalty for a newly faulty sector that has not been declared later than one deadline. SP_late(t) = 2*SP(t)

func PledgePenaltyForTermination added in v0.7.2

func PledgePenaltyForTermination(initialPledge abi.TokenAmount, sectorAge abi.ChainEpoch, epochTargetReward abi.TokenAmount, networkQAPower, qaSectorPower abi.StoragePower) abi.TokenAmount

Penalty to locked pledge collateral for the termination of a sector before scheduled expiry. SectorAge is the time between now and the sector's activation.

func PledgePenaltyForUndeclaredFault added in v0.7.0

func PledgePenaltyForUndeclaredFault(epochTargetReward abi.TokenAmount, networkQAPower abi.StoragePower, qaSectorPower abi.StoragePower) abi.TokenAmount

This is the SP(t) penalty for a newly faulty sector that has not been declared. SP(t) = UndeclaredFaultFactor * BR(t)

func PowerForSectors added in v0.7.0

func PowerForSectors(sectorSize abi.SectorSize, sectors []*SectorOnChainInfo) (rawBytePower, qaPower big.Int)

Returns the sum of the raw byte and quality-adjusted power for sectors.

func QAPowerForSector added in v0.7.0

func QAPowerForSector(size abi.SectorSize, sector *SectorOnChainInfo) abi.StoragePower

Returns the quality-adjusted power for a sector.

func QAPowerForWeight added in v0.7.0

func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower

Returns the power for a sector size and weight.

func QualityForWeight added in v0.7.0

func QualityForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.SectorQuality

DealWeight and VerifiedDealWeight are spacetime occupied by regular deals and verified deals in a sector. Sum of DealWeight and VerifiedDealWeight should be less than or equal to total SpaceTime of a sector. Sectors full of VerifiedDeals will have a SectorQuality of VerifiedDealWeightMultiplier/QualityBaseMultiplier. Sectors full of Deals will have a SectorQuality of DealWeightMultiplier/QualityBaseMultiplier. Sectors with neither will have a SectorQuality of QualityBaseMultiplier/QualityBaseMultiplier. SectorQuality of a sector is a weighted average of multipliers based on their propotions.

func RewardForConsensusSlashReport added in v0.7.0

func RewardForConsensusSlashReport(elapsedEpoch abi.ChainEpoch, collateral abi.TokenAmount) abi.TokenAmount

func SectorKey

func SectorKey(e abi.SectorNumber) adt.Keyer

Types

type Actor

type Actor struct{}

func (Actor) AddLockedFund

func (a Actor) AddLockedFund(rt Runtime, amountToLock *abi.TokenAmount) *adt.EmptyValue

Locks up some amount of a the miner's unlocked balance (including any received alongside the invoking message).

func (Actor) ChangeMultiaddrs added in v0.5.5

func (a Actor) ChangeMultiaddrs(rt Runtime, params *ChangeMultiaddrsParams) *adt.EmptyValue

func (Actor) ChangePeerID

func (a Actor) ChangePeerID(rt Runtime, params *ChangePeerIDParams) *adt.EmptyValue

func (Actor) ChangeWorkerAddress

func (a Actor) ChangeWorkerAddress(rt Runtime, params *ChangeWorkerAddressParams) *adt.EmptyValue

func (Actor) CheckSectorProven

func (a Actor) CheckSectorProven(rt Runtime, params *CheckSectorProvenParams) *adt.EmptyValue

func (Actor) ConfirmSectorProofsValid added in v0.5.4

func (a Actor) ConfirmSectorProofsValid(rt Runtime, params *builtin.ConfirmSectorProofsParams) *adt.EmptyValue

func (Actor) Constructor

func (a Actor) Constructor(rt Runtime, params *ConstructorParams) *adt.EmptyValue

func (Actor) ControlAddresses

func (a Actor) ControlAddresses(rt Runtime, _ *adt.EmptyValue) *GetControlAddressesReturn

func (Actor) DeclareFaults

func (a Actor) DeclareFaults(rt Runtime, params *DeclareFaultsParams) *adt.EmptyValue

func (Actor) DeclareFaultsRecovered

func (a Actor) DeclareFaultsRecovered(rt Runtime, params *DeclareFaultsRecoveredParams) *adt.EmptyValue

func (Actor) Exports

func (a Actor) Exports() []interface{}

func (Actor) ExtendSectorExpiration

func (a Actor) ExtendSectorExpiration(rt Runtime, params *ExtendSectorExpirationParams) *adt.EmptyValue

func (Actor) OnDeferredCronEvent

func (a Actor) OnDeferredCronEvent(rt Runtime, payload *CronEventPayload) *adt.EmptyValue

func (Actor) PreCommitSector

func (a Actor) PreCommitSector(rt Runtime, params *SectorPreCommitInfo) *adt.EmptyValue

Proposals must be posted on chain via sma.PublishStorageDeals before PreCommitSector. Optimization: PreCommitSector could contain a list of deals that are not published yet.

func (Actor) ProveCommitSector

func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *adt.EmptyValue

Checks state of the corresponding sector pre-commitment, then schedules the proof to be verified in bulk by the power actor. If valid, the power actor will call ConfirmSectorProofsValid at the end of the same epoch as this message.

func (Actor) ReportConsensusFault

func (a Actor) ReportConsensusFault(rt Runtime, params *ReportConsensusFaultParams) *adt.EmptyValue

func (Actor) SubmitWindowedPoSt

func (a Actor) SubmitWindowedPoSt(rt Runtime, params *SubmitWindowedPoStParams) *adt.EmptyValue

Invoked by miner's worker address to submit their fallback post

func (Actor) TerminateSectors

func (a Actor) TerminateSectors(rt Runtime, params *TerminateSectorsParams) *adt.EmptyValue

func (Actor) WithdrawBalance

func (a Actor) WithdrawBalance(rt Runtime, params *WithdrawBalanceParams) *adt.EmptyValue

type BigFrac

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

type ChangeMultiaddrsParams added in v0.5.5

type ChangeMultiaddrsParams struct {
	NewMultiaddrs []abi.Multiaddrs
}

func (*ChangeMultiaddrsParams) MarshalCBOR added in v0.5.5

func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error

func (*ChangeMultiaddrsParams) UnmarshalCBOR added in v0.5.5

func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) error

type ChangePeerIDParams

type ChangePeerIDParams struct {
	NewID abi.PeerID
}

func (*ChangePeerIDParams) MarshalCBOR

func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error

func (*ChangePeerIDParams) UnmarshalCBOR

func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) error

type ChangeWorkerAddressParams

type ChangeWorkerAddressParams struct {
	NewWorker addr.Address
}

func (*ChangeWorkerAddressParams) MarshalCBOR

func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error

func (*ChangeWorkerAddressParams) UnmarshalCBOR

func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) error

type CheckSectorProvenParams

type CheckSectorProvenParams struct {
	SectorNumber abi.SectorNumber
}

func (*CheckSectorProvenParams) MarshalCBOR

func (t *CheckSectorProvenParams) MarshalCBOR(w io.Writer) error

func (*CheckSectorProvenParams) UnmarshalCBOR

func (t *CheckSectorProvenParams) UnmarshalCBOR(r io.Reader) error

type ConstructorParams

type ConstructorParams = power.MinerConstructorParams

Storage miner actors are created exclusively by the storage power actor. In order to break a circular dependency between the two, the construction parameters are defined in the power actor.

type CronEventPayload

type CronEventPayload struct {
	EventType CronEventType
	Sectors   *abi.BitField
}

func (*CronEventPayload) MarshalCBOR

func (t *CronEventPayload) MarshalCBOR(w io.Writer) error

func (*CronEventPayload) UnmarshalCBOR

func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) error

type CronEventType

type CronEventType int64
const (
	CronEventWorkerKeyChange CronEventType = iota
	CronEventPreCommitExpiry
	CronEventProvingPeriod
)

type DeadlineInfo

type DeadlineInfo struct {
	CurrentEpoch abi.ChainEpoch // Epoch at which this info was calculated.
	PeriodStart  abi.ChainEpoch // First epoch of the proving period (<= CurrentEpoch).
	Index        uint64         // A deadline index, in [0..WPoStProvingPeriodDeadlines) unless period elapsed.
	Open         abi.ChainEpoch // First epoch from which a proof may be submitted, inclusive (>= CurrentEpoch).
	Close        abi.ChainEpoch // First epoch from which a proof may no longer be submitted, exclusive (>= Open).
	Challenge    abi.ChainEpoch // Epoch at which to sample the chain for challenge (< Open).
	FaultCutoff  abi.ChainEpoch // First epoch at which a fault declaration is rejected (< Open).
}

Deadline calculations with respect to a current epoch. "Deadline" refers to the window during which proofs may be submitted. Windows are non-overlapping ranges [Open, Close), but the challenge epoch for a window occurs before the window opens. The current epoch may not necessarily lie within the deadline or proving period represented here.

func ComputeProvingPeriodDeadline

func ComputeProvingPeriodDeadline(periodStart, currEpoch abi.ChainEpoch) *DeadlineInfo

Calculates the deadline at some epoch for a proving period and returns the deadline-related calculations.

func NewDeadlineInfo added in v0.5.1

func NewDeadlineInfo(periodStart abi.ChainEpoch, deadlineIdx uint64, currEpoch abi.ChainEpoch) *DeadlineInfo

Returns deadline-related calculations for a deadline in some proving period and the current epoch.

func (*DeadlineInfo) FaultCutoffPassed

func (d *DeadlineInfo) FaultCutoffPassed() bool

Whether the deadline's fault cutoff has passed.

func (*DeadlineInfo) HasElapsed

func (d *DeadlineInfo) HasElapsed() bool

Whether the current deadline has already closed.

func (*DeadlineInfo) IsOpen

func (d *DeadlineInfo) IsOpen() bool

Whether the current deadline is currently open.

func (*DeadlineInfo) NextPeriodStart

func (d *DeadlineInfo) NextPeriodStart() abi.ChainEpoch

The first epoch in the next proving period.

func (*DeadlineInfo) PeriodElapsed added in v0.5.1

func (d *DeadlineInfo) PeriodElapsed() bool

Whether the proving period has elapsed.

func (*DeadlineInfo) PeriodEnd

func (d *DeadlineInfo) PeriodEnd() abi.ChainEpoch

The last epoch in the proving period.

func (*DeadlineInfo) PeriodStarted

func (d *DeadlineInfo) PeriodStarted() bool

Whether the proving period has begun.

type Deadlines

type Deadlines struct {
	// A bitfield of sector numbers due at each deadline.
	// The sectors for each deadline are logically grouped into sequential partitions for proving.
	Due [WPoStPeriodDeadlines]*abi.BitField
}

func ConstructDeadlines

func ConstructDeadlines() *Deadlines

func (*Deadlines) AddToDeadline

func (d *Deadlines) AddToDeadline(deadline uint64, newSectors ...uint64) (err error)

Adds sector numbers to a deadline. The sector numbers are given as uint64 to avoid pointless conversions for bitfield use.

func (*Deadlines) MarshalCBOR

func (t *Deadlines) MarshalCBOR(w io.Writer) error

func (*Deadlines) RemoveFromAllDeadlines

func (d *Deadlines) RemoveFromAllDeadlines(sectorNos *abi.BitField) (err error)

Removes sector numbers from all deadlines.

func (*Deadlines) UnmarshalCBOR

func (t *Deadlines) UnmarshalCBOR(r io.Reader) error

type DeclareFaultsParams

type DeclareFaultsParams struct {
	Faults []FaultDeclaration
}

func (*DeclareFaultsParams) MarshalCBOR

func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error

func (*DeclareFaultsParams) UnmarshalCBOR

func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) error

type DeclareFaultsRecoveredParams

type DeclareFaultsRecoveredParams struct {
	Recoveries []RecoveryDeclaration
}

func (*DeclareFaultsRecoveredParams) MarshalCBOR

func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error

func (*DeclareFaultsRecoveredParams) UnmarshalCBOR

func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) error

type ExtendSectorExpirationParams

type ExtendSectorExpirationParams struct {
	SectorNumber  abi.SectorNumber
	NewExpiration abi.ChainEpoch
}

func (*ExtendSectorExpirationParams) MarshalCBOR

func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error

func (*ExtendSectorExpirationParams) UnmarshalCBOR

func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) error

type FaultDeclaration

type FaultDeclaration struct {
	Deadline uint64 // In range [0..WPoStPeriodDeadlines)
	Sectors  *abi.BitField
}

func (*FaultDeclaration) MarshalCBOR

func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error

func (*FaultDeclaration) UnmarshalCBOR

func (t *FaultDeclaration) UnmarshalCBOR(r io.Reader) error

type GetControlAddressesReturn

type GetControlAddressesReturn struct {
	Owner  addr.Address
	Worker addr.Address
}

func (*GetControlAddressesReturn) MarshalCBOR

func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error

func (*GetControlAddressesReturn) UnmarshalCBOR

func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) error

type MinerInfo

type MinerInfo struct {
	// Account that owns this miner.
	// - Income and returned collateral are paid to this address.
	// - This address is also allowed to change the worker address for the miner.
	Owner addr.Address // Must be an ID-address.

	// Worker account for this miner.
	// The associated pubkey-type address is used to sign blocks and messages on behalf of this miner.
	Worker addr.Address // Must be an ID-address.

	PendingWorkerKey *WorkerKeyChange

	// Byte array representing a Libp2p identity that should be used when connecting to this miner.
	PeerId abi.PeerID

	// Slice of byte arrays representing Libp2p multi-addresses used for establishing a connection with this miner.
	Multiaddrs []abi.Multiaddrs

	// The proof type used by this miner for sealing sectors.
	SealProofType abi.RegisteredSealProof

	// Amount of space in each sector committed by this miner.
	// This is computed from the proof type and represented here redundantly.
	SectorSize abi.SectorSize

	// The number of sectors in each Window PoSt partition (proof).
	// This is computed from the proof type and represented here redundantly.
	WindowPoStPartitionSectors uint64
}

func ConstructMinerInfo added in v0.7.2

func ConstructMinerInfo(owner addr.Address, worker addr.Address, pid []byte, multiAddrs [][]byte, sealProofType abi.RegisteredSealProof) (*MinerInfo, error)

func (*MinerInfo) MarshalCBOR

func (t *MinerInfo) MarshalCBOR(w io.Writer) error

func (*MinerInfo) UnmarshalCBOR

func (t *MinerInfo) UnmarshalCBOR(r io.Reader) error

type ProveCommitSectorParams

type ProveCommitSectorParams struct {
	SectorNumber abi.SectorNumber
	Proof        []byte
}

func (*ProveCommitSectorParams) MarshalCBOR

func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error

func (*ProveCommitSectorParams) UnmarshalCBOR

func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) error

type RecoveryDeclaration

type RecoveryDeclaration struct {
	Deadline uint64 // In range [0..WPoStPeriodDeadlines)
	Sectors  *abi.BitField
}

func (*RecoveryDeclaration) MarshalCBOR

func (t *RecoveryDeclaration) MarshalCBOR(w io.Writer) error

func (*RecoveryDeclaration) UnmarshalCBOR

func (t *RecoveryDeclaration) UnmarshalCBOR(r io.Reader) error

type ReportConsensusFaultParams

type ReportConsensusFaultParams struct {
	BlockHeader1     []byte
	BlockHeader2     []byte
	BlockHeaderExtra []byte
}

func (*ReportConsensusFaultParams) MarshalCBOR

func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error

func (*ReportConsensusFaultParams) UnmarshalCBOR

func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) error

type Runtime

type Runtime = vmr.Runtime

type SealVerifyStuff added in v0.5.4

type SealVerifyStuff struct {
	SealedCID        cid.Cid        // CommR
	InteractiveEpoch abi.ChainEpoch // Used to derive the interactive PoRep challenge.
	abi.RegisteredSealProof
	Proof   []byte
	DealIDs []abi.DealID
	abi.SectorNumber
	SealRandEpoch abi.ChainEpoch // Used to tie the seal to a chain.
}

SealVerifyParams is the structure of information that must be sent with a message to commit a sector. Most of this information is not needed in the state tree but will be verified in sm.CommitSector. See SealCommitment for data stored on the state tree for each sector.

type SectorOnChainInfo

type SectorOnChainInfo struct {
	SectorNumber       abi.SectorNumber
	SealProof          abi.RegisteredSealProof // The seal proof type implies the PoSt proof/s
	SealedCID          cid.Cid                 // CommR
	DealIDs            []abi.DealID
	Activation         abi.ChainEpoch  // Epoch during which the sector proof was accepted
	Expiration         abi.ChainEpoch  // Epoch during which the sector expires
	DealWeight         abi.DealWeight  // Integral of active deals over sector lifetime
	VerifiedDealWeight abi.DealWeight  // Integral of active verified deals over sector lifetime
	InitialPledge      abi.TokenAmount // Pledge collected to commit this sector
}

Information stored on-chain for a proven sector.

func (*SectorOnChainInfo) AsSectorInfo

func (s *SectorOnChainInfo) AsSectorInfo() abi.SectorInfo

func (*SectorOnChainInfo) MarshalCBOR

func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error

func (*SectorOnChainInfo) UnmarshalCBOR

func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) error

type SectorPreCommitInfo

type SectorPreCommitInfo struct {
	SealProof       abi.RegisteredSealProof
	SectorNumber    abi.SectorNumber
	SealedCID       cid.Cid // CommR
	SealRandEpoch   abi.ChainEpoch
	DealIDs         []abi.DealID
	Expiration      abi.ChainEpoch
	ReplaceCapacity bool             // Whether to replace a "committed capacity" no-deal sector (requires non-empty DealIDs)
	ReplaceSector   abi.SectorNumber // The committed capacity sector to replace
}

Information provided by a miner when pre-committing a sector.

func (*SectorPreCommitInfo) MarshalCBOR

func (t *SectorPreCommitInfo) MarshalCBOR(w io.Writer) error

func (*SectorPreCommitInfo) UnmarshalCBOR

func (t *SectorPreCommitInfo) UnmarshalCBOR(r io.Reader) error

type SectorPreCommitOnChainInfo

type SectorPreCommitOnChainInfo struct {
	Info               SectorPreCommitInfo
	PreCommitDeposit   abi.TokenAmount
	PreCommitEpoch     abi.ChainEpoch
	DealWeight         abi.DealWeight // Integral of active deals over sector lifetime
	VerifiedDealWeight abi.DealWeight // Integral of active verified deals over sector lifetime
}

Information stored on-chain for a pre-committed sector.

func (*SectorPreCommitOnChainInfo) MarshalCBOR

func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error

func (*SectorPreCommitOnChainInfo) UnmarshalCBOR

func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) error

type State

type State struct {
	// Information not related to sectors.
	Info cid.Cid

	PreCommitDeposits        abi.TokenAmount // Total funds locked as PreCommitDeposits
	LockedFunds              abi.TokenAmount // Total unvested funds locked as pledge collateral
	VestingFunds             cid.Cid         // Array, AMT[ChainEpoch]TokenAmount
	InitialPledgeRequirement abi.TokenAmount // Sum of initial pledge requirements of all active sectors

	// Sectors that have been pre-committed but not yet proven.
	PreCommittedSectors cid.Cid // Map, HAMT[SectorNumber]SectorPreCommitOnChainInfo

	// Information for all proven and not-yet-expired sectors.
	Sectors cid.Cid // Array, AMT[SectorNumber]SectorOnChainInfo (sparse)

	// The first epoch in this miner's current proving period. This is the first epoch in which a PoSt for a
	// partition at the miner's first deadline may arrive. Alternatively, it is after the last epoch at which
	// a PoSt for the previous window is valid.
	// Always greater than zero, his may be greater than the current epoch for genesis miners in the first
	// WPoStProvingPeriod epochs of the chain; the epochs before the first proving period starts are exempt from Window
	// PoSt requirements.
	// Updated at the end of every period by a power actor cron event.
	ProvingPeriodStart abi.ChainEpoch

	// Sector numbers prove-committed since period start, to be added to Deadlines at next proving period boundary.
	NewSectors *abi.BitField

	// Sector numbers indexed by expiry epoch (which are on proving period boundaries).
	// Invariant: Keys(Sectors) == union(SectorExpirations.Values())
	SectorExpirations cid.Cid // Array, AMT[ChainEpoch]Bitfield

	// The sector numbers due for PoSt at each deadline in the current proving period, frozen at period start.
	// New sectors are added and expired ones removed at proving period boundary.
	// Faults are not subtracted from this in state, but on the fly.
	Deadlines cid.Cid

	// All currently known faulty sectors, mutated eagerly.
	// These sectors are exempt from inclusion in PoSt.
	Faults *abi.BitField

	// Faulty sector numbers indexed by the start epoch of the proving period in which detected.
	// Used to track fault durations for eventual sector termination.
	// At most 14 entries, b/c sectors faulty longer expire.
	// Invariant: Faults == union(FaultEpochs.Values())
	FaultEpochs cid.Cid // AMT[ChainEpoch]Bitfield

	// Faulty sectors that will recover when next included in a valid PoSt.
	// Invariant: Recoveries ⊆ Faults.
	Recoveries *abi.BitField

	// Records successful PoSt submission in the current proving period by partition number.
	// The presence of a partition number indicates on-time PoSt received.
	PostSubmissions *abi.BitField

	// The index of the next deadline for which faults should been detected and processed (after it's closed).
	// The proving period cron handler will always reset this to 0, for the subsequent period.
	// Eager fault detection processing on fault/recovery declarations or PoSt may set a smaller number,
	// indicating partial progress, from which subsequent processing should continue.
	// In the range [0, WPoStProvingPeriodDeadlines).
	NextDeadlineToProcessFaults uint64
}

Balance of Miner Actor should be greater than or equal to the sum of PreCommitDeposits and LockedFunds. Excess balance as computed by st.GetAvailableBalance will be withdrawable or usable for pre-commit deposit or pledge lock-up.

func ConstructState

func ConstructState(infoCid cid.Cid, periodStart abi.ChainEpoch, emptyArrayCid, emptyMapCid, emptyDeadlinesCid cid.Cid) (*State, error)

func (*State) AddFaults

func (st *State) AddFaults(store adt.Store, sectorNos *abi.BitField, faultEpoch abi.ChainEpoch) (err error)

Adds sectors numbers to faults and fault epochs.

func (*State) AddInitialPledgeRequirement added in v0.7.0

func (st *State) AddInitialPledgeRequirement(amount abi.TokenAmount)

func (*State) AddLockedFunds

func (st *State) AddLockedFunds(store adt.Store, currEpoch abi.ChainEpoch, vestingSum abi.TokenAmount, spec *VestSpec) error

func (*State) AddNewSectors

func (st *State) AddNewSectors(sectorNos ...abi.SectorNumber) (err error)

Adds some sector numbers to the new sectors bitfield.

func (*State) AddPoStSubmissions

func (st *State) AddPoStSubmissions(partitionNos *abi.BitField) (err error)

Adds partition numbers to the set of PoSt submissions

func (*State) AddPreCommitDeposit

func (st *State) AddPreCommitDeposit(amount abi.TokenAmount)

func (*State) AddRecoveries

func (st *State) AddRecoveries(sectorNos *abi.BitField) (err error)

Adds sectors to recoveries.

func (*State) AddSectorExpirations

func (st *State) AddSectorExpirations(store adt.Store, sectors ...*SectorOnChainInfo) error

Adds some sector numbers to the set expiring at an epoch. The sector numbers are given as uint64s to avoid pointless conversions.

func (*State) AssertBalanceInvariants

func (st *State) AssertBalanceInvariants(balance abi.TokenAmount)

func (*State) CheckVestedFunds

func (st *State) CheckVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)

CheckVestedFunds returns the amount of vested funds that have vested before the provided epoch.

func (*State) ClearFaultEpochs

func (st *State) ClearFaultEpochs(store adt.Store, epochs ...abi.ChainEpoch) error

func (*State) ClearPoStSubmissions

func (st *State) ClearPoStSubmissions() error

Removes all PoSt submissions

func (*State) ClearSectorExpirations

func (st *State) ClearSectorExpirations(store adt.Store, expirations ...abi.ChainEpoch) error

Removes all sector numbers from the set expiring some epochs.

func (*State) DeadlineInfo

func (st *State) DeadlineInfo(currEpoch abi.ChainEpoch) *DeadlineInfo

Returns deadline calculations for the current proving period.

func (*State) DeletePrecommittedSectors added in v0.7.2

func (st *State) DeletePrecommittedSectors(store adt.Store, sectorNos ...abi.SectorNumber) error

func (*State) DeleteSectors

func (st *State) DeleteSectors(store adt.Store, sectorNos *abi.BitField) error

func (*State) ForEachFaultEpoch

func (st *State) ForEachFaultEpoch(store adt.Store, cb func(epoch abi.ChainEpoch, faults *abi.BitField) error) error

Iterates faults by declaration epoch, in order.

func (*State) ForEachSector

func (st *State) ForEachSector(store adt.Store, f func(*SectorOnChainInfo)) error

Iterates sectors. The pointer provided to the callback is not safe for re-use. Copy the pointed-to value in full to hold a reference.

func (*State) ForEachSectorExpiration

func (st *State) ForEachSectorExpiration(store adt.Store, f func(expiry abi.ChainEpoch, sectors *abi.BitField) error) error

Iterates sector expiration groups in order. Note that the sectors bitfield provided to the callback is not safe to store.

func (*State) GetAvailableBalance

func (st *State) GetAvailableBalance(actorBalance abi.TokenAmount) abi.TokenAmount

func (*State) GetInfo added in v0.7.2

func (st *State) GetInfo(store adt.Store) (*MinerInfo, error)

func (*State) GetMaxAllowedFaults

func (st *State) GetMaxAllowedFaults(store adt.Store) (uint64, error)

func (*State) GetPrecommittedSector

func (st *State) GetPrecommittedSector(store adt.Store, sectorNo abi.SectorNumber) (*SectorPreCommitOnChainInfo, bool, error)

func (*State) GetSector

func (st *State) GetSector(store adt.Store, sectorNo abi.SectorNumber) (*SectorOnChainInfo, bool, error)

func (*State) GetSectorCount

func (st *State) GetSectorCount(store adt.Store) (uint64, error)

func (*State) GetSectorExpirations

func (st *State) GetSectorExpirations(store adt.Store, expiry abi.ChainEpoch) (*abi.BitField, error)

Gets the sector numbers expiring at some epoch.

func (*State) HasSectorNo

func (st *State) HasSectorNo(store adt.Store, sectorNo abi.SectorNumber) (bool, error)

func (*State) LoadDeadlines

func (st *State) LoadDeadlines(store adt.Store) (*Deadlines, error)

func (*State) LoadSectorInfos

func (st *State) LoadSectorInfos(store adt.Store, sectors *abi.BitField) ([]*SectorOnChainInfo, error)

Loads sector info for a sequence of sectors.

func (*State) LoadSectorInfosForProof added in v0.5.1

func (st *State) LoadSectorInfosForProof(store adt.Store, provenSectors *abi.BitField) (sectorInfos []*SectorOnChainInfo, recoveries *bitfield.BitField, err error)

Loads info for a set of sectors to be proven. If any of the sectors are declared faulty and not to be recovered, info for the first non-faulty sector is substituted instead. If any of the sectors are declared recovered, they are returned from this method.

func (*State) LoadSectorInfosWithFaultMask

func (st *State) LoadSectorInfosWithFaultMask(store adt.Store, sectors *abi.BitField, faults *abi.BitField, faultStandIn abi.SectorNumber) ([]*SectorOnChainInfo, error)

Loads sector info for a sequence of sectors, substituting info for a stand-in sector for any that are faulty.

func (*State) MarshalCBOR

func (t *State) MarshalCBOR(w io.Writer) error

func (*State) PutPrecommittedSector

func (st *State) PutPrecommittedSector(store adt.Store, info *SectorPreCommitOnChainInfo) error

func (*State) PutSectors added in v0.7.2

func (st *State) PutSectors(store adt.Store, newSectors ...*SectorOnChainInfo) error

func (*State) RemoveFaults

func (st *State) RemoveFaults(store adt.Store, sectorNos *abi.BitField) error

Removes sector numbers from faults and fault epochs, if present.

func (*State) RemoveNewSectors

func (st *State) RemoveNewSectors(sectorNos *abi.BitField) (err error)

Removes some sector numbers from the new sectors bitfield, if present.

func (*State) RemoveRecoveries

func (st *State) RemoveRecoveries(sectorNos *abi.BitField) (err error)

Removes sectors from recoveries, if present.

func (*State) RemoveSectorExpirations

func (st *State) RemoveSectorExpirations(store adt.Store, sectors ...*SectorOnChainInfo) error

Removes some sector numbers from the set expiring at an epoch.

func (*State) SaveDeadlines

func (st *State) SaveDeadlines(store adt.Store, deadlines *Deadlines) error

func (*State) SaveInfo added in v0.7.2

func (st *State) SaveInfo(store adt.Store, info *MinerInfo) error

func (*State) UnlockUnvestedFunds

func (st *State) UnlockUnvestedFunds(store adt.Store, currEpoch abi.ChainEpoch, target abi.TokenAmount) (abi.TokenAmount, error)

Unlocks an amount of funds that have *not yet vested*, if possible. The soonest-vesting entries are unlocked first. Returns the amount actually unlocked.

func (*State) UnlockVestedFunds

func (st *State) UnlockVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)

Unlocks all vesting funds that have vested before the provided epoch. Returns the amount unlocked.

func (*State) UnmarshalCBOR

func (t *State) UnmarshalCBOR(r io.Reader) error

type SubmitWindowedPoStParams

type SubmitWindowedPoStParams struct {
	// The deadline index which the submission targets.
	Deadline uint64
	// The partition indices being proven.
	// Partitions are counted across all deadlines, such that all partition indices in the second deadline are greater
	// than the partition numbers in the first deadlines.
	Partitions []uint64
	// Array of proofs, one per distinct registered proof type present in the sectors being proven.
	// In the usual case of a single proof type, this array will always have a single element (independent of number of partitions).
	Proofs []abi.PoStProof
	// Sectors skipped while proving that weren't already declared faulty
	Skipped abi.BitField
}

Information submitted by a miner to provide a Window PoSt.

func (*SubmitWindowedPoStParams) MarshalCBOR

func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error

func (*SubmitWindowedPoStParams) UnmarshalCBOR

func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) error

type TerminateSectorsParams

type TerminateSectorsParams struct {
	Sectors *abi.BitField
}

func (*TerminateSectorsParams) MarshalCBOR

func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error

func (*TerminateSectorsParams) UnmarshalCBOR

func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) error

type VestSpec

type VestSpec struct {
	InitialDelay abi.ChainEpoch // Delay before any amount starts vesting.
	VestPeriod   abi.ChainEpoch // Period over which the total should vest, after the initial delay.
	StepDuration abi.ChainEpoch // Duration between successive incremental vests (independent of vesting period).
	Quantization abi.ChainEpoch // Maximum precision of vesting table (limits cardinality of table).
}

Specification for a linear vesting schedule.

type WithdrawBalanceParams

type WithdrawBalanceParams struct {
	AmountRequested abi.TokenAmount
}

func (*WithdrawBalanceParams) MarshalCBOR

func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error

func (*WithdrawBalanceParams) UnmarshalCBOR

func (t *WithdrawBalanceParams) UnmarshalCBOR(r io.Reader) error

type WorkerKeyChange

type WorkerKeyChange struct {
	NewWorker   addr.Address // Must be an ID address
	EffectiveAt abi.ChainEpoch
}

func (*WorkerKeyChange) MarshalCBOR

func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error

func (*WorkerKeyChange) UnmarshalCBOR

func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) error

Jump to

Keyboard shortcuts

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