miner

package
v7.0.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0, MIT Imports: 37 Imported by: 17

Documentation

Index

Constants

View Source
const (
	CronEventProvingDeadline          = miner0.CronEventProvingDeadline
	CronEventProcessEarlyTerminations = miner0.CronEventProcessEarlyTerminations
)
View Source
const (
	DenyCollisions  = CollisionPolicy(false)
	AllowCollisions = CollisionPolicy(true)
)
View Source
const (
	// MaxPeerIDLength is the maximum length allowed for any on-chain peer ID.
	// Most Peer IDs are expected to be less than 50 bytes.
	MaxPeerIDLength = 128 // PARAM_SPEC

	// MaxMultiaddrData is the maximum amount of data that can be stored in multiaddrs.
	MaxMultiaddrData = 1024 // PARAM_SPEC
)

Libp2p peer info limits.

View Source
const AddressedPartitionsMax = MaxPartitionsPerDeadline

The maximum number of partitions that can be loaded in a single invocation. This limits the number of simultaneous fault, recovery, or sector-extension declarations. We set this to same as MaxPartitionsPerDeadline so we can process that many partitions every deadline.

View Source
const AddressedSectorsMax = 25_000 // PARAM_SPEC

The maximum number of sector infos that can be loaded in a single invocation. This limits the amount of state to be read in a single message execution.

View Source
const ChainFinality = abi.ChainEpoch(900) // PARAM_SPEC

Epochs after which chain state is final with overwhelming probability (hence the likelihood of two fork of this size is negligible) This is a conservative value that is chosen via simulations of all known attacks.

View Source
const ConsensusFaultFactor = 5

Multiplier of whole per-winner rewards for a consensus fault penalty.

View Source
const ConsensusFaultIneligibilityDuration = ChainFinality

Number of epochs after a consensus fault for which a miner is ineligible for permissioned actor methods and winning block elections.

View Source
const DeadlineExpirationAmtBitwidth = 5
View Source
const DeadlineOptimisticPoStSubmissionsAmtBitwidth = 2

Given that 4 partitions can be proven in one post, this AMT's height will only exceed the partition AMT's height at ~0.75EiB of storage.

View Source
const DeadlinePartitionsAmtBitwidth = 3 // Usually a small array

Bitwidth of AMTs determined empirically from mutation patterns and projections of mainnet data.

View Source
const DealLimitDenominator = 134217728 // PARAM_SPEC

Ratio of sector size to maximum number of deals per sector. The maximum number of deals is the sector size divided by this number (2^27) which limits 32GiB sectors to 256 deals and 64GiB sectors to 512

View Source
const DeclarationsMax = AddressedPartitionsMax

Maximum number of unique "declarations" in batch operations.

View Source
const (

	// The following errors are particular cases of illegal state.
	// They're not expected to ever happen, but if they do, distinguished codes can help us
	// diagnose the problem.
	ErrBalanceInvariantBroken = 1000
)
View Source
const ExpiredPreCommitCleanUpDelay = 8 * builtin.EpochsInHour

The delay between pre commit expiration and clean up from state. This enforces that expired pre-commits stay in state for a period of time creating a grace period during which a late-running aggregated prove-commit can still prove its non-expired precommits without resubmitting a message

View Source
const FaultDeclarationCutoff = WPoStChallengeLookback + 50 // PARAM_SPEC

Minimum period between fault declaration and the next deadline opening. If the number of epochs between fault declaration and deadline's challenge window opening is lower than FaultDeclarationCutoff, the fault declaration is considered invalid for that deadline. This guarantees that a miner is not likely to successfully fork the chain and declare a fault after seeing the challenges.

View Source
const MaxAggregateProofSize = 81960
View Source
const MaxAggregatedSectors = 819
View Source
const MaxControlAddresses = 10

Maximum number of control addresses a miner may register.

View Source
const MaxPartitionsPerDeadline = 3000

MaxPartitionsPerDeadline is the maximum number of partitions that will be assigned to a deadline. For a minimum storage of upto 1Eib, we need 300 partitions per deadline. 48 * 32GiB * 2349 * 300 = 1.00808144 EiB So, to support upto 10Eib storage, we set this to 3000.

View Source
const MaxSectorExpirationExtension = 540 * builtin.EpochsInDay // PARAM_SPEC

The maximum number of epochs past the current epoch that sector lifetime may be extended. A sector may be extended multiple times, however, the total maximum lifetime is also bounded by the associated seal proof's maximum lifetime.

View Source
const MinAggregatedSectors = 4
View Source
const MinSectorExpiration = 180 * builtin.EpochsInDay // PARAM_SPEC

Minimum number of epochs past the current epoch a sector may be set to expire.

View Source
const PartitionEarlyTerminationArrayAmtBitwidth = 3
View Source
const PartitionExpirationAmtBitwidth = 4

Bitwidth of AMTs determined empirically from mutation patterns and projections of mainnet data.

View Source
const PreCommitSectorBatchMaxSize = 256

The maximum number of sector pre-commitments in a single batch. 32 sectors per epoch would support a single miner onboarding 1EiB of 32GiB sectors in 1 year.

View Source
const PrecommitCleanUpAmtBitwidth = 6

Bitwidth of AMTs determined empirically from mutation patterns and projections of mainnet data.

View Source
const ProveReplicaUpdatesMaxSize = PreCommitSectorBatchMaxSize

The maximum number of sector replica updates in a single batch. Same as PreCommitSectorBatchMaxSize for consistency

View Source
const SectorsAmtBitwidth = 5
View Source
const TerminationLifetimeCap = 140 // PARAM_SPEC

Maximum number of lifetime days penalized when a sector is terminated.

View Source
const WPoStChallengeLookback = abi.ChainEpoch(20) // PARAM_SPEC

Lookback from the deadline's challenge window opening from which to sample chain randomness for the WindowPoSt challenge seed. This means that deadline windows can be non-overlapping (which make the programming simpler) without requiring a miner to wait for chain stability during the challenge window. This value cannot be too large lest it compromise the rationality of honest storage (from Window PoSt cost assumptions).

View Source
const WPoStPeriodDeadlines = uint64(48) // PARAM_SPEC

The number of non-overlapping PoSt deadlines in a proving period. This spreads a miner's Window PoSt work across a proving period.

View Source
const WorkerKeyChangeDelay = ChainFinality // PARAM_SPEC

Staging period for a miner worker key change. This delay prevents a miner choosing a more favorable worker key that wins leader elections.

Variables

View Source
var BasePenaltyForDisputedWindowPoSt = big.Mul(big.NewInt(20), builtin.TokenPrecision) // PARAM_SPEC

Base penalty for a successful disputed window post proof.

View Source
var BaseRewardForDisputedWindowPoSt = big.Mul(big.NewInt(4), builtin.TokenPrecision) // PARAM_SPEC

Base reward for successfully disputing a window posts proofs.

View Source
var BatchBalancer = big.Mul(big.NewInt(5), builtin.OneNanoFIL) // PARAM_SPEC
View Source
var BatchDiscount = builtin.BigFrac{
	Numerator:   big.NewInt(1),
	Denominator: big.NewInt(20),
}
View Source
var ContinuedFaultFactorDenom = 100
View Source
var ContinuedFaultFactorNum = 351 // PARAM_SPEC

Projection period of expected daily sector block reward penalised when a fault is continued after initial detection. This guarantees that a miner pays back at least the expected block reward earned since the last successful PoSt. The network conservatively assumes the sector was faulty since the last time it was proven. This penalty is currently overly punitive for continued faults. FF = BR(t, ContinuedFaultProjectionPeriod)

View Source
var EstimatedSinglePreCommitGasUsage = big.NewInt(16433324) // PARAM_SPEC
View Source
var EstimatedSingleProveCommitGasUsage = big.NewInt(49299973) // PARAM_SPEC
View Source
var FaultMaxAge = WPoStProvingPeriod * 42 // PARAM_SPEC

The maximum age of a fault before the sector is terminated. This bounds the time a miner can lose client's data before sacrificing pledge and deal collateral.

View Source
var InitialPledgeFactor = 20 // PARAM_SPEC

Projection period of expected sector block rewards for storage pledge required to commit a sector. This pledge is lost if a sector is terminated before its full committed lifetime.

View Source
var InitialPledgeLockTarget = builtin.BigFrac{
	Numerator:   big.NewInt(3),
	Denominator: big.NewInt(10),
}

Multiplier of share of circulating money supply for consensus pledge required to commit a sector. This pledge is lost if a sector is terminated before its full committed lifetime.

View Source
var InitialPledgeMaxPerByte = big.Div(big.NewInt(1e18), big.NewInt(32<<30))

Cap on initial pledge requirement for sectors. The target is 1 FIL (10**18 attoFIL) per 32GiB. This does not divide evenly, so the result is fractionally smaller.

View Source
var InitialPledgeProjectionPeriod = abi.ChainEpoch(InitialPledgeFactor) * builtin.EpochsInDay
View Source
var InvalidWindowPoStProjectionPeriod = abi.ChainEpoch(ContinuedFaultProjectionPeriod + 2*builtin.EpochsInDay) // PARAM_SPEC

FF + 2BR

View Source
var LockedRewardFactorDenom = big.NewInt(100)
View Source
var LockedRewardFactorNum = big.NewInt(75)

Fraction of total reward (block reward + gas reward) to be locked up as of V6

View Source
var MaxPreCommitRandomnessLookback = builtin.EpochsInDay + ChainFinality // PARAM_SPEC

Maximum delay between challenge and pre-commitment. This prevents a miner sealing sectors far in advance of committing them to the chain, thus committing to a particular chain.

Maximum delay to allow between sector pre-commit and subsequent proof. The allowable delay depends on seal proof algorithm.

View Source
var PreCommitChallengeDelay = abi.ChainEpoch(150) // PARAM_SPEC

Number of epochs between publishing a sector pre-commitment and when the challenge for interactive PoRep is drawn. This (1) prevents a miner predicting a challenge before staking their pre-commit deposit, and (2) prevents a miner attempting a long fork in the past to insert a pre-commitment after seeing the challenge.

