miner

package
v0.10.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0, MIT Imports: 22 Imported by: 79

Documentation

Index

Constants

View Source
const AddressedPartitionsMax = MaxPartitionsPerDeadline

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

View Source
const AddressedSectorsMax = 25_000 // PARAM_SPEC

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

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

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

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

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

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

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

View Source
const DeclarationsMax = AddressedPartitionsMax

Maximum number of unique "declarations" in batch operations.

View Source
const FaultDeclarationCutoff = WPoStChallengeLookback + 50 // PARAM_SPEC

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

View Source
const MaxAggregateProofSize = 81960
View Source
const MaxAggregatedSectors = 819
View Source
const MaxPartitionsPerDeadline = 3000

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

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

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

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

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

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

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

View Source
const PreCommitSectorBatchMaxSize = 256

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

View Source
const PrecommitCleanUpAmtBitwidth = 6

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

View Source
const ProveReplicaUpdatesMaxSize = PreCommitSectorBatchMaxSize

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

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

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

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

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

View Source
const WorkerKeyChangeDelay = ChainFinality // PARAM_SPEC

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

Variables

View Source
var BatchBalancer = big.Mul(big.NewInt(5), builtin.OneNanoFIL) // PARAM_SPEC
View Source
var BatchDiscount = builtin.BigFrac{
	Numerator:   big.NewInt(1),
	Denominator: big.NewInt(20),
}
View Source
var EstimatedSinglePreCommitGasUsage = big.NewInt(16433324) // PARAM_SPEC
View Source
var EstimatedSingleProveCommitGasUsage = big.NewInt(49299973) // PARAM_SPEC
View Source
var FaultMaxAge = WPoStProvingPeriod * 42 // PARAM_SPEC

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

View Source
var InitialPledgeFactor = 20 // PARAM_SPEC

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

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

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

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

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

View Source
var InitialPledgeProjectionPeriod = abi.ChainEpoch(InitialPledgeFactor) * builtin.EpochsInDay
View Source
var MaxPreCommitRandomnessLookback = builtin.EpochsInDay + ChainFinality // PARAM_SPEC

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

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

View Source
var Methods = map[abi.MethodNum]builtin.MethodMeta{
	1:  {"Constructor", *new(func(*power.MinerConstructorParams) *abi.EmptyValue)},
	2:  {"ControlAddresses", *new(func(*abi.EmptyValue) *GetControlAddressesReturn)},
	3:  {"ChangeWorkerAddress", *new(func(*ChangeWorkerAddressParams) *abi.EmptyValue)},
	4:  {"ChangePeerID", *new(func(*ChangePeerIDParams) *abi.EmptyValue)},
	5:  {"SubmitWindowedPoSt", *new(func(*SubmitWindowedPoStParams) *abi.EmptyValue)},
	6:  {"PreCommitSector", *new(func(*PreCommitSectorParams) *abi.EmptyValue)},
	7:  {"ProveCommitSector", *new(func(*ProveCommitSectorParams) *abi.EmptyValue)},
	8:  {"ExtendSectorExpiration", *new(func(*ExtendSectorExpirationParams) *abi.EmptyValue)},
	9:  {"TerminateSectors", *new(func(*TerminateSectorsParams) *TerminateSectorsReturn)},
	10: {"DeclareFaults", *new(func(*DeclareFaultsParams) *abi.EmptyValue)},
	11: {"DeclareFaultsRecovered", *new(func(*DeclareFaultsRecoveredParams) *abi.EmptyValue)},
	12: {"OnDeferredCronEvent", *new(func(*DeferredCronEventParams) *abi.EmptyValue)},
	13: {"CheckSectorProven", *new(func(*CheckSectorProvenParams) *abi.EmptyValue)},
	14: {"ApplyRewards", *new(func(*ApplyRewardParams) *abi.EmptyValue)},
	15: {"ReportConsensusFault", *new(func(*ReportConsensusFaultParams) *abi.EmptyValue)},
	16: {"WithdrawBalance", *new(func(*WithdrawBalanceParams) *abi.TokenAmount)},
	17: {"ConfirmSectorProofsValid", *new(func(*ConfirmSectorProofsParams) *abi.EmptyValue)},
	18: {"ChangeMultiaddrs", *new(func(*ChangeMultiaddrsParams) *abi.EmptyValue)},
	19: {"CompactPartitions", *new(func(*CompactPartitionsParams) *abi.EmptyValue)},
	20: {"CompactSectorNumbers", *new(func(*CompactSectorNumbersParams) *abi.EmptyValue)},
	21: {"ConfirmUpdateWorkerKey", *new(func(*abi.EmptyValue) *abi.EmptyValue)},
	22: {"RepayDebt", *new(func(*abi.EmptyValue) *abi.EmptyValue)},
	23: {"ChangeOwnerAddress", *new(func(*address.Address) *abi.EmptyValue)},
	24: {"DisputeWindowedPoSt", *new(func(*DisputeWindowedPoStParams) *abi.EmptyValue)},
	25: {"PreCommitSectorBatch", *new(func(*PreCommitSectorBatchParams) *abi.EmptyValue)},
	26: {"ProveCommitAggregate", *new(func(*ProveCommitAggregateParams) *abi.EmptyValue)},
	27: {"ProveReplicaUpdates", *new(func(*ProveReplicaUpdatesParams) *bitfield.BitField)},

	28: {"PreCommitSectorBatch2", *new(func(*PreCommitSectorBatchParams2) *abi.EmptyValue)},

	29: {"ProveReplicaUpdates2", *new(func(*ProveReplicaUpdatesParams2) *bitfield.BitField)},
	30: {"ChangeBeneficiary", *new(func(*ChangeBeneficiaryParams) *abi.EmptyValue)},
	31: {"GetBeneficiary", *new(func(*abi.EmptyValue) *GetBeneficiaryReturn)},

	32: {"ExtendSectorExpiration2", *new(func(*ExtendSectorExpiration2Params) *abi.EmptyValue)},
}
View Source
var PreCommitChallengeDelay = abi.ChainEpoch(150) // PARAM_SPEC

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

