Skip to content

Commit

Permalink
Add aggregate proof type parameter to ProveCommitSectors3 (#1489)
Browse files Browse the repository at this point in the history
  • Loading branch information
anorth authored Jan 8, 2024
1 parent 1d85ec5 commit aa0a168
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ impl Actor {
&proof_inputs,
miner_actor_id,
precommits[0].info.seal_proof,
RegisteredAggregateProof::SnarkPackV2,
&params.aggregate_proof,
)?;

Expand Down Expand Up @@ -1690,6 +1691,9 @@ impl Actor {
rt.validate_immediate_caller_is(
info.control_addresses.iter().chain(&[info.worker, info.owner]),
)?;
if params.aggregate_proof_type != RegisteredAggregateProof::SnarkPackV2 {
return Err(actor_error!(illegal_argument, "aggregate proof type must be SnarkPackV2"));
}

// Load pre-commits, failing if any don't exist.
let sector_numbers = params.sector_activations.iter().map(|sa| sa.sector_number);
Expand Down Expand Up @@ -1786,6 +1790,7 @@ impl Actor {
&proof_inputs,
miner_id,
precommits[0].info.seal_proof,
params.aggregate_proof_type,
&params.aggregate_proof,
)?;

Expand Down Expand Up @@ -4728,6 +4733,7 @@ fn verify_aggregate_seal(
proof_inputs: &[SectorSealProofInput],
miner_actor_id: ActorID,
seal_proof: RegisteredSealProof,
aggregate_proof: RegisteredAggregateProof,
proof_bytes: &RawBytes,
) -> Result<(), ActorError> {
let seal_verify_inputs =
Expand All @@ -4736,7 +4742,7 @@ fn verify_aggregate_seal(
rt.verify_aggregate_seals(&AggregateSealVerifyProofAndInfos {
miner: miner_actor_id,
seal_proof,
aggregate_proof: RegisteredAggregateProof::SnarkPackV2,
aggregate_proof,
proof: proof_bytes.clone().into(),
infos: seal_verify_inputs,
})
Expand Down
2 changes: 2 additions & 0 deletions actors/miner/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ pub struct ProveCommitSectors3Params {
// Aggregate proof for all sectors.
// Exactly one of sector_proofs or aggregate_proof must be non-empty.
pub aggregate_proof: RawBytes,
// The proof type for the aggregate proof (ignored if no aggregate proof).
pub aggregate_proof_type: RegisteredAggregateProof,
// Whether to abort if any sector activation fails.
pub require_activation_success: bool,
// Whether to abort if any notification returns a non-zero exit code.
Expand Down
1 change: 1 addition & 0 deletions actors/miner/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ impl ActorHarness {
} else {
vec![]
},
aggregate_proof_type: RegisteredAggregateProof::SnarkPackV2,
require_activation_success,
require_notification_success,
};
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/src/tests/prove_commit2_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use fvm_shared::clock::ChainEpoch;
use fvm_shared::deal::DealID;
use fvm_shared::econ::TokenAmount;
use fvm_shared::piece::{PaddedPieceSize, PieceInfo};
use fvm_shared::sector::{RegisteredSealProof, SectorNumber, StoragePower};
use fvm_shared::sector::{
RegisteredAggregateProof, RegisteredSealProof, SectorNumber, StoragePower,
};
use integer_encoding::VarInt;
use num_traits::Zero;

Expand Down Expand Up @@ -225,6 +227,7 @@ pub fn prove_commit_sectors2_test(v: &dyn VM) {
sector_activations: manifests.clone(),
sector_proofs: proofs,
aggregate_proof: RawBytes::default(),
aggregate_proof_type: RegisteredAggregateProof::SnarkPackV2,
require_activation_success: true,
require_notification_success: true,
};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/src/tests/replica_update2_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn prove_replica_update2_test(v: &dyn VM) {
sector_activations: activations,
sector_proofs: proofs,
aggregate_proof: RawBytes::default(),
aggregate_proof_type: RegisteredAggregateProof::SnarkPackV2,
require_activation_success: true,
require_notification_success: true,
};
Expand Down Expand Up @@ -256,7 +257,7 @@ pub fn prove_replica_update2_test(v: &dyn VM) {
sector_proofs: proofs,
aggregate_proof: RawBytes::default(),
update_proofs_type: update_proof,
aggregate_proof_type: RegisteredAggregateProof::SnarkPackV1,
aggregate_proof_type: RegisteredAggregateProof::SnarkPackV2,
require_activation_success: true,
require_notification_success: true,
};
Expand Down

0 comments on commit aa0a168

Please sign in to comment.