builtin

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0, MIT Imports: 15 Imported by: 136

Documentation

Index

Constants

View Source
const (
	MethodSend        = builtin0.MethodSend
	MethodConstructor = builtin0.MethodConstructor
)
View Source
const EpochDurationSeconds = 30

PARAM_SPEC The duration of a chain epoch. Motivation: It guarantees that a block is propagated and WinningPoSt can be successfully done in time all supported miners. Usage: It is used for deriving epoch-denominated periods that are more naturally expressed in clock time. TODO: In lieu of a real configuration mechanism for this value, we'd like to make it a var so that implementations can override it at runtime. Doing so requires changing all the static references to it in this repo to go through late-binding function calls, or they'll see the "wrong" value. https://github.com/filecoin-project/specs-actors/issues/353 If EpochDurationSeconds is changed, update `BaselineExponent`, `lambda`, and // `expLamSubOne` in ./reward/reward_logic.go You can re-calculate these constants by changing the epoch duration in ./reward/reward_calc.py and running it.

View Source
const EpochsInDay = 24 * EpochsInHour
View Source
const EpochsInFiveYears = stabi.ChainEpoch(5 * EpochsInYear)

For all Stacked DRG sectors, the max is 5 years

View Source
const EpochsInYear = 365 * EpochsInDay
View Source
const FirstNonSingletonActorId = 100
View Source
const SecondsInDay = 24 * SecondsInHour
View Source
const SecondsInHour = 60 * 60
View Source
const SectorQualityPrecision = 20

Precision used for making QA power calculations

Variables

View Source
var (
	SystemActorCodeID           cid.Cid
	InitActorCodeID             cid.Cid
	CronActorCodeID             cid.Cid
	AccountActorCodeID          cid.Cid
	StoragePowerActorCodeID     cid.Cid
	StorageMinerActorCodeID     cid.Cid
	StorageMarketActorCodeID    cid.Cid
	PaymentChannelActorCodeID   cid.Cid
	MultisigActorCodeID         cid.Cid
	RewardActorCodeID           cid.Cid
	VerifiedRegistryActorCodeID cid.Cid
	CallerTypesSignable         []cid.Cid
)

The built-in actor code IDs

View Source
var (
	// Distinguished AccountActor that is the source of system implicit messages.
	SystemActorAddr           = mustMakeAddress(0)
	InitActorAddr             = mustMakeAddress(1)
	RewardActorAddr           = mustMakeAddress(2)
	CronActorAddr             = mustMakeAddress(3)
	StoragePowerActorAddr     = mustMakeAddress(4)
	StorageMarketActorAddr    = mustMakeAddress(5)
	VerifiedRegistryActorAddr = mustMakeAddress(6)
	// Distinguished AccountActor that is the destination of all burnt funds.
	BurntFundsActorAddr = mustMakeAddress(99)
)

Addresses for singleton system actors.

View Source
var DealWeightMultiplier = big.NewInt(10)

Quality multiplier for unverified deals in a sector

View Source
var ExpectedLeadersPerEpoch = int64(5)

PARAM_SPEC Expected number of block quality in an epoch (e.g. 1 block with block quality 5, or 5 blocks with quality 1) Motivation: It ensures that there is enough on-chain throughput Usage: It is used to calculate the block reward.