View Source
var PreCommitDepositFactor = 20 // PARAM_SPEC

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

View Source
var PreCommitDepositProjectionPeriod = abi.ChainEpoch(PreCommitDepositFactor) * builtin.EpochsInDay
View Source
var SealedCIDPrefix = cid.Prefix{
	Version:  1,
	Codec:    cid.FilCommitmentSealed,
	MhType:   mh.POSEIDON_BLS12_381_A1_FC1,
	MhLength: 32,
}

Prefix for sealed sector CIDs (CommR).

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

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

View Source
var WPoStDisputeWindow = 2 * ChainFinality // PARAM_SPEC

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

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

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

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

Functions

func AggregatePreCommitNetworkFee

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

func AggregateProveCommitNetworkFee

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

func CheckEarlyTerminationQueue added in v0.9.3

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

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

func CheckMinerBalances added in v0.9.3

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

func CheckMinerInfo added in v0.9.3

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

func CheckPreCommits added in v0.9.3

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

func ExpectedRewardForPower

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

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

func ExpectedRewardForPowerClampedAtAttoFIL

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

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

func FindSector

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

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

func InitialPledgeForPower

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

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

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

func NewDeadlineInfo

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

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

func PreCommitDepositForPower

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

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

func QAPowerForSector added in v0.9.3

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

The quality-adjusted power for a sector.

func QAPowerForWeight

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

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

func QAPowerMax

func QAPowerMax(size abi.SectorSize) abi.StoragePower

Returns maximum achievable QA power.

func QualityForWeight

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

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

func QuantSpecForDeadline

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

func SectorKey

func SectorKey(e abi.SectorNumber) abi.Keyer

Types

type ActiveBeneficiary

type ActiveBeneficiary struct {
	Beneficiary addr.Address
	Term        BeneficiaryTerm
}

func (*ActiveBeneficiary) MarshalCBOR

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

func (*ActiveBeneficiary) UnmarshalCBOR

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

type ApplyRewardParams

type ApplyRewardParams struct {
	Reward  abi.TokenAmount
	Penalty abi.TokenAmount
}

func (*ApplyRewardParams) MarshalCBOR

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

func (*ApplyRewardParams) UnmarshalCBOR

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

type BeneficiaryTerm

type BeneficiaryTerm struct {
	Quota      abi.TokenAmount
	UsedQuota  abi.TokenAmount
	Expiration abi.ChainEpoch
}