View Source
var PreCommitDepositFactor = 20 // PARAM_SPEC

Projection period of expected sector block reward for deposit required to pre-commit a sector. This deposit is lost if the pre-commitment is not timely followed up by a commitment proof.

View Source
var PreCommitDepositProjectionPeriod = abi.ChainEpoch(PreCommitDepositFactor) * builtin.EpochsInDay

List of proof types which may be used when pre-committing a new sector. This is mutable to allow configuration of testing and development networks. From network version 8, sectors sealed with the V1 seal proof types cannot be committed.

View Source
var RewardVestingSpec = VestSpec{
	InitialDelay: abi.ChainEpoch(0),
	VestPeriod:   abi.ChainEpoch(180 * builtin.EpochsInDay),
	StepDuration: abi.ChainEpoch(1 * builtin.EpochsInDay),
	Quantization: 12 * builtin.EpochsInHour,
}

The vesting schedule for total rewards (block reward + gas reward) earned by a block producer.

View Source
var SealedCIDPrefix = cid.Prefix{
	Version:  1,
	Codec:    cid.FilCommitmentSealed,
	MhType:   mh.POSEIDON_BLS12_381_A1_FC1,
	MhLength: 32,
}

Prefix for sealed sector CIDs (CommR).

View Source
var TerminationPenaltyLowerBoundProjectionPeriod = abi.ChainEpoch((builtin.EpochsInDay * 35) / 10) // PARAM_SPEC
View Source
var TerminationRewardFactor = builtin.BigFrac{
	Numerator:   big.NewInt(1),
	Denominator: big.NewInt(2),
}

Fraction of assumed block reward penalized when a sector is terminated.

View Source
var WPoStChallengeWindow = abi.ChainEpoch(30 * 60 / builtin.EpochDurationSeconds) // 30 minutes (48 per day) PARAM_SPEC

The period between the opening and the closing of a WindowPoSt deadline in which the miner is expected to provide a Window PoSt proof. This provides a miner enough time to compute and propagate a Window PoSt proof.

View Source
var WPoStDisputeWindow = 2 * ChainFinality // PARAM_SPEC

WPoStDisputeWindow is the period after a challenge window ends during which PoSts submitted during that period may be disputed.

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

The period over which a miner's active sectors are expected to be proven via WindowPoSt. This guarantees that (1) user data is proven daily, (2) user data is stored for 24h by a rational miner (due to Window PoSt cost assumption).

List of proof types which may be used when creating a new miner actor. This is mutable to allow configuration of testing and development networks.

Functions

func AggregatePreCommitNetworkFee

func AggregatePreCommitNetworkFee(aggregateSize int, baseFee abi.TokenAmount) abi.TokenAmount

func AggregateProveCommitNetworkFee

func AggregateProveCommitNetworkFee(aggregateSize int, baseFee abi.TokenAmount) abi.TokenAmount

func CanExtendSealProofType

func CanExtendSealProofType(_ abi.RegisteredSealProof) bool

Checks whether a seal proof type is supported for new miners and sectors. As of network version 11, all permitted seal proof types may be extended.

func CanPreCommitSealProof

func CanPreCommitSealProof(s abi.RegisteredSealProof) bool

Checks whether a seal proof type is supported for new miners and sectors.

func CanWindowPoStProof

func CanWindowPoStProof(s abi.RegisteredPoStProof) bool

Checks whether a PoSt proof type is supported for new miners.

func CheckEarlyTerminationQueue

func CheckEarlyTerminationQueue(earlyQ BitfieldQueue, terminated bitfield.BitField, acc *builtin.MessageAccumulator) int

Checks the early termination queue for consistency. Returns the number of sectors in the queue.

func CheckMinerBalances

func CheckMinerBalances(st *State, store adt.Store, balance abi.TokenAmount, acc *builtin.MessageAccumulator)

func CheckMinerInfo

func CheckMinerInfo(info *MinerInfo, acc *builtin.MessageAccumulator)

func CheckPreCommits

func CheckPreCommits(st *State, store adt.Store, allocatedSectors map[uint64]bool, acc *builtin.MessageAccumulator)

func ConsensusFaultActive

func ConsensusFaultActive(info *MinerInfo, currEpoch abi.ChainEpoch) bool

func ConsensusFaultPenalty

func ConsensusFaultPenalty(thisEpochReward abi.TokenAmount) abi.TokenAmount

func ExpectedRewardForPower

func ExpectedRewardForPower(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower, projectionDuration abi.ChainEpoch) abi.TokenAmount

The projected block reward a sector would earn over some period. Also known as "BR(t)". BR(t) = ProjectedRewardFraction(t) * SectorQualityAdjustedPower ProjectedRewardFraction(t) is the sum of estimated reward over estimated total power over all epochs in the projection period [t t+projectionDuration]

func ExpectedRewardForPowerClampedAtAttoFIL

func ExpectedRewardForPowerClampedAtAttoFIL(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower, projectionDuration abi.ChainEpoch) abi.TokenAmount

BR but zero values are clamped at 1 attofil Some uses of BR (PCD, IP) require a strictly positive value for BR derived values so accounting variables can be used as succinct indicators of miner activity.

func FindSector

func FindSector(store adt.Store, deadlines *Deadlines, sectorNum abi.SectorNumber) (uint64, uint64, error)

FindSector returns the deadline and partition index for a sector number. It returns an error if the sector number is not tracked by deadlines.

func InitialPledgeForPower

func InitialPledgeForPower(qaPower, baselinePower abi.StoragePower, rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, circulatingSupply abi.TokenAmount) abi.TokenAmount

Computes the pledge requirement for committing new quality-adjusted power to the network, given the current network total and baseline power, per-epoch reward, and circulating token supply. The pledge comprises two parts: - storage pledge, aka IP base: a multiple of the reward expected to be earned by newly-committed power - consensus pledge, aka additional IP: a pro-rata fraction of the circulating money supply

IP = IPBase(t) + AdditionalIP(t) IPBase(t) = BR(t, InitialPledgeProjectionPeriod) AdditionalIP(t) = LockTarget(t)*PledgeShare(t) LockTarget = (LockTargetFactorNum / LockTargetFactorDenom) * FILCirculatingSupply(t) PledgeShare(t) = sectorQAPower / max(BaselinePower(t), NetworkQAPower(t))

func NewDeadlineInfo

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

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

func NewDeadlineInfoFromOffsetAndEpoch

func NewDeadlineInfoFromOffsetAndEpoch(periodStartSeed abi.ChainEpoch, currEpoch abi.ChainEpoch) *dline.Info

Determine current period start and deadline index directly from current epoch and the offset implied by the proving period. This works correctly even for the state of a miner actor without an active deadline cron

func PledgePenaltyForContinuedFault

func PledgePenaltyForContinuedFault(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower) abi.TokenAmount

The penalty for a sector continuing faulty for another proving period. It is a projection of the expected reward earned by the sector. Also known as "FF(t)"

func PledgePenaltyForInvalidWindowPoSt

func PledgePenaltyForInvalidWindowPoSt(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower) abi.TokenAmount

The penalty for optimistically proving a sector with an invalid window PoSt.

func PledgePenaltyForTermination

func PledgePenaltyForTermination(dayReward abi.TokenAmount, sectorAge abi.ChainEpoch,
	twentyDayRewardAtActivation abi.TokenAmount, networkQAPowerEstimate smoothing.FilterEstimate,
	qaSectorPower abi.StoragePower, rewardEstimate smoothing.FilterEstimate, replacedDayReward abi.TokenAmount,
	replacedSectorAge abi.ChainEpoch) abi.TokenAmount

Penalty to locked pledge collateral for the termination of a sector before scheduled expiry. SectorAge is the time between the sector's activation and termination. replacedDayReward and replacedSectorAge are the day reward and age of the replaced sector in a capacity upgrade. They must be zero if no upgrade occurred.

func PledgePenaltyForTerminationLowerBound

func PledgePenaltyForTerminationLowerBound(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower) abi.TokenAmount

Lower bound on the penalty for a terminating sector. It is a projection of the expected reward earned by the sector. Also known as "SP(t)"

func PreCommitDepositForPower

func PreCommitDepositForPower(rewardEstimate, networkQAPowerEstimate smoothing.FilterEstimate, qaSectorPower abi.StoragePower) abi.TokenAmount

Computes the PreCommit deposit given sector qa weight and current network conditions. PreCommit Deposit = BR(PreCommitDepositProjectionPeriod)

func QAPowerForSector

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

The quality-adjusted power for a sector.

func QAPowerForWeight

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

The power for a sector size, committed duration, and weight.

func QualityForWeight

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 proportions.

func QuantSpecForDeadline

func QuantSpecForDeadline(di *dline.Info) builtin.QuantSpec

func RepayDebtsOrAbort

func RepayDebtsOrAbort(rt Runtime, st *State) abi.TokenAmount

Repays all fee debt and then verifies that the miner has amount needed to cover the pledge requirement after burning all fee debt. If not aborts. Returns an amount that must be burnt by the actor. Note that this call does not compute recent vesting so reported unlocked balance may be slightly lower than the true amount. Computing vesting here would be almost always redundant since vesting is quantized to ~daily units. Vesting will be at most one proving period old if computed in the cron callback.

func RewardForConsensusSlashReport

func RewardForConsensusSlashReport(epochReward abi.TokenAmount) abi.TokenAmount

When an actor reports a consensus fault, they earn a share of the penalty paid by the miner.

func RewardForDisputedWindowPoSt

func RewardForDisputedWindowPoSt(proofType abi.RegisteredPoStProof, disputedPower PowerPair) abi.TokenAmount

The reward given for successfully disputing a window post.

func SectorDealsMax

func SectorDealsMax(size abi.SectorSize) uint64

Determine maximum number of deal miner's sector can hold

func SectorKey

func SectorKey(e abi.SectorNumber) abi.Keyer

Types

type Actor

type Actor struct{}

func (Actor) ApplyRewards