View Source
var MethodsAccount = struct {
	Constructor   abi.MethodNum
	PubkeyAddress abi.MethodNum
}{MethodConstructor, 2}
View Source
var MethodsCron = struct {
	Constructor abi.MethodNum
	EpochTick   abi.MethodNum
}{MethodConstructor, 2}
View Source
var MethodsInit = struct {
	Constructor abi.MethodNum
	Exec        abi.MethodNum
}{MethodConstructor, 2}
View Source
var MethodsMarket = struct {
	Constructor              abi.MethodNum
	AddBalance               abi.MethodNum
	WithdrawBalance          abi.MethodNum
	PublishStorageDeals      abi.MethodNum
	VerifyDealsForActivation abi.MethodNum
	ActivateDeals            abi.MethodNum
	OnMinerSectorsTerminate  abi.MethodNum
	ComputeDataCommitment    abi.MethodNum
	CronTick                 abi.MethodNum
}{MethodConstructor, 2, 3, 4, 5, 6, 7, 8, 9}
View Source
var MethodsMiner = struct {
	Constructor              abi.MethodNum
	ControlAddresses         abi.MethodNum
	ChangeWorkerAddress      abi.MethodNum
	ChangePeerID             abi.MethodNum
	SubmitWindowedPoSt       abi.MethodNum
	PreCommitSector          abi.MethodNum
	ProveCommitSector        abi.MethodNum
	ExtendSectorExpiration   abi.MethodNum
	TerminateSectors         abi.MethodNum
	DeclareFaults            abi.MethodNum
	DeclareFaultsRecovered   abi.MethodNum
	OnDeferredCronEvent      abi.MethodNum
	CheckSectorProven        abi.MethodNum
	ApplyRewards             abi.MethodNum
	ReportConsensusFault     abi.MethodNum
	WithdrawBalance          abi.MethodNum
	ConfirmSectorProofsValid abi.MethodNum
	ChangeMultiaddrs         abi.MethodNum
	CompactPartitions        abi.MethodNum
	CompactSectorNumbers     abi.MethodNum
	ConfirmUpdateWorkerKey   abi.MethodNum
	RepayDebt                abi.MethodNum
	ChangeOwnerAddress       abi.MethodNum
}{MethodConstructor, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}
View Source
var MethodsMultisig = struct {
	Constructor                 abi.MethodNum
	Propose                     abi.MethodNum
	Approve                     abi.MethodNum
	Cancel                      abi.MethodNum
	AddSigner                   abi.MethodNum
	RemoveSigner                abi.MethodNum
	SwapSigner                  abi.MethodNum
	ChangeNumApprovalsThreshold abi.MethodNum
	LockBalance                 abi.MethodNum
}{MethodConstructor, 2, 3, 4, 5, 6, 7, 8, 9}
View Source
var MethodsPaych = struct {
	Constructor        abi.MethodNum
	UpdateChannelState abi.MethodNum
	Settle             abi.MethodNum
	Collect            abi.MethodNum
}{MethodConstructor, 2, 3, 4}
View Source
var MethodsPower = struct {
	Constructor              abi.MethodNum
	CreateMiner              abi.MethodNum
	UpdateClaimedPower       abi.MethodNum
	EnrollCronEvent          abi.MethodNum
	OnEpochTickEnd           abi.MethodNum
	UpdatePledgeTotal        abi.MethodNum
	Deprecated1              abi.MethodNum
	SubmitPoRepForBulkVerify abi.MethodNum
	CurrentTotalPower        abi.MethodNum
}{MethodConstructor, 2, 3, 4, 5, 6, 7, 8, 9}
View Source
var MethodsReward = struct {
	Constructor      abi.MethodNum
	AwardBlockReward abi.MethodNum
	ThisEpochReward  abi.MethodNum
	UpdateNetworkKPI abi.MethodNum
}{MethodConstructor, 2, 3, 4}
View Source
var MethodsVerifiedRegistry = struct {
	Constructor       abi.MethodNum
	AddVerifier       abi.MethodNum
	RemoveVerifier    abi.MethodNum
	AddVerifiedClient abi.MethodNum
	UseBytes          abi.MethodNum
	RestoreBytes      abi.MethodNum
}{MethodConstructor, 2, 3, 4, 5, 6}
View Source
var PoStProofPolicies = map[stabi.RegisteredPoStProof]*PoStProofPolicy{
	stabi.RegisteredPoStProof_StackedDrgWindow2KiBV1: {
		WindowPoStPartitionSectors: 2,
	},
	stabi.RegisteredPoStProof_StackedDrgWindow8MiBV1: {
		WindowPoStPartitionSectors: 2,
	},
	stabi.RegisteredPoStProof_StackedDrgWindow512MiBV1: {
		WindowPoStPartitionSectors: 2,
	},
	stabi.RegisteredPoStProof_StackedDrgWindow32GiBV1: {
		WindowPoStPartitionSectors: 2349,
	},
	stabi.RegisteredPoStProof_StackedDrgWindow64GiBV1: {
		WindowPoStPartitionSectors: 2300,
	},
}