func (*BeneficiaryTerm) MarshalCBOR

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

func (*BeneficiaryTerm) UnmarshalCBOR

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

type ChangeBeneficiaryParams

type ChangeBeneficiaryParams struct {
	NewBeneficiary addr.Address
	NewQuota       abi.TokenAmount
	NewExpiration  abi.ChainEpoch
}

func (*ChangeBeneficiaryParams) MarshalCBOR

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

func (*ChangeBeneficiaryParams) UnmarshalCBOR

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

type ChangeMultiaddrsParams

type ChangeMultiaddrsParams struct {
	NewMultiaddrs []abi.Multiaddrs
}

func (*ChangeMultiaddrsParams) MarshalCBOR

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

func (*ChangeMultiaddrsParams) UnmarshalCBOR

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

type ChangePeerIDParams

type ChangePeerIDParams struct {
	NewID abi.PeerID
}

func (*ChangePeerIDParams) MarshalCBOR

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

func (*ChangePeerIDParams) UnmarshalCBOR

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

type ChangeWorkerAddressParams

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

func (*ChangeWorkerAddressParams) MarshalCBOR

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

func (*ChangeWorkerAddressParams) UnmarshalCBOR

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

type CheckSectorProvenParams

type CheckSectorProvenParams struct {
	SectorNumber abi.SectorNumber
}

func (*CheckSectorProvenParams) MarshalCBOR

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

func (*CheckSectorProvenParams) UnmarshalCBOR

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

type CompactPartitionsParams

type CompactPartitionsParams struct {
	Deadline   uint64
	Partitions bitfield.BitField
}

func (*CompactPartitionsParams) MarshalCBOR

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

func (*CompactPartitionsParams) UnmarshalCBOR

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

type CompactSectorNumbersParams

type CompactSectorNumbersParams struct {
	MaskSectorNumbers bitfield.BitField
}

func (*CompactSectorNumbersParams) MarshalCBOR

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

func (*CompactSectorNumbersParams) UnmarshalCBOR

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

type ConfirmSectorProofsParams

type ConfirmSectorProofsParams struct {
	Sectors                 []abi.SectorNumber
	RewardSmoothed          smoothing.FilterEstimate
	RewardBaselinePower     abi.StoragePower
	QualityAdjPowerSmoothed smoothing.FilterEstimate
}

func (*ConfirmSectorProofsParams) MarshalCBOR

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

func (*ConfirmSectorProofsParams) UnmarshalCBOR

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

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

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

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

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

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

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

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

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

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

	// Snapshot of the miner's sectors AMT at the end of the previous challenge
	// window for this deadline.
	SectorsSnapshot cid.Cid // Array, AMT[SectorNumber]SectorOnChainInfo (sparse)

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

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

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

func ConstructDeadline added in v0.9.0

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

func (*Deadline) LoadPartition

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

func (*Deadline) MarshalCBOR

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

func (*Deadline) OptimisticProofsSnapshotArray

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

func (*Deadline) PartitionsArray

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

func (*Deadline) PartitionsSnapshotArray added in v0.9.3

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

func (*Deadline) UnmarshalCBOR

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

func (*Deadline) ValidateState

func (d *Deadline) ValidateState() error

type DeadlineStateSummary added in v0.9.3

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

func CheckDeadlineStateInvariants added in v0.9.3

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

type Deadlines

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

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

func ConstructDeadlines added in v0.9.0

func ConstructDeadlines(emptyDeadlineCid cid.Cid) *Deadlines

func (*Deadlines) ForEach

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

func (*Deadlines) LoadDeadline

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

func (*Deadlines) MarshalCBOR

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

func (*Deadlines) UnmarshalCBOR

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

func (*Deadlines) UpdateDeadline

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

type DealSummary added in v0.9.3

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

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 DeferredCronEventParams

type DeferredCronEventParams struct {
	EventPayload            []byte
	RewardSmoothed          smoothing.FilterEstimate
	QualityAdjPowerSmoothed smoothing.FilterEstimate
}

func (*DeferredCronEventParams) MarshalCBOR

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

func (*DeferredCronEventParams) UnmarshalCBOR

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

type DisputeWindowedPoStParams

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

func (*DisputeWindowedPoStParams) MarshalCBOR

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

