power

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0, MIT Imports: 18 Imported by: 30

Documentation

Index

Constants

View Source
const ConsensusMinerMinMiners = 3

Minimum number of registered miners for the minimum miner size limit to effectively limit consensus power.

View Source
const SectorQualityPrecision = 20

Variables

View Source
var BaseMultiplier = big.NewInt(10) // PARAM_FINISH
View Source
var ConsensusMinerMinPower = abi.NewStoragePower(1 << 40) // PARAM_FINISH

Minimum power of an individual miner to meet the threshold for leader election.

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

Functions

func InitialPledgeForWeight

func InitialPledgeForWeight(qapower abi.StoragePower, totqapower abi.StoragePower, circSupply abi.TokenAmount, totalPledge abi.TokenAmount, perEpochReward abi.TokenAmount) abi.TokenAmount

func QAPowerForWeight

func QAPowerForWeight(weight *SectorStorageWeightDesc) abi.StoragePower

func SectorQualityFromWeight

func SectorQualityFromWeight(weight *SectorStorageWeightDesc) 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/BaseMultiplier. Sectors full of Deals will have a SectorQuality of DealWeightMultiplier/BaseMultiplier. Sectors with neither will have a SectorQuality of BaseMultiplier/BaseMultiplier. SectorQuality of a sector is a weighted average of multipliers based on their propotions.

Types

type Actor

type Actor struct{}

func (Actor) Constructor

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

func (Actor) CreateMiner

func (a Actor) CreateMiner(rt Runtime, params *CreateMinerParams) *CreateMinerReturn

func (Actor) DeleteMiner

func (a Actor) DeleteMiner(rt Runtime, params *DeleteMinerParams) *adt.EmptyValue

func (Actor) EnrollCronEvent

func (a Actor) EnrollCronEvent(rt Runtime, params *EnrollCronEventParams) *adt.EmptyValue

func (Actor) Exports

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

func (Actor) OnConsensusFault

func (a Actor) OnConsensusFault(rt Runtime, pledgeAmount *abi.TokenAmount) *adt.EmptyValue

func (Actor) OnEpochTickEnd

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

Called by Cron.

func (Actor) OnFaultBegin

func (a Actor) OnFaultBegin(rt Runtime, params *OnFaultBeginParams) *adt.EmptyValue

func (Actor) OnFaultEnd

func (a Actor) OnFaultEnd(rt Runtime, params *OnFaultEndParams) *adt.EmptyValue

func (Actor) OnSectorModifyWeightDesc

func (a Actor) OnSectorModifyWeightDesc(rt Runtime, params *OnSectorModifyWeightDescParams) *abi.TokenAmount

Returns new initial pledge, now committed in place of the old.

func (Actor) OnSectorProveCommit

func (a Actor) OnSectorProveCommit(rt Runtime, params *OnSectorProveCommitParams) *abi.TokenAmount

Returns the initial pledge collateral requirement.

func (Actor) OnSectorTerminate

func (a Actor) OnSectorTerminate(rt Runtime, params *OnSectorTerminateParams) *adt.EmptyValue

func (Actor) SubmitPoRepForBulkVerify added in v0.5.4

func (a Actor) SubmitPoRepForBulkVerify(rt Runtime, sealInfo *abi.SealVerifyInfo) *adt.EmptyValue

func (Actor) UpdatePledgeTotal

func (a Actor) UpdatePledgeTotal(rt Runtime, pledgeDelta *abi.TokenAmount) *adt.EmptyValue

type AddrKey

type AddrKey = adt.AddrKey

type Claim

type Claim struct {
	// Sum of raw byte power for a miner's sectors.
	RawBytePower abi.StoragePower

	// Sum of quality adjusted power for a miner's sectors.
	QualityAdjPower abi.StoragePower
}

func (*Claim) MarshalCBOR

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

func (*Claim) UnmarshalCBOR

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

type CreateMinerParams

type CreateMinerParams struct {
	Owner         addr.Address
	Worker        addr.Address
	SealProofType abi.RegisteredSealProof
	Peer          abi.PeerID
	Multiaddrs    []abi.Multiaddrs
}

func (*CreateMinerParams) MarshalCBOR

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

func (*CreateMinerParams) UnmarshalCBOR

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

type CreateMinerReturn

type CreateMinerReturn struct {
	IDAddress     addr.Address // The canonical ID-based address for the actor.
	RobustAddress addr.Address // A more expensive but re-org-safe address for the newly created actor.
}

func (*CreateMinerReturn) MarshalCBOR

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

func (*CreateMinerReturn) UnmarshalCBOR

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

type CronEvent

type CronEvent struct {
	MinerAddr       addr.Address
	CallbackPayload []byte
}

func (*CronEvent) MarshalCBOR

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