func (a Actor) ApplyRewards(rt Runtime, params *builtin.ApplyRewardParams) *abi.EmptyValue

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

func (Actor) ChangeMultiaddrs

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

func (Actor) ChangeOwnerAddress

func (a Actor) ChangeOwnerAddress(rt Runtime, newAddress *addr.Address) *abi.EmptyValue

Proposes or confirms a change of owner address. If invoked by the current owner, proposes a new owner address for confirmation. If the proposed address is the current owner address, revokes any existing proposal. If invoked by the previously proposed address, with the same proposal, changes the current owner address to be that proposed address.

func (Actor) ChangePeerID

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

func (Actor) ChangeWorkerAddress

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

ChangeWorkerAddress will ALWAYS overwrite the existing control addresses with the control addresses passed in the params. If a nil addresses slice is passed, the control addresses will be cleared. A worker change will be scheduled if the worker passed in the params is different from the existing worker.

func (Actor) CheckSectorProven

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

func (Actor) Code

func (a Actor) Code() cid.Cid

func (Actor) CompactPartitions

func (a Actor) CompactPartitions(rt Runtime, params *CompactPartitionsParams) *abi.EmptyValue

Compacts a number of partitions at one deadline by removing terminated sectors, re-ordering the remaining sectors, and assigning them to new partitions so as to completely fill all but one partition with live sectors. The addressed partitions are removed from the deadline, and new ones appended. The final partition in the deadline is always included in the compaction, whether or not explicitly requested. Removed sectors are removed from state entirely. May not be invoked if the deadline has any un-processed early terminations.

func (Actor) CompactSectorNumbers

func (a Actor) CompactSectorNumbers(rt Runtime, params *CompactSectorNumbersParams) *abi.EmptyValue

Compacts sector number allocations to reduce the size of the allocated sector number bitfield.

When allocating sector numbers sequentially, or in sequential groups, this bitfield should remain fairly small. However, if the bitfield grows large enough such that PreCommitSector fails (or becomes expensive), this method can be called to mask out (throw away) entire ranges of unused sector IDs. For example, if sectors 1-99 and 101-200 have been allocated, sector number 99 can be masked out to collapse these two ranges into one.

func (Actor) ConfirmSectorProofsValid

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

func (Actor) ConfirmUpdateWorkerKey

func (a Actor) ConfirmUpdateWorkerKey(rt Runtime, params *abi.EmptyValue) *abi.EmptyValue

Triggers a worker address change if a change has been requested and its effective epoch has arrived.

func (Actor) Constructor

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

func (Actor) ControlAddresses

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

func (Actor) DeclareFaults

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

func (Actor) DeclareFaultsRecovered

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

func (Actor) DisputeWindowedPoSt

func (a Actor) DisputeWindowedPoSt(rt Runtime, params *DisputeWindowedPoStParams) *abi.EmptyValue

func (Actor) Exports

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

func (Actor) ExtendSectorExpiration

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

Changes the expiration epoch for a sector to a new, later one. The sector must not be terminated or faulty. The sector's power is recomputed for the new expiration.

func (Actor) OnDeferredCronEvent

func (a Actor) OnDeferredCronEvent(rt Runtime, params *builtin.DeferredCronEventParams) *abi.EmptyValue

func (Actor) PreCommitSector

func (a Actor) PreCommitSector(rt Runtime, params *PreCommitSectorParams) *abi.EmptyValue

Pledges to seal and commit a single sector. See PreCommitSectorBatch for details. This method may be deprecated and removed in the future.

func (Actor) PreCommitSectorBatch

func (a Actor) PreCommitSectorBatch(rt Runtime, params *PreCommitSectorBatchParams) *abi.EmptyValue

Pledges the miner to seal and commit some new sectors. The caller specifies sector numbers, sealed sector data CIDs, seal randomness epoch, expiration, and the IDs of any storage deals contained in the sector data. The storage deal proposals must be already submitted to the storage market actor. This method calculates the sector's power, locks a pre-commit deposit for the sector, stores information about the sector in state and waits for it to be proven or expire.

func (Actor) ProveCommitAggregate

func (a Actor) ProveCommitAggregate(rt Runtime, params *ProveCommitAggregateParams) *abi.EmptyValue

Checks state of the corresponding sector pre-commitments and verifies aggregate proof of replication of these sectors. If valid, the sectors' deals are activated, sectors are assigned a deadline and charged pledge and precommit state is removed.

func (Actor) ProveCommitSector

func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *abi.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) ProveReplicaUpdates

func (a Actor) ProveReplicaUpdates(rt Runtime, params *ProveReplicaUpdatesParams) *bitfield.BitField

func (Actor) RepayDebt

func (a Actor) RepayDebt(rt Runtime, _ *abi.EmptyValue) *abi.EmptyValue

func (Actor) ReportConsensusFault

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

func (Actor) State

func (a Actor) State() cbor.Er

func (Actor) SubmitWindowedPoSt

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

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

func (Actor) TerminateSectors

func (a Actor) TerminateSectors(rt Runtime, params *TerminateSectorsParams) *TerminateSectorsReturn

Marks some sectors as terminated at the present epoch, earlier than their scheduled termination, and adds these sectors to the early termination queue. This method then processes up to AddressedSectorsMax sectors and AddressedPartitionsMax partitions from the early termination queue, terminating deals, paying fines, and returning pledge collateral. While sectors remain in this queue:

  1. The miner will be unable to withdraw funds.
  2. The chain will process up to AddressedSectorsMax sectors and AddressedPartitionsMax per epoch until the queue is empty.

The sectors are immediately ignored for Window PoSt proofs, and should be masked in the same way as faulty sectors. A miner may not terminate sectors in the current deadline or the next deadline to be proven.

This function may be invoked with no new sectors to explicitly process the next batch of sectors.

func (Actor) WithdrawBalance

func (a Actor) WithdrawBalance(rt Runtime, params *WithdrawBalanceParams) *abi.TokenAmount

Attempt to withdraw the specified amount from the miner's available balance. Only owner key has permission to withdraw. If less than the specified amount is available, yields the entire available balance. Returns the amount withdrawn.

type AdvanceDeadlineResult

type AdvanceDeadlineResult struct {
	PledgeDelta           abi.TokenAmount
	PowerDelta            PowerPair
	PreviouslyFaultyPower PowerPair // Power that was faulty before this advance (including recovering)
	DetectedFaultyPower   PowerPair // Power of new faults and failed recoveries
	TotalFaultyPower      PowerPair // Total faulty power after detecting faults (before expiring sectors)

}

type BitfieldQueue

type BitfieldQueue struct {
	*adt.Array
	// contains filtered or unexported fields
}

Wrapper for working with an AMT[ChainEpoch]*Bitfield functioning as a queue, bucketed by epoch. Keys in the queue are quantized (upwards), modulo some offset, to reduce the cardinality of keys.

func LoadBitfieldQueue

func LoadBitfieldQueue(store adt.Store, root cid.Cid, quant builtin.QuantSpec, bitwidth int) (BitfieldQueue, error)

func (BitfieldQueue) AddManyToQueueValues

func (q BitfieldQueue) AddManyToQueueValues(values map[abi.ChainEpoch][]uint64) error

func (BitfieldQueue) AddToQueue

func (q BitfieldQueue) AddToQueue(rawEpoch abi.ChainEpoch, values bitfield.BitField) error

Adds values to the queue entry for an epoch.

func (BitfieldQueue) AddToQueueValues

func (q BitfieldQueue) AddToQueueValues(epoch abi.ChainEpoch, values ...uint64) error

func (BitfieldQueue) Cut

func (q BitfieldQueue) Cut(toCut bitfield.BitField) error

Cut cuts the elements from the bits in the given bitfield out of the queue, shifting other bits down and removing any newly empty entries.

See the docs on BitField.Cut to better understand what it does.

func (BitfieldQueue) ForEach

func (q BitfieldQueue) ForEach(cb func(epoch abi.ChainEpoch, bf bitfield.BitField) error) error

Iterates the queue.

func (BitfieldQueue) PopUntil

func (q BitfieldQueue) PopUntil(until abi.ChainEpoch) (values bitfield.BitField, modified bool, err error)

Removes and returns all values with keys less than or equal to until. Modified return value indicates whether this structure has been changed by the call.

type BurnMethod

type BurnMethod string
const (
	BurnMethodDisputeWindowedPoSt      BurnMethod = "DisputeWindowedPoSt"
	BurnMethodPreCommitSectorBatch     BurnMethod = "PreCommitSectorBatch"
	BurnMethodProveCommitAggregate     BurnMethod = "ProveCommitAggregate"
	BurnMethodDeclareFaultsRecovered   BurnMethod = "DeclareFaultsRecovered"
	BurnMethodApplyRewards             BurnMethod = "ApplyRewards"
	BurnMethodReportConsensusFault     BurnMethod = "ReportConsensusFault"
	BurnMethodWithdrawBalance          BurnMethod = "WithdrawBalance "
	BurnMethodRepayDebt                BurnMethod = "RepayDebt"
	BurnMethodProcessEarlyTerminations BurnMethod = "ProcessEarlyTerminations"
	BurnMethodHandleProvingDeadline    BurnMethod = "HandleProvingDeadline "
)

type ChangeMultiaddrsParams

type ChangeMultiaddrsParams = miner0.ChangeMultiaddrsParams
type ChangeMultiaddrsParams struct {
	NewMultiaddrs []abi.Multiaddrs
}

type ChangePeerIDParams

type ChangePeerIDParams = miner0.ChangePeerIDParams
type ChangePeerIDParams struct {
	NewID abi.PeerID
}

type ChangeWorkerAddressParams

type ChangeWorkerAddressParams = miner0.ChangeWorkerAddressParams
type ChangeWorkerAddressParams struct {
	NewWorker       addr.Address
	NewControlAddrs []addr.Address
}

type CheckSectorProvenParams

type CheckSectorProvenParams = miner0.CheckSectorProvenParams
type CheckSectorProvenParams struct {
	SectorNumber abi.SectorNumber
}

