@@ -21,7 +21,6 @@ pub struct Policy {
21
21
pub max_replica_update_proof_size : usize ,
22
22
23
23
/// The maximum number of sector pre-commitments in a single batch.
24
- /// 32 sectors per epoch would support a single miner onboarding 1EiB of 32GiB sectors in 1 year.
25
24
pub pre_commit_sector_batch_max_size : usize ,
26
25
/// The maximum number of sector replica updates in a single batch.
27
26
pub prove_replica_updates_max_size : usize ,
@@ -49,25 +48,19 @@ pub struct Policy {
49
48
pub sectors_max : usize ,
50
49
51
50
/// Maximum number of partitions that will be assigned to a deadline.
52
- /// For a minimum storage of upto 1Eib, we need 300 partitions per deadline.
53
- /// 48 * 32GiB * 2349 * 300 = 1.00808144 EiB
54
- /// So, to support upto 10Eib storage, we set this to 3000.
55
51
pub max_partitions_per_deadline : u64 ,
56
52
57
53
/// Maximum number of control addresses a miner may register.
58
54
pub max_control_addresses : usize ,
59
55
60
56
/// MaxPeerIDLength is the maximum length allowed for any on-chain peer ID.
61
- /// Most Peer IDs are expected to be less than 50 bytes.
62
57
pub max_peer_id_length : usize ,
63
58
64
59
/// MaxMultiaddrData is the maximum amount of data that can be stored in multiaddrs.
65
60
pub max_multiaddr_data : usize ,
66
61
67
62
/// The maximum number of partitions that may be required to be loaded in a single invocation.
68
63
/// This limits the number of simultaneous fault, recovery, or sector-extension declarations.
69
- /// With 48 deadlines (half-hour), 200 partitions per declaration permits loading a full EiB of 32GiB
70
- /// sectors with 1 message per epoch within a single half-hour deadline. A miner can of course submit more messages.
71
64
pub addressed_partitions_max : u64 ,
72
65
73
66
/// Maximum number of unique "declarations" in batch operations.
@@ -83,24 +76,15 @@ pub struct Policy {
83
76
pub pre_commit_challenge_delay : ChainEpoch ,
84
77
85
78
/// Lookback from the deadline's challenge window opening from which to sample chain randomness for the challenge seed.
86
-
87
- /// This lookback exists so that deadline windows can be non-overlapping (which make the programming simpler)
88
- /// but without making the miner wait for chain stability before being able to start on PoSt computation.
89
- /// The challenge is available this many epochs before the window is actually open to receiving a PoSt.
90
79
pub wpost_challenge_lookback : ChainEpoch ,
91
80
92
81
/// Minimum period before a deadline's challenge window opens that a fault must be declared for that deadline.
93
- /// This lookback must not be less than WPoStChallengeLookback lest a malicious miner be able to selectively declare
94
- /// faults after learning the challenge value.
95
82
pub fault_declaration_cutoff : ChainEpoch ,
96
83
97
84
/// The maximum age of a fault before the sector is terminated.
98
85
pub fault_max_age : ChainEpoch ,
99
86
100
87
/// Staging period for a miner worker key change.
101
- /// Finality is a harsh delay for a miner who has lost their worker key, as the miner will miss Window PoSts until
102
- /// it can be changed. It's the only safe value, though. We may implement a mitigation mechanism such as a second
103
- /// key or allowing the owner account to submit PoSts while a key change is pending.
104
88
pub worker_key_change_delay : ChainEpoch ,
105
89
106
90
/// Minimum number of epochs past the current epoch a sector may be set to expire.
@@ -112,8 +96,7 @@ pub struct Policy {
112
96
pub max_sector_expiration_extension : i64 ,
113
97
114
98
/// Ratio of sector size to maximum deals per sector.
115
- /// The maximum number of deals is the sector size divided by this number (2^27)
116
- /// which limits 32GiB sectors to 256 deals and 64GiB sectors to 512
99
+ /// The maximum number of deals is the sector size divided by this number.
117
100
pub deal_limit_denominator : u64 ,
118
101
119
102
/// Number of epochs after a consensus fault for which a miner is ineligible
@@ -123,8 +106,8 @@ pub struct Policy {
123
106
/// The maximum number of new sectors that may be staged by a miner during a single proving period.
124
107
pub new_sectors_per_period_max : usize ,
125
108
126
- /// Epochs after which chain state is final with overwhelming probability (hence the likelihood of two fork of this size is negligible)
127
- /// This is a conservative value that is chosen via simulations of all known attacks .
109
+ /// Epochs after which chain state is final with overwhelming probability
110
+ /// (hence the likelihood of two fork of this size is negligible) .
128
111
pub chain_finality : ChainEpoch ,
129
112
130
113
/// Allowed post proof types for new miners
@@ -235,133 +218,96 @@ pub mod policy_constants {
235
218
236
219
use crate :: builtin:: * ;
237
220
238
- /// Maximum amount of sectors that can be aggregated .
221
+ // See comments on Policy struct .
239
222
pub const MAX_AGGREGATED_SECTORS : u64 = 819 ;
240
- /// Minimum amount of sectors that can be aggregated.
223
+
241
224
pub const MIN_AGGREGATED_SECTORS : u64 = 4 ;
242
- /// Maximum total aggregated proof size.
225
+
243
226
pub const MAX_AGGREGATED_PROOF_SIZE : usize = 81960 ;
244
- /// Maximum total aggregated proof size.
227
+
245
228
pub const MAX_REPLICA_UPDATE_PROOF_SIZE : usize = 4096 ;
246
229
247
- /// The maximum number of sector pre-commitments in a single batch.
248
- /// 32 sectors per epoch would support a single miner onboarding 1EiB of 32GiB sectors in 1 year.
230
+ // 32 sectors per epoch would support a single miner onboarding 1EiB of 32GiB sectors in 1 year.
249
231
pub const PRE_COMMIT_SECTOR_BATCH_MAX_SIZE : usize = 256 ;
250
232
251
- /// The maximum number of sector replica updates in a single batch.
252
- /// Same as PRE_COMMIT_SECTOR_BATCH_MAX_SIZE for consistency
233
+ // Same as PRE_COMMIT_SECTOR_BATCH_MAX_SIZE for consistency.
253
234
pub const PROVE_REPLICA_UPDATES_MAX_SIZE : usize = PRE_COMMIT_SECTOR_BATCH_MAX_SIZE ;
254
235
255
- /// The delay between pre commit expiration and clean up from state. This enforces that expired pre-commits
256
- /// stay in state for a period of time creating a grace period during which a late-running aggregated prove-commit
257
- /// can still prove its non-expired precommits without resubmitting a message
258
236
pub const EXPIRED_PRE_COMMIT_CLEAN_UP_DELAY : i64 = 8 * EPOCHS_IN_HOUR ;
259
237
260
- /// The period over which all a miner's active sectors will be challenged.
261
238
pub const WPOST_PROVING_PERIOD : ChainEpoch = EPOCHS_IN_DAY ;
262
- /// The duration of a deadline's challenge window, the period before a deadline when the challenge is available.
263
- // Half an hour (=48 per day)
239
+
240
+ // Half an hour (=48 per day).
241
+ // This must be consistent with WPOST_PERIOD_DEADLINES.
264
242
pub const WPOST_CHALLENGE_WINDOW : ChainEpoch = 30 * 60 / EPOCH_DURATION_SECONDS ;
265
- /// The number of non-overlapping PoSt deadlines in each proving period.
243
+
244
+ // This must be consistent with WPOST_CHALLENGE_WINDOW.
266
245
pub const WPOST_PERIOD_DEADLINES : u64 = 48 ;
267
- /// The maximum distance back that a valid Window PoSt must commit to the current chain.
246
+
268
247
pub const WPOST_MAX_CHAIN_COMMIT_AGE : ChainEpoch = WPOST_CHALLENGE_WINDOW ;
269
- // WPoStDisputeWindow is the period after a challenge window ends during which
270
- // PoSts submitted during that period may be disputed.
248
+
271
249
pub const WPOST_DISPUTE_WINDOW : ChainEpoch = 2 * CHAIN_FINALITY ;
272
250
273
- /// The maximum number of sectors that a miner can have simultaneously active.
274
- /// This also bounds the number of faults that can be declared, etc.
275
251
pub const SECTORS_MAX : usize = 32 << 20 ;
276
252
277
- /// Maximum number of partitions that will be assigned to a deadline.
278
- /// For a minimum storage of upto 1Eib, we need 300 partitions per deadline.
279
- /// 48 * 32GiB * 2349 * 300 = 1.00808144 EiB
280
- /// So, to support upto 10Eib storage, we set this to 3000.
253
+ // For a minimum storage of upto 1Eib, we need 300 partitions per deadline.
254
+ // 48 * 32GiB * 2349 * 300 = 1.00808144 EiB
255
+ // So, to support upto 10Eib storage, we set this to 3000.
281
256
pub const MAX_PARTITIONS_PER_DEADLINE : u64 = 3000 ;
282
257
283
- /// Maximum number of control addresses a miner may register.
284
258
pub const MAX_CONTROL_ADDRESSES : usize = 10 ;
285
259
286
- /// MaxPeerIDLength is the maximum length allowed for any on-chain peer ID.
287
- /// Most Peer IDs are expected to be less than 50 bytes.
260
+ // Most Peer IDs are expected to be less than 50 bytes.
288
261
pub const MAX_PEER_ID_LENGTH : usize = 128 ;
289
262
290
- /// MaxMultiaddrData is the maximum amount of data that can be stored in multiaddrs.
291
263
pub const MAX_MULTIADDR_DATA : usize = 1024 ;
292
264
293
- /// The maximum number of partitions that may be required to be loaded in a single invocation.
294
- /// This limits the number of simultaneous fault, recovery, or sector-extension declarations.
295
- /// With 48 deadlines (half-hour), 200 partitions per declaration permits loading a full EiB of 32GiB
296
- /// sectors with 1 message per epoch within a single half-hour deadline. A miner can of course submit more messages.
265
+ // With 48 deadlines (half-hour), 300 partitions per declaration permits addressing a full EiB
266
+ // of partitions of 32GiB sectors with 1 message per epoch within a single half-hour deadline.
267
+ // A miner can of course submit more messages.
297
268
pub const ADDRESSED_PARTITIONS_MAX : u64 = MAX_PARTITIONS_PER_DEADLINE ;
298
269
299
- /// Maximum number of unique "declarations" in batch operations.
300
270
pub const DECLARATIONS_MAX : u64 = ADDRESSED_PARTITIONS_MAX ;
301
271
302
- /// The maximum number of sector infos that may be required to be loaded in a single invocation.
303
272
pub const ADDRESSED_SECTORS_MAX : u64 = 25_000 ;
304
273
305
274
pub const MAX_PRE_COMMIT_RANDOMNESS_LOOKBACK : ChainEpoch = EPOCHS_IN_DAY + CHAIN_FINALITY ;
306
275
307
- /// Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn
308
- /// used to ensure it is not predictable by miner.
309
276
#[ cfg( not( feature = "short-precommit" ) ) ]
310
277
pub const PRE_COMMIT_CHALLENGE_DELAY : ChainEpoch = 150 ;
311
278
#[ cfg( feature = "short-precommit" ) ]
312
279
pub const PRE_COMMIT_CHALLENGE_DELAY : ChainEpoch = 10 ;
313
280
314
- /// Lookback from the deadline's challenge window opening from which to sample chain randomness for the challenge seed.
315
-
316
- /// This lookback exists so that deadline windows can be non-overlapping (which make the programming simpler)
317
- /// but without making the miner wait for chain stability before being able to start on PoSt computation.
318
- /// The challenge is available this many epochs before the window is actually open to receiving a PoSt.
281
+ // This lookback exists so that deadline windows can be non-overlapping (which make the programming simpler)
282
+ // but without making the miner wait for chain stability before being able to start on PoSt computation.
283
+ // The challenge is available this many epochs before the window is actually open to receiving a PoSt.
319
284
pub const WPOST_CHALLENGE_LOOKBACK : ChainEpoch = 20 ;
320
285
321
- /// Minimum period before a deadline's challenge window opens that a fault must be declared for that deadline.
322
- /// This lookback must not be less than WPoStChallengeLookback lest a malicious miner be able to selectively declare
323
- /// faults after learning the challenge value.
286
+ // This lookback must not be less than WPoStChallengeLookback lest a malicious miner be able to selectively declare
287
+ // faults after learning the challenge value.
324
288
pub const FAULT_DECLARATION_CUTOFF : ChainEpoch = WPOST_CHALLENGE_LOOKBACK + 50 ;
325
289
326
- /// The maximum age of a fault before the sector is terminated.
327
290
pub const FAULT_MAX_AGE : ChainEpoch = WPOST_PROVING_PERIOD * 42 ;
328
291
329
- /// Staging period for a miner worker key change.
330
- /// Finality is a harsh delay for a miner who has lost their worker key, as the miner will miss Window PoSts until
331
- /// it can be changed. It's the only safe value, though. We may implement a mitigation mechanism such as a second
332
- /// key or allowing the owner account to submit PoSts while a key change is pending.
292
+ // Finality is a harsh delay for a miner who has lost their worker key, as the miner will miss Window PoSts until
293
+ // it can be changed. It's the only safe value, though. We may implement a mitigation mechanism such as a second
294
+ // key or allowing the owner account to submit PoSts while a key change is pending.
333
295
pub const WORKER_KEY_CHANGE_DELAY : ChainEpoch = CHAIN_FINALITY ;
334
296
335
- /// Minimum number of epochs past the current epoch a sector may be set to expire.
336
297
pub const MIN_SECTOR_EXPIRATION : i64 = 180 * EPOCHS_IN_DAY ;
337
298
338
- /// Maximum number of epochs past the current epoch a sector may be set to expire.
339
- /// The actual maximum extension will be the minimum of CurrEpoch + MaximumSectorExpirationExtension
340
- /// and sector.ActivationEpoch+sealProof.SectorMaximumLifetime()
341
299
pub const MAX_SECTOR_EXPIRATION_EXTENSION : i64 = 1278 * EPOCHS_IN_DAY ;
342
300
343
- /// Ratio of sector size to maximum deals per sector.
344
- /// The maximum number of deals is the sector size divided by this number (2^27)
345
- /// which limits 32GiB sectors to 256 deals and 64GiB sectors to 512
301
+ /// A value (2^27) limits 32GiB sectors to 256 deals and 64GiB sectors to 512.
346
302
pub const DEAL_LIMIT_DENOMINATOR : u64 = 134217728 ;
347
303
348
- /// Number of epochs after a consensus fault for which a miner is ineligible
349
- /// for permissioned actor methods and winning block elections.
350
304
pub const CONSENSUS_FAULT_INELIGIBILITY_DURATION : ChainEpoch = CHAIN_FINALITY ;
351
305
352
- /// The maximum number of new sectors that may be staged by a miner during a single proving period.
353
306
pub const NEW_SECTORS_PER_PERIOD_MAX : usize = 128 << 10 ;
354
307
355
- /// Epochs after which chain state is final with overwhelming probability (hence the likelihood of two fork of this size is negligible)
356
308
/// This is a conservative value that is chosen via simulations of all known attacks.
357
309
pub const CHAIN_FINALITY : ChainEpoch = 900 ;
358
310
359
- /// The number of total possible types (enum variants) of RegisteredPoStProof
360
- pub const REGISTERED_POST_PROOF_VARIANTS : usize = 15 ;
361
-
362
- /// The number of total possible types (enum variants) of RegisteredSealProof
363
- pub const REGISTERED_SEAL_PROOF_VARIANTS : usize = 10 ;
364
-
365
311
#[ cfg( not( feature = "small-deals" ) ) ]
366
312
pub const MINIMUM_VERIFIED_ALLOCATION_SIZE : i32 = 1 << 20 ;
367
313
#[ cfg( feature = "small-deals" ) ]
@@ -371,18 +317,13 @@ pub mod policy_constants {
371
317
pub const MAXIMUM_VERIFIED_ALLOCATION_EXPIRATION : i64 = 60 * EPOCHS_IN_DAY ;
372
318
pub const END_OF_LIFE_CLAIM_DROP_PERIOD : ChainEpoch = 30 * EPOCHS_IN_DAY ;
373
319
374
- /// DealUpdatesInterval is the number of epochs between payouts for deals
375
320
pub const DEAL_UPDATES_INTERVAL : i64 = 30 * EPOCHS_IN_DAY ;
376
321
377
- /// Numerator of the percentage of normalized cirulating
378
- /// supply that must be covered by provider collateral
379
322
#[ cfg( not( feature = "no-provider-deal-collateral" ) ) ]
380
323
pub const PROV_COLLATERAL_PERCENT_SUPPLY_NUM : i64 = 1 ;
381
324
#[ cfg( feature = "no-provider-deal-collateral" ) ]
382
325
pub const PROV_COLLATERAL_PERCENT_SUPPLY_NUM : i64 = 0 ;
383
326
384
- /// Denominator of the percentage of normalized cirulating
385
- /// supply that must be covered by provider collateral
386
327
pub const PROV_COLLATERAL_PERCENT_SUPPLY_DENOM : i64 = 100 ;
387
328
388
329
pub const MARKET_DEFAULT_ALLOCATION_TERM_BUFFER : i64 = 90 * EPOCHS_IN_DAY ;
@@ -407,10 +348,16 @@ pub mod policy_constants {
407
348
#[ derive( Debug , PartialEq , Eq , Clone , Serialize , Deserialize ) ]
408
349
pub struct ProofSet ( Vec < bool > ) ;
409
350
351
+ /// The number of total possible types (enum variants) of RegisteredPoStProof
352
+ const REGISTERED_POST_PROOF_VARIANTS : usize = 15 ;
353
+
354
+ /// The number of total possible types (enum variants) of RegisteredSealProof
355
+ const REGISTERED_SEAL_PROOF_VARIANTS : usize = 10 ;
356
+
410
357
impl ProofSet {
411
358
/// Create a `ProofSet` for enabled `RegisteredPoStProof`s
412
359
pub fn default_post_proofs ( ) -> Self {
413
- let mut proofs = vec ! [ false ; policy_constants :: REGISTERED_POST_PROOF_VARIANTS ] ;
360
+ let mut proofs = vec ! [ false ; REGISTERED_POST_PROOF_VARIANTS ] ;
414
361
// TODO: v12: cleanup https://github.com/filecoin-project/builtin-actors/issues/1260
415
362
#[ cfg( feature = "sector-2k" ) ]
416
363
{
@@ -442,7 +389,7 @@ impl ProofSet {
442
389
443
390
/// Create a `ProofSet` for enabled `RegisteredSealProof`s
444
391
pub fn default_seal_proofs ( ) -> Self {
445
- let mut proofs = vec ! [ false ; policy_constants :: REGISTERED_SEAL_PROOF_VARIANTS ] ;
392
+ let mut proofs = vec ! [ false ; REGISTERED_SEAL_PROOF_VARIANTS ] ;
446
393
#[ cfg( feature = "sector-2k" ) ]
447
394
{
448
395
proofs[ i64:: from ( RegisteredSealProof :: StackedDRG2KiBV1P1 ) as usize ] = true ;
0 commit comments