func (*DisputeWindowedPoStParams) UnmarshalCBOR

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

type ExpirationExtension

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

func (*ExpirationExtension) MarshalCBOR

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

func (*ExpirationExtension) UnmarshalCBOR

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

type ExpirationExtension2

type ExpirationExtension2 struct {
	Deadline          uint64
	Partition         uint64
	Sectors           bitfield.BitField
	SectorsWithClaims []SectorClaim
	NewExpiration     abi.ChainEpoch
}

func (*ExpirationExtension2) MarshalCBOR

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

func (*ExpirationExtension2) UnmarshalCBOR

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

type ExpirationQueue

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

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

func LoadExpirationQueue

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

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

type ExpirationQueueStateSummary added in v0.9.3

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

func CheckExpirationQueue added in v0.9.3

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

Checks the expiration queue for consistency.

type ExpirationSet

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

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

func (*ExpirationSet) MarshalCBOR

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

func (*ExpirationSet) UnmarshalCBOR

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

type ExtendSectorExpiration2Params

type ExtendSectorExpiration2Params struct {
	Extensions []ExpirationExtension2
}

func (*ExtendSectorExpiration2Params) MarshalCBOR

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

func (*ExtendSectorExpiration2Params) UnmarshalCBOR

func (t *ExtendSectorExpiration2Params) 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 GetBeneficiaryReturn

type GetBeneficiaryReturn struct {
	Active   ActiveBeneficiary
	Proposed *PendingBeneficiaryChange
}

func (*GetBeneficiaryReturn) MarshalCBOR

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

func (*GetBeneficiaryReturn) UnmarshalCBOR

func (t *GetBeneficiaryReturn) 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 MinerConstructorParams

type MinerConstructorParams = power.MinerConstructorParams

type MinerInfo

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

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

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

	PendingWorkerKey *WorkerKeyChange

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

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

	// The proof type used for Window PoSt for this miner.
	// A miner may commit sectors with different seal proof types (but compatible sector size and
	// corresponding PoSt proof types).
	WindowPoStProofType abi.RegisteredPoStProof

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

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

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

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

	// Beneficiary address for this miner.
	// This is the address that tokens will be withdrawn to
	Beneficiary addr.Address

	// Beneficiary's withdrawal quota, how much of the quota has been withdrawn,
	// and when the Beneficiary expires.
	BeneficiaryTerm BeneficiaryTerm

	// A proposed change to `BenificiaryTerm`
	PendingBeneficiaryTerm *PendingBeneficiaryChange
}

func (*MinerInfo) MarshalCBOR

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

func (*MinerInfo) UnmarshalCBOR

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

type Partition

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

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

func (*Partition) ActivateUnproven

func (p *Partition) ActivateUnproven() PowerPair

Activates unproven sectors, returning the activated power.

func (*Partition) ActivePower added in v0.9.3

func (p *Partition) ActivePower() PowerPair

Active power is power of non-faulty sectors.

func (*Partition) ActiveSectors

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

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

func (*Partition) LiveSectors

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

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

func (*Partition) MarshalCBOR

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

func (*Partition) UnmarshalCBOR

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

type PartitionKey

type PartitionKey struct {
	Deadline  uint64
	Partition uint64
}

Identifier for a single partition within a miner.

type PartitionStateSummary added in v0.9.3

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

func CheckPartitionStateInvariants added in v0.9.3

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

type PendingBeneficiaryChange

type PendingBeneficiaryChange struct {
	NewBeneficiary        addr.Address
	NewQuota              abi.TokenAmount
	NewExpiration         abi.ChainEpoch
	ApprovedByBeneficiary bool
	ApprovedByNominee     bool
}

func (*PendingBeneficiaryChange) MarshalCBOR

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

func (*PendingBeneficiaryChange) UnmarshalCBOR

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

type PoStPartition

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

func (*PoStPartition) MarshalCBOR

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

func (*PoStPartition) UnmarshalCBOR

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

type PowerPair

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

Value type for a pair of raw and QA power.

func NewPowerPair

func NewPowerPair(raw, qa abi.StoragePower) PowerPair

func NewPowerPairZero

func NewPowerPairZero() PowerPair

func (PowerPair) Add

func (pp PowerPair) Add(other PowerPair) PowerPair

func (*PowerPair) Equals added in v0.9.3

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