type CollisionPolicy

type CollisionPolicy bool

type CompactPartitionsParams

type CompactPartitionsParams = miner0.CompactPartitionsParams
type CompactPartitionsParams struct {
	Deadline   uint64
	Partitions bitfield.BitField
}

type CompactSectorNumbersParams

type CompactSectorNumbersParams = miner0.CompactSectorNumbersParams
type CompactSectorNumbersParams struct {
	MaskSectorNumbers bitfield.BitField
}

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 = miner0.CronEventPayload
type CronEventPayload struct {
	EventType CronEventType
}

type CronEventType

type CronEventType = miner0.CronEventType

type Deadline

type Deadline struct {
	// Partitions in this deadline, in order.
	// The keys of this AMT are always sequential integers beginning with zero.
	Partitions cid.Cid // AMT[PartitionNumber]Partition

	// Maps epochs to partitions that _may_ have sectors that expire in or
	// before that epoch, either on-time or early as faults.
	// Keys are quantized to final epochs in each proving deadline.
	//
	// NOTE: Partitions MUST NOT be removed from this queue (until the
	// associated epoch has passed) even if they no longer have sectors
	// expiring at that epoch. Sectors expiring at this epoch may later be
	// recovered, and this queue will not be updated at that time.
	ExpirationsEpochs cid.Cid // AMT[ChainEpoch]BitField

	// Partitions that have been proved by window PoSts so far during the
	// current challenge window.
	// NOTE: This bitfield includes both partitions whose proofs
	// were optimistically accepted and stored in
	// OptimisticPoStSubmissions, and those whose proofs were
	// verified on-chain.
	PartitionsPoSted bitfield.BitField

	// Partitions with sectors that terminated early.
	EarlyTerminations bitfield.BitField

	// The number of non-terminated sectors in this deadline (incl faulty).
	LiveSectors uint64

	// The total number of sectors in this deadline (incl dead).
	TotalSectors uint64

	// Memoized sum of faulty power in partitions.
	FaultyPower PowerPair

	// AMT of optimistically accepted WindowPoSt proofs, submitted during
	// the current challenge window. At the end of the challenge window,
	// this AMT will be moved to OptimisticPoStSubmissionsSnapshot. WindowPoSt proofs
	// verified on-chain do not appear in this AMT.
	OptimisticPoStSubmissions cid.Cid // AMT[]WindowedPoSt

	// Snapshot of the miner's sectors AMT at the end of the previous challenge
	// window for this deadline.
	SectorsSnapshot cid.Cid

	// Snapshot of partition state at the end of the previous challenge
	// window for this deadline.
	PartitionsSnapshot cid.Cid

	// Snapshot of the proofs submitted by the end of the previous challenge
	// window for this deadline.
	//
	// These proofs may be disputed via DisputeWindowedPoSt. Successfully
	// disputed window PoSts are removed from the snapshot.
	OptimisticPoStSubmissionsSnapshot cid.Cid
}

Deadline holds the state for all sectors due at a specific deadline.

func ConstructDeadline

func ConstructDeadline(store adt.Store) (*Deadline, error)

func (*Deadline) AddExpirationPartitions

func (d *Deadline) AddExpirationPartitions(store adt.Store, expirationEpoch abi.ChainEpoch, partitions []uint64, quant builtin.QuantSpec) error

Adds some partition numbers to the set expiring at an epoch.

func (*Deadline) AddSectors

func (dl *Deadline) AddSectors(
	store adt.Store, partitionSize uint64, proven bool, sectors []*SectorOnChainInfo,
	ssize abi.SectorSize, quant builtin.QuantSpec,
) (PowerPair, error)

Adds sectors to a deadline. It's the caller's responsibility to make sure that this deadline isn't currently "open" (i.e., being proved at this point in time). The sectors are assumed to be non-faulty. Returns the power of the added sectors (which is active yet if proven=false).

func (*Deadline) DeclareFaultsRecovered

func (dl *Deadline) DeclareFaultsRecovered(
	store adt.Store, sectors Sectors, ssize abi.SectorSize,
	partitionSectors PartitionSectorMap,
) (err error)

func (*Deadline) IsLive

func (d *Deadline) IsLive() (bool, error)

IsLive returns true if the deadline has any live sectors or any other state that should be updated at the end of the challenge window.

func (*Deadline) LoadPartition

func (d *Deadline) LoadPartition(store adt.Store, partIdx uint64) (*Partition, error)

func (*Deadline) LoadPartitionSnapshot

func (d *Deadline) LoadPartitionSnapshot(store adt.Store, partIdx uint64) (*Partition, error)

func (*Deadline) LoadPartitionsForDispute

func (dl *Deadline) LoadPartitionsForDispute(store adt.Store, partitions bitfield.BitField) (*DisputeInfo, error)

LoadPartitionsForDispute

func (*Deadline) MarshalCBOR

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

func (*Deadline) OptimisticProofsArray

func (d *Deadline) OptimisticProofsArray(store adt.Store) (*adt.Array, error)

func (*Deadline) OptimisticProofsSnapshotArray

func (d *Deadline) OptimisticProofsSnapshotArray(store adt.Store) (*adt.Array, error)

func (*Deadline) PartitionsArray

func (d *Deadline) PartitionsArray(store adt.Store) (*adt.Array, error)

func (*Deadline) PartitionsSnapshotArray

func (d *Deadline) PartitionsSnapshotArray(store adt.Store) (*adt.Array, error)

func (*Deadline) PopEarlyTerminations

func (dl *Deadline) PopEarlyTerminations(store adt.Store, maxPartitions, maxSectors uint64) (result TerminationResult, hasMore bool, err error)

func (*Deadline) PopExpiredSectors

func (dl *Deadline) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant builtin.QuantSpec) (*ExpirationSet, error)

PopExpiredSectors terminates expired sectors from all partitions. Returns the expired sector aggregates.

func (*Deadline) ProcessDeadlineEnd

func (dl *Deadline) ProcessDeadlineEnd(store adt.Store, quant builtin.QuantSpec, faultExpirationEpoch abi.ChainEpoch, sectors cid.Cid) (
	powerDelta, penalizedPower PowerPair, err error,
)

ProcessDeadlineEnd processes all PoSt submissions, marking unproven sectors as faulty and clearing failed recoveries. It returns the power delta, and any power that should be penalized (new faults and failed recoveries).

func (*Deadline) RecordFaults

func (dl *Deadline) RecordFaults(
	store adt.Store, sectors Sectors, ssize abi.SectorSize, quant builtin.QuantSpec,
	faultExpirationEpoch abi.ChainEpoch, partitionSectors PartitionSectorMap,
) (powerDelta PowerPair, err error)

func (*Deadline) RecordPoStProofs

func (dl *Deadline) RecordPoStProofs(store adt.Store, partitions bitfield.BitField, proofs []prooftypes.PoStProof) error

RecordPoStProofs records a set of optimistically accepted PoSt proofs (usually one), associating them with the given partitions.

func (*Deadline) RecordProvenSectors

func (dl *Deadline) RecordProvenSectors(
	store adt.Store, sectors Sectors,
	ssize abi.SectorSize, quant builtin.QuantSpec, faultExpiration abi.ChainEpoch,
	postPartitions []PoStPartition,
) (*PoStResult, error)

RecordProvenSectors processes a series of posts, recording proven partitions and marking skipped sectors as faulty.

