diff --git a/actors/miner/src/lib.rs b/actors/miner/src/lib.rs index 5ee8961eb..d347a75b8 100644 --- a/actors/miner/src/lib.rs +++ b/actors/miner/src/lib.rs @@ -4,8 +4,8 @@ use std::cmp::max; use std::collections::btree_map::Entry; use std::collections::{BTreeMap, BTreeSet}; -use std::iter; use std::ops::Neg; +use std::{cmp, iter}; use anyhow::{anyhow, Error}; use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; @@ -561,8 +561,11 @@ impl Actor { } // Validate that the miner didn't try to prove too many partitions at once. - let submission_partition_limit = - load_partitions_sectors_max(rt.policy(), info.window_post_partition_sectors); + let submission_partition_limit = cmp::min( + load_partitions_sectors_max(rt.policy(), info.window_post_partition_sectors), + rt.policy().posted_partitions_max, + ); + if params.partitions.len() as u64 > submission_partition_limit { return Err(actor_error!( illegal_argument, @@ -4401,8 +4404,10 @@ struct SectorSealProofInput { pub sector_number: SectorNumber, pub randomness: SealRandomness, pub interactive_randomness: InteractiveSealRandomness, - pub sealed_cid: Cid, // Commr - pub unsealed_cid: Cid, // Commd + // Commr + pub sealed_cid: Cid, + // Commd + pub unsealed_cid: Cid, } impl SectorSealProofInput { diff --git a/runtime/src/runtime/policy.rs b/runtime/src/runtime/policy.rs index d4565af6f..523b066e5 100644 --- a/runtime/src/runtime/policy.rs +++ b/runtime/src/runtime/policy.rs @@ -69,6 +69,9 @@ pub struct Policy { /// The maximum number of sector infos that may be required to be loaded in a single invocation. pub addressed_sectors_max: u64, + /// The maximum number of partitions that can be proven in a single PoSt message. + pub posted_partitions_max: u64, + pub max_pre_commit_randomness_lookback: ChainEpoch, /// Number of epochs between publishing the precommit and when the challenge for interactive PoRep is drawn @@ -173,6 +176,7 @@ impl Default for Policy { addressed_partitions_max: policy_constants::ADDRESSED_PARTITIONS_MAX, declarations_max: policy_constants::DECLARATIONS_MAX, addressed_sectors_max: policy_constants::ADDRESSED_SECTORS_MAX, + posted_partitions_max: policy_constants::POSTED_PARTITIONS_MAX, max_pre_commit_randomness_lookback: policy_constants::MAX_PRE_COMMIT_RANDOMNESS_LOOKBACK, pre_commit_challenge_delay: policy_constants::PRE_COMMIT_CHALLENGE_DELAY, @@ -271,6 +275,8 @@ pub mod policy_constants { pub const ADDRESSED_SECTORS_MAX: u64 = 25_000; + pub const POSTED_PARTITIONS_MAX: u64 = 3; + pub const MAX_PRE_COMMIT_RANDOMNESS_LOOKBACK: ChainEpoch = EPOCHS_IN_DAY + CHAIN_FINALITY; #[cfg(not(feature = "short-precommit"))]