func (PowerPair) IsZero added in v0.9.3

func (pp PowerPair) IsZero() bool

func (*PowerPair) MarshalCBOR

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

func (PowerPair) Sub

func (pp PowerPair) Sub(other PowerPair) PowerPair

func (*PowerPair) UnmarshalCBOR

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

type PreCommitSectorBatchParams

type PreCommitSectorBatchParams struct {
	Sectors []PreCommitSectorParams
}

func (*PreCommitSectorBatchParams) MarshalCBOR

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

func (*PreCommitSectorBatchParams) UnmarshalCBOR

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

type PreCommitSectorBatchParams2

type PreCommitSectorBatchParams2 struct {
	Sectors []SectorPreCommitInfo
}

func (*PreCommitSectorBatchParams2) MarshalCBOR

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

func (*PreCommitSectorBatchParams2) UnmarshalCBOR

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

type PreCommitSectorParams

type PreCommitSectorParams struct {
	SealProof       abi.RegisteredSealProof
	SectorNumber    abi.SectorNumber
	SealedCID       cid.Cid `checked:"true"` // CommR
	SealRandEpoch   abi.ChainEpoch
	DealIDs         []abi.DealID
	Expiration      abi.ChainEpoch
	ReplaceCapacity bool // DEPRECATED: Whether to replace a "committed capacity" no-deal sector (requires non-empty DealIDs)
	// DEPRECATED: The committed capacity sector to replace, and it's deadline/partition location
	ReplaceSectorDeadline  uint64
	ReplaceSectorPartition uint64
	ReplaceSectorNumber    abi.SectorNumber
}

func (*PreCommitSectorParams) MarshalCBOR

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

func (*PreCommitSectorParams) UnmarshalCBOR

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

type ProveCommitAggregateParams

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

func (*ProveCommitAggregateParams) MarshalCBOR

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

func (*ProveCommitAggregateParams) UnmarshalCBOR

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

type ProveCommitSectorParams

type ProveCommitSectorParams 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 ProveReplicaUpdatesParams

type ProveReplicaUpdatesParams struct {
	Updates []ReplicaUpdate
}

func (*ProveReplicaUpdatesParams) MarshalCBOR

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

func (*ProveReplicaUpdatesParams) UnmarshalCBOR

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

type ProveReplicaUpdatesParams2

type ProveReplicaUpdatesParams2 struct {
	Updates []ReplicaUpdate2
}

func (*ProveReplicaUpdatesParams2) MarshalCBOR

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

func (*ProveReplicaUpdatesParams2) UnmarshalCBOR

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

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 ReplicaUpdate

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

func (*ReplicaUpdate) MarshalCBOR

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

func (*ReplicaUpdate) UnmarshalCBOR

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

type ReplicaUpdate2

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

func (*ReplicaUpdate2) MarshalCBOR

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

func (*ReplicaUpdate2) UnmarshalCBOR

func (t *ReplicaUpdate2) 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 SectorClaim

type SectorClaim struct {
	SectorNumber   abi.SectorNumber
	MaintainClaims []verifreg.ClaimId
	DropClaims     []verifreg.ClaimId
}

func (*SectorClaim) MarshalCBOR

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

func (*SectorClaim) UnmarshalCBOR

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

type SectorOnChainInfo

type SectorOnChainInfo struct {
	SectorNumber          abi.SectorNumber
	SealProof             abi.RegisteredSealProof // The seal proof type implies the PoSt proof/s
	SealedCID             cid.Cid                 // CommR
	DealIDs               []abi.DealID
	Activation            abi.ChainEpoch  // Epoch during which the sector proof was accepted
	Expiration            abi.ChainEpoch  // Epoch during which the sector expires
	DealWeight            abi.DealWeight  // Integral of active deals over sector lifetime
	VerifiedDealWeight    abi.DealWeight  // Integral of active verified deals over sector lifetime
	InitialPledge         abi.TokenAmount // Pledge collected to commit this sector
	ExpectedDayReward     abi.TokenAmount // Expected one day projection of reward for sector computed at activation time
	ExpectedStoragePledge abi.TokenAmount // Expected twenty day projection of reward for sector computed at activation time
	ReplacedSectorAge     abi.ChainEpoch  // Age of sector this sector replaced or zero
	ReplacedDayReward     abi.TokenAmount // Day reward of sector this sector replace or zero
	SectorKeyCID          *cid.Cid        // The original SealedSectorCID, only gets set on the first ReplicaUpdate
	SimpleQAPower         bool            // Flag for QA power mechanism introduced in FIP-0045
}

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
	UnsealedCid   *cid.Cid
}

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
}

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