It returns a PoStResult containing the list of proven and skipped sectors and changes to power (newly faulty power, power that should have been proven recovered but wasn't, and newly recovered power).

NOTE: This function does not actually _verify_ any proofs.

func (*Deadline) RemovePartitions

func (dl *Deadline) RemovePartitions(store adt.Store, toRemove bitfield.BitField, quant builtin.QuantSpec) (
	live, dead bitfield.BitField, removedPower PowerPair, err error,
)

RemovePartitions removes the specified partitions, shifting the remaining ones to the left, and returning the live and dead sectors they contained.

Returns an error if any of the partitions contained faulty sectors or early terminations.

func (*Deadline) SectorsSnapshotArray

func (d *Deadline) SectorsSnapshotArray(store adt.Store) (*adt.Array, error)

func (*Deadline) TakePoStProofs

func (dl *Deadline) TakePoStProofs(store adt.Store, idx uint64) (partitions bitfield.BitField, proofs []prooftypes.PoStProof, err error)

TakePoStProofs removes and returns a PoSt proof by index, along with the associated partitions. This method takes the PoSt from the PoSt submissions snapshot.

func (*Deadline) TerminateSectors

func (dl *Deadline) TerminateSectors(
	store adt.Store,
	sectors Sectors,
	epoch abi.ChainEpoch,
	partitionSectors PartitionSectorMap,
	ssize abi.SectorSize,
	quant builtin.QuantSpec,
) (powerLost PowerPair, err error)

func (*Deadline) UnmarshalCBOR

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

func (*Deadline) ValidateState

func (d *Deadline) ValidateState() error

type DeadlineSectorMap

type DeadlineSectorMap map[uint64]PartitionSectorMap

Maps deadlines to partition maps.

func (DeadlineSectorMap) Add

func (dm DeadlineSectorMap) Add(dlIdx, partIdx uint64, sectorNos bitfield.BitField) error

Add records the given sector bitfield at the given deadline/partition index.

func (DeadlineSectorMap) AddValues

func (dm DeadlineSectorMap) AddValues(dlIdx, partIdx uint64, sectorNos ...uint64) error

AddValues records the given sectors at the given deadline/partition index.

func (DeadlineSectorMap) Check

func (dm DeadlineSectorMap) Check(maxPartitions, maxSectors uint64) error

Check validates all bitfields and counts the number of partitions & sectors contained within the map, and returns an error if they exceed the given maximums.

func (DeadlineSectorMap) Count

func (dm DeadlineSectorMap) Count() (partitions, sectors uint64, err error)

Count counts the number of partitions & sectors within the map.

func (DeadlineSectorMap) Deadlines

func (dm DeadlineSectorMap) Deadlines() []uint64

Deadlines returns a sorted slice of deadlines in the map.

func (DeadlineSectorMap) ForEach

func (dm DeadlineSectorMap) ForEach(cb func(dlIdx uint64, pm PartitionSectorMap) error) error

ForEach walks the deadlines in deadline order.

type DeadlineStateSummary

type DeadlineStateSummary struct {
	AllSectors        bitfield.BitField
	LiveSectors       bitfield.BitField
	FaultySectors     bitfield.BitField
	RecoveringSectors bitfield.BitField
	UnprovenSectors   bitfield.BitField
	TerminatedSectors bitfield.BitField
	LivePower         PowerPair
	ActivePower       PowerPair
	FaultyPower       PowerPair
}

func CheckDeadlineStateInvariants

func CheckDeadlineStateInvariants(deadline *Deadline, store adt.Store, quant builtin.QuantSpec, ssize abi.SectorSize,
	sectors map[abi.SectorNumber]*SectorOnChainInfo, acc *builtin.MessageAccumulator) *DeadlineStateSummary

type Deadlines

type Deadlines struct {
	// Note: we could inline part of the deadline struct (e.g., active/assigned sectors)
	// to make new sector assignment cheaper. At the moment, assigning a sector requires
	// loading all deadlines to figure out where best to assign new sectors.
	Due [WPoStPeriodDeadlines]cid.Cid // []Deadline
}

Deadlines contains Deadline objects, describing the sectors due at the given deadline and their state (faulty, terminated, recovering, etc.).

func ConstructDeadlines

func ConstructDeadlines(emptyDeadlineCid cid.Cid) *Deadlines

func (*Deadlines) ForEach

func (d *Deadlines) ForEach(store adt.Store, cb func(dlIdx uint64, dl *Deadline) error) error

func (*Deadlines) LoadDeadline

func (d *Deadlines) LoadDeadline(store adt.Store, dlIdx uint64) (*Deadline, error)

func (*Deadlines) MarshalCBOR

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

func (*Deadlines) UnmarshalCBOR

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

func (*Deadlines) UpdateDeadline

func (d *Deadlines) UpdateDeadline(store adt.Store, dlIdx uint64, deadline *Deadline) error

type DealSummary

type DealSummary struct {
	SectorStart      abi.ChainEpoch
	SectorExpiration abi.ChainEpoch
}

type DeclareFaultsParams

type DeclareFaultsParams = miner0.DeclareFaultsParams
type DeclareFaultsParams struct {
	Faults []FaultDeclaration
}

type DeclareFaultsRecoveredParams

type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
type DeclareFaultsRecoveredParams struct {
	Recoveries []RecoveryDeclaration
}

type DisputeInfo

type DisputeInfo struct {
	AllSectorNos, IgnoredSectorNos bitfield.BitField
	DisputedSectors                PartitionSectorMap
	DisputedPower                  PowerPair
}

DisputeInfo includes all the information necessary to dispute a post to the given partitions.

type DisputeWindowedPoStParams

type DisputeWindowedPoStParams = miner3.DisputeWindowedPoStParams
type DisputeWindowedPoStParams struct {
		Deadline  uint64
		PoStIndex uint64 // only one is allowed at a time to avoid loading too many sector infos.
}

type ExpirationExtension

type ExpirationExtension = miner0.ExpirationExtension
type ExpirationExtension struct {
	Deadline      uint64
	Partition     uint64
	Sectors       bitfield.BitField
	NewExpiration abi.ChainEpoch
}

type ExpirationQueue

type ExpirationQueue struct {
	*adt.Array
	// contains filtered or unexported fields
}

A queue of expiration sets by epoch, representing the on-time or early termination epoch for a collection of sectors. Wraps an AMT[ChainEpoch]*ExpirationSet. Keys in the queue are quantized (upwards), modulo some offset, to reduce the cardinality of keys.

func LoadExpirationQueue

func LoadExpirationQueue(store adt.Store, root cid.Cid, quant builtin.QuantSpec, bitwidth int) (ExpirationQueue, error)

Loads a queue root. Epochs provided to subsequent method calls will be quantized upwards to quanta mod offsetSeed before being written to/read from queue entries.

func (ExpirationQueue) AddActiveSectors

func (q ExpirationQueue) AddActiveSectors(sectors []*SectorOnChainInfo, ssize abi.SectorSize) (bitfield.BitField, PowerPair, abi.TokenAmount, error)

Adds a collection of sectors to their on-time target expiration entries (quantized). The sectors are assumed to be active (non-faulty). Returns the sector numbers, power, and pledge added.

func (ExpirationQueue) PopUntil

func (q ExpirationQueue) PopUntil(until abi.ChainEpoch) (*ExpirationSet, error)

Removes and aggregates entries from the queue up to and including some epoch.

func (ExpirationQueue) RemoveSectors

func (q ExpirationQueue) RemoveSectors(sectors []*SectorOnChainInfo, faults bitfield.BitField, recovering bitfield.BitField,
	ssize abi.SectorSize) (*ExpirationSet, PowerPair, error)

Remove some sectors from the queue. The sectors may be active or faulty, and scheduled either for on-time or early termination. Returns the aggregate of removed sectors and power, and recovering power. Fails if any sectors are not found in the queue.

func (ExpirationQueue) ReplaceSectors

func (q ExpirationQueue) ReplaceSectors(oldSectors, newSectors []*SectorOnChainInfo, ssize abi.SectorSize) (bitfield.BitField, bitfield.BitField, PowerPair, abi.TokenAmount, error)

Removes some sectors and adds some others. The sectors being replaced must not be faulty, so must be scheduled for on-time rather than early expiration. The sectors added are assumed to be not faulty. Returns the old a new sector number bitfields, and delta to power and pledge, new minus old.

func (ExpirationQueue) RescheduleAllAsFaults

func (q ExpirationQueue) RescheduleAllAsFaults(faultExpiration abi.ChainEpoch) error

Re-schedules *all* sectors to expire at an early expiration epoch, if they wouldn't expire before then anyway.

func (ExpirationQueue) RescheduleAsFaults

func (q ExpirationQueue) RescheduleAsFaults(newExpiration abi.ChainEpoch, sectors []*SectorOnChainInfo, ssize abi.SectorSize) (PowerPair, error)

Re-schedules sectors to expire at an early expiration epoch (quantized), if they wouldn't expire before then anyway. The sectors must not be currently faulty, so must be registered as expiring on-time rather than early. The pledge for the now-early sectors is removed from the queue. Returns the total power represented by the sectors.

func (ExpirationQueue) RescheduleRecovered

func (q ExpirationQueue) RescheduleRecovered(sectors []*SectorOnChainInfo, ssize abi.SectorSize) (PowerPair, error)

Removes sectors from any queue entries in which they appear that are earlier then their scheduled expiration epoch, and schedules them at their expected termination epoch. Pledge for the sectors is re-added as on-time. Power for the sectors is changed from faulty to active (whether rescheduled or not). Returns the newly-recovered power. Fails if any sectors are not found in the queue.

type ExpirationQueueStateSummary

type ExpirationQueueStateSummary struct {
	OnTimeSectors    bitfield.BitField
	EarlySectors     bitfield.BitField
	ActivePower      PowerPair
	FaultyPower      PowerPair
	OnTimePledge     abi.TokenAmount
	ExpirationEpochs []abi.ChainEpoch
}

func CheckExpirationQueue

func CheckExpirationQueue(expQ ExpirationQueue, liveSectors map[abi.SectorNumber]*SectorOnChainInfo,
	partitionFaults bitfield.BitField, quant builtin.QuantSpec, sectorSize abi.SectorSize, acc *builtin.MessageAccumulator) *ExpirationQueueStateSummary

Checks the expiration queue for consistency.

type ExpirationSet

type ExpirationSet struct {
	OnTimeSectors bitfield.BitField // Sectors expiring "on time" at the end of their committed life
	EarlySectors  bitfield.BitField // Sectors expiring "early" due to being faulty for too long
	OnTimePledge  abi.TokenAmount   // Pledge total for the on-time sectors
	ActivePower   PowerPair         // Power that is currently active (not faulty)
	FaultyPower   PowerPair         // Power that is currently faulty
}

ExpirationSet is a collection of sector numbers that are expiring, either due to expected "on-time" expiration at the end of their life, or unexpected "early" termination due to being faulty for too long consecutively. Note that there is not a direct correspondence between on-time sectors and active power; a sector may be faulty but expiring on-time if it faults just prior to expected termination. Early sectors are always faulty, and active power always represents on-time sectors.

func NewExpirationSet

func NewExpirationSet(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, activePower, faultyPower PowerPair) *ExpirationSet

func NewExpirationSetEmpty

func NewExpirationSetEmpty() *ExpirationSet

func (*ExpirationSet) Add

func (es *ExpirationSet) Add(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, activePower, faultyPower PowerPair) error

Adds sectors and power to the expiration set in place.

func (*ExpirationSet) Count

func (es *ExpirationSet) Count() (count uint64, err error)

Counts all sectors in the expiration set.

func (*ExpirationSet) IsEmpty

func (es *ExpirationSet) IsEmpty() (empty bool, err error)

A set is empty if it has no sectors. The power and pledge are not checked, but expected to be zero.

func (*ExpirationSet) MarshalCBOR

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

func (*ExpirationSet) Remove

func (es *ExpirationSet) Remove(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, activePower, faultyPower PowerPair) error

Removes sectors and power from the expiration set in place.

func (*ExpirationSet) UnmarshalCBOR

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

func (*ExpirationSet) ValidateState

func (es *ExpirationSet) ValidateState() error

validates a set of assertions that must hold for expiration sets

type ExtendSectorExpirationParams

type ExtendSectorExpirationParams = miner0.ExtendSectorExpirationParams
type ExtendSectorExpirationParams struct {
	Extensions []ExpirationExtension
}

type FaultDeclaration

type FaultDeclaration = miner0.FaultDeclaration
type FaultDeclaration struct {
	// The deadline to which the faulty sectors are assigned, in range [0..WPoStPeriodDeadlines)
	Deadline uint64
	// Partition index within the deadline containing the faulty sectors.
	Partition uint64
	// Sectors in the partition being declared faulty.
	Sectors bitfield.BitField
}

type GetControlAddressesReturn

type GetControlAddressesReturn = miner2.GetControlAddressesReturn
type GetControlAddressesReturn struct {
	Owner        addr.Address
	Worker       addr.Address
	ControlAddrs []addr.Address
}

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.

	// Additional addresses that are permitted to submit messages controlling this actor (optional).
	ControlAddresses []addr.Address // Must all be ID addresses.

	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 for Window PoSt for this miner.
	// A miner may commit sectors with different seal proof types (but compatible sector size and
	// corresponding PoSt proof types).
	WindowPoStProofType abi.RegisteredPoStProof

	// 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

	// The next epoch this miner is eligible for certain permissioned actor methods
	// and winning block elections as a result of being reported for a consensus fault.
	ConsensusFaultElapsed abi.ChainEpoch

	// A proposed new owner account for this miner.
	// Must be confirmed by a message from the pending address itself.
	PendingOwnerAddress *addr.Address
}

