Documentation ¶
Index ¶
- Constants
- Variables
- func AsStorageWeightDesc(sectorSize abi.SectorSize, sectorInfo *SectorOnChainInfo) *power.SectorStorageWeightDesc
- func AssignNewSectors(deadlines *Deadlines, partitionSize uint64, newSectors []uint64, ...) error
- func ComputePartitionsSectors(d *Deadlines, partitionSize uint64, deadlineIndex uint64, partitions []uint64) ([]*abi.BitField, error)
- func DeadlineCount(d *Deadlines, partitionSize, deadlineIdx uint64) (partitionCount, sectorCount uint64, err error)
- func EpochKey(e abi.ChainEpoch) uint64
- func PartitionsForDeadline(d *Deadlines, partitionSize, deadlineIdx uint64) (firstPartition, sectorCount uint64, _ error)
- func SectorKey(e abi.SectorNumber) adt.Keyer
- type Actor
- func (a Actor) AddLockedFund(rt Runtime, amountToLock *abi.TokenAmount) *adt.EmptyValue
- func (a Actor) ChangePeerID(rt Runtime, params *ChangePeerIDParams) *adt.EmptyValue
- func (a Actor) ChangeWorkerAddress(rt Runtime, params *ChangeWorkerAddressParams) *adt.EmptyValue
- func (a Actor) CheckSectorProven(rt Runtime, params *CheckSectorProvenParams) *adt.EmptyValue
- func (a Actor) Constructor(rt Runtime, params *ConstructorParams) *adt.EmptyValue
- func (a Actor) ControlAddresses(rt Runtime, _ *adt.EmptyValue) *GetControlAddressesReturn
- func (a Actor) DeclareFaults(rt Runtime, params *DeclareFaultsParams) *adt.EmptyValue
- func (a Actor) DeclareFaultsRecovered(rt Runtime, params *DeclareFaultsRecoveredParams) *adt.EmptyValue
- func (a Actor) Exports() []interface{}
- func (a Actor) ExtendSectorExpiration(rt Runtime, params *ExtendSectorExpirationParams) *adt.EmptyValue
- func (a Actor) OnDeferredCronEvent(rt Runtime, payload *CronEventPayload) *adt.EmptyValue
- func (a Actor) PreCommitSector(rt Runtime, params *SectorPreCommitInfo) *adt.EmptyValue
- func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *adt.EmptyValue
- func (a Actor) ReportConsensusFault(rt Runtime, params *ReportConsensusFaultParams) *adt.EmptyValue
- func (a Actor) SubmitWindowedPoSt(rt Runtime, params *SubmitWindowedPoStParams) *adt.EmptyValue
- func (a Actor) TerminateSectors(rt Runtime, params *TerminateSectorsParams) *adt.EmptyValue
- func (a Actor) WithdrawBalance(rt Runtime, params *WithdrawBalanceParams) *adt.EmptyValue
- type BigFrac
- type ChangePeerIDParams
- type ChangeWorkerAddressParams
- type CheckSectorProvenParams
- type ConstructorParams
- type CronEventPayload
- type CronEventType
- type DeadlineInfo
- type Deadlines
- type DeclareFaultsParams
- type DeclareFaultsRecoveredParams
- type ExtendSectorExpirationParams
- type FaultDeclaration
- type GetControlAddressesReturn
- type MinerInfo
- type PeerID
- type ProveCommitSectorParams
- type RecoveryDeclaration
- type ReportConsensusFaultParams
- type Runtime
- type SectorOnChainInfo
- type SectorPreCommitInfo
- type SectorPreCommitOnChainInfo
- type State
- func (st *State) AddFaults(store adt.Store, sectorNos *abi.BitField, faultEpoch abi.ChainEpoch) (err error)
- func (st *State) AddLockedFunds(store adt.Store, currEpoch abi.ChainEpoch, vestingSum abi.TokenAmount, ...) error
- func (st *State) AddNewSectors(sectorNos ...abi.SectorNumber) (err error)
- func (st *State) AddPoStSubmissions(partitionNos *abi.BitField) (err error)
- func (st *State) AddPreCommitDeposit(amount abi.TokenAmount)
- func (st *State) AddRecoveries(sectorNos *abi.BitField) (err error)
- func (st *State) AddSectorExpirations(store adt.Store, expiry abi.ChainEpoch, sectors ...uint64) error
- func (st *State) AssertBalanceInvariants(balance abi.TokenAmount)
- func (st *State) CheckVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)
- func (st *State) ClearFaultEpochs(store adt.Store, epochs ...abi.ChainEpoch) error
- func (st *State) ClearPoStSubmissions() error
- func (st *State) ClearSectorExpirations(store adt.Store, expirations ...abi.ChainEpoch) error
- func (st *State) DeadlineInfo(currEpoch abi.ChainEpoch) *DeadlineInfo
- func (st *State) DeletePrecommittedSector(store adt.Store, sectorNo abi.SectorNumber) error
- func (st *State) DeleteSectors(store adt.Store, sectorNos *abi.BitField) error
- func (st *State) ForEachFaultEpoch(store adt.Store, cb func(epoch abi.ChainEpoch, faults *abi.BitField) error) error
- func (st *State) ForEachSector(store adt.Store, f func(*SectorOnChainInfo)) error
- func (st *State) ForEachSectorExpiration(store adt.Store, f func(expiry abi.ChainEpoch, sectors *abi.BitField) error) error
- func (st *State) GetAvailableBalance(actorBalance abi.TokenAmount) abi.TokenAmount
- func (st *State) GetMaxAllowedFaults(store adt.Store) (uint64, 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) GetSectorCount(store adt.Store) (uint64, error)
- func (st *State) GetSectorExpirations(store adt.Store, expiry abi.ChainEpoch) (*abi.BitField, error)
- func (st *State) GetSectorSize() abi.SectorSize
- func (st *State) GetWorker() addr.Address
- 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 *abi.BitField) ([]*SectorOnChainInfo, error)
- func (st *State) LoadSectorInfosWithFaultMask(store adt.Store, sectors *abi.BitField, faults *abi.BitField, ...) ([]*SectorOnChainInfo, error)
- func (t *State) MarshalCBOR(w io.Writer) error
- func (st *State) PutPrecommittedSector(store adt.Store, info *SectorPreCommitOnChainInfo) error
- func (st *State) PutSector(store adt.Store, sector *SectorOnChainInfo) error
- func (st *State) RemoveFaults(store adt.Store, sectorNos *abi.BitField) (err error)
- func (st *State) RemoveNewSectors(sectorNos *abi.BitField) (err error)
- func (st *State) RemoveRecoveries(sectorNos *abi.BitField) (err error)
- func (st *State) RemoveSectorExpirations(store adt.Store, expiry abi.ChainEpoch, sectors ...uint64) error
- func (st *State) SaveDeadlines(store adt.Store, deadlines *Deadlines) 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 VestSpec
- type WithdrawBalanceParams
- type WorkerKeyChange
Constants ¶
const ChainFinalityish = abi.ChainEpoch(500) // PARAM_FINISH
An approximation to chain state finality (should include message propagation time as well).
const ElectionLookback = abi.ChainEpoch(1) // PARAM_FINISH
Lookback from the current epoch for state view for leader elections.
const EpochDurationSeconds = 25
The duration of a chain epoch. This is used for deriving epoch-denominated periods that are more naturally expressed in clock time.
const FaultDeclarationCutoff = WPoStChallengeLookback // PARAM_FINISH
Minimum period before a deadline's challenge window opens that a fault must be declared for that deadline. A fault declaration may appear in the challenge epoch, since it must have been posted before the epoch completed, and hence before the challenge was knowable.
const FaultMaxAge = WPoStProvingPeriod*14 - 1
The maximum age of a fault before the sector is terminated.
const NewSectorsPerPeriodMax = 128 << 10
The maximum number of new sectors that may be staged by a miner during a single proving period.
const PreCommitChallengeDelay = abi.ChainEpoch(10)
Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn used to ensure it is not predictable by miner.
const SecondsInDay = 86400
const SecondsInYear = 31556925
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
const WPoStChallengeLookback = abi.ChainEpoch(20) // PARAM_FINISH
Lookback from the deadline's challenge window opening from which to sample chain randomness for the challenge seed.
const WPoStChallengeWindow = abi.ChainEpoch(1800 / EpochDurationSeconds) // Half an hour (=48 per day)
The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
const WPoStPeriodDeadlines = uint64(WPoStProvingPeriod / WPoStChallengeWindow)
The number of non-overlapping PoSt deadlines in each proving period.
const WPoStProvingPeriod = abi.ChainEpoch(SecondsInDay / EpochDurationSeconds)
The period over which all a miner's active sectors will be challenged.
const WorkerKeyChangeDelay = 2 * ElectionLookback // PARAM_FINISH
Staging period for a miner worker key change.
Variables ¶
var MaxSealDuration = map[abi.RegisteredProof]abi.ChainEpoch{ abi.RegisteredProof_StackedDRG32GiBSeal: abi.ChainEpoch(10000), abi.RegisteredProof_StackedDRG2KiBSeal: abi.ChainEpoch(10000), abi.RegisteredProof_StackedDRG8MiBSeal: abi.ChainEpoch(10000), abi.RegisteredProof_StackedDRG512MiBSeal: abi.ChainEpoch(10000), }
Maximum duration to allow for the sealing process for seal algorithms. Dependent on algorithm and sector size
var PledgeVestingSpec = VestSpec{ InitialDelay: abi.ChainEpoch(SecondsInYear / EpochDurationSeconds), VestPeriod: abi.ChainEpoch(SecondsInYear / EpochDurationSeconds), StepDuration: abi.ChainEpoch(7 * SecondsInDay / EpochDurationSeconds), Quantization: SecondsInDay / EpochDurationSeconds, }
Functions ¶
func AsStorageWeightDesc ¶
func AsStorageWeightDesc(sectorSize abi.SectorSize, sectorInfo *SectorOnChainInfo) *power.SectorStorageWeightDesc
func AssignNewSectors ¶
func AssignNewSectors(deadlines *Deadlines, partitionSize uint64, newSectors []uint64, seed abi.Randomness) error
Assigns a sequence of sector numbers to deadlines by: - filling any non-full partitions, in round-robin order across the deadlines - repeatedly adding a new partition to the deadline with the fewest partitions When multiple partitions share the minimal sector count, one is chosen at random (from a seed).
func ComputePartitionsSectors ¶
func ComputePartitionsSectors(d *Deadlines, partitionSize uint64, deadlineIndex uint64, partitions []uint64) ([]*abi.BitField, error)
Computes a bitfield of the sector numbers included in a sequence of partitions due at some deadline. Fails if any partition is not due at the provided deadline.
func DeadlineCount ¶
func DeadlineCount(d *Deadlines, partitionSize, deadlineIdx uint64) (partitionCount, sectorCount uint64, err error)
Counts the partitions (including up to one partial) and sectors at a deadline.
func EpochKey ¶
func EpochKey(e abi.ChainEpoch) uint64
func PartitionsForDeadline ¶
func PartitionsForDeadline(d *Deadlines, partitionSize, deadlineIdx uint64) (firstPartition, sectorCount uint64, _ error)
Computes the first partition index and number of sectors for a deadline. Partitions are numbered globally for the miner, not per-deadline. If the deadline has no sectors, the first partition index is the index that a partition at that deadline would have, if non-empty (and sectorCount is zero).
Types ¶
type Actor ¶
type Actor struct{}
func (Actor) AddLockedFund ¶
func (a Actor) AddLockedFund(rt Runtime, amountToLock *abi.TokenAmount) *adt.EmptyValue
Locks up some amount of a the miner's unlocked balance (including any received alongside the invoking message).
func (Actor) ChangePeerID ¶
func (a Actor) ChangePeerID(rt Runtime, params *ChangePeerIDParams) *adt.EmptyValue
func (Actor) ChangeWorkerAddress ¶
func (a Actor) ChangeWorkerAddress(rt Runtime, params *ChangeWorkerAddressParams) *adt.EmptyValue
func (Actor) CheckSectorProven ¶
func (a Actor) CheckSectorProven(rt Runtime, params *CheckSectorProvenParams) *adt.EmptyValue
func (Actor) Constructor ¶
func (a Actor) Constructor(rt Runtime, params *ConstructorParams) *adt.EmptyValue
func (Actor) ControlAddresses ¶
func (a Actor) ControlAddresses(rt Runtime, _ *adt.EmptyValue) *GetControlAddressesReturn
func (Actor) DeclareFaults ¶
func (a Actor) DeclareFaults(rt Runtime, params *DeclareFaultsParams) *adt.EmptyValue
func (Actor) DeclareFaultsRecovered ¶
func (a Actor) DeclareFaultsRecovered(rt Runtime, params *DeclareFaultsRecoveredParams) *adt.EmptyValue
func (Actor) ExtendSectorExpiration ¶
func (a Actor) ExtendSectorExpiration(rt Runtime, params *ExtendSectorExpirationParams) *adt.EmptyValue
func (Actor) OnDeferredCronEvent ¶
func (a Actor) OnDeferredCronEvent(rt Runtime, payload *CronEventPayload) *adt.EmptyValue
func (Actor) PreCommitSector ¶
func (a Actor) PreCommitSector(rt Runtime, params *SectorPreCommitInfo) *adt.EmptyValue
Proposals must be posted on chain via sma.PublishStorageDeals before PreCommitSector. Optimization: PreCommitSector could contain a list of deals that are not published yet.
func (Actor) ProveCommitSector ¶
func (a Actor) ProveCommitSector(rt Runtime, params *ProveCommitSectorParams) *adt.EmptyValue
func (Actor) ReportConsensusFault ¶
func (a Actor) ReportConsensusFault(rt Runtime, params *ReportConsensusFaultParams) *adt.EmptyValue
func (Actor) SubmitWindowedPoSt ¶
func (a Actor) SubmitWindowedPoSt(rt Runtime, params *SubmitWindowedPoStParams) *adt.EmptyValue
Invoked by miner's worker address to submit their fallback post
func (Actor) TerminateSectors ¶
func (a Actor) TerminateSectors(rt Runtime, params *TerminateSectorsParams) *adt.EmptyValue
func (Actor) WithdrawBalance ¶
func (a Actor) WithdrawBalance(rt Runtime, params *WithdrawBalanceParams) *adt.EmptyValue
type 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 ConstructorParams ¶
type ConstructorParams = power.MinerConstructorParams
Storage miner actors are created exclusively by the storage power actor. In order to break a circular dependency between the two, the construction parameters are defined in the power actor.
type CronEventPayload ¶
type CronEventPayload struct { EventType CronEventType Sectors *abi.BitField }
func (*CronEventPayload) MarshalCBOR ¶
func (t *CronEventPayload) MarshalCBOR(w io.Writer) error
func (*CronEventPayload) UnmarshalCBOR ¶
func (t *CronEventPayload) UnmarshalCBOR(r io.Reader) error
type CronEventType ¶
type CronEventType int64
const ( CronEventWorkerKeyChange CronEventType = iota CronEventPreCommitExpiry CronEventProvingPeriod )
type DeadlineInfo ¶
type DeadlineInfo struct { CurrentEpoch abi.ChainEpoch // Epoch at which this info was calculated. PeriodStart abi.ChainEpoch // First epoch of the proving period (<= CurrentEpoch). Index uint64 // Current deadline index, in [0..WPoStProvingPeriodDeadlines). Open abi.ChainEpoch // First epoch from which a proof may be submitted, inclusive (>= CurrentEpoch). Close abi.ChainEpoch // First epoch from which a proof may no longer be submitted, exclusive (>= Open). Challenge abi.ChainEpoch // Epoch at which to sample the chain for challenge (< Open). FaultCutoff abi.ChainEpoch // First epoch at which a fault declaration is rejected (< Open). }
Deadline calculations with respect to a current epoch. "Deadline" refers to the window during which proofs may be submitted. Windows are non-overlapping ranges [Open, Close), but the challenge epoch for a window occurs before the window opens.
func ComputeProvingPeriodDeadline ¶
func ComputeProvingPeriodDeadline(periodStart, currEpoch abi.ChainEpoch) *DeadlineInfo
Returns deadline-related calculations for a proving period start and current epoch.
func (*DeadlineInfo) FaultCutoffPassed ¶
func (d *DeadlineInfo) FaultCutoffPassed() bool
func (*DeadlineInfo) HasElapsed ¶
func (d *DeadlineInfo) HasElapsed() bool
func (*DeadlineInfo) IsOpen ¶
func (d *DeadlineInfo) IsOpen() bool
func (*DeadlineInfo) NextPeriodStart ¶
func (d *DeadlineInfo) NextPeriodStart() abi.ChainEpoch
func (*DeadlineInfo) PeriodEnd ¶
func (d *DeadlineInfo) PeriodEnd() abi.ChainEpoch
func (*DeadlineInfo) PeriodStarted ¶
func (d *DeadlineInfo) PeriodStarted() bool
type Deadlines ¶
type Deadlines struct { // A bitfield of sector numbers due at each deadline. // The sectors for each deadline are logically grouped into sequential partitions for proving. Due [WPoStPeriodDeadlines]*abi.BitField }
func ConstructDeadlines ¶
func ConstructDeadlines() *Deadlines
func (*Deadlines) AddToDeadline ¶
Adds sector numbers to a deadline. The sector numbers are given as uint64 to avoid pointless conversions for bitfield use.
func (*Deadlines) RemoveFromAllDeadlines ¶
Removes sector numbers from all deadlines.
type DeclareFaultsParams ¶
type DeclareFaultsParams struct {
Faults []FaultDeclaration
}
func (*DeclareFaultsParams) MarshalCBOR ¶
func (t *DeclareFaultsParams) MarshalCBOR(w io.Writer) error
func (*DeclareFaultsParams) UnmarshalCBOR ¶
func (t *DeclareFaultsParams) UnmarshalCBOR(r io.Reader) error
type DeclareFaultsRecoveredParams ¶
type DeclareFaultsRecoveredParams struct {
Recoveries []RecoveryDeclaration
}
func (*DeclareFaultsRecoveredParams) MarshalCBOR ¶
func (t *DeclareFaultsRecoveredParams) MarshalCBOR(w io.Writer) error
func (*DeclareFaultsRecoveredParams) UnmarshalCBOR ¶
func (t *DeclareFaultsRecoveredParams) UnmarshalCBOR(r io.Reader) error
type ExtendSectorExpirationParams ¶
type ExtendSectorExpirationParams struct { SectorNumber abi.SectorNumber NewExpiration abi.ChainEpoch }
func (*ExtendSectorExpirationParams) MarshalCBOR ¶
func (t *ExtendSectorExpirationParams) MarshalCBOR(w io.Writer) error
func (*ExtendSectorExpirationParams) UnmarshalCBOR ¶
func (t *ExtendSectorExpirationParams) UnmarshalCBOR(r io.Reader) error
type FaultDeclaration ¶
type FaultDeclaration struct { Deadline uint64 // In range [0..WPoStPeriodDeadlines) Sectors *abi.BitField }
func (*FaultDeclaration) MarshalCBOR ¶
func (t *FaultDeclaration) MarshalCBOR(w io.Writer) error
func (*FaultDeclaration) UnmarshalCBOR ¶
func (t *FaultDeclaration) UnmarshalCBOR(r io.Reader) error
type GetControlAddressesReturn ¶
func (*GetControlAddressesReturn) MarshalCBOR ¶
func (t *GetControlAddressesReturn) MarshalCBOR(w io.Writer) error
func (*GetControlAddressesReturn) UnmarshalCBOR ¶
func (t *GetControlAddressesReturn) UnmarshalCBOR(r io.Reader) error
type MinerInfo ¶
type MinerInfo struct { // Account that owns this miner. // - Income and returned collateral are paid to this address. // - This address is also allowed to change the worker address for the miner. Owner addr.Address // Must be an ID-address. // Worker account for this miner. // The associated pubkey-type address is used to sign blocks and messages on behalf of this miner. Worker addr.Address // Must be an ID-address. PendingWorkerKey *WorkerKeyChange // Libp2p identity that should be used when connecting to this miner. PeerId peer.ID // The proof type used by this miner for sealing sectors. SealProofType abi.RegisteredProof // 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 }
type ProveCommitSectorParams ¶
type ProveCommitSectorParams struct { SectorNumber abi.SectorNumber Proof []byte }
func (*ProveCommitSectorParams) MarshalCBOR ¶
func (t *ProveCommitSectorParams) MarshalCBOR(w io.Writer) error
func (*ProveCommitSectorParams) UnmarshalCBOR ¶
func (t *ProveCommitSectorParams) UnmarshalCBOR(r io.Reader) error
type RecoveryDeclaration ¶
type RecoveryDeclaration struct { Deadline uint64 // In range [0..WPoStPeriodDeadlines) Sectors *abi.BitField }
func (*RecoveryDeclaration) MarshalCBOR ¶
func (t *RecoveryDeclaration) MarshalCBOR(w io.Writer) error
func (*RecoveryDeclaration) UnmarshalCBOR ¶
func (t *RecoveryDeclaration) UnmarshalCBOR(r io.Reader) error
type ReportConsensusFaultParams ¶
type ReportConsensusFaultParams struct { BlockHeader1 []byte BlockHeader2 []byte BlockHeaderExtra []byte }
func (*ReportConsensusFaultParams) MarshalCBOR ¶
func (t *ReportConsensusFaultParams) MarshalCBOR(w io.Writer) error
func (*ReportConsensusFaultParams) UnmarshalCBOR ¶
func (t *ReportConsensusFaultParams) UnmarshalCBOR(r io.Reader) error
type SectorOnChainInfo ¶
type SectorOnChainInfo struct { Info SectorPreCommitInfo ActivationEpoch abi.ChainEpoch // Epoch at which SectorProveCommit is accepted DealWeight abi.DealWeight // Integral of active deals over sector lifetime VerifiedDealWeight abi.DealWeight // Integral of active verified deals over sector lifetime }
func (*SectorOnChainInfo) AsSectorInfo ¶
func (s *SectorOnChainInfo) AsSectorInfo() abi.SectorInfo
func (*SectorOnChainInfo) MarshalCBOR ¶
func (t *SectorOnChainInfo) MarshalCBOR(w io.Writer) error
func (*SectorOnChainInfo) UnmarshalCBOR ¶
func (t *SectorOnChainInfo) UnmarshalCBOR(r io.Reader) error
type SectorPreCommitInfo ¶
type SectorPreCommitInfo struct { RegisteredProof abi.RegisteredProof SectorNumber abi.SectorNumber SealedCID cid.Cid // CommR SealRandEpoch abi.ChainEpoch DealIDs []abi.DealID Expiration abi.ChainEpoch // Sector Expiration }
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 }
func (*SectorPreCommitOnChainInfo) MarshalCBOR ¶
func (t *SectorPreCommitOnChainInfo) MarshalCBOR(w io.Writer) error
func (*SectorPreCommitOnChainInfo) UnmarshalCBOR ¶
func (t *SectorPreCommitOnChainInfo) UnmarshalCBOR(r io.Reader) error
type State ¶
type State struct { // Information not related to sectors. // TODO: this should be a cid of the miner Info struct so it's not re-written when other fields change. Info MinerInfo PreCommitDeposits abi.TokenAmount // Total funds locked as PreCommitDeposits LockedFunds abi.TokenAmount // Total unvested funds locked as pledge collateral VestingFunds cid.Cid // Array, AMT[ChainEpoch]TokenAmount // Sectors that have been pre-committed but not yet proven. PreCommittedSectors cid.Cid // Map, HAMT[SectorNumber]SectorPreCommitOnChainInfo // Information for all proven and not-yet-expired sectors. Sectors cid.Cid // Array, AMT[SectorNumber]SectorOnChainInfo (sparse) // The first epoch in this miner's current proving period. This is the first epoch in which a PoSt for a // partition at the miner's first deadline may arrive. Alternatively, it is after the last epoch at which // a PoSt for the previous window is valid. // Always greater than zero, his may be greater than the current epoch for genesis miners in the first // WPoStProvingPeriod epochs of the chain; the epochs before the first proving period starts are exempt from Window // PoSt requirements. // Updated at the end of every period by a power actor cron event. ProvingPeriodStart abi.ChainEpoch // Sector numbers prove-committed since period start, to be added to Deadlines at next proving period boundary. NewSectors *abi.BitField // Sector numbers indexed by expiry epoch (which are on proving period boundaries). // Invariant: Keys(Sectors) == union(SectorExpirations.Values()) SectorExpirations cid.Cid // Array, AMT[ChainEpoch]Bitfield // The sector numbers due for PoSt at each deadline in the current proving period, frozen at period start. // New sectors are added and expired ones removed at proving period boundary. // Faults are not subtracted from this in state, but on the fly. Deadlines cid.Cid // All currently known faulty sectors, mutated eagerly. // These sectors are exempt from inclusion in PoSt. Faults *abi.BitField // Faulty sector numbers indexed by the start epoch of the proving period in which detected. // Used to track fault durations for eventual sector termination. // At most 14 entries, b/c sectors faulty longer expire. // Invariant: Faults == union(FaultEpochs.Values()) FaultEpochs cid.Cid // AMT[ChainEpoch]Bitfield // Faulty sectors that will recover when next included in a valid PoSt. // Invariant: Recoveries ⊆ Faults. Recoveries *abi.BitField // Records successful PoSt submission in the current proving period by partition number. // The presence of a partition number indicates on-time PoSt received. PostSubmissions *abi.BitField }
Balance of Miner Actor should be greater than or equal to the sum of PreCommitDeposits and LockedFunds. Excess balance as computed by st.GetAvailableBalance will be withdrawable or usable for pre-commit deposit or pledge lock-up.
func ConstructState ¶
func (*State) AddFaults ¶
func (st *State) AddFaults(store adt.Store, sectorNos *abi.BitField, faultEpoch abi.ChainEpoch) (err error)
Adds sectors numbers to faults and fault epochs.
func (*State) AddLockedFunds ¶
func (st *State) AddLockedFunds(store adt.Store, currEpoch abi.ChainEpoch, vestingSum abi.TokenAmount, spec *VestSpec) error
func (*State) AddNewSectors ¶
func (st *State) AddNewSectors(sectorNos ...abi.SectorNumber) (err error)
Adds some sector numbers to the new sectors bitfield.
func (*State) AddPoStSubmissions ¶
Adds partition numbers to the set of PoSt submissions
func (*State) AddPreCommitDeposit ¶
func (st *State) AddPreCommitDeposit(amount abi.TokenAmount)
func (*State) AddRecoveries ¶
Adds sectors to recoveries.
func (*State) AddSectorExpirations ¶
func (st *State) AddSectorExpirations(store adt.Store, expiry abi.ChainEpoch, sectors ...uint64) error
Adds some sector numbers to the set expiring at an epoch. The sector numbers are given as uint64s to avoid pointless conversions.
func (*State) AssertBalanceInvariants ¶
func (st *State) AssertBalanceInvariants(balance abi.TokenAmount)
func (*State) CheckVestedFunds ¶
func (st *State) CheckVestedFunds(store adt.Store, currEpoch abi.ChainEpoch) (abi.TokenAmount, error)
CheckVestedFunds returns the amount of vested funds that have vested before the provided epoch.
func (*State) ClearFaultEpochs ¶
func (*State) ClearPoStSubmissions ¶
Removes all PoSt submissions
func (*State) ClearSectorExpirations ¶
Removes all sector numbers from the set expiring some epochs.
func (*State) DeadlineInfo ¶
func (st *State) DeadlineInfo(currEpoch abi.ChainEpoch) *DeadlineInfo
Returns deadline calculations for the current proving period.
func (*State) DeletePrecommittedSector ¶
func (*State) DeleteSectors ¶
func (*State) ForEachFaultEpoch ¶
func (st *State) ForEachFaultEpoch(store adt.Store, cb func(epoch abi.ChainEpoch, faults *abi.BitField) error) error
Iterates faults by declaration epoch, in order.
func (*State) ForEachSector ¶
func (st *State) ForEachSector(store adt.Store, f func(*SectorOnChainInfo)) error
func (*State) ForEachSectorExpiration ¶
func (st *State) ForEachSectorExpiration(store adt.Store, f func(expiry abi.ChainEpoch, sectors *abi.BitField) error) error
Iterates sector expiration groups in order. Note that the sectors bitfield provided to the callback is not safe to store.
func (*State) GetAvailableBalance ¶
func (st *State) GetAvailableBalance(actorBalance abi.TokenAmount) abi.TokenAmount
func (*State) GetMaxAllowedFaults ¶
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) GetSectorExpirations ¶
func (st *State) GetSectorExpirations(store adt.Store, expiry abi.ChainEpoch) (*abi.BitField, error)
Gets the sector numbers expiring at some epoch.
func (*State) GetSectorSize ¶
func (st *State) GetSectorSize() abi.SectorSize
func (*State) HasSectorNo ¶
func (*State) LoadSectorInfos ¶
func (st *State) LoadSectorInfos(store adt.Store, sectors *abi.BitField) ([]*SectorOnChainInfo, error)
Loads sector info for a sequence of sectors.
func (*State) LoadSectorInfosWithFaultMask ¶
func (st *State) LoadSectorInfosWithFaultMask(store adt.Store, sectors *abi.BitField, faults *abi.BitField, faultStandIn abi.SectorNumber) ([]*SectorOnChainInfo, error)
Loads sector info for a sequence of sectors, substituting info for a stand-in sector for any that are faulty.
func (*State) PutPrecommittedSector ¶
func (st *State) PutPrecommittedSector(store adt.Store, info *SectorPreCommitOnChainInfo) error
func (*State) PutSector ¶
func (st *State) PutSector(store adt.Store, sector *SectorOnChainInfo) error
func (*State) RemoveFaults ¶
Removes sector numbers from faults and fault epochs, if present.
func (*State) RemoveNewSectors ¶
Removes some sector numbers from the new sectors bitfield, if present.
func (*State) RemoveRecoveries ¶
Removes sectors from recoveries, if present.
func (*State) RemoveSectorExpirations ¶
func (st *State) RemoveSectorExpirations(store adt.Store, expiry abi.ChainEpoch, sectors ...uint64) error
Removes some sector numbers from the set expiring at an epoch.
func (*State) SaveDeadlines ¶
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 partition indices being proven. // Partitions are counted across all deadlines, such that all partition indices in the second deadline are greater // than the partition numbers in the first deadlines. Partitions []uint64 // Parallel array of proofs corresponding to the partitions. Proofs []abi.PoStProof // Sectors skipped while proving that weren't already declared faulty Skipped abi.BitField }
Information submitted by a miner to provide a Window PoSt.
func (*SubmitWindowedPoStParams) MarshalCBOR ¶
func (t *SubmitWindowedPoStParams) MarshalCBOR(w io.Writer) error
func (*SubmitWindowedPoStParams) UnmarshalCBOR ¶
func (t *SubmitWindowedPoStParams) UnmarshalCBOR(r io.Reader) error
type TerminateSectorsParams ¶
func (*TerminateSectorsParams) MarshalCBOR ¶
func (t *TerminateSectorsParams) MarshalCBOR(w io.Writer) error
func (*TerminateSectorsParams) UnmarshalCBOR ¶
func (t *TerminateSectorsParams) UnmarshalCBOR(r io.Reader) error
type VestSpec ¶
type VestSpec struct { InitialDelay abi.ChainEpoch // Delay before any amount starts vesting. VestPeriod abi.ChainEpoch // Period over which the total should vest, after the initial delay. StepDuration abi.ChainEpoch // Duration between successive incremental vests (independent of vesting period). Quantization abi.ChainEpoch // Maximum precision of vesting table (limits cardinality of table). }
Specification for a linear vesting schedule.
type WithdrawBalanceParams ¶
type WithdrawBalanceParams struct {
AmountRequested abi.TokenAmount
}
func (*WithdrawBalanceParams) MarshalCBOR ¶
func (t *WithdrawBalanceParams) MarshalCBOR(w io.Writer) error
func (*WithdrawBalanceParams) UnmarshalCBOR ¶
func (t *WithdrawBalanceParams) UnmarshalCBOR(r io.Reader) error
type WorkerKeyChange ¶
type WorkerKeyChange struct { NewWorker addr.Address // Must be an ID address EffectiveAt abi.ChainEpoch }
func (*WorkerKeyChange) MarshalCBOR ¶
func (t *WorkerKeyChange) MarshalCBOR(w io.Writer) error
func (*WorkerKeyChange) UnmarshalCBOR ¶
func (t *WorkerKeyChange) UnmarshalCBOR(r io.Reader) error