github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/builtin/network.go (about) 1 package builtin 2 3 import ( 4 "fmt" 5 6 "github.com/filecoin-project/go-state-types/big" 7 ) 8 9 // PARAM_SPEC 10 // The duration of a chain epoch. 11 // Motivation: It guarantees that a block is propagated and WinningPoSt can be successfully done in time all supported miners. 12 // Usage: It is used for deriving epoch-denominated periods that are more naturally expressed in clock time. 13 // TODO: In lieu of a real configuration mechanism for this value, we'd like to make it a var so that implementations 14 // can override it at runtime. Doing so requires changing all the static references to it in this repo to go through 15 // late-binding function calls, or they'll see the "wrong" value. 16 // https://github.com/filecoin-project/specs-actors/issues/353 17 // If EpochDurationSeconds is changed, update `BaselineExponent`, `lambda`, and // `expLamSubOne` in ./reward/reward_logic.go 18 // You can re-calculate these constants by changing the epoch duration in ./reward/reward_calc.py and running it. 19 const EpochDurationSeconds = 30 20 const SecondsInHour = 60 * 60 21 const SecondsInDay = 24 * SecondsInHour 22 const EpochsInHour = SecondsInHour / EpochDurationSeconds 23 const EpochsInDay = 24 * EpochsInHour 24 const EpochsInYear = 365 * EpochsInDay 25 26 // PARAM_SPEC 27 // Expected number of block quality in an epoch (e.g. 1 block with block quality 5, or 5 blocks with quality 1) 28 // Motivation: It ensures that there is enough on-chain throughput 29 // Usage: It is used to calculate the block reward. 30 var ExpectedLeadersPerEpoch = int64(5) 31 32 func init() { 33 //noinspection GoBoolExpressions 34 if SecondsInHour%EpochDurationSeconds != 0 { 35 // This even division is an assumption that other code might unwittingly make. 36 // Don't rely on it on purpose, though. 37 // While we're pretty sure everything will still work fine, we're safer maintaining this invariant anyway. 38 panic(fmt.Sprintf("epoch duration %d does not evenly divide one hour (%d)", EpochDurationSeconds, SecondsInHour)) 39 } 40 } 41 42 // Number of token units in an abstract "FIL" token. 43 // The network works purely in the indivisible token amounts. This constant converts to a fixed decimal with more 44 // human-friendly scale. 45 var TokenPrecision = big.NewIntUnsigned(1_000_000_000_000_000_000) 46 47 // The maximum supply of Filecoin that will ever exist (in token units) 48 var TotalFilecoin = big.Mul(big.NewIntUnsigned(2_000_000_000), TokenPrecision) 49 50 // Quality multiplier for committed capacity (no deals) in a sector 51 var QualityBaseMultiplier = big.NewInt(10) 52 53 // Quality multiplier for unverified deals in a sector 54 var DealWeightMultiplier = big.NewInt(10) 55 56 // Quality multiplier for verified deals in a sector 57 var VerifiedDealWeightMultiplier = big.NewInt(100) 58 59 // Precision used for making QA power calculations 60 const SectorQualityPrecision = 20