Documentation ¶
Index ¶
- Constants
- Variables
- func ExpectedRewardForPower(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, ...) abi.TokenAmount
- func FindSector(store adt.Store, deadlines *Deadlines, sectorNum abi.SectorNumber) (uint64, uint64, error)
- func InitialPledgeForPower(qaPower abi.StoragePower, baselinePower abi.StoragePower, ...) abi.TokenAmount
- func NewDeadlineInfo(periodStart abi.ChainEpoch, deadlineIdx uint64, currEpoch abi.ChainEpoch) *dline.Info
- func PledgePenaltyForDeclaredFault(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, ...) abi.TokenAmount
- func PledgePenaltyForTermination(dayRewardAtActivation, twentyDayRewardAtActivation abi.TokenAmount, ...) abi.TokenAmount
- func PledgePenaltyForUndeclaredFault(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, ...) abi.TokenAmount
- func PreCommitDepositForPower(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, ...) abi.TokenAmount
- func QAPowerForSector(size abi.SectorSize, sector *SectorOnChainInfo) abi.StoragePower
- func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, ...) abi.StoragePower
- func QualityForWeight(size abi.SectorSize, duration abi.ChainEpoch, ...) abi.SectorQuality
- func RewardForConsensusSlashReport(elapsedEpoch abi.ChainEpoch, collateral abi.TokenAmount) abi.TokenAmount
- func SectorKey(e abi.SectorNumber) abi.Keyer
- type Actor
- func (a Actor) AddLockedFund(rt Runtime, amountToLock *abi.TokenAmount) *abi.EmptyValue
- func (a Actor) ChangeMultiaddrs(rt Runtime, params *ChangeMultiaddrsParams) *abi.EmptyValue
- func (a Actor) ChangePeerID(rt Runtime, params *ChangePeerIDParams) *abi.EmptyValue
- func (a Actor) ChangeWorkerAddress(rt Runtime, params *ChangeWorkerAddressParams) *abi.EmptyValue
- func (a Actor) CheckSectorProven(rt Runtime, params *CheckSectorProvenParams) *abi.EmptyValue
- func (a Actor) Code() cid.Cid
- func (a Actor) CompactPartitions(rt Runtime, params *CompactPartitionsParams) *abi.EmptyValue
- func (a Actor) CompactSectorNumbers(rt Runtime, params *CompactSectorNumbersParams) *abi.EmptyValue
- func (a Actor) ConfirmSectorProofsValid(rt Runtime, params *builtin.ConfirmSectorProofsParams) *abi.EmptyValue
- func (a Actor) Constructor(rt Runtime, params *ConstructorParams) *abi.EmptyValue
- func (a Actor) ControlAddresses(rt Runtime, _ *abi.EmptyValue) *GetControlAddressesReturn
- func (a Actor) DeclareFaults(rt Runtime, params *DeclareFaultsParams) *abi.EmptyValue
- func (a Actor) DeclareFaultsRecovered(rt Runtime, params *DeclareFaultsRecoveredParams) *abi.EmptyValue
- func (a Actor) Exports() []interface{}
- func (a Actor) ExtendSectorExpiration(rt Runtime, params *ExtendSectorExpirationParams) *abi.EmptyValue
- func (a Actor) OnDeferredCronEvent(rt Runtime, payload *CronEventPayload) *abi.EmptyValue
- func (a Actor) PreCommitSector(rt Runtime, params *SectorPreCommitInfo) *abi.EmptyValue
- func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *abi.EmptyValue
- func (a Actor) ReportConsensusFault(rt Runtime, params *ReportConsensusFaultParams) *abi.EmptyValue
- func (a Actor) State() cbor.Er
- func (a Actor) SubmitWindowedPoSt(rt Runtime, params *SubmitWindowedPoStParams) *abi.EmptyValue
- func (a Actor) TerminateSectors(rt Runtime, params *TerminateSectorsParams) *TerminateSectorsReturn
- func (a Actor) WithdrawBalance(rt Runtime, params *WithdrawBalanceParams) *abi.EmptyValue
- type BigFrac
- type BitfieldQueue
- func (q BitfieldQueue) AddManyToQueueValues(values map[abi.ChainEpoch][]uint64) error
- func (q BitfieldQueue) AddToQueue(rawEpoch abi.ChainEpoch, values bitfield.BitField) error
- func (q BitfieldQueue) AddToQueueValues(epoch abi.ChainEpoch, values ...uint64) error
- func (q BitfieldQueue) Cut(toCut bitfield.BitField) error
- func (q BitfieldQueue) ForEach(cb func(epoch abi.ChainEpoch, bf bitfield.BitField) error) error
- func (q BitfieldQueue) PopUntil(until abi.ChainEpoch) (values bitfield.BitField, modified bool, err error)
- type ChangeMultiaddrsParams
- type ChangePeerIDParams
- type ChangeWorkerAddressParams
- type CheckSectorProvenParams
- type CompactPartitionsParams
- type CompactSectorNumbersParams
- type ConstructorParams
- type CronEventPayload
- type CronEventType
- type Deadline
- func (d *Deadline) AddExpirationPartitions(store adt.Store, expirationEpoch abi.ChainEpoch, partitions []uint64, ...) error
- func (dl *Deadline) AddSectors(store adt.Store, partitionSize uint64, sectors []*SectorOnChainInfo, ...) (PowerPair, error)
- func (dl *Deadline) DeclareFaults(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec, ...) (newFaultyPower PowerPair, err error)
- func (dl *Deadline) DeclareFaultsRecovered(store adt.Store, sectors Sectors, ssize abi.SectorSize, ...) (err error)
- func (d *Deadline) LoadPartition(store adt.Store, partIdx uint64) (*Partition, error)
- func (t *Deadline) MarshalCBOR(w io.Writer) error
- func (d *Deadline) PartitionsArray(store adt.Store) (*adt.Array, error)
- func (dl *Deadline) PopEarlyTerminations(store adt.Store, maxPartitions, maxSectors uint64) (result TerminationResult, hasMore bool, err error)
- func (dl *Deadline) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant QuantSpec) (*ExpirationSet, error)
- func (dl *Deadline) ProcessDeadlineEnd(store adt.Store, quant QuantSpec, faultExpirationEpoch abi.ChainEpoch) (newFaultyPower, failedRecoveryPower PowerPair, err error)
- func (dl *Deadline) RecordProvenSectors(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec, ...) (*PoStResult, error)
- func (dl *Deadline) RemovePartitions(store adt.Store, toRemove bitfield.BitField, quant QuantSpec) (live, dead bitfield.BitField, removedPower PowerPair, err error)
- func (dl *Deadline) RescheduleSectorExpirations(store adt.Store, sectors Sectors, expiration abi.ChainEpoch, ...) error
- func (dl *Deadline) TerminateSectors(store adt.Store, sectors Sectors, epoch abi.ChainEpoch, ...) (powerLost PowerPair, err error)
- func (t *Deadline) UnmarshalCBOR(r io.Reader) error
- type DeadlineSectorMap
- func (dm DeadlineSectorMap) Add(dlIdx, partIdx uint64, sectorNos bitfield.BitField) error
- func (dm DeadlineSectorMap) AddValues(dlIdx, partIdx uint64, sectorNos ...uint64) error
- func (dm DeadlineSectorMap) Check(maxPartitions, maxSectors uint64) error
- func (dm DeadlineSectorMap) Count() (partitions, sectors uint64, err error)
- func (dm DeadlineSectorMap) Deadlines() []uint64
- func (dm DeadlineSectorMap) ForEach(cb func(dlIdx uint64, pm PartitionSectorMap) error) error
- type Deadlines
- func (d *Deadlines) ForEach(store adt.Store, cb func(dlIdx uint64, dl *Deadline) error) error
- func (d *Deadlines) LoadDeadline(store adt.Store, dlIdx uint64) (*Deadline, error)
- func (t *Deadlines) MarshalCBOR(w io.Writer) error
- func (t *Deadlines) UnmarshalCBOR(r io.Reader) error
- func (d *Deadlines) UpdateDeadline(store adt.Store, dlIdx uint64, deadline *Deadline) error
- type DeclareFaultsParams
- type DeclareFaultsRecoveredParams
- type ExpirationExtension
- type ExpirationQueue
- func (q ExpirationQueue) AddActiveSectors(sectors []*SectorOnChainInfo, ssize abi.SectorSize) (bitfield.BitField, PowerPair, abi.TokenAmount, error)
- func (q ExpirationQueue) PopUntil(until abi.ChainEpoch) (*ExpirationSet, error)
- func (q ExpirationQueue) RemoveSectors(sectors []*SectorOnChainInfo, faults bitfield.BitField, ...) (*ExpirationSet, PowerPair, error)
- func (q ExpirationQueue) ReplaceSectors(oldSectors, newSectors []*SectorOnChainInfo, ssize abi.SectorSize) (bitfield.BitField, bitfield.BitField, PowerPair, abi.TokenAmount, error)
- func (q ExpirationQueue) RescheduleAllAsFaults(faultExpiration abi.ChainEpoch) error
- func (q ExpirationQueue) RescheduleAsFaults(newExpiration abi.ChainEpoch, sectors []*SectorOnChainInfo, ...) (PowerPair, error)
- func (q ExpirationQueue) RescheduleExpirations(newExpiration abi.ChainEpoch, sectors []*SectorOnChainInfo, ...) error
- func (q ExpirationQueue) RescheduleRecovered(sectors []*SectorOnChainInfo, ssize abi.SectorSize) (PowerPair, error)
- type ExpirationSet
- func (es *ExpirationSet) Add(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, ...) error
- func (es *ExpirationSet) Count() (count uint64, err error)
- func (es *ExpirationSet) IsEmpty() (empty bool, err error)
- func (t *ExpirationSet) MarshalCBOR(w io.Writer) error
- func (es *ExpirationSet) Remove(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, ...) error
- func (t *ExpirationSet) UnmarshalCBOR(r io.Reader) error
- type ExtendSectorExpirationParams
- type FaultDeclaration
- type GetControlAddressesReturn
- type MinerInfo
- type Partition
- func (p *Partition) ActivePower() PowerPair
- func (p *Partition) ActiveSectors() (bitfield.BitField, error)
- func (p *Partition) AddSectors(store adt.Store, sectors []*SectorOnChainInfo, ssize abi.SectorSize, ...) (PowerPair, error)
- func (p *Partition) DeclareFaults(store adt.Store, sectors Sectors, sectorNos bitfield.BitField, ...) (newFaults bitfield.BitField, newFaultyPower PowerPair, err error)
- func (p *Partition) DeclareFaultsRecovered(sectors Sectors, ssize abi.SectorSize, sectorNos bitfield.BitField) (err error)
- func (p *Partition) LiveSectors() (bitfield.BitField, error)
- func (t *Partition) MarshalCBOR(w io.Writer) error
- func (p *Partition) PopEarlyTerminations(store adt.Store, maxSectors uint64) (result TerminationResult, hasMore bool, err error)
- func (p *Partition) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant QuantSpec) (*ExpirationSet, error)
- func (p *Partition) RecordMissedPost(store adt.Store, faultExpiration abi.ChainEpoch, quant QuantSpec) (newFaultPower, failedRecoveryPower PowerPair, err error)
- func (p *Partition) RecordSkippedFaults(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec, ...) (newFaultPower, retractedRecoveryPower PowerPair, err error)
- func (p *Partition) RecoverFaults(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec) (PowerPair, error)
- func (p *Partition) ReplaceSectors(store adt.Store, oldSectors, newSectors []*SectorOnChainInfo, ...) (PowerPair, abi.TokenAmount, error)
- func (p *Partition) RescheduleExpirations(store adt.Store, sectors Sectors, newExpiration abi.ChainEpoch, ...) (moved bitfield.BitField, err error)
- func (p *Partition) TerminateSectors(store adt.Store, sectors Sectors, epoch abi.ChainEpoch, ...) (*ExpirationSet, error)
- func (t *Partition) UnmarshalCBOR(r io.Reader) error
- type PartitionKey
- type PartitionSectorMap
- func (pm PartitionSectorMap) Add(partIdx uint64, sectorNos bitfield.BitField) error
- func (pm PartitionSectorMap) AddValues(partIdx uint64, sectorNos ...uint64) error
- func (pm PartitionSectorMap) Count() (partitions, sectors uint64, err error)
- func (pm PartitionSectorMap) ForEach(cb func(partIdx uint64, sectorNos bitfield.BitField) error) error
- func (pm PartitionSectorMap) Partitions() []uint64
- type PoStPartition
- type PoStResult
- type PowerPair
- func (pp PowerPair) Add(other PowerPair) PowerPair
- func (pp *PowerPair) Equals(other PowerPair) bool
- func (pp PowerPair) IsZero() bool
- func (t *PowerPair) MarshalCBOR(w io.Writer) error
- func (pp PowerPair) Neg() PowerPair
- func (pp PowerPair) Sub(other PowerPair) PowerPair
- func (t *PowerPair) UnmarshalCBOR(r io.Reader) error
- type ProveCommitSectorParams
- type QuantSpec
- type RecoveryDeclaration
- type ReportConsensusFaultParams
- type Runtime
- type SealVerifyStuff
- type SectorOnChainInfo
- type SectorPreCommitInfo
- type SectorPreCommitOnChainInfo
- type Sectors
- func (sa Sectors) Get(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, found bool, err error)
- func (sa Sectors) Load(sectorNos bitfield.BitField) ([]*SectorOnChainInfo, error)
- func (sa Sectors) MustGet(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, err error)
- func (sa Sectors) Store(infos ...*SectorOnChainInfo) error
- type State
- func (st *State) AddInitialPledgeRequirement(amount abi.TokenAmount)
- func (st *State) AddLockedFunds(store adt.Store, currEpoch abi.ChainEpoch, vestingSum abi.TokenAmount, ...) (vested abi.TokenAmount, err error)
- func (st *State) AddPreCommitDeposit(amount abi.TokenAmount)
- func (st *State) AddPreCommitExpiry(store adt.Store, expireEpoch abi.ChainEpoch, sectorNum abi.SectorNumber) error
- func (st *State) AllocateSectorNumber(store adt.Store, sectorNo abi.SectorNumber) error
- func (st *State) AssertBalanceInvariants(balance abi.TokenAmount)
- func (st *State) AssignSectorsToDeadlines(store adt.Store, currentEpoch abi.ChainEpoch, sectors []*SectorOnChainInfo, ...) (PowerPair, error)
- func (st *State) CheckSectorHealth(store adt.Store, dlIdx, pIdx uint64, sector abi.SectorNumber) error
- func (st *State) CheckVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)
- func (st *State) DeadlineInfo(currEpoch abi.ChainEpoch) *dline.Info
- func (st *State) DeletePrecommittedSectors(store adt.Store, sectorNos ...abi.SectorNumber) error
- func (st *State) DeleteSectors(store adt.Store, sectorNos bitfield.BitField) error
- func (st *State) FindPrecommittedSectors(store adt.Store, sectorNos ...abi.SectorNumber) ([]*SectorPreCommitOnChainInfo, error)
- func (st *State) FindSector(store adt.Store, sno abi.SectorNumber) (uint64, uint64, error)
- func (st *State) ForEachSector(store adt.Store, f func(*SectorOnChainInfo)) error
- func (st *State) GetAvailableBalance(actorBalance abi.TokenAmount) abi.TokenAmount
- func (st *State) GetInfo(store adt.Store) (*MinerInfo, error)
- func (st *State) GetPrecommittedSector(store adt.Store, sectorNo abi.SectorNumber) (*SectorPreCommitOnChainInfo, bool, error)
- func (st *State) GetSector(store adt.Store, sectorNo abi.SectorNumber) (*SectorOnChainInfo, bool, error)
- func (st *State) GetUnlockedBalance(actorBalance abi.TokenAmount) abi.TokenAmount
- func (st *State) HasSectorNo(store adt.Store, sectorNo abi.SectorNumber) (bool, error)
- func (st *State) LoadDeadlines(store adt.Store) (*Deadlines, error)
- func (st *State) LoadSectorInfos(store adt.Store, sectors bitfield.BitField) ([]*SectorOnChainInfo, error)
- func (st *State) LoadSectorInfosForProof(store adt.Store, provenSectors, expectedFaults bitfield.BitField) ([]*SectorOnChainInfo, error)
- func (st *State) LoadSectorInfosWithFaultMask(store adt.Store, sectors bitfield.BitField, faults bitfield.BitField, ...) ([]*SectorOnChainInfo, error)
- func (st *State) LoadVestingFunds(store adt.Store) (*VestingFunds, error)
- func (t *State) MarshalCBOR(w io.Writer) error
- func (st *State) MaskSectorNumbers(store adt.Store, sectorNos bitfield.BitField) error
- func (st *State) MeetsInitialPledgeCondition(balance abi.TokenAmount) bool
- func (st *State) PenalizeFundsInPriorityOrder(store adt.Store, currEpoch abi.ChainEpoch, ...) (fromVesting abi.TokenAmount, fromBalance abi.TokenAmount, err error)
- func (st *State) PopEarlyTerminations(store adt.Store, maxPartitions, maxSectors uint64) (result TerminationResult, hasMore bool, err error)
- func (st *State) PutPrecommittedSector(store adt.Store, info *SectorPreCommitOnChainInfo) error
- func (st *State) PutSectors(store adt.Store, newSectors ...*SectorOnChainInfo) error
- func (st *State) QuantSpecEveryDeadline() QuantSpec
- func (st *State) QuantSpecForDeadline(dlIdx uint64) QuantSpec
- func (st *State) RescheduleSectorExpirations(store adt.Store, currEpoch abi.ChainEpoch, ssize abi.SectorSize, ...) error
- func (st *State) SaveDeadlines(store adt.Store, deadlines *Deadlines) error
- func (st *State) SaveInfo(store adt.Store, info *MinerInfo) error
- func (st *State) SaveVestingFunds(store adt.Store, funds *VestingFunds) error
- func (st *State) UnlockUnvestedFunds(store adt.Store, currEpoch abi.ChainEpoch, target abi.TokenAmount) (abi.TokenAmount, error)
- func (st *State) UnlockVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)
- func (t *State) UnmarshalCBOR(r io.Reader) error
- type SubmitWindowedPoStParams
- type TerminateSectorsParams
- type TerminateSectorsReturn
- type TerminationDeclaration
- type TerminationResult
- type VestSpec
- type VestingFund
- type VestingFunds
- type WithdrawBalanceParams
- type WorkerKeyChange
Constants ¶
const AddressedPartitionsMax = 200
The maximum number of partitions that may be required to be loaded in a single invocation. This limits the number of simultaneous fault, recovery, or sector-extension declarations. With 48 deadlines (half-hour), 200 partitions per declaration permits loading a full EiB of 32GiB sectors with 1 message per epoch within a single half-hour deadline. A miner can of course submit more messages.
const AddressedSectorsMax = 10_000
The maximum number of sector infos that may be required to be loaded in a single invocation.
const ChainFinality = abi.ChainEpoch(900)
Epochs after which chain state is final.
const DealLimitDenominator = 134217728
Ratio of sector size to maximum 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
const ElectionLookback = abi.ChainEpoch(1) // PARAM_FINISH
Lookback from the current epoch for state view for leader elections.
const FaultDeclarationCutoff = WPoStChallengeLookback + 50
Minimum period before a deadline's challenge window opens that a fault must be declared for that deadline. This lookback must not be less than WPoStChallengeLookback lest a malicious miner be able to selectively declare faults after learning the challenge value.
const MaxSectorExpirationExtension = 540 * builtin.EpochsInDay
Maximum number of epochs past the current epoch a sector may be set to expire. The actual maximum extension will be the minimum of CurrEpoch + MaximumSectorExpirationExtension and sector.ActivationEpoch+sealProof.SectorMaximumLifetime()
const MinSectorExpiration = 180 * builtin.EpochsInDay
Minimum number of epochs past the current epoch a sector may be set to expire.
const NewSectorsPerPeriodMax = 128 << 10
The maximum number of new sectors that may be staged by a miner during a single proving period.
const SectorsMax = 32 << 20 // PARAM_FINISH
The maximum number of sectors that a miner can have simultaneously active. This also bounds the number of faults that can be declared, etc. TODO raise this number, carefully https://github.com/filecoin-project/specs-actors/issues/470
const TerminationLifetimeCap = abi.ChainEpoch(70)
Maximum number of days of BR a terminated sector can be penalized
const WPoStChallengeLookback = abi.ChainEpoch(20)
Lookback from the deadline's challenge window opening from which to sample chain randomness for the challenge seed. This lookback exists so that deadline windows can be non-overlapping (which make the programming simpler) but without making the miner wait for chain stability before being able to start on PoSt computation. The challenge is available this many epochs before the window is actually open to receiving a PoSt.
const WPoStPeriodDeadlines = uint64(48)
The number of non-overlapping PoSt deadlines in each proving period.
const WorkerKeyChangeDelay = ChainFinality
Staging period for a miner worker key change. Finality is a harsh delay for a miner who has lost their worker key, as the miner will miss Window PoSts until it can be changed. It's the only safe value, though. We may implement a mitigation mechanism such as a second key or allowing the owner account to submit PoSts while a key change is pending.
Variables ¶
var DeclaredFaultFactorDenom = 100
var DeclaredFaultFactorNumV0 = 214
FF = BR(t, DeclaredFaultProjectionPeriod) projection period of 2.14 days: 2880 * 2.14 = 6163.2. Rounded to nearest epoch 6163
var DeclaredFaultFactorNumV3 = 351
var DeclaredFaultProjectionPeriodV0 = abi.ChainEpoch((builtin.EpochsInDay * DeclaredFaultFactorNumV0) / DeclaredFaultFactorDenom)
var DeclaredFaultProjectionPeriodV3 = abi.ChainEpoch((builtin.EpochsInDay * DeclaredFaultFactorNumV3) / DeclaredFaultFactorDenom)
var FaultMaxAge = WPoStProvingPeriod * 14
The maximum age of a fault before the sector is terminated.
var InitialPledgeFactor = 20
var InitialPledgeProjectionPeriod = abi.ChainEpoch(InitialPledgeFactor) * builtin.EpochsInDay
var LockTargetFactorDenom = big.NewInt(10)
var LockTargetFactorNum = big.NewInt(3)
var MaxSealDuration = map[abi.RegisteredSealProof]abi.ChainEpoch{ abi.RegisteredSealProof_StackedDrg32GiBV1: abi.ChainEpoch(10000), abi.RegisteredSealProof_StackedDrg2KiBV1: abi.ChainEpoch(10000), abi.RegisteredSealProof_StackedDrg8MiBV1: abi.ChainEpoch(10000), abi.RegisteredSealProof_StackedDrg512MiBV1: abi.ChainEpoch(10000), abi.RegisteredSealProof_StackedDrg64GiBV1: abi.ChainEpoch(10000), }
Maximum duration to allow for the sealing process for seal algorithms. Dependent on algorithm and sector size
var NoQuantization = NewQuantSpec(1, 0)
var PreCommitChallengeDelay = abi.ChainEpoch(150)
Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn used to ensure it is not predictable by miner.
var PreCommitDepositFactor = 20
IP = IPBase(precommit time) + AdditionalIP(precommit time) IPBase(t) = BR(t, InitialPledgeProjectionPeriod) AdditionalIP(t) = LockTarget(t)*PledgeShare(t) LockTarget = (LockTargetFactorNum / LockTargetFactorDenom) * FILCirculatingSupply(t) PledgeShare(t) = sectorQAPower / max(BaselinePower(t), NetworkQAPower(t)) PARAM_FINISH
var PreCommitDepositProjectionPeriod = abi.ChainEpoch(PreCommitDepositFactor) * builtin.EpochsInDay
var RewardVestingSpecV0 = VestSpec{ InitialDelay: abi.ChainEpoch(20 * builtin.EpochsInDay), VestPeriod: abi.ChainEpoch(180 * builtin.EpochsInDay), StepDuration: abi.ChainEpoch(1 * builtin.EpochsInDay), Quantization: 12 * builtin.EpochsInHour, }
var RewardVestingSpecV1 = VestSpec{ InitialDelay: abi.ChainEpoch(0), VestPeriod: abi.ChainEpoch(180 * builtin.EpochsInDay), StepDuration: abi.ChainEpoch(1 * builtin.EpochsInDay), Quantization: 12 * builtin.EpochsInHour, }
var SealedCIDPrefix = cid.Prefix{ Version: 1, Codec: cid.FilCommitmentSealed, MhType: mh.POSEIDON_BLS12_381_A1_FC1, MhLength: 32, }
Cap on initial pledge requirement for sectors during the Space Race network. The target is 1 FIL (10**18 attoFIL) per 32GiB. This does not divide evenly, so the result is fractionally smaller.
var SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg32GiBV1: {}, abi.RegisteredSealProof_StackedDrg64GiBV1: {}, }
List of proof types which can be used when creating new miner actors
var UndeclaredFaultFactorDenom = 10
var UndeclaredFaultFactorNumV0 = 50
SP = BR(t, UndeclaredFaultProjectionPeriod)
var UndeclaredFaultFactorNumV1 = 35
var UndeclaredFaultProjectionPeriodV0 = abi.ChainEpoch((builtin.EpochsInDay * UndeclaredFaultFactorNumV0) / UndeclaredFaultFactorDenom)
var UndeclaredFaultProjectionPeriodV1 = abi.ChainEpoch((builtin.EpochsInDay * UndeclaredFaultFactorNumV1) / UndeclaredFaultFactorDenom)
var WPoStChallengeWindow = abi.ChainEpoch(30 * 60 / builtin.EpochDurationSeconds) // 30 minutes (48 per day)
The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
var WPoStMaxChainCommitAge = WPoStChallengeWindow
WPoStMaxChainCommitAge is the maximum distance back that a valid Window PoSt must commit to the current chain.
var WPoStProvingPeriod = abi.ChainEpoch(builtin.EpochsInDay) // 24 hours
The period over which all a miner's active sectors will be challenged.
Functions ¶
func ExpectedRewardForPower ¶ added in v0.8.6
func ExpectedRewardForPower(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, qaSectorPower abi.StoragePower, projectionDuration abi.ChainEpoch) abi.TokenAmount
This is the BR(t) value of the given sector for the current epoch. It is the expected reward this sector would pay out over a one day period. BR(t) = CurrEpochReward(t) * SectorQualityAdjustedPower * EpochsInDay / TotalNetworkQualityAdjustedPower(t)
func FindSector ¶ added in v0.8.0
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 ¶ added in v0.7.0
func InitialPledgeForPower(qaPower abi.StoragePower, baselinePower abi.StoragePower, networkTotalPledge abi.TokenAmount, rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, networkCirculatingSupplySmoothed abi.TokenAmount) abi.TokenAmount
Computes the pledge requirement for committing new quality-adjusted power to the network, given the current total power, total pledge commitment, epoch block reward, and circulating token supply. In plain language, the pledge requirement is a multiple of the block reward expected to be earned by the newly-committed power, holding the per-epoch block reward constant (though in reality it will change over time).
func NewDeadlineInfo ¶ added in v0.5.1
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 PledgePenaltyForDeclaredFault ¶ added in v0.7.0
func PledgePenaltyForDeclaredFault(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, qaSectorPower abi.StoragePower, networkVersion network.Version) abi.TokenAmount
This is the FF(t) penalty for a sector expected to be in the fault state either because the fault was declared or because it has been previously detected by the network. FF(t) = DeclaredFaultFactor * BR(t)
func PledgePenaltyForTermination ¶ added in v0.7.2
func PledgePenaltyForTermination(dayRewardAtActivation, twentyDayRewardAtActivation abi.TokenAmount, sectorAge abi.ChainEpoch, rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, qaSectorPower abi.StoragePower, networkVersion network.Version) 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.
func PledgePenaltyForUndeclaredFault ¶ added in v0.7.0
func PledgePenaltyForUndeclaredFault(rewardEstimate, networkQAPowerEstimate *smoothing.FilterEstimate, qaSectorPower abi.StoragePower, networkVersion network.Version) abi.TokenAmount
This is the SP(t) penalty for a newly faulty sector that has not been declared. SP(t) = UndeclaredFaultFactor * BR(t)
func PreCommitDepositForPower ¶ added in v0.8.1
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 = 20 * BR(t)
func QAPowerForSector ¶ added in v0.7.0
func QAPowerForSector(size abi.SectorSize, sector *SectorOnChainInfo) abi.StoragePower
Returns the quality-adjusted power for a sector.
func QAPowerForWeight ¶ added in v0.7.0
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower
Returns the power for a sector size and weight.
func QualityForWeight ¶ added in v0.7.0
func QualityForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.SectorQuality
DealWeight and VerifiedDealWeight are spacetime occupied by regular deals and verified deals in a sector. Sum of DealWeight and VerifiedDealWeight should be less than or equal to total SpaceTime of a sector. Sectors full of VerifiedDeals will have a SectorQuality of VerifiedDealWeightMultiplier/QualityBaseMultiplier. Sectors full of Deals will have a SectorQuality of DealWeightMultiplier/QualityBaseMultiplier. Sectors with neither will have a SectorQuality of QualityBaseMultiplier/QualityBaseMultiplier. SectorQuality of a sector is a weighted average of multipliers based on their propotions.
func RewardForConsensusSlashReport ¶ added in v0.7.0
func RewardForConsensusSlashReport(elapsedEpoch abi.ChainEpoch, collateral abi.TokenAmount) abi.TokenAmount
Types ¶
type Actor ¶
type Actor struct{}
func (Actor) AddLockedFund ¶
func (a Actor) AddLockedFund(rt Runtime, amountToLock *abi.TokenAmount) *abi.EmptyValue
Locks up some amount of the miner's unlocked balance (including funds received alongside the invoking message).
func (Actor) ChangeMultiaddrs ¶ added in v0.5.5
func (a Actor) ChangeMultiaddrs(rt Runtime, params *ChangeMultiaddrsParams) *abi.EmptyValue
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) CompactPartitions ¶ added in v0.8.0
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 ¶ added in v0.8.2
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 ¶ added in v0.5.4
func (a Actor) ConfirmSectorProofsValid(rt Runtime, params *builtin.ConfirmSectorProofsParams) *abi.EmptyValue
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) 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, payload *CronEventPayload) *abi.EmptyValue
func (Actor) PreCommitSector ¶
func (a Actor) PreCommitSector(rt Runtime, params *SectorPreCommitInfo) *abi.EmptyValue
Proposals must be posted on chain via sma.PublishStorageDeals before PreCommitSector. Optimization: PreCommitSector could contain a list of deals that are not published yet.
func (Actor) ProveCommitSector ¶
func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *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) ReportConsensusFault ¶
func (a Actor) ReportConsensusFault(rt Runtime, params *ReportConsensusFaultParams) *abi.EmptyValue
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:
- The miner will be unable to withdraw funds.
- 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 terminating sectors in the current deadline must be careful to compute an appropriate Window PoSt proof for the sectors that will be active at the time the PoSt is submitted.
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.EmptyValue
type BitfieldQueue ¶ added in v0.8.0
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 ¶ added in v0.8.0
func LoadBitfieldQueue(store adt.Store, root cid.Cid, quant QuantSpec) (BitfieldQueue, error)
func (BitfieldQueue) AddManyToQueueValues ¶ added in v0.8.0
func (q BitfieldQueue) AddManyToQueueValues(values map[abi.ChainEpoch][]uint64) error
func (BitfieldQueue) AddToQueue ¶ added in v0.8.0
func (q BitfieldQueue) AddToQueue(rawEpoch abi.ChainEpoch, values bitfield.BitField) error
Adds values to the queue entry for an epoch.
func (BitfieldQueue) AddToQueueValues ¶ added in v0.8.0
func (q BitfieldQueue) AddToQueueValues(epoch abi.ChainEpoch, values ...uint64) error
func (BitfieldQueue) Cut ¶ added in v0.8.1
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 ¶ added in v0.8.0
func (q BitfieldQueue) ForEach(cb func(epoch abi.ChainEpoch, bf bitfield.BitField) error) error
Iterates the queue.
func (BitfieldQueue) PopUntil ¶ added in v0.8.0
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 ChangeMultiaddrsParams ¶ added in v0.5.5
type ChangeMultiaddrsParams struct {
NewMultiaddrs []abi.Multiaddrs
}
func (*ChangeMultiaddrsParams) MarshalCBOR ¶ added in v0.5.5
func (t *ChangeMultiaddrsParams) MarshalCBOR(w io.Writer) error
func (*ChangeMultiaddrsParams) UnmarshalCBOR ¶ added in v0.5.5
func (t *ChangeMultiaddrsParams) UnmarshalCBOR(r io.Reader) error
type ChangePeerIDParams ¶
func (*ChangePeerIDParams) MarshalCBOR ¶
func (t *ChangePeerIDParams) MarshalCBOR(w io.Writer) error
func (*ChangePeerIDParams) UnmarshalCBOR ¶
func (t *ChangePeerIDParams) UnmarshalCBOR(r io.Reader) error
type ChangeWorkerAddressParams ¶
func (*ChangeWorkerAddressParams) MarshalCBOR ¶
func (t *ChangeWorkerAddressParams) MarshalCBOR(w io.Writer) error
func (*ChangeWorkerAddressParams) UnmarshalCBOR ¶
func (t *ChangeWorkerAddressParams) UnmarshalCBOR(r io.Reader) error
type CheckSectorProvenParams ¶
type CheckSectorProvenParams struct {
SectorNumber abi.SectorNumber
}
func (*CheckSectorProvenParams) MarshalCBOR ¶
func (t *CheckSectorProvenParams) MarshalCBOR(w io.Writer) error
func (*CheckSectorProvenParams) UnmarshalCBOR ¶
func (t *CheckSectorProvenParams) UnmarshalCBOR(r io.Reader) error
type CompactPartitionsParams ¶ added in v0.8.0
type CompactPartitionsParams struct { Deadline uint64 Partitions bitfield.BitField }
func (*CompactPartitionsParams) MarshalCBOR ¶ added in v0.8.0
func (t *CompactPartitionsParams) MarshalCBOR(w io.Writer) error
func (*CompactPartitionsParams) UnmarshalCBOR ¶ added in v0.8.0
func (t *CompactPartitionsParams) UnmarshalCBOR(r io.Reader) error
type CompactSectorNumbersParams ¶ added in v0.8.2
type CompactSectorNumbersParams struct {
MaskSectorNumbers bitfield.BitField
}
func (*CompactSectorNumbersParams) MarshalCBOR ¶ added in v0.9.2
func (t *CompactSectorNumbersParams) MarshalCBOR(w io.Writer) error
func (*CompactSectorNumbersParams) UnmarshalCBOR ¶ added in v0.9.2
func (t *CompactSectorNumbersParams) UnmarshalCBOR(r io.Reader) error
type ConstructorParams ¶
type ConstructorParams = power.MinerConstructorParams
Storage miner actors are created exclusively by the storage power actor. In order to break a circular dependency between the two, the construction parameters are defined in the power actor.
type CronEventPayload ¶
type CronEventPayload struct {
EventType CronEventType
}
func (*CronEventPayload) MarshalCBOR ¶
func (t *CronEventPayload) MarshalCBOR(w io.Writer) error
func (*CronEventPayload) UnmarshalCBOR ¶
func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) error
type CronEventType ¶
type CronEventType int64
const ( CronEventWorkerKeyChange CronEventType = iota CronEventProvingDeadline CronEventProcessEarlyTerminations )
type Deadline ¶ added in v0.8.0
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 numbers with PoSt submissions since the proving period started. PostSubmissions 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 }
Deadline holds the state for all sectors due at a specific deadline.
func ConstructDeadline ¶ added in v0.8.0
func ConstructDeadline(emptyArrayCid cid.Cid) *Deadline
func (*Deadline) AddExpirationPartitions ¶ added in v0.8.0
func (d *Deadline) AddExpirationPartitions(store adt.Store, expirationEpoch abi.ChainEpoch, partitions []uint64, quant QuantSpec) error
Adds some partition numbers to the set expiring at an epoch.
func (*Deadline) AddSectors ¶ added in v0.8.0
func (dl *Deadline) AddSectors(store adt.Store, partitionSize uint64, sectors []*SectorOnChainInfo, ssize abi.SectorSize, quant 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.
func (*Deadline) DeclareFaults ¶ added in v0.8.2
func (dl *Deadline) DeclareFaults( store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec, faultExpirationEpoch abi.ChainEpoch, partitionSectors PartitionSectorMap, ) (newFaultyPower PowerPair, err error)
func (*Deadline) DeclareFaultsRecovered ¶ added in v0.8.2
func (dl *Deadline) DeclareFaultsRecovered( store adt.Store, sectors Sectors, ssize abi.SectorSize, partitionSectors PartitionSectorMap, ) (err error)
func (*Deadline) LoadPartition ¶ added in v0.8.0
func (*Deadline) PartitionsArray ¶ added in v0.8.0
func (*Deadline) PopEarlyTerminations ¶ added in v0.8.0
func (*Deadline) PopExpiredSectors ¶ added in v0.8.0
func (dl *Deadline) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant QuantSpec) (*ExpirationSet, error)
PopExpiredSectors terminates expired sectors from all partitions. Returns the expired sector aggregates.
func (*Deadline) ProcessDeadlineEnd ¶ added in v0.8.2
func (dl *Deadline) ProcessDeadlineEnd(store adt.Store, quant QuantSpec, faultExpirationEpoch abi.ChainEpoch) ( newFaultyPower, failedRecoveryPower PowerPair, err error, )
ProcessDeadlineEnd processes all PoSt submissions, marking unproven sectors as faulty and clearing failed recoveries. It returns any new faulty power and failed recovery power.
func (*Deadline) RecordProvenSectors ¶ added in v0.8.2
func (dl *Deadline) RecordProvenSectors( store adt.Store, sectors Sectors, ssize abi.SectorSize, quant 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. The returned Sectors and IgnoredSectors must subsequently be validated against the PoSt submitted by the miner.
func (*Deadline) RemovePartitions ¶ added in v0.8.1
func (dl *Deadline) RemovePartitions(store adt.Store, toRemove bitfield.BitField, quant 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) RescheduleSectorExpirations ¶ added in v0.9.2
func (dl *Deadline) RescheduleSectorExpirations( store adt.Store, sectors Sectors, expiration abi.ChainEpoch, partitionSectors PartitionSectorMap, ssize abi.SectorSize, quant QuantSpec, ) error
RescheduleSectorExpirations reschedules the expirations of the given sectors to the target epoch, skipping any sectors it can't find.
The power of the rescheduled sectors is assumed to have not changed since initial scheduling.
Note: see the docs on State.RescheduleSectorExpirations for details on why we skip sectors/partitions we can't find.
func (*Deadline) TerminateSectors ¶ added in v0.8.1
func (dl *Deadline) TerminateSectors( store adt.Store, sectors Sectors, epoch abi.ChainEpoch, partitionSectors PartitionSectorMap, ssize abi.SectorSize, quant QuantSpec, ) (powerLost PowerPair, err error)
type DeadlineSectorMap ¶ added in v0.9.2
type DeadlineSectorMap map[uint64]PartitionSectorMap
Maps deadlines to partition maps.
func (DeadlineSectorMap) Add ¶ added in v0.9.2
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 ¶ added in v0.9.2
func (dm DeadlineSectorMap) AddValues(dlIdx, partIdx uint64, sectorNos ...uint64) error
AddValues records the given sectors at the given deadline/partition index.
func (DeadlineSectorMap) Check ¶ added in v0.9.2
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 ¶ added in v0.9.2
func (dm DeadlineSectorMap) Count() (partitions, sectors uint64, err error)
Count counts the number of partitions & sectors within the map.
func (DeadlineSectorMap) Deadlines ¶ added in v0.9.2
func (dm DeadlineSectorMap) Deadlines() []uint64
Deadlines returns a sorted slice of deadlines in the map.
func (DeadlineSectorMap) ForEach ¶ added in v0.9.2
func (dm DeadlineSectorMap) ForEach(cb func(dlIdx uint64, pm PartitionSectorMap) error) error
ForEach walks the deadlines in deadline order.
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) LoadDeadline ¶ added in v0.8.0
type DeclareFaultsParams ¶
type DeclareFaultsParams struct {
Faults []FaultDeclaration
}
func (*DeclareFaultsParams) MarshalCBOR ¶
func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error
func (*DeclareFaultsParams) UnmarshalCBOR ¶
func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) error
type DeclareFaultsRecoveredParams ¶
type DeclareFaultsRecoveredParams struct {
Recoveries []RecoveryDeclaration
}
func (*DeclareFaultsRecoveredParams) MarshalCBOR ¶
func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error
func (*DeclareFaultsRecoveredParams) UnmarshalCBOR ¶
func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) error
type ExpirationExtension ¶ added in v0.8.0
type ExpirationExtension struct { Deadline uint64 Partition uint64 Sectors bitfield.BitField NewExpiration abi.ChainEpoch }
func (*ExpirationExtension) MarshalCBOR ¶ added in v0.8.0
func (t *ExpirationExtension) MarshalCBOR(w io.Writer) error
func (*ExpirationExtension) UnmarshalCBOR ¶ added in v0.8.0
func (t *ExpirationExtension) UnmarshalCBOR(r io.Reader) error
type ExpirationQueue ¶ added in v0.8.0
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 ¶ added in v0.8.0
func LoadExpirationQueue(store adt.Store, root cid.Cid, quant QuantSpec) (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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
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) RescheduleExpirations ¶ added in v0.8.0
func (q ExpirationQueue) RescheduleExpirations(newExpiration abi.ChainEpoch, sectors []*SectorOnChainInfo, ssize abi.SectorSize) error
Reschedules some sectors to a new (quantized) expiration epoch. The sectors being rescheduled are assumed to be not faulty, and hence are removed from and re-scheduled for on-time rather than early expiration. The sectors' power and pledge are assumed not to change, despite the new expiration.
func (ExpirationQueue) RescheduleRecovered ¶ added in v0.8.0
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 ExpirationSet ¶ added in v0.8.0
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 ¶ added in v0.8.0
func NewExpirationSet(onTimeSectors, earlySectors bitfield.BitField, onTimePledge abi.TokenAmount, activePower, faultyPower PowerPair) *ExpirationSet
func NewExpirationSetEmpty ¶ added in v0.8.0
func NewExpirationSetEmpty() *ExpirationSet
func (*ExpirationSet) Add ¶ added in v0.8.0
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 ¶ added in v0.9.2
func (es *ExpirationSet) Count() (count uint64, err error)
Counts all sectors in the expiration set.
func (*ExpirationSet) IsEmpty ¶ added in v0.8.0
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 ¶ added in v0.8.0
func (t *ExpirationSet) MarshalCBOR(w io.Writer) error
func (*ExpirationSet) Remove ¶ added in v0.8.0
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 ¶ added in v0.8.0
func (t *ExpirationSet) UnmarshalCBOR(r io.Reader) error
type ExtendSectorExpirationParams ¶
type ExtendSectorExpirationParams struct {
Extensions []ExpirationExtension
}
func (*ExtendSectorExpirationParams) MarshalCBOR ¶
func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error
func (*ExtendSectorExpirationParams) UnmarshalCBOR ¶
func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) error
type FaultDeclaration ¶
type FaultDeclaration struct { // 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 }
func (*FaultDeclaration) MarshalCBOR ¶
func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error
func (*FaultDeclaration) UnmarshalCBOR ¶
func (t *FaultDeclaration) UnmarshalCBOR(r io.Reader) error
type GetControlAddressesReturn ¶
type GetControlAddressesReturn struct { Owner addr.Address Worker addr.Address ControlAddrs []addr.Address }
func (*GetControlAddressesReturn) MarshalCBOR ¶
func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error
func (*GetControlAddressesReturn) UnmarshalCBOR ¶
func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) error
type MinerInfo ¶
type MinerInfo struct { // Account that owns this miner. // - Income and returned collateral are paid to this address. // - This address is also allowed to change the worker address for the miner. Owner addr.Address // Must be an ID-address. // Worker account for this miner. // The associated pubkey-type address is used to sign blocks and messages on behalf of this miner. Worker addr.Address // Must be an ID-address. // 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 by this miner for sealing sectors. SealProofType abi.RegisteredSealProof // Amount of space in each sector committed by this miner. // This is computed from the proof type and represented here redundantly. SectorSize abi.SectorSize // The number of sectors in each Window PoSt partition (proof). // This is computed from the proof type and represented here redundantly. WindowPoStPartitionSectors uint64 }
func ConstructMinerInfo ¶ added in v0.7.2
type Partition ¶ added in v0.8.0
type Partition struct { // Sector numbers in this partition, including faulty and terminated sectors. Sectors 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). LivePower PowerPair // Power of currently-faulty sectors. FaultyPower <= LivePower. FaultyPower PowerPair // Power of expected-to-recover sectors. RecoveringPower <= FaultyPower. RecoveringPower PowerPair }
func ConstructPartition ¶ added in v0.8.0
func ConstructPartition(emptyArray cid.Cid) *Partition
A set of sectors associated with a given epoch.
func (*Partition) ActivePower ¶ added in v0.8.0
Active power is power of non-faulty sectors.
func (*Partition) ActiveSectors ¶ added in v0.8.0
Active sectors are those that are neither terminated nor faulty, i.e. actively contributing power.
func (*Partition) AddSectors ¶ added in v0.8.0
func (p *Partition) AddSectors(store adt.Store, sectors []*SectorOnChainInfo, ssize abi.SectorSize, quant 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.
func (*Partition) DeclareFaults ¶ added in v0.9.2
func (p *Partition) DeclareFaults( store adt.Store, sectors Sectors, sectorNos bitfield.BitField, faultExpirationEpoch abi.ChainEpoch, ssize abi.SectorSize, quant QuantSpec, ) (newFaults bitfield.BitField, 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) DeclareFaultsRecovered ¶ added in v0.9.2
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 ¶ added in v0.8.0
Live sectors are those that are not terminated (but may be faulty).
func (*Partition) PopEarlyTerminations ¶ added in v0.8.0
func (*Partition) PopExpiredSectors ¶ added in v0.8.0
func (p *Partition) PopExpiredSectors(store adt.Store, until abi.ChainEpoch, quant QuantSpec) (*ExpirationSet, error)
PopExpiredSectors traverses the expiration queue up to and including some epoch, and marks all expiring sectors as terminated. Returns the expired sector aggregates.
func (*Partition) RecordMissedPost ¶ added in v0.8.0
func (p *Partition) RecordMissedPost(store adt.Store, faultExpiration abi.ChainEpoch, quant QuantSpec) (newFaultPower, failedRecoveryPower 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 of the newly faulty and failed recovery sectors.
func (*Partition) RecordSkippedFaults ¶ added in v0.8.2
func (p *Partition) RecordSkippedFaults( store adt.Store, sectors Sectors, ssize abi.SectorSize, quant QuantSpec, faultExpiration abi.ChainEpoch, skipped bitfield.BitField, ) (newFaultPower, retractedRecoveryPower PowerPair, 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 ¶ added in v0.8.0
func (p *Partition) RecoverFaults(store adt.Store, sectors Sectors, ssize abi.SectorSize, quant 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 ¶ added in v0.8.0
func (p *Partition) ReplaceSectors(store adt.Store, oldSectors, newSectors []*SectorOnChainInfo, ssize abi.SectorSize, quant QuantSpec) (PowerPair, abi.TokenAmount, error)
Replaces a number of "old" sectors with new ones. The old sectors must not be faulty or terminated. 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) RescheduleExpirations ¶ added in v0.8.0
func (p *Partition) RescheduleExpirations( store adt.Store, sectors Sectors, newExpiration abi.ChainEpoch, sectorNos bitfield.BitField, ssize abi.SectorSize, quant QuantSpec, ) (moved bitfield.BitField, err error)
RescheduleExpirations moves expiring sectors to the target expiration, skipping any sectors it can't find.
The power of the rescheduled sectors is assumed to have not changed since initial scheduling.
Note: see the docs on State.RescheduleSectorExpirations for details on why we skip sectors/partitions we can't find.
func (*Partition) TerminateSectors ¶ added in v0.8.0
func (p *Partition) TerminateSectors( store adt.Store, sectors Sectors, epoch abi.ChainEpoch, sectorNos bitfield.BitField, ssize abi.SectorSize, quant 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.
type PartitionKey ¶ added in v0.8.0
Identifier for a single partition within a miner.
type PartitionSectorMap ¶ added in v0.9.2
type PartitionSectorMap map[uint64]bitfield.BitField
Maps partitions to sector bitfields.
func (PartitionSectorMap) Add ¶ added in v0.9.2
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 ¶ added in v0.9.2
func (pm PartitionSectorMap) AddValues(partIdx uint64, sectorNos ...uint64) error
AddValues records the given sectors at the given partition.
func (PartitionSectorMap) Count ¶ added in v0.9.2
func (pm PartitionSectorMap) Count() (partitions, sectors uint64, err error)
Count counts the number of partitions & sectors within the map.
func (PartitionSectorMap) ForEach ¶ added in v0.9.2
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 ¶ added in v0.9.2
func (pm PartitionSectorMap) Partitions() []uint64
Partitions returns a sorted slice of partitions in the map.
type PoStPartition ¶ added in v0.8.0
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 }
func (*PoStPartition) MarshalCBOR ¶ added in v0.8.0
func (t *PoStPartition) MarshalCBOR(w io.Writer) error
func (*PoStPartition) UnmarshalCBOR ¶ added in v0.8.0
func (t *PoStPartition) UnmarshalCBOR(r io.Reader) error
type PoStResult ¶ added in v0.8.2
type PoStResult struct {
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
}
func (*PoStResult) PenaltyPower ¶ added in v0.8.2
func (p *PoStResult) PenaltyPower() PowerPair
PenaltyPower is the power from this PoSt that should be penalized.
func (*PoStResult) PowerDelta ¶ added in v0.8.2
func (p *PoStResult) PowerDelta() PowerPair
PowerDelta returns the power change (positive or negative) after processing the PoSt submission.
type PowerPair ¶ added in v0.8.0
type PowerPair struct { Raw abi.StoragePower QA abi.StoragePower }
Value type for a pair of raw and QA power.
func NewPowerPair ¶ added in v0.8.0
func NewPowerPair(raw, qa abi.StoragePower) PowerPair
func NewPowerPairZero ¶ added in v0.8.0
func NewPowerPairZero() PowerPair
func PowerForSector ¶ added in v0.8.0
func PowerForSector(sectorSize abi.SectorSize, sector *SectorOnChainInfo) PowerPair
func PowerForSectors ¶ added in v0.7.0
func PowerForSectors(ssize abi.SectorSize, sectors []*SectorOnChainInfo) PowerPair
Returns the sum of the raw byte and quality-adjusted power for sectors.
type ProveCommitSectorParams ¶
type ProveCommitSectorParams struct { SectorNumber abi.SectorNumber Proof []byte }
func (*ProveCommitSectorParams) MarshalCBOR ¶
func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error
func (*ProveCommitSectorParams) UnmarshalCBOR ¶
func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) error
type QuantSpec ¶ added in v0.8.0
type QuantSpec struct {
// contains filtered or unexported fields
}
A spec for quantization.
func NewQuantSpec ¶ added in v0.8.1
func NewQuantSpec(unit, offset abi.ChainEpoch) QuantSpec
func QuantSpecForDeadline ¶ added in v0.9.9
func (QuantSpec) QuantizeUp ¶ added in v0.8.0
func (q QuantSpec) QuantizeUp(e abi.ChainEpoch) abi.ChainEpoch
type 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 }
func (*RecoveryDeclaration) MarshalCBOR ¶
func (t *RecoveryDeclaration) MarshalCBOR(w io.Writer) error
func (*RecoveryDeclaration) UnmarshalCBOR ¶
func (t *RecoveryDeclaration) UnmarshalCBOR(r io.Reader) error
type ReportConsensusFaultParams ¶
type ReportConsensusFaultParams struct { BlockHeader1 []byte BlockHeader2 []byte BlockHeaderExtra []byte }
func (*ReportConsensusFaultParams) MarshalCBOR ¶
func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error
func (*ReportConsensusFaultParams) UnmarshalCBOR ¶
func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) error
type SealVerifyStuff ¶ added in v0.5.4
type SealVerifyStuff struct { SealedCID cid.Cid // CommR InteractiveEpoch abi.ChainEpoch // Used to derive the interactive PoRep challenge. abi.RegisteredSealProof Proof []byte DealIDs []abi.DealID abi.SectorNumber SealRandEpoch abi.ChainEpoch // Used to tie the seal to a chain. }
SealVerifyParams is the structure of information that must be sent with a message to commit a sector. Most of this information is not needed in the state tree but will be verified in sm.CommitSector. See SealCommitment for data stored on the state tree for each sector.
type SectorOnChainInfo ¶
type SectorOnChainInfo struct { SectorNumber abi.SectorNumber SealProof abi.RegisteredSealProof // The seal proof type implies the PoSt proof/s SealedCID cid.Cid // CommR DealIDs []abi.DealID Activation abi.ChainEpoch // Epoch during which the sector proof was accepted Expiration abi.ChainEpoch // Epoch during which the sector expires DealWeight abi.DealWeight // Integral of active deals over sector lifetime VerifiedDealWeight abi.DealWeight // Integral of active verified deals over sector lifetime InitialPledge abi.TokenAmount // Pledge collected to commit this sector 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 }
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 ¶ added in v0.8.1
Sectors is a helper type for accessing/modifying a miner's sectors. It's safe to pass this object around as needed.
func (Sectors) Get ¶ added in v0.8.1
func (sa Sectors) Get(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, found bool, err error)
func (Sectors) Load ¶ added in v0.8.1
func (sa Sectors) Load(sectorNos bitfield.BitField) ([]*SectorOnChainInfo, error)
func (Sectors) MustGet ¶ added in v0.8.1
func (sa Sectors) MustGet(sectorNumber abi.SectorNumber) (info *SectorOnChainInfo, err error)
func (Sectors) Store ¶ added in v0.8.1
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). InitialPledgeRequirement abi.TokenAmount // Sum of initial pledge requirements of all active sectors // Sectors that have been pre-committed but not yet proven. PreCommittedSectors cid.Cid // Map, HAMT[SectorNumber]SectorPreCommitOnChainInfo // PreCommittedSectorsExpiry maintains the state required to expire PreCommittedSectors. PreCommittedSectorsExpiry 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) // 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 // 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 }
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 (*State) AddInitialPledgeRequirement ¶ added in v0.7.0
func (st *State) AddInitialPledgeRequirement(amount abi.TokenAmount)
func (*State) AddLockedFunds ¶
func (st *State) AddLockedFunds(store adt.Store, currEpoch abi.ChainEpoch, vestingSum abi.TokenAmount, spec *VestSpec) (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) AddPreCommitDeposit ¶
func (st *State) AddPreCommitDeposit(amount abi.TokenAmount)
func (*State) AddPreCommitExpiry ¶ added in v0.9.2
func (st *State) AddPreCommitExpiry(store adt.Store, expireEpoch abi.ChainEpoch, sectorNum abi.SectorNumber) error
func (*State) AllocateSectorNumber ¶ added in v0.8.2
func (*State) AssertBalanceInvariants ¶
func (st *State) AssertBalanceInvariants(balance abi.TokenAmount)
func (*State) AssignSectorsToDeadlines ¶ added in v0.8.0
func (st *State) AssignSectorsToDeadlines( store adt.Store, currentEpoch abi.ChainEpoch, sectors []*SectorOnChainInfo, partitionSize uint64, sectorSize abi.SectorSize, ) (PowerPair, error)
Assign new sectors to deadlines.
func (*State) CheckSectorHealth ¶ added in v0.8.2
func (st *State) CheckSectorHealth(store adt.Store, dlIdx, pIdx uint64, sector abi.SectorNumber) error
Returns an error if the target sector cannot be found and/or is faulty/terminated.
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) DeadlineInfo ¶
func (st *State) DeadlineInfo(currEpoch abi.ChainEpoch) *dline.Info
Returns deadline calculations for the current (according to state) proving period.
func (*State) DeletePrecommittedSectors ¶ added in v0.7.2
func (*State) DeleteSectors ¶
func (*State) FindPrecommittedSectors ¶ added in v0.8.0
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 ¶ added in v0.8.0
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) GetAvailableBalance ¶
func (st *State) GetAvailableBalance(actorBalance abi.TokenAmount) abi.TokenAmount
Unclaimed funds. Actor balance - (locked funds, precommit deposit, ip requirement) Can go negative if the miner is in IP debt
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 ¶ added in v0.8.1
func (st *State) GetUnlockedBalance(actorBalance abi.TokenAmount) abi.TokenAmount
Unclaimed funds that are not locked -- includes funds used to cover initial pledge requirement
func (*State) HasSectorNo ¶
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) LoadSectorInfosForProof ¶ added in v0.5.1
func (st *State) LoadSectorInfosForProof(store adt.Store, 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 (*State) LoadSectorInfosWithFaultMask ¶
func (st *State) LoadSectorInfosWithFaultMask(store adt.Store, 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 (*State) LoadVestingFunds ¶ added in v0.9.2
func (st *State) LoadVestingFunds(store adt.Store) (*VestingFunds, error)
LoadVestingFunds loads the vesting funds table from the store
func (*State) MaskSectorNumbers ¶ added in v0.8.2
func (*State) MeetsInitialPledgeCondition ¶ added in v0.8.1
func (st *State) MeetsInitialPledgeCondition(balance abi.TokenAmount) bool
func (*State) PenalizeFundsInPriorityOrder ¶ added in v0.8.1
func (st *State) PenalizeFundsInPriorityOrder(store adt.Store, currEpoch abi.ChainEpoch, target, unlockedBalance abi.TokenAmount) (fromVesting abi.TokenAmount, fromBalance abi.TokenAmount, err error)
PenalizeFundsInPriorityOrder first unlocks unvested funds from the vesting table. If the target is not yet hit it deducts funds from the (new) available balance. Returns the amount unlocked from the vesting table and the amount taken from current balance. If the penalty exceeds the total amount available in the vesting table and unlocked funds the penalty is reduced to match. This must be fixed when handling bankrupcy: https://github.com/filecoin-project/specs-actors/issues/627
func (*State) PopEarlyTerminations ¶ added in v0.8.0
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) PutPrecommittedSector ¶
func (st *State) PutPrecommittedSector(store adt.Store, info *SectorPreCommitOnChainInfo) error
func (*State) PutSectors ¶ added in v0.7.2
func (st *State) PutSectors(store adt.Store, newSectors ...*SectorOnChainInfo) error
func (*State) QuantSpecEveryDeadline ¶ added in v0.9.2
pre-commit expiry
func (*State) QuantSpecForDeadline ¶ added in v0.9.2
Returns deadline calculations for the current (according to state) proving period.
func (*State) RescheduleSectorExpirations ¶ added in v0.8.0
func (st *State) RescheduleSectorExpirations( store adt.Store, currEpoch abi.ChainEpoch, ssize abi.SectorSize, deadlineSectors DeadlineSectorMap, ) error
Schedules each sector to expire at its next deadline end. If it can't find any given sector, it skips it.
This method assumes that each sector's power has not changed, despite the rescheduling.
Note: this method is used to "upgrade" sectors, rescheduling the now-replaced sectors to expire at the end of the next deadline. Given the expense of sealing a sector, this function skips missing/faulty/terminated "upgraded" sectors instead of failing. That way, the new sectors can still be proved.
func (*State) SaveDeadlines ¶
func (*State) SaveVestingFunds ¶ added in v0.9.2
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.
type SubmitWindowedPoStParams ¶
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. ChainCommitEpoch abi.ChainEpoch // The ticket randomness on the chain at the ChainCommitEpoch on the chain this post is committed to ChainCommitRand abi.Randomness }
Information submitted by a miner to provide a Window PoSt.
func (*SubmitWindowedPoStParams) MarshalCBOR ¶
func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error
func (*SubmitWindowedPoStParams) UnmarshalCBOR ¶
func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) error
type TerminateSectorsParams ¶
type TerminateSectorsParams struct {
Terminations []TerminationDeclaration
}
func (*TerminateSectorsParams) MarshalCBOR ¶
func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error
func (*TerminateSectorsParams) UnmarshalCBOR ¶
func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) error
type TerminateSectorsReturn ¶ added in v0.8.0
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 }
func (*TerminateSectorsReturn) MarshalCBOR ¶ added in v0.8.0
func (t *TerminateSectorsReturn) MarshalCBOR(w io.Writer) error
func (*TerminateSectorsReturn) UnmarshalCBOR ¶ added in v0.8.0
func (t *TerminateSectorsReturn) UnmarshalCBOR(r io.Reader) error
type TerminationDeclaration ¶ added in v0.8.0
func (*TerminationDeclaration) MarshalCBOR ¶ added in v0.8.0
func (t *TerminationDeclaration) MarshalCBOR(w io.Writer) error
func (*TerminationDeclaration) UnmarshalCBOR ¶ added in v0.8.0
func (t *TerminationDeclaration) UnmarshalCBOR(r io.Reader) error
type TerminationResult ¶ added in v0.8.0
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 ¶ added in v0.8.0
func (t *TerminationResult) Add(newResult TerminationResult) error
func (*TerminationResult) BelowLimit ¶ added in v0.8.0
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 ¶ added in v0.8.0
func (t *TerminationResult) ForEach(cb func(epoch abi.ChainEpoch, sectors bitfield.BitField) error) error
func (*TerminationResult) IsEmpty ¶ added in v0.8.0
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.
type VestingFund ¶ added in v0.9.2
type VestingFund struct { Epoch abi.ChainEpoch Amount abi.TokenAmount }
VestingFund represents miner funds that will vest at the given epoch.
func (*VestingFund) MarshalCBOR ¶ added in v0.9.2
func (t *VestingFund) MarshalCBOR(w io.Writer) error
func (*VestingFund) UnmarshalCBOR ¶ added in v0.9.2
func (t *VestingFund) UnmarshalCBOR(r io.Reader) error
type VestingFunds ¶ added in v0.9.2
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 ¶ added in v0.9.2
func ConstructVestingFunds() *VestingFunds
ConstructVestingFunds constructs empty VestingFunds state.
func (*VestingFunds) MarshalCBOR ¶ added in v0.9.2
func (t *VestingFunds) MarshalCBOR(w io.Writer) error
func (*VestingFunds) UnmarshalCBOR ¶ added in v0.9.2
func (t *VestingFunds) UnmarshalCBOR(r io.Reader) error
type WithdrawBalanceParams ¶
type WithdrawBalanceParams struct {
AmountRequested abi.TokenAmount
}
func (*WithdrawBalanceParams) MarshalCBOR ¶
func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error
func (*WithdrawBalanceParams) UnmarshalCBOR ¶
func (t *WithdrawBalanceParams) UnmarshalCBOR(r io.Reader) error
type WorkerKeyChange ¶
type WorkerKeyChange struct { NewWorker addr.Address // Must be an ID address EffectiveAt abi.ChainEpoch }
func (*WorkerKeyChange) MarshalCBOR ¶
func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error
func (*WorkerKeyChange) UnmarshalCBOR ¶
func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) error