Partition sizes must match those used by the proofs library. See https://github.com/filecoin-project/rust-fil-proofs/blob/master/filecoin-proofs/src/constants.rs#L85

View Source
var QualityBaseMultiplier = big.NewInt(10)

Quality multiplier for committed capacity (no deals) in a sector

View Source
var SealProofPolicies = map[stabi.RegisteredSealProof]*SealProofPolicy{
	stabi.RegisteredSealProof_StackedDrg2KiBV1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg8MiBV1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg512MiBV1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg32GiBV1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg64GiBV1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},

	stabi.RegisteredSealProof_StackedDrg2KiBV1_1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg8MiBV1_1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg512MiBV1_1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg32GiBV1_1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
	stabi.RegisteredSealProof_StackedDrg64GiBV1_1: {
		SectorMaxLifetime:      EpochsInFiveYears,
		ConsensusMinerMinPower: stabi.NewStoragePower(10 << 40),
	},
}
View Source
var TokenPrecision = big.NewIntUnsigned(1_000_000_000_000_000_000)

Number of token units in an abstract "FIL" token. The network works purely in the indivisible token amounts. This constant converts to a fixed decimal with more human-friendly scale.

View Source
var TotalFilecoin = big.Mul(big.NewIntUnsigned(2_000_000_000), TokenPrecision)

The maximum supply of Filecoin that will ever exist (in token units)

View Source
var VerifiedDealWeightMultiplier = big.NewInt(100)

Quality multiplier for verified deals in a sector

Functions

func ActorNameByCode

func ActorNameByCode(code cid.Cid) string

ActorNameByCode returns the (string) name of the actor given a cid code.

func ConsensusMinerMinPower

func ConsensusMinerMinPower(p stabi.RegisteredSealProof) (stabi.StoragePower, error)

The minimum power of an individual miner to meet the threshold for leader election (in bytes). Motivation: - Limits sybil generation - Improves consensus fault detection - Guarantees a minimum fee for consensus faults - Ensures that a specific soundness for the power table Note: We may be able to reduce this in the future, addressing consensus faults with more complicated penalties, sybil generation with crypto-economic mechanism, and PoSt soundness by increasing the challenges for small miners.

func IsBuiltinActor

func IsBuiltinActor(code cid.Cid) bool

IsBuiltinActor returns true if the code belongs to an actor defined in this repo.

func IsPrincipal

func IsPrincipal(code cid.Cid) bool

Tests whether a code CID represents an actor that can be an external principal: i.e. an account or multisig. We could do something more sophisticated here: https://github.com/filecoin-project/specs-actors/issues/178

func PoStProofWindowPoStPartitionSectors

func PoStProofWindowPoStPartitionSectors(p stabi.RegisteredPoStProof) (uint64, error)

Returns the partition size, in sectors, associated with a Window PoSt proof type. The partition size is the number of sectors proved in a single PoSt proof.

func RequestMinerControlAddrs

func RequestMinerControlAddrs(rt runtime.Runtime, minerAddr addr.Address) (ownerAddr addr.Address, workerAddr addr.Address, controlAddrs []addr.Address)

func RequireNoErr

func RequireNoErr(rt runtime.Runtime, err error, defaultExitCode exitcode.ExitCode, msg string, args ...interface{})

Aborts with a formatted message if err is not nil. The provided message will be suffixed by ": %s" and the provided args suffixed by the err.

func RequireParam

func RequireParam(rt runtime.Runtime, predicate bool, msg string, args ...interface{})

Aborts with an ErrIllegalArgument if predicate is not true.

func RequireSuccess

func RequireSuccess(rt runtime.Runtime, e exitcode.ExitCode, msg string, args ...interface{})

Propagates a failed send by aborting the current method with the same exit code.

func ResolveToIDAddr

func ResolveToIDAddr(rt runtime.Runtime, address addr.Address) (addr.Address, error)