func (*SectorPreCommitOnChainInfo) MarshalCBOR

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

func (*SectorPreCommitOnChainInfo) UnmarshalCBOR

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

type Sectors

type Sectors struct {
	*adt.Array
}

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

func LoadSectors

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

func (Sectors) Get

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

func (Sectors) Load

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

type State

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

	PreCommitDeposits abi.TokenAmount // Total funds locked as PreCommitDeposits
	LockedFunds       abi.TokenAmount // Total rewards and added funds locked in vesting table

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

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

	InitialPledge abi.TokenAmount // Sum of initial pledge requirements of all active sectors

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

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

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

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

	// DEPRECATED. This field will change names and no longer be updated every proving period in a future upgrade
	// The first epoch in this miner's current proving period. This is the first epoch in which a PoSt for a
	// partition at the miner's first deadline may arrive. Alternatively, it is after the last epoch at which
	// a PoSt for the previous window is valid.
	// Always greater than zero, this may be greater than the current epoch for genesis miners in the first
	// WPoStProvingPeriod epochs of the chain; the epochs before the first proving period starts are exempt from Window
	// PoSt requirements.
	// Updated at the end of every period by a cron callback.
	ProvingPeriodStart abi.ChainEpoch

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

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

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

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

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

func (*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) ContinueDeadlineCron added in v0.9.3

func (st *State) ContinueDeadlineCron() bool

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

func (*State) FindSector

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

func (*State) GetAvailableBalance

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

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

func (*State) GetInfo

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

func (*State) GetPrecommittedSector

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

func (*State) GetSector

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

func (*State) GetUnlockedBalance

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

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

func (*State) LoadDeadlines

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

func (*State) LoadVestingFunds

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

LoadVestingFunds loads the vesting funds table from the store

func (*State) MarshalCBOR

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

func (*State) QuantSpecEveryDeadline added in v0.9.3

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

pre-commit clean up

func (*State) QuantSpecForDeadline

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

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

func (*State) RecordedDeadlineInfo

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

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

func (*State) SaveDeadlines

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

func (*State) UnmarshalCBOR

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

type StateSummary added in v0.9.3

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

func CheckStateInvariants added in v0.9.3

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

Checks internal invariants of init state.

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

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

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

func (*TerminateSectorsReturn) UnmarshalCBOR

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

type TerminationDeclaration

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

func (*TerminationDeclaration) MarshalCBOR

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

func (*TerminationDeclaration) UnmarshalCBOR

func (t *TerminationDeclaration) 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 VestingFund

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

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

func (*VestingFund) MarshalCBOR

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

func (*VestingFund) UnmarshalCBOR

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

type VestingFunds

type VestingFunds struct {
	Funds []VestingFund
}

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

func ConstructVestingFunds

func ConstructVestingFunds() *VestingFunds

ConstructVestingFunds constructs empty VestingFunds state.

func (*VestingFunds) MarshalCBOR

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

func (*VestingFunds) UnmarshalCBOR

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

type WindowedPoSt

type WindowedPoSt struct {
	// Partitions proved by this WindowedPoSt.
	Partitions bitfield.BitField
	// Array of proofs, one per distinct registered proof type present in
	// the sectors being proven. In the usual case of a single proof type,
	// this array will always have a single element (independent of number
	// of partitions).
	Proofs []proof.PoStProof
}

func (*WindowedPoSt) MarshalCBOR

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

func (*WindowedPoSt) UnmarshalCBOR

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

type WithdrawBalanceParams

type WithdrawBalanceParams struct {
	AmountRequested abi.TokenAmount
}

func (*WithdrawBalanceParams) MarshalCBOR

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

func (*WithdrawBalanceParams) UnmarshalCBOR

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

type WorkerKeyChange

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

func (*WorkerKeyChange) MarshalCBOR

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

func (*WorkerKeyChange) UnmarshalCBOR

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

Jump to

Keyboard shortcuts

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