func ConstructMinerInfo

func ConstructMinerInfo(owner, worker addr.Address, controlAddrs []addr.Address, pid []byte, multiAddrs []abi.Multiaddrs,
	windowPoStProofType abi.RegisteredPoStProof) (*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 Partition

type Partition struct {
	// Sector numbers in this partition, including faulty, unproven, and terminated sectors.
	Sectors bitfield.BitField
	// Unproven sectors in this partition. This bitfield will be cleared on
	// a successful window post (or at the end of the partition's next
	// deadline). At that time, any still unproven sectors will be added to
	// the faulty sector bitfield.
	Unproven bitfield.BitField
	// Subset of sectors detected/declared faulty and not yet recovered (excl. from PoSt).
	// Faults ∩ Terminated = ∅
	Faults bitfield.BitField
	// Subset of faulty sectors expected to recover on next PoSt
	// Recoveries ∩ Terminated = ∅
	Recoveries bitfield.BitField
	// Subset of sectors terminated but not yet removed from partition (excl. from PoSt)
	Terminated bitfield.BitField
	// Maps epochs sectors that expire in or before that epoch.
	// An expiration may be an "on-time" scheduled expiration, or early "faulty" expiration.
	// Keys are quantized to last-in-deadline epochs.
	ExpirationsEpochs cid.Cid // AMT[ChainEpoch]ExpirationSet
	// Subset of terminated that were before their committed expiration epoch, by termination epoch.
	// Termination fees have not yet been calculated or paid and associated deals have not yet been
	// canceled but effective power has already been adjusted.
	// Not quantized.
	EarlyTerminated cid.Cid // AMT[ChainEpoch]BitField

	// Power of not-yet-terminated sectors (incl faulty & unproven).
	LivePower PowerPair
	// Power of yet-to-be-proved sectors (never faulty).
	UnprovenPower PowerPair
	// Power of currently-faulty sectors. FaultyPower <= LivePower.
	FaultyPower PowerPair
	// Power of expected-to-recover sectors. RecoveringPower <= FaultyPower.
	RecoveringPower PowerPair
}

func ConstructPartition

func ConstructPartition(store adt.Store) (*Partition, error)

A set of sectors associated with a given epoch.

func (*Partition) ActivateUnproven

func (p *Partition) ActivateUnproven() PowerPair

Activates unproven sectors, returning the activated power.

func (*Partition) ActivePower

func (p *Partition) ActivePower() PowerPair

Active power is power of non-faulty sectors.

func (*Partition) ActiveSectors

func (p *Partition) ActiveSectors() (bitfield.BitField, error)

Active sectors are those that are neither terminated nor faulty nor unproven, i.e. actively contributing power.

func (*Partition) AddSectors

func (p *Partition) AddSectors(
	store adt.Store, proven bool, sectors []*SectorOnChainInfo, ssize abi.SectorSize, quant builtin.QuantSpec,
) (PowerPair, error)

AddSectors adds new sectors to the partition. The sectors are "live", neither faulty, recovering, nor terminated. Each new sector's expiration is scheduled shortly after its target expiration epoch. If proven is false, the sectors are added to the partition's unproven set. Returns the total power of the added sectors.

func (*Partition) DeclareFaultsRecovered

func (p *Partition) DeclareFaultsRecovered(sectors Sectors, ssize abi.SectorSize, sectorNos bitfield.BitField) (err error)

Declares sectors as recovering. Non-faulty and already recovering sectors will be skipped.

func (*Partition) LiveSectors

func (p *Partition) LiveSectors() (bitfield.BitField, error)

Live sectors are those that are not terminated (but may be faulty).

func (*Partition) MarshalCBOR

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

func (*Partition) PopEarlyTerminations

func (p *Partition) PopEarlyTerminations(store adt.Store, maxSectors uint64) (result TerminationResult, hasMore bool, err error)

func (*Partition) PopExpiredSectors

func (p *Partition) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant builtin.QuantSpec) (*ExpirationSet, error)

PopExpiredSectors traverses the expiration queue up to and including some epoch, and marks all expiring sectors as terminated.

This cannot be called while there are unproven sectors.

Returns the expired sector aggregates.

func (*Partition) RecordFaults

func (p *Partition) RecordFaults(
	store adt.Store, sectors Sectors, sectorNos bitfield.BitField, faultExpirationEpoch abi.ChainEpoch,
	ssize abi.SectorSize, quant builtin.QuantSpec,
) (newFaults bitfield.BitField, powerDelta, newFaultyPower PowerPair, err error)

Declares a set of sectors faulty. Already faulty sectors are ignored, terminated sectors are skipped, and recovering sectors are reverted to faulty.

- New faults are added to the Faults bitfield and the FaultyPower is increased. - The sectors' expirations are rescheduled to the fault expiration epoch, as "early" (if not expiring earlier).

Returns the power of the now-faulty sectors.

func (*Partition) RecordMissedPost

func (p *Partition) RecordMissedPost(
	store adt.Store, faultExpiration abi.ChainEpoch, quant builtin.QuantSpec,
) (powerDelta, penalizedPower, newFaultyPower PowerPair, err error)

Marks all non-faulty sectors in the partition as faulty and clears recoveries, updating power memos appropriately. All sectors' expirations are rescheduled to the fault expiration, as "early" (if not expiring earlier) Returns the power delta, power that should be penalized (new faults + failed recoveries), and newly faulty power.

func (*Partition) RecordSkippedFaults

func (p *Partition) RecordSkippedFaults(
	store adt.Store, sectors Sectors, ssize abi.SectorSize, quant builtin.QuantSpec, faultExpiration abi.ChainEpoch, skipped bitfield.BitField,
) (powerDelta, newFaultPower, retractedRecoveryPower PowerPair, hasNewFaults bool, err error)

Discovers how skipped faults declared during post intersect with existing faults and recoveries, records the new faults in state. Returns the amount of power newly faulty, or declared recovered but faulty again.

- Skipped faults that are not in the provided partition triggers an error. - Skipped faults that are already declared (but not delcared recovered) are ignored.

func (*Partition) RecoverFaults

func (p *Partition) RecoverFaults(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant builtin.QuantSpec) (PowerPair, error)

Removes sector numbers from faults and thus from recoveries. The sectors are removed from the Faults and Recovering bitfields, and FaultyPower and RecoveringPower reduced. The sectors are re-scheduled for expiration shortly after their target expiration epoch. Returns the power of the now-recovered sectors.

func (*Partition) ReplaceSectors

func (p *Partition) ReplaceSectors(store adt.Store, oldSectors, newSectors []*SectorOnChainInfo,
	ssize abi.SectorSize, quant builtin.QuantSpec) (PowerPair, abi.TokenAmount, error)

Replaces a number of "old" sectors with new ones. The old sectors must not be faulty, terminated, or unproven. If the same sector is both removed and added, this permits rescheduling *with a change in power*, unlike RescheduleExpirations. Returns the delta to power and pledge requirement.

func (*Partition) TerminateSectors

func (p *Partition) TerminateSectors(
	store adt.Store, sectors Sectors, epoch abi.ChainEpoch, sectorNos bitfield.BitField,
	ssize abi.SectorSize, quant builtin.QuantSpec) (*ExpirationSet, error)

Marks a collection of sectors as terminated. The sectors are removed from Faults and Recoveries. The epoch of termination is recorded for future termination fee calculation.

func (*Partition) UnmarshalCBOR

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

func (*Partition) ValidateBFState

func (p *Partition) ValidateBFState() error

Test that invariants about sector bitfields hold

func (*Partition) ValidatePowerState

func (p *Partition) ValidatePowerState() error

Test that invariants about partition power hold

func (*Partition) ValidateState

func (p *Partition) ValidateState() error

Test all invariants hold

type PartitionSectorMap

type PartitionSectorMap map[uint64]bitfield.BitField

Maps partitions to sector bitfields.

func (PartitionSectorMap) Add

func (pm PartitionSectorMap) Add(partIdx uint64, sectorNos bitfield.BitField) error

Add records the given sector bitfield at the given partition index, merging it with any existing bitfields if necessary.

func (PartitionSectorMap) AddValues

func (pm PartitionSectorMap) AddValues(partIdx uint64, sectorNos ...uint64) error

AddValues records the given sectors at the given partition.

func (PartitionSectorMap) Count

func (pm PartitionSectorMap) Count() (partitions, sectors uint64, err error)

Count counts the number of partitions & sectors within the map.

func (PartitionSectorMap) ForEach

func (pm PartitionSectorMap) ForEach(cb func(partIdx uint64, sectorNos bitfield.BitField) error) error

ForEach walks the partitions in the map, in order of increasing index.

func (PartitionSectorMap) Partitions

func (pm PartitionSectorMap) Partitions() []uint64

Partitions returns a sorted slice of partitions in the map.

type PartitionStateSummary

