power

package
v0.15.0-dev Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0, MIT Imports: 14 Imported by: 9

Documentation

Index

Constants

View Source
const ConsensusMinerMinMiners = 4 // PARAM_SPEC

The number of miners that must meet the consensus minimum miner power before that minimum power is enforced as a condition of leader election. This ensures a network still functions before any miners reach that threshold.

View Source
const CronQueueAmtBitwidth = 6

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

View Source
const CronQueueHamtBitwidth = 6

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

View Source
const MaxMinerProveCommitsPerEpoch = 200 // PARAM_SPEC

PARAM_SPEC// Maximum number of prove-commits each miner can submit in one epoch.

This limits the number of proof partitions we may need to load in the cron call path. Onboarding 1EiB/year requires at least 32 prove-commits per epoch.

View Source
const ProofValidationBatchAmtBitwidth = 4

Bitwidth of ProofValidationBatch AMT determined empirically from mutation pattersn and projections of mainnet data.

Variables

View Source
var InitialQAPowerEstimatePosition = big.Mul(big.NewInt(750_000), big.NewInt(1<<30))

genesis power in bytes = 750,000 GiB

View Source
var InitialQAPowerEstimateVelocity = big.Mul(big.NewInt(3_840), big.NewInt(1<<30))

max chain throughput in bytes per epoch = 120 ProveCommits / epoch = 3,840 GiB

View Source
var Methods = map[abi.MethodNum]builtin.MethodMeta{
	1: builtin.NewMethodMeta("Constructor", *new(func(*abi.EmptyValue) *abi.EmptyValue)),
	2: builtin.NewMethodMeta("CreateMiner", *new(func(*CreateMinerParams) *CreateMinerReturn)),
	builtin.MustGenerateFRCMethodNum("CreateMiner"): builtin.NewMethodMeta("CreateMinerExported", *new(func(*CreateMinerParams) *CreateMinerReturn)),
	3: builtin.NewMethodMeta("UpdateClaimedPower", *new(func(*UpdateClaimedPowerParams) *abi.EmptyValue)),
	4: builtin.NewMethodMeta("EnrollCronEvent", *new(func(*EnrollCronEventParams) *abi.EmptyValue)),
	5: builtin.NewMethodMeta("CronTick", *new(func(*abi.EmptyValue) *abi.EmptyValue)),
	6: builtin.NewMethodMeta("UpdatePledgeTotal", *new(func(*abi.TokenAmount) *abi.EmptyValue)),
	7: builtin.NewMethodMeta("OnConsensusFault", nil),
	8: builtin.NewMethodMeta("SubmitPoRepForBulkVerify", *new(func(*proof.SealVerifyInfo) *abi.EmptyValue)),
	9: builtin.NewMethodMeta("CurrentTotalPower", *new(func(*abi.EmptyValue) *CurrentTotalPowerReturn)),
	builtin.MustGenerateFRCMethodNum("NetworkRawPower"):     builtin.NewMethodMeta("NetworkRawPowerExported", *new(func(*abi.EmptyValue) *NetworkRawPowerReturn)),
	builtin.MustGenerateFRCMethodNum("MinerRawPower"):       builtin.NewMethodMeta("MinerRawPowerExported", *new(func(*MinerRawPowerParams) *MinerRawPowerReturn)),
	builtin.MustGenerateFRCMethodNum("MinerCount"):          builtin.NewMethodMeta("MinerCountExported", *new(func(*abi.EmptyValue) *MinerCountReturn)),
	builtin.MustGenerateFRCMethodNum("MinerConsensusCount"): builtin.NewMethodMeta("MinerConsensusCountExported", *new(func(*abi.EmptyValue) *MinerConsensusCountReturn)),
}

Functions

This section is empty.

Types

type Claim

