Skip to content

Commit

Permalink
Return error if success count for proof validation or data activation…
Browse files Browse the repository at this point in the history
…s is 0 (#1406)
  • Loading branch information
shrenujbansal authored and anorth committed Dec 14, 2023
1 parent 6bb26d0 commit 23e8bb2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,9 @@ impl Actor {
return Err(actor_error!(illegal_argument, "no valid updates"));
}
let proven_batch = proven_batch_gen.gen();
if proven_batch.success_count == 0 {
return Err(actor_error!(illegal_argument, "no valid proofs specified"));
}

// Activate data.
let data_activation_inputs: Vec<SectorPiecesActivationInput> = proven_manifests
Expand All @@ -1114,6 +1117,9 @@ impl Actor {
// Activate data for proven updates.
let (data_batch, data_activations) =
activate_sectors_pieces(rt, data_activation_inputs, params.require_activation_success)?;
if data_batch.success_count == 0 {
return Err(actor_error!(illegal_argument, "all data activations failed"));
}

// Successful data activation is required for sector activation.
let successful_manifests = data_batch.successes(&proven_manifests);
Expand Down Expand Up @@ -1789,6 +1795,9 @@ impl Actor {
proven_batch_gen.add_successes(validation_batch.size());
}
let proven_batch = proven_batch_gen.gen();
if proven_batch.success_count == 0 {
return Err(actor_error!(illegal_argument, "no valid proofs specified"));
}

// Activate data and verify CommD matches the declared one.
let data_activation_inputs = proven_activation_inputs
Expand All @@ -1807,6 +1816,9 @@ impl Actor {
// Activate data for proven sectors.
let (data_batch, data_activations) =
activate_sectors_pieces(rt, data_activation_inputs, params.require_activation_success)?;
if data_batch.success_count == 0 {
return Err(actor_error!(illegal_argument, "all data activations failed"));
}

// Successful data activation is required for sector activation.
let successful_sector_activations = data_batch.successes(&proven_activation_inputs);
Expand Down

0 comments on commit 23e8bb2

Please sign in to comment.