type PartitionStateSummary struct {
	AllSectors            bitfield.BitField
	LiveSectors           bitfield.BitField
	FaultySectors         bitfield.BitField
	RecoveringSectors     bitfield.BitField
	UnprovenSectors       bitfield.BitField
	TerminatedSectors     bitfield.BitField
	LivePower             PowerPair
	ActivePower           PowerPair
	FaultyPower           PowerPair
	RecoveringPower       PowerPair
	ExpirationEpochs      []abi.ChainEpoch // Epochs at which some sector is scheduled to expire.
	EarlyTerminationCount int
}

func CheckPartitionStateInvariants

func CheckPartitionStateInvariants(
	partition *Partition,
	store adt.Store,
	quant builtin.QuantSpec,
	sectorSize abi.SectorSize,
	sectors map[abi.SectorNumber]*SectorOnChainInfo,
	acc *builtin.MessageAccumulator,
) *PartitionStateSummary

type PoStPartition

type PoStPartition = minertypes.PoStPartition
type PoStPartition struct {
	// Partitions are numbered per-deadline, from zero.
	Index uint64
	// Sectors skipped while proving that weren't already declared faulty
	Skipped bitfield.BitField
}

type PoStResult

type PoStResult struct {
	// Power activated or deactivated (positive or negative).
	PowerDelta PowerPair
	// Powers used for calculating penalties.
	NewFaultyPower, RetractedRecoveryPower, RecoveredPower PowerPair
	// Sectors is a bitfield of all sectors in the proven partitions.
	Sectors bitfield.BitField
	// IgnoredSectors is a subset of Sectors that should be ignored.
	IgnoredSectors bitfield.BitField
	// Bitfield of partitions that were proven.
	Partitions bitfield.BitField
}

type PowerPair

type PowerPair struct {
	Raw abi.StoragePower
	QA  abi.StoragePower
}

Value type for a pair of raw and QA power.

func NewPowerPair

func NewPowerPair(raw, qa abi.StoragePower) PowerPair

func NewPowerPairZero

func NewPowerPairZero() PowerPair

func PowerForSector

func PowerForSector(sectorSize abi.SectorSize, sector *SectorOnChainInfo) PowerPair

func PowerForSectors

func PowerForSectors(ssize abi.SectorSize, sectors []*SectorOnChainInfo) PowerPair

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

func (PowerPair) Add

func (pp PowerPair) Add(other PowerPair) PowerPair

func (*PowerPair) Equals

func (pp *PowerPair) Equals(other PowerPair) bool

func (PowerPair) IsZero

func (pp PowerPair) IsZero() bool

func (*PowerPair) MarshalCBOR

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

func (PowerPair) Mul

func (pp PowerPair) Mul(m big.Int) PowerPair

func (PowerPair) Neg

func (pp PowerPair) Neg() PowerPair

func (PowerPair) Sub

func (pp PowerPair) Sub(other PowerPair) PowerPair

func (*PowerPair) UnmarshalCBOR

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

type PreCommitSectorBatchParams

type PreCommitSectorBatchParams struct {
	Sectors []miner0.SectorPreCommitInfo
}

func (*PreCommitSectorBatchParams) MarshalCBOR

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

func (*PreCommitSectorBatchParams) UnmarshalCBOR

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

type PreCommitSectorParams

type PreCommitSectorParams = miner0.SectorPreCommitInfo
type SectorPreCommitInfo struct {
	SealProof       abi.RegisteredSealProof
	SectorNumber    abi.SectorNumber
	SealedCID       cid.Cid `checked:"true"` // CommR
	SealRandEpoch   abi.ChainEpoch
	DealIDs         []abi.DealID
	Expiration      abi.ChainEpoch
	ReplaceCapacity bool                    // Must be false since v7
	ReplaceSectorDeadline  uint64           // Unused since v7
	ReplaceSectorPartition uint64           // Unused since v7
	ReplaceSectorNumber    abi.SectorNumber // Unused since v7
}

type ProveCommitAggregateParams

type ProveCommitAggregateParams struct {
	SectorNumbers  bitfield.BitField
	AggregateProof []byte
}

func (*ProveCommitAggregateParams) MarshalCBOR

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

func (*ProveCommitAggregateParams) UnmarshalCBOR

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

type ProveCommitSectorParams

type ProveCommitSectorParams = miner0.ProveCommitSectorParams
type ProveCommitSectorParams struct {
	SectorNumber abi.SectorNumber
	ReplicaProof        []byte
}

type ProveReplicaUpdatesParams

type ProveReplicaUpdatesParams struct {
	Updates []ReplicaUpdate
}

func (*ProveReplicaUpdatesParams) MarshalCBOR

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

func (*ProveReplicaUpdatesParams) UnmarshalCBOR

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

type RecoveryDeclaration

type RecoveryDeclaration = miner0.RecoveryDeclaration
type RecoveryDeclaration struct {
	// The deadline to which the recovered sectors are assigned, in range [0..WPoStPeriodDeadlines)
	Deadline uint64
	// Partition index within the deadline containing the recovered sectors.
	Partition uint64
	// Sectors in the partition being declared recovered.
	Sectors bitfield.BitField
}

type ReplicaUpdate

type ReplicaUpdate struct {
	SectorID           abi.SectorNumber
	Deadline           uint64
	Partition          uint64
	NewSealedSectorCID cid.Cid `checked:"true"`
	Deals              []abi.DealID
	UpdateProofType    abi.RegisteredUpdateProof
	ReplicaProof       []byte
}

func (*ReplicaUpdate) MarshalCBOR

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

func (*ReplicaUpdate) UnmarshalCBOR

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

type ReportConsensusFaultParams

type ReportConsensusFaultParams = miner0.ReportConsensusFaultParams
type ReportConsensusFaultParams struct {
	BlockHeader1     []byte
	BlockHeader2     []byte
	BlockHeaderExtra []byte
}

type Runtime

type Runtime = runtime.Runtime

type SealVerifyStuff

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
	ExpectedDayReward     abi.TokenAmount // Expected one day projection of reward for sector computed at activation time
	ExpectedStoragePledge abi.TokenAmount // Expected twenty day projection of reward for sector computed at activation time
	ReplacedSectorAge     abi.ChainEpoch  // Age of sector this sector replaced or zero
	ReplacedDayReward     abi.TokenAmount // Day reward of sector this sector replace or zero
	SectorKeyCID          *cid.Cid        // The original SealedSectorCID, only gets set on the first ReplicaUpdate
}

Information stored on-chain for a proven sector.

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 `checked:"true"` // 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)
	// The committed capacity sector to replace, and it's deadline/partition location
	ReplaceSectorDeadline  uint64
	ReplaceSectorPartition uint64
	ReplaceSectorNumber    abi.SectorNumber
}

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 Sectors

type Sectors struct {
	*adt.Array
}

Sectors is a helper type for accessing/modifying a miner's sectors. It's safe to pass this object around as needed.

func LoadSectors

func LoadSectors(store adt.Store, root cid.Cid) (Sectors, error)

func (Sectors) Get

func (sa Sectors) Get(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, found bool, err error)

func (Sectors) Load

func (sa Sectors) Load(sectorNos bitfield.BitField) ([]*SectorOnChainInfo, error)

func (Sectors) LoadForProof

func (sa Sectors) LoadForProof(provenSectors, expectedFaults bitfield.BitField) ([]*SectorOnChainInfo, 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 (Sectors) LoadWithFaultMask

func (sa Sectors) LoadWithFaultMask(sectors bitfield.BitField, faults bitfield.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 (Sectors) MustGet

func (sa Sectors) MustGet(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, err error)

func (Sectors) Store

func (sa Sectors) Store(infos ...*SectorOnChainInfo) 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 rewards and added funds locked in vesting table

	VestingFunds cid.Cid // VestingFunds (Vesting Funds schedule for the miner).

	FeeDebt abi.TokenAmount // Absolute value of debt this miner owes from unpaid fees

	InitialPledge 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

	// PreCommittedSectorsCleanUp maintains the state required to cleanup expired PreCommittedSectors.
	PreCommittedSectorsCleanUp cid.Cid // BitFieldQueue (AMT[Epoch]*BitField)

	// Allocated sector IDs. Sector IDs can never be reused once allocated.
	AllocatedSectors cid.Cid // BitField

	// Information for all proven and not-yet-garbage-collected sectors.
	//
	// Sectors are removed from this AMT when the partition to which the
	// sector belongs is compacted.
	Sectors cid.Cid // Array, AMT[SectorNumber]SectorOnChainInfo (sparse)

	// DEPRECATED. This field will change names and no longer be updated every proving period in a future upgrade
	// 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, this 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 cron callback.
	ProvingPeriodStart abi.ChainEpoch

	// DEPRECATED. This field will be removed from state in a future upgrade.
	// Index of the deadline within the proving period beginning at ProvingPeriodStart that has not yet been
	// finalized.
	// Updated at the end of each deadline window by a cron callback.
	CurrentDeadline uint64

	// 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

	// Deadlines with outstanding fees for early sector termination.
	EarlyTerminations bitfield.BitField

	// True when miner cron is active, false otherwise
	DeadlineCronActive bool
}

Balance of Miner Actor should be greater than or equal to the sum of PreCommitDeposits and LockedFunds. It is possible for balance to fall below the sum of PCD, LF and InitialPledgeRequirements, and this is a bad state (IP Debt) that limits a miner actor's behavior (i.e. no balance withdrawals) Excess balance as computed by st.GetAvailableBalance will be withdrawable or usable for pre-commit deposit or pledge lock-up.

func ConstructState

func ConstructState(store adt.Store, infoCid cid.Cid, periodStart abi.ChainEpoch, deadlineIndex uint64) (*State, error)

func (*State) AddInitialPledge

func (st *State) AddInitialPledge(amount abi.TokenAmount) error

func (*State) AddLockedFunds

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

AddLockedFunds first vests and unlocks the vested funds AND then locks the given funds in the vesting table.

func (*State) AddPreCommitCleanUps

func (st *State) AddPreCommitCleanUps(store adt.Store, cleanUpEvents map[abi.ChainEpoch][]uint64) error

func (*State) AddPreCommitDeposit

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

func (*State) AdvanceDeadline

func (st *State) AdvanceDeadline(store adt.Store, currEpoch abi.ChainEpoch) (*AdvanceDeadlineResult, error)

AdvanceDeadline advances the deadline. It: - Processes expired sectors. - Handles missed proofs. - Returns the changes to power & pledge, and faulty power (both declared and undeclared).

func (*State) AllocateSectorNumbers

func (st *State) AllocateSectorNumbers(store adt.Store, sectorNos bitfield.BitField, policy CollisionPolicy) error

Marks a set of sector numbers as having been allocated. If policy is `DenyCollisions`, fails if the set intersects with the sector numbers already allocated.

func (*State) ApplyPenalty

func (st *State) ApplyPenalty(penalty abi.TokenAmount) error

ApplyPenalty adds the provided penalty to fee debt.

func (*State) AssignSectorsToDeadlines

func (st *State) AssignSectorsToDeadlines(
	store adt.Store, currentEpoch abi.ChainEpoch, sectors []*SectorOnChainInfo, partitionSize uint64, sectorSize abi.SectorSize,
) error

Assign new sectors to deadlines.

func (*State) CheckBalanceInvariants

func (st *State) CheckBalanceInvariants(balance abi.TokenAmount) error

func (*State) CheckSectorActive

func (st *State) CheckSectorActive(store adt.Store, dlIdx, pIdx uint64, sector abi.SectorNumber, requireProven bool) (bool, error)

Returns an error if the target sector cannot be found, or some other bad state is reached. Returns false if the target sector is faulty, terminated, or unproven Returns true otherwise

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) CleanUpExpiredPreCommits

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

