Skip to content

Commit

Permalink
Add proof types for synthetic porep (FIP-0059) (#1409)
Browse files Browse the repository at this point in the history
* finish update

* I guess patches aren't enough

* fix evm tests

We now need to explicitly specify the sha3/ripemd features when
testing (it was removed from shared).

* feat: adds support for Synthetic PoRep
feat: updates to use latest fvm releases

* style: rust fmt

* fix: add proper seal proof variant count

* fix: apply review feedback

* style: rust fmt

---------

Co-authored-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
cryptonemo and Stebalien authored Sep 14, 2023
1 parent 2b1df06 commit 66bb5f7
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 31 deletions.
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

0 comments on commit 66bb5f7

Please sign in to comment.