Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove obsolete gas-limited parameters #1584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,13 +1486,6 @@ impl Actor {
let policy = rt.policy();
if sectors.is_empty() {
return Err(actor_error!(illegal_argument, "batch empty"));
} else if sectors.len() > policy.pre_commit_sector_batch_max_size {
return Err(actor_error!(
illegal_argument,
"batch of {} too large, max {}",
sectors.len(),
policy.pre_commit_sector_batch_max_size
));
}
}
// Check per-sector preconditions before opening state transaction or sending other messages.
Expand Down Expand Up @@ -2515,18 +2508,6 @@ impl Actor {
// Note: this cannot terminate pre-committed but un-proven sectors.
// They must be allowed to expire (and deposit burnt).

{
let policy = rt.policy();
if params.terminations.len() as u64 > policy.declarations_max {
return Err(actor_error!(
illegal_argument,
"too many declarations when terminating sectors: {} > {}",
params.terminations.len(),
policy.declarations_max
));
}
}

let mut to_process = DeadlineSectorMap::new();

for term in params.terminations {
Expand Down Expand Up @@ -2656,17 +2637,6 @@ impl Actor {
}

fn declare_faults(rt: &impl Runtime, params: DeclareFaultsParams) -> Result<(), ActorError> {
{
let policy = rt.policy();
if params.faults.len() as u64 > policy.declarations_max {
return Err(actor_error!(
illegal_argument,
"too many fault declarations for a single message: {} > {}",
params.faults.len(),
policy.declarations_max
));
}
}

let mut to_process = DeadlineSectorMap::new();

Expand Down Expand Up @@ -2789,17 +2759,6 @@ impl Actor {
rt: &impl Runtime,
params: DeclareFaultsRecoveredParams,
) -> Result<(), ActorError> {
{
let policy = rt.policy();
if params.recoveries.len() as u64 > policy.declarations_max {
return Err(actor_error!(
illegal_argument,
"too many recovery declarations for a single message: {} > {}",
params.recoveries.len(),
policy.declarations_max
));
}
}

let mut to_process = DeadlineSectorMap::new();

Expand Down Expand Up @@ -3967,15 +3926,6 @@ fn validate_replica_updates<'a, BS>(
where
BS: Blockstore,
{
if updates.len() > policy.prove_replica_updates_max_size {
return Err(actor_error!(
illegal_argument,
"too many updates ({} > {})",
updates.len(),
policy.prove_replica_updates_max_size
));
}

let mut sector_numbers = BTreeSet::<SectorNumber>::new();
let mut validate_one = |update: &ReplicaUpdateInner,
sector_info: &SectorOnChainInfo|
Expand Down
11 changes: 0 additions & 11 deletions actors/miner/tests/miner_actor_test_precommit_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,6 @@ mod miner_actor_precommit_batch {
);
}

#[test]
fn too_many_sectors() {
assert_simple_batch(
Policy::default().pre_commit_sector_batch_max_size + 1,
TokenAmount::zero(),
TokenAmount::zero(),
&[],
ExitCode::USR_ILLEGAL_ARGUMENT,
"batch of 257 too large",
);
}
#[test]
fn insufficient_balance() {
assert_simple_batch(
Expand Down
5 changes: 1 addition & 4 deletions integration_tests/src/tests/batch_onboarding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use export_macro::vm_test;
use fil_actor_miner::SectorPreCommitOnChainInfo;
use fil_actor_miner::{power_for_sector, State as MinerState};
use fil_actors_runtime::runtime::policy::policy_constants::PRE_COMMIT_CHALLENGE_DELAY;
use fil_actors_runtime::runtime::policy_constants::{
MAX_AGGREGATED_SECTORS, PRE_COMMIT_SECTOR_BATCH_MAX_SIZE,
};
use fil_actors_runtime::runtime::policy_constants::MAX_AGGREGATED_SECTORS;
use fil_actors_runtime::runtime::Policy;
use fvm_shared::bigint::BigInt;
use fvm_shared::econ::TokenAmount;
Expand Down Expand Up @@ -76,7 +74,6 @@ pub fn batch_onboarding_test(v: &dyn VM) {
let mut pre_committed_count = 0;

let vec_onboarding = vec![
Onboarding::new(0, 10, PRE_COMMIT_SECTOR_BATCH_MAX_SIZE, 0, 0),
Onboarding::new(1, 20, 12, 0, 0),
Onboarding::new(PRE_COMMIT_CHALLENGE_DELAY + 1, 0, 0, 8, MAX_AGGREGATED_SECTORS as usize),
Onboarding::new(1, 0, 0, 8, 4),
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/src/tests/commit_post_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ pub fn aggregate_bad_sector_number_test(v: &dyn VM) {
precommit_sectors_v2(
v,
4,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&id_addr,
Expand Down Expand Up @@ -464,7 +464,7 @@ pub fn aggregate_size_limits_test(v: &dyn VM) {
precommit_sectors_v2(
v,
oversized_batch,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&id_addr,
Expand Down Expand Up @@ -568,7 +568,7 @@ pub fn aggregate_bad_sender_test(v: &dyn VM) {
precommit_sectors_v2(
v,
4,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&id_addr,
Expand Down Expand Up @@ -640,7 +640,7 @@ pub fn aggregate_one_precommit_expires_test(v: &dyn VM) {
let early_precommits = precommit_sectors_v2(
v,
1,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&miner_addr,
Expand All @@ -660,7 +660,7 @@ pub fn aggregate_one_precommit_expires_test(v: &dyn VM) {
let later_precommits = precommit_sectors_v2(
v,
3,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&miner_addr,
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/tests/replica_update_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ pub fn deal_included_in_multiple_sectors_failure_test(v: &dyn VM) {
let precommits = precommit_sectors_v2(
v,
policy.min_aggregated_sectors as usize,
policy.pre_commit_sector_batch_max_size,
256,
vec![],
&worker,
&maddr,
Expand Down
19 changes: 0 additions & 19 deletions runtime/src/runtime/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ pub struct Policy {
/// Maximum total replica update proof size.
pub max_replica_update_proof_size: usize,

/// The maximum number of sector pre-commitments in a single batch.
pub pre_commit_sector_batch_max_size: usize,
/// The maximum number of sector replica updates in a single batch.
pub prove_replica_updates_max_size: usize,

/// The delay between pre commit expiration and clean up from state. This enforces that expired pre-commits
/// stay in state for a period of time creating a grace period during which a late-running aggregated prove-commit
/// can still prove its non-expired precommits without resubmitting a message
Expand Down Expand Up @@ -63,9 +58,6 @@ pub struct Policy {
/// This limits the number of simultaneous fault, recovery, or sector-extension declarations.
pub addressed_partitions_max: u64,

/// Maximum number of unique "declarations" in batch operations.
pub declarations_max: u64,

/// The maximum number of sector numbers addressable in a single invocation
/// (which implies also the max infos that may be loaded at once).
/// One upper bound on this is the max size of a storage block: 1MiB supports 130k at 8 bytes each,
Expand Down Expand Up @@ -175,8 +167,6 @@ impl Default for Policy {
min_aggregated_sectors: policy_constants::MIN_AGGREGATED_SECTORS,
max_aggregated_proof_size: policy_constants::MAX_AGGREGATED_PROOF_SIZE,
max_replica_update_proof_size: policy_constants::MAX_REPLICA_UPDATE_PROOF_SIZE,
pre_commit_sector_batch_max_size: policy_constants::PRE_COMMIT_SECTOR_BATCH_MAX_SIZE,
prove_replica_updates_max_size: policy_constants::PROVE_REPLICA_UPDATES_MAX_SIZE,
expired_pre_commit_clean_up_delay: policy_constants::EXPIRED_PRE_COMMIT_CLEAN_UP_DELAY,
wpost_proving_period: policy_constants::WPOST_PROVING_PERIOD,
wpost_challenge_window: policy_constants::WPOST_CHALLENGE_WINDOW,
Expand All @@ -189,7 +179,6 @@ impl Default for Policy {
max_peer_id_length: policy_constants::MAX_PEER_ID_LENGTH,
max_multiaddr_data: policy_constants::MAX_MULTIADDR_DATA,
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:
Expand Down Expand Up @@ -254,12 +243,6 @@ pub mod policy_constants {

pub const MAX_REPLICA_UPDATE_PROOF_SIZE: usize = 4096;

// 32 sectors per epoch would support a single miner onboarding 1EiB of 32GiB sectors in 1 year.
pub const PRE_COMMIT_SECTOR_BATCH_MAX_SIZE: usize = 256;

// Same as PRE_COMMIT_SECTOR_BATCH_MAX_SIZE for consistency.
pub const PROVE_REPLICA_UPDATES_MAX_SIZE: usize = PRE_COMMIT_SECTOR_BATCH_MAX_SIZE;

pub const EXPIRED_PRE_COMMIT_CLEAN_UP_DELAY: i64 = 8 * EPOCHS_IN_HOUR;

pub const WPOST_PROVING_PERIOD: ChainEpoch = EPOCHS_IN_DAY;
Expand Down Expand Up @@ -294,8 +277,6 @@ pub mod policy_constants {
// A miner can of course submit more messages.
pub const ADDRESSED_PARTITIONS_MAX: u64 = MAX_PARTITIONS_PER_DEADLINE;

pub const DECLARATIONS_MAX: u64 = ADDRESSED_PARTITIONS_MAX;

pub const ADDRESSED_SECTORS_MAX: u64 = 25_000;

pub const POSTED_PARTITIONS_MAX: u64 = 3;
Expand Down
Loading