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

Add proof types for synthetic porep (FIP-0059) #1409

Merged
merged 8 commits into from
Sep 14, 2023
Merged
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
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fil_actors_integration_tests = { version = "1.0.0", path = "integration_tests" }
vm_api = { version = "1.0.0", path = "vm_api" }
test_vm = { version = "12.0.0", path = "test_vm" }

[patch.crates-io]
#[patch.crates-io]
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
#fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
Expand Down
15 changes: 10 additions & 5 deletions actors/miner/src/commd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,16 @@ fn zero_commd(seal_proof: RegisteredSealProof) -> Result<Cid, ActorError> {
let mut seal_proof = seal_proof;
seal_proof.update_to_v1();
let i = match seal_proof {
RegisteredSealProof::StackedDRG2KiBV1P1 => 0,
RegisteredSealProof::StackedDRG512MiBV1P1 => 1,
RegisteredSealProof::StackedDRG8MiBV1P1 => 2,
RegisteredSealProof::StackedDRG32GiBV1P1 => 3,
RegisteredSealProof::StackedDRG64GiBV1P1 => 4,
RegisteredSealProof::StackedDRG2KiBV1P1
| RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep => 0,
RegisteredSealProof::StackedDRG512MiBV1P1
| RegisteredSealProof::StackedDRG512MiBV1P1_Feat_SyntheticPoRep => 1,
RegisteredSealProof::StackedDRG8MiBV1P1
| RegisteredSealProof::StackedDRG8MiBV1P1_Feat_SyntheticPoRep => 2,
RegisteredSealProof::StackedDRG32GiBV1P1
| RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep => 3,
RegisteredSealProof::StackedDRG64GiBV1P1
| RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep => 4,
_ => {
return Err(actor_error!(illegal_argument, "unknown SealProof"));
}
Expand Down
26 changes: 22 additions & 4 deletions actors/miner/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,18 @@ pub fn max_prove_commit_duration(
match proof {
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
| StackedDRG64GiBV1 => Some(EPOCHS_IN_DAY + policy.pre_commit_challenge_delay),
StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1 | StackedDRG512MiBV1P1 | StackedDRG8MiBV1P1
| StackedDRG2KiBV1P1 => Some(30 * EPOCHS_IN_DAY + policy.pre_commit_challenge_delay),
StackedDRG32GiBV1P1
| StackedDRG64GiBV1P1
| StackedDRG512MiBV1P1
| StackedDRG8MiBV1P1
| StackedDRG2KiBV1P1
| StackedDRG32GiBV1P1_Feat_SyntheticPoRep
| StackedDRG64GiBV1P1_Feat_SyntheticPoRep
| StackedDRG512MiBV1P1_Feat_SyntheticPoRep
| StackedDRG8MiBV1P1_Feat_SyntheticPoRep
| StackedDRG2KiBV1P1_Feat_SyntheticPoRep => {
Some(30 * EPOCHS_IN_DAY + policy.pre_commit_challenge_delay)
}
_ => None,
}
}
Expand All @@ -117,8 +127,16 @@ pub fn seal_proof_sector_maximum_lifetime(proof: RegisteredSealProof) -> Option<
match proof {
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
| StackedDRG64GiBV1 => Some(EPOCHS_IN_DAY * 540),
StackedDRG32GiBV1P1 | StackedDRG2KiBV1P1 | StackedDRG8MiBV1P1 | StackedDRG512MiBV1P1
| StackedDRG64GiBV1P1 => Some(EPOCHS_IN_YEAR * 5),
StackedDRG32GiBV1P1
| StackedDRG2KiBV1P1
| StackedDRG8MiBV1P1
| StackedDRG512MiBV1P1
| StackedDRG64GiBV1P1
| StackedDRG32GiBV1P1_Feat_SyntheticPoRep
| StackedDRG2KiBV1P1_Feat_SyntheticPoRep
| StackedDRG8MiBV1P1_Feat_SyntheticPoRep
| StackedDRG512MiBV1P1_Feat_SyntheticPoRep
| StackedDRG64GiBV1P1_Feat_SyntheticPoRep => Some(EPOCHS_IN_YEAR * 5),
_ => None,
}
}
Expand Down
3 changes: 3 additions & 0 deletions actors/miner/tests/miner_actor_test_commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,11 @@ mod miner_actor_test_commitment {
let sector_number: SectorNumber = 100;
let deal_limits = [
(RegisteredSealProof::StackedDRG2KiBV1P1, 256),
(RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep, 256),
(RegisteredSealProof::StackedDRG32GiBV1P1, 256),
(RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep, 256),
(RegisteredSealProof::StackedDRG64GiBV1P1, 512),
(RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep, 512),
];

for (proof, limit) in deal_limits {
Expand Down
14 changes: 13 additions & 1 deletion runtime/src/runtime/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ pub struct ProofSet(Vec<bool>);
const REGISTERED_POST_PROOF_VARIANTS: usize = 15;

/// The number of total possible types (enum variants) of RegisteredSealProof
const REGISTERED_SEAL_PROOF_VARIANTS: usize = 10;
const REGISTERED_SEAL_PROOF_VARIANTS: usize = 15;

impl ProofSet {
/// Create a `ProofSet` for enabled `RegisteredPoStProof`s
Expand Down Expand Up @@ -393,22 +393,34 @@ impl ProofSet {
#[cfg(feature = "sector-2k")]
{
proofs[i64::from(RegisteredSealProof::StackedDRG2KiBV1P1) as usize] = true;
proofs
[i64::from(RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep) as usize] =
true;
}
#[cfg(feature = "sector-8m")]
{
proofs[i64::from(RegisteredSealProof::StackedDRG8MiBV1P1) as usize] = true;
proofs
[i64::from(RegisteredSealProof::StackedDRG8MiBV1P1_Feat_SyntheticPoRep) as usize] =
true;
}
#[cfg(feature = "sector-512m")]
{
proofs[i64::from(RegisteredSealProof::StackedDRG512MiBV1P1) as usize] = true;
proofs[i64::from(RegisteredSealProof::StackedDRG512MiBV1P1_Feat_SyntheticPoRep)
as usize] = true;
}
#[cfg(feature = "sector-32g")]
{
proofs[i64::from(RegisteredSealProof::StackedDRG32GiBV1P1) as usize] = true;
proofs[i64::from(RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep)
as usize] = true;
}
#[cfg(feature = "sector-64g")]
{
proofs[i64::from(RegisteredSealProof::StackedDRG64GiBV1P1) as usize] = true;
proofs[i64::from(RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep)
as usize] = true;
}
ProofSet(proofs)
}
Expand Down