type Claim struct {
	// Miner's proof type used to determine minimum miner size
	WindowPoStProofType abi.RegisteredPoStProof

	// 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) (err error)

type ClaimsByAddress

type ClaimsByAddress map[address.Address]Claim

func CheckClaimInvariants

func CheckClaimInvariants(st *State, store adt.Store, acc *builtin.MessageAccumulator) ClaimsByAddress

type CreateMinerParams

type CreateMinerParams struct {
	Owner               addr.Address
	Worker              addr.Address
	WindowPoStProofType abi.RegisteredPoStProof
	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) (err 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) (err 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) (err error)

type CronEventsByAddress

type CronEventsByAddress map[address.Address][]MinerCronEvent

func CheckCronInvariants

func CheckCronInvariants(st *State, store adt.Store, acc *builtin.MessageAccumulator) CronEventsByAddress

type CurrentTotalPowerReturn

type CurrentTotalPowerReturn struct {
	RawBytePower            abi.StoragePower
	QualityAdjPower         abi.StoragePower
	PledgeCollateral        abi.TokenAmount
	QualityAdjPowerSmoothed smoothing.FilterEstimate
}

func (*CurrentTotalPowerReturn) MarshalCBOR

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

func (*CurrentTotalPowerReturn) UnmarshalCBOR

func (t *CurrentTotalPowerReturn) UnmarshalCBOR(r io.Reader) (err 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) (err error)

type MinerConsensusCountReturn

type MinerConsensusCountReturn = cbg.CborInt

type MinerConstructorParams

type MinerConstructorParams struct {
	OwnerAddr           addr.Address
	WorkerAddr          addr.Address
	ControlAddrs        []addr.Address
	WindowPoStProofType abi.RegisteredPoStProof
	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) (err error)

type MinerCountReturn

type MinerCountReturn = cbg.CborInt

type MinerCronEvent

type MinerCronEvent struct {
	Epoch   abi.ChainEpoch
	Payload []byte
}

type MinerRawPowerParams

type MinerRawPowerParams = cbg.CborInt // abi.ActorID

type MinerRawPowerReturn

type MinerRawPowerReturn struct {
	RawBytePower          abi.StoragePower
	MeetsConsensusMinimum bool
}

func (*MinerRawPowerReturn) MarshalCBOR

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

func (*MinerRawPowerReturn) UnmarshalCBOR

func (t *MinerRawPowerReturn) UnmarshalCBOR(r io.Reader) (err error)

type NetworkRawPowerReturn

type NetworkRawPowerReturn = abi.StoragePower

type ProofsByAddress

type ProofsByAddress map[address.Address][]proof.SealVerifyInfo

func CheckProofValidationInvariants

func CheckProofValidationInvariants(st *State, store adt.Store, claims ClaimsByAddress, acc *builtin.MessageAccumulator) ProofsByAddress

type State

type State struct {
	TotalRawBytePower abi.StoragePower
	// TotalBytesCommitted includes claims from miners below min power threshold
	TotalBytesCommitted  abi.StoragePower
	TotalQualityAdjPower abi.StoragePower
	// TotalQABytesCommitted includes claims from miners below min power threshold
	TotalQABytesCommitted abi.StoragePower
	TotalPledgeCollateral abi.TokenAmount

	// These fields are set once per epoch in the previous cron tick and used
	// for consistent values across a single epoch's state transition.
	ThisEpochRawBytePower     abi.StoragePower
	ThisEpochQualityAdjPower  abi.StoragePower
	ThisEpochPledgeCollateral abi.TokenAmount
	ThisEpochQAPowerSmoothed  smoothing.FilterEstimate

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

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

	// First epoch in which a cron task may be stored.
	// Cron will iterate every epoch between this and the current epoch inclusively to find tasks to execute.
	FirstCronEpoch abi.ChainEpoch

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

	ProofValidationBatch *cid.Cid // Multimap, (HAMT[Address]AMT[SealVerifyInfo])
}

func ConstructState

func ConstructState(store adt.Store) (*State, error)

func (*State) GetClaim

func (st *State) GetClaim(s adt.Store, a addr.Address) (*Claim, bool, error)

func (*State) MarshalCBOR

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

func (*State) MinerNominalPowerMeetsConsensusMinimum

func (st *State) MinerNominalPowerMeetsConsensusMinimum(s adt.Store, miner addr.Address) (bool, error)

MinerNominalPowerMeetsConsensusMinimum is used to validate Election PoSt winners outside the chain state. If the miner has over a threshold of power the miner meets the minimum. If the network is a below a threshold of miners and has power > zero the miner meets the minimum.

func (*State) UnmarshalCBOR

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

type StateSummary

type StateSummary struct {
	Crons  CronEventsByAddress
	Claims ClaimsByAddress
	Proofs ProofsByAddress
}

func CheckStateInvariants

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

Checks internal invariants of power state.

type UpdateClaimedPowerParams

type UpdateClaimedPowerParams struct {
	RawByteDelta         abi.StoragePower
	QualityAdjustedDelta abi.StoragePower
}

func (*UpdateClaimedPowerParams) MarshalCBOR

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

func (*UpdateClaimedPowerParams) UnmarshalCBOR

func (t *UpdateClaimedPowerParams) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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