func (*CronEvent) UnmarshalCBOR

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

type DeleteMinerParams

type DeleteMinerParams struct {
	Miner addr.Address
}

func (*DeleteMinerParams) MarshalCBOR

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

func (*DeleteMinerParams) UnmarshalCBOR

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

type EnrollCronEventParams

type EnrollCronEventParams struct {
	EventEpoch abi.ChainEpoch
	Payload    []byte
}

func (*EnrollCronEventParams) MarshalCBOR

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

func (*EnrollCronEventParams) UnmarshalCBOR

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

type MinerConstructorParams

type MinerConstructorParams struct {
	OwnerAddr     addr.Address
	WorkerAddr    addr.Address
	SealProofType abi.RegisteredSealProof
	PeerId        abi.PeerID
	Multiaddrs    []abi.Multiaddrs
}

Storage miner actor constructor params are defined here so the power actor can send them to the init actor to instantiate miners.

func (*MinerConstructorParams) MarshalCBOR

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

func (*MinerConstructorParams) UnmarshalCBOR

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

type OnFaultBeginParams

type OnFaultBeginParams struct {
	Weights []SectorStorageWeightDesc // TODO: replace with power if it can be computed by miner, https://github.com/filecoin-project/specs-actors/issues/466
}

func (*OnFaultBeginParams) MarshalCBOR

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

func (*OnFaultBeginParams) UnmarshalCBOR

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

type OnFaultEndParams

type OnFaultEndParams struct {
	Weights []SectorStorageWeightDesc // TODO: replace with power if it can be computed by miner, https://github.com/filecoin-project/specs-actors/issues/466
}

func (*OnFaultEndParams) MarshalCBOR

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

func (*OnFaultEndParams) UnmarshalCBOR

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

type OnSectorModifyWeightDescParams

type OnSectorModifyWeightDescParams struct {
	PrevWeight SectorStorageWeightDesc // TODO: replace with power if it can be computed by miner, https://github.com/filecoin-project/specs-actors/issues/466
	NewWeight  SectorStorageWeightDesc
}

func (*OnSectorModifyWeightDescParams) MarshalCBOR

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

func (*OnSectorModifyWeightDescParams) UnmarshalCBOR

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

type OnSectorProveCommitParams

type OnSectorProveCommitParams struct {
	Weight SectorStorageWeightDesc
}

func (*OnSectorProveCommitParams) MarshalCBOR

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

func (*OnSectorProveCommitParams) UnmarshalCBOR

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

type OnSectorTerminateParams

type OnSectorTerminateParams struct {
	TerminationType SectorTermination
	Weights         []SectorStorageWeightDesc // TODO: replace with power if it can be computed by miner, https://github.com/filecoin-project/specs-actors/issues/419
}

func (*OnSectorTerminateParams) MarshalCBOR

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

func (*OnSectorTerminateParams) UnmarshalCBOR

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

type Runtime

type Runtime = vmr.Runtime

type SectorStorageWeightDesc

type SectorStorageWeightDesc struct {
	SectorSize         abi.SectorSize
	Duration           abi.ChainEpoch
	DealWeight         abi.DealWeight
	VerifiedDealWeight abi.DealWeight
}

func (*SectorStorageWeightDesc) MarshalCBOR

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

func (*SectorStorageWeightDesc) UnmarshalCBOR

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

type SectorTermination

type SectorTermination int64
const (
	SectorTerminationExpired SectorTermination = iota // Implicit termination after all deals expire
	SectorTerminationManual                           // Unscheduled explicit termination by the miner
	SectorTerminationFaulty                           // Implicit termination due to unrecovered fault
)

type State

type State struct {
	TotalRawBytePower     abi.StoragePower
	TotalQualityAdjPower  abi.StoragePower
	TotalPledgeCollateral abi.TokenAmount
	MinerCount            int64

	// A queue of events to be triggered by cron, indexed by epoch.
	CronEventQueue cid.Cid // Multimap, (HAMT[ChainEpoch]AMT[CronEvent]

	// Last chain epoch OnEpochTickEnd was called on
	LastEpochTick abi.ChainEpoch

	// Claimed power for each miner.
	Claims cid.Cid // Map, HAMT[address]Claim

	// Number of miners having proven the minimum consensus power.
	NumMinersMeetingMinPower int64

	ProofValidationBatch *cid.Cid
}

func ConstructState

func ConstructState(emptyMapCid, emptyMMapCid cid.Cid) *State

func (*State) AddToClaim

func (st *State) AddToClaim(s adt.Store, miner addr.Address, power abi.StoragePower, qapower abi.StoragePower) error

Parameters may be negative to subtract.

func (*State) MarshalCBOR

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

func (*State) UnmarshalCBOR

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

Jump to

Keyboard shortcuts

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