ResolveToIDAddr resolves the given address to it's ID address form. If an ID address for the given address dosen't exist yet, it tries to create one by sending a zero balance to the given address.

func SealProofSectorMaximumLifetime

func SealProofSectorMaximumLifetime(p stabi.RegisteredSealProof) (stabi.ChainEpoch, error)

SectorMaximumLifetime is the maximum duration a sector sealed with this proof may exist between activation and expiration

func SealProofWindowPoStPartitionSectors

func SealProofWindowPoStPartitionSectors(p stabi.RegisteredSealProof) (uint64, error)

Returns the partition size, in sectors, associated with a seal proof type. The partition size is the number of sectors proved in a single PoSt proof.

Types

type ApplyRewardParams

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

Changed since v0: - Wrapping struct, added Penalty

func (*ApplyRewardParams) MarshalCBOR

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

func (*ApplyRewardParams) UnmarshalCBOR

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

type BigFrac

type BigFrac struct {
	Numerator   big.Int
	Denominator big.Int
}

type CBORBytes

type CBORBytes []byte

Wraps already-serialized bytes as CBOR-marshalable.

func (CBORBytes) MarshalCBOR

func (b CBORBytes) MarshalCBOR(w io.Writer) error

func (*CBORBytes) UnmarshalCBOR

func (b *CBORBytes) UnmarshalCBOR(r io.Reader) error

type ConfirmSectorProofsParams

type ConfirmSectorProofsParams = builtin0.ConfirmSectorProofsParams

Note: we could move this alias back to the mutually-importing packages that use it, now that they can instead both alias the v0 version.

type ConfirmSectorProofsParams struct {
	Sectors []abi.SectorNumber
}

type Discard

type Discard struct{}

Discard is a helper

func (*Discard) MarshalCBOR

func (d *Discard) MarshalCBOR(_ io.Writer) error

func (*Discard) UnmarshalCBOR

func (d *Discard) UnmarshalCBOR(_ io.Reader) error

type MessageAccumulator

type MessageAccumulator struct {
	// contains filtered or unexported fields
}

Accumulates a sequence of messages (e.g. validation failures).

func (*MessageAccumulator) Add

func (ma *MessageAccumulator) Add(msg string)

Adds messages to the accumulator.

func (*MessageAccumulator) AddAll

func (ma *MessageAccumulator) AddAll(other *MessageAccumulator)

Adds messages from another accumulator to this one.

func (*MessageAccumulator) Addf

func (ma *MessageAccumulator) Addf(format string, args ...interface{})

Adds a message to the accumulator

func (*MessageAccumulator) IsEmpty

func (ma *MessageAccumulator) IsEmpty() bool

func (*MessageAccumulator) Messages

func (ma *MessageAccumulator) Messages() []string

func (*MessageAccumulator) Require

func (ma *MessageAccumulator) Require(predicate bool, msg string, args ...interface{})

Adds a message if predicate is false.

func (*MessageAccumulator) RequireNoError added in v2.2.0

func (ma *MessageAccumulator) RequireNoError(err error, msg string, args ...interface{})

func (*MessageAccumulator) WithPrefix

func (ma *MessageAccumulator) WithPrefix(format string, args ...interface{}) *MessageAccumulator

Returns a new accumulator backed by the same collection, that will prefix each new message with a formatted string.

type MinerAddrs

type MinerAddrs struct {
	Owner        addr.Address
	Worker       addr.Address
	ControlAddrs []addr.Address
}

This type duplicates the Miner.ControlAddresses return type, to work around a circular dependency between actors.

func (*MinerAddrs) MarshalCBOR

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

func (*MinerAddrs) UnmarshalCBOR

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

type PoStProofPolicy added in v2.3.0

type PoStProofPolicy struct {
	WindowPoStPartitionSectors uint64
}

Policy values associated with a PoSt proof type.

type SealProofPolicy

type SealProofPolicy struct {
	SectorMaxLifetime      stabi.ChainEpoch
	ConsensusMinerMinPower stabi.StoragePower
}

Policy values associated with a seal proof type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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