func (*State) ContinueDeadlineCron

func (st *State) ContinueDeadlineCron() bool

Return true when the miner actor needs to continue scheduling deadline crons

func (*State) CurrentProvingPeriodStart

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

Returns current proving period start for the current epoch according to the current epoch and constant state offset

func (*State) DeadlineInfo

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

Returns deadline calculations for the current proving period, according to the current epoch and constant state offset

func (*State) DeletePrecommittedSectors

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

func (*State) DeleteSectors

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

func (*State) FindPrecommittedSectors

func (st *State) FindPrecommittedSectors(store adt.Store, sectorNos ...abi.SectorNumber) ([]*SectorPreCommitOnChainInfo, error)

This method gets and returns the requested pre-committed sectors, skipping missing sectors.

func (*State) FindSector

func (st *State) FindSector(store adt.Store, sno abi.SectorNumber) (uint64, uint64, error)

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) GetAllPrecommittedSectors

func (st *State) GetAllPrecommittedSectors(store adt.Store, sectorNos bitfield.BitField) ([]*SectorPreCommitOnChainInfo, error)

Load all precommits or fail trying

func (*State) GetAvailableBalance

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

Unclaimed funds. Actor balance - (locked funds, precommit deposit, initial pledge, fee debt) Can go negative if the miner is in IP debt

func (*State) GetInfo

func (st *State) GetInfo(store adt.Store) (*MinerInfo, 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) GetUnlockedBalance

func (st *State) GetUnlockedBalance(actorBalance abi.TokenAmount) (abi.TokenAmount, error)

Unclaimed funds that are not locked -- includes free funds and does not account for fee debt. Always greater than or equal to zero

func (*State) HasSectorNo

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

func (*State) IsDebtFree

func (st *State) IsDebtFree() bool

func (*State) LoadDeadlines

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

func (*State) LoadSectorInfos

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

Loads sector info for a sequence of sectors.

func (*State) LoadVestingFunds

func (st *State) LoadVestingFunds(store adt.Store) (*VestingFunds, error)

LoadVestingFunds loads the vesting funds table from the store

func (*State) MarshalCBOR

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

func (*State) PopEarlyTerminations

func (st *State) PopEarlyTerminations(store adt.Store, maxPartitions, maxSectors uint64) (result TerminationResult, hasMore bool, err error)

Pops up to max early terminated sectors from all deadlines.

Returns hasMore if we still have more early terminations to process.

func (*State) PutPrecommittedSectors

func (st *State) PutPrecommittedSectors(store adt.Store, precommits ...*SectorPreCommitOnChainInfo) error

Stores a pre-committed sector info, failing if the sector number is already present.

func (*State) PutSectors

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

func (*State) QuantSpecEveryDeadline

func (st *State) QuantSpecEveryDeadline() builtin.QuantSpec

pre-commit clean up

func (*State) QuantSpecForDeadline

func (st *State) QuantSpecForDeadline(dlIdx uint64) builtin.QuantSpec

Returns deadline calculations for the current (according to state) proving period

func (*State) RecordedDeadlineInfo

func (st *State) RecordedDeadlineInfo(currEpoch abi.ChainEpoch) *dline.Info

Returns deadline calculations for the state recorded proving period and deadline. This is out of date if the a miner does not have an active miner cron

func (*State) RepayPartialDebtInPriorityOrder

func (st *State) RepayPartialDebtInPriorityOrder(store adt.Store, currEpoch abi.ChainEpoch, currBalance abi.TokenAmount) (fromVesting abi.TokenAmount, fromBalance abi.TokenAmount, err error)

Draws from vesting table and unlocked funds to repay up to the fee debt. Returns the amount unlocked from the vesting table and the amount taken from current balance. If the fee debt exceeds the total amount available for repayment the fee debt field is updated to track the remaining debt. Otherwise it is set to zero.

func (*State) SaveDeadlines

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

func (*State) SaveInfo

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

func (*State) SaveVestingFunds

func (st *State) SaveVestingFunds(store adt.Store, funds *VestingFunds) error

SaveVestingFunds saves the vesting table to the store

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 StateSummary

type StateSummary struct {
	LivePower           PowerPair
	ActivePower         PowerPair
	FaultyPower         PowerPair
	Deals               map[abi.DealID]DealSummary
	WindowPoStProofType abi.RegisteredPoStProof
	DeadlineCronActive  bool
}

func CheckStateInvariants

func CheckStateInvariants(st *State, store adt.Store, balance abi.TokenAmount) (*StateSummary, *builtin.MessageAccumulator)

Checks internal invariants of init state.

type SubmitWindowedPoStParams

type SubmitWindowedPoStParams = minertypes.SubmitWindowedPoStParams

Information submitted by a miner to provide a Window PoSt.

type SubmitWindowedPoStParams struct {
	// The deadline index which the submission targets.
	Deadline uint64
	// The partitions being proven.
	Partitions []PoStPartition
	// 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 []proof.PoStProof
	// The epoch at which these proofs is being committed to a particular chain.
	// NOTE: This field should be removed in the future. See
	// https://github.com/filecoin-project/specs-actors/issues/1094
	ChainCommitEpoch abi.ChainEpoch
	// The ticket randomness on the chain at the chain commit epoch.
	ChainCommitRand abi.Randomness
}

type TerminateSectorsParams

type TerminateSectorsParams = miner0.TerminateSectorsParams
type TerminateSectorsParams struct {
	Terminations []TerminationDeclaration
}

type TerminateSectorsReturn

type TerminateSectorsReturn = miner0.TerminateSectorsReturn
type TerminateSectorsReturn struct {
	// Set to true if all early termination work has been completed. When
	// false, the miner may choose to repeatedly invoke TerminateSectors
	// with no new sectors to process the remainder of the pending
	// terminations. While pending terminations are outstanding, the miner
	// will not be able to withdraw funds.
	Done bool
}

type TerminationDeclaration

type TerminationDeclaration = miner0.TerminationDeclaration
type TerminationDeclaration struct {
	Deadline  uint64
	Partition uint64
	Sectors   bitfield.BitField
}

type TerminationResult

type TerminationResult struct {
	// Sectors maps epochs at which sectors expired, to bitfields of sector
	// numbers.
	Sectors map[abi.ChainEpoch]bitfield.BitField
	// Counts the number of partitions & sectors processed.
	PartitionsProcessed, SectorsProcessed uint64
}

func (*TerminationResult) Add

func (t *TerminationResult) Add(newResult TerminationResult) error

func (*TerminationResult) BelowLimit

func (t *TerminationResult) BelowLimit(maxPartitions, maxSectors uint64) bool

Returns true if we're below the partition/sector limit. Returns false if we're at (or above) the limit.

func (*TerminationResult) ForEach

func (t *TerminationResult) ForEach(cb func(epoch abi.ChainEpoch, sectors bitfield.BitField) error) error

func (*TerminationResult) IsEmpty

func (t *TerminationResult) IsEmpty() bool

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.

func LockedRewardFromReward

func LockedRewardFromReward(reward abi.TokenAmount) (abi.TokenAmount, *VestSpec)

Returns the amount of a reward to vest, and the vesting schedule, for a reward amount.

type VestingFund

type VestingFund struct {
	Epoch  abi.ChainEpoch
	Amount abi.TokenAmount
}

VestingFund represents miner funds that will vest at the given epoch.

func (*VestingFund) MarshalCBOR

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

func (*VestingFund) UnmarshalCBOR

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

type VestingFunds

type VestingFunds struct {
	Funds []VestingFund
}

VestingFunds represents the vesting table state for the miner. It is a slice of (VestingEpoch, VestingAmount). The slice will always be sorted by the VestingEpoch.

func ConstructVestingFunds

func ConstructVestingFunds() *VestingFunds

ConstructVestingFunds constructs empty VestingFunds state.

func (*VestingFunds) MarshalCBOR

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

func (*VestingFunds) UnmarshalCBOR

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

type WindowedPoSt

type WindowedPoSt struct {
	// Partitions proved by this WindowedPoSt.
	Partitions bitfield.BitField
	// 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 []proof.PoStProof
}

func (*WindowedPoSt) MarshalCBOR

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

func (*WindowedPoSt) UnmarshalCBOR

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

type WithdrawBalanceParams

type WithdrawBalanceParams = miner0.WithdrawBalanceParams
type WithdrawBalanceParams struct {
	AmountRequested abi.TokenAmount
}

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