Skip to content

Commit 66bb5f7

Browse files
Add proof types for synthetic porep (FIP-0059) (#1409)
* 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 <[email protected]>
1 parent 2b1df06 commit 66bb5f7

File tree

6 files changed

+69
-31
lines changed

6 files changed

+69
-31
lines changed

Cargo.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fil_actors_integration_tests = { version = "1.0.0", path = "integration_tests" }
147147
vm_api = { version = "1.0.0", path = "vm_api" }
148148
test_vm = { version = "12.0.0", path = "test_vm" }
149149

150-
[patch.crates-io]
150+
#[patch.crates-io]
151151
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
152152
#fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
153153
#fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }

actors/miner/src/commd.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ fn zero_commd(seal_proof: RegisteredSealProof) -> Result<Cid, ActorError> {
6868
let mut seal_proof = seal_proof;
6969
seal_proof.update_to_v1();
7070
let i = match seal_proof {
71-
RegisteredSealProof::StackedDRG2KiBV1P1 => 0,
72-
RegisteredSealProof::StackedDRG512MiBV1P1 => 1,
73-
RegisteredSealProof::StackedDRG8MiBV1P1 => 2,
74-
RegisteredSealProof::StackedDRG32GiBV1P1 => 3,
75-
RegisteredSealProof::StackedDRG64GiBV1P1 => 4,
71+
RegisteredSealProof::StackedDRG2KiBV1P1
72+
| RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep => 0,
73+
RegisteredSealProof::StackedDRG512MiBV1P1
74+
| RegisteredSealProof::StackedDRG512MiBV1P1_Feat_SyntheticPoRep => 1,
75+
RegisteredSealProof::StackedDRG8MiBV1P1
76+
| RegisteredSealProof::StackedDRG8MiBV1P1_Feat_SyntheticPoRep => 2,
77+
RegisteredSealProof::StackedDRG32GiBV1P1
78+
| RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep => 3,
79+
RegisteredSealProof::StackedDRG64GiBV1P1
80+
| RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep => 4,
7681
_ => {
7782
return Err(actor_error!(illegal_argument, "unknown SealProof"));
7883
}

actors/miner/src/policy.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,18 @@ pub fn max_prove_commit_duration(
104104
match proof {
105105
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
106106
| StackedDRG64GiBV1 => Some(EPOCHS_IN_DAY + policy.pre_commit_challenge_delay),
107-
StackedDRG32GiBV1P1 | StackedDRG64GiBV1P1 | StackedDRG512MiBV1P1 | StackedDRG8MiBV1P1
108-
| StackedDRG2KiBV1P1 => Some(30 * EPOCHS_IN_DAY + policy.pre_commit_challenge_delay),
107+
StackedDRG32GiBV1P1
108+
| StackedDRG64GiBV1P1
109+
| StackedDRG512MiBV1P1
110+
| StackedDRG8MiBV1P1
111+
| StackedDRG2KiBV1P1
112+
| StackedDRG32GiBV1P1_Feat_SyntheticPoRep
113+
| StackedDRG64GiBV1P1_Feat_SyntheticPoRep
114+
| StackedDRG512MiBV1P1_Feat_SyntheticPoRep
115+
| StackedDRG8MiBV1P1_Feat_SyntheticPoRep
116+
| StackedDRG2KiBV1P1_Feat_SyntheticPoRep => {
117+
Some(30 * EPOCHS_IN_DAY + policy.pre_commit_challenge_delay)
118+
}
109119
_ => None,
110120
}
111121
}
@@ -117,8 +127,16 @@ pub fn seal_proof_sector_maximum_lifetime(proof: RegisteredSealProof) -> Option<
117127
match proof {
118128
StackedDRG32GiBV1 | StackedDRG2KiBV1 | StackedDRG8MiBV1 | StackedDRG512MiBV1
119129
| StackedDRG64GiBV1 => Some(EPOCHS_IN_DAY * 540),
120-
StackedDRG32GiBV1P1 | StackedDRG2KiBV1P1 | StackedDRG8MiBV1P1 | StackedDRG512MiBV1P1
121-
| StackedDRG64GiBV1P1 => Some(EPOCHS_IN_YEAR * 5),
130+
StackedDRG32GiBV1P1
131+
| StackedDRG2KiBV1P1
132+
| StackedDRG8MiBV1P1
133+
| StackedDRG512MiBV1P1
134+
| StackedDRG64GiBV1P1
135+
| StackedDRG32GiBV1P1_Feat_SyntheticPoRep
136+
| StackedDRG2KiBV1P1_Feat_SyntheticPoRep
137+
| StackedDRG8MiBV1P1_Feat_SyntheticPoRep
138+
| StackedDRG512MiBV1P1_Feat_SyntheticPoRep
139+
| StackedDRG64GiBV1P1_Feat_SyntheticPoRep => Some(EPOCHS_IN_YEAR * 5),
122140
_ => None,
123141
}
124142
}

actors/miner/tests/miner_actor_test_commitment.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,11 @@ mod miner_actor_test_commitment {
429429
let sector_number: SectorNumber = 100;
430430
let deal_limits = [
431431
(RegisteredSealProof::StackedDRG2KiBV1P1, 256),
432+
(RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep, 256),
432433
(RegisteredSealProof::StackedDRG32GiBV1P1, 256),
434+
(RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep, 256),
433435
(RegisteredSealProof::StackedDRG64GiBV1P1, 512),
436+
(RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep, 512),
434437
];
435438

436439
for (proof, limit) in deal_limits {

runtime/src/runtime/policy.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub struct ProofSet(Vec<bool>);
352352
const REGISTERED_POST_PROOF_VARIANTS: usize = 15;
353353

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

357357
impl ProofSet {
358358
/// Create a `ProofSet` for enabled `RegisteredPoStProof`s
@@ -393,22 +393,34 @@ impl ProofSet {
393393
#[cfg(feature = "sector-2k")]
394394
{
395395
proofs[i64::from(RegisteredSealProof::StackedDRG2KiBV1P1) as usize] = true;
396+
proofs
397+
[i64::from(RegisteredSealProof::StackedDRG2KiBV1P1_Feat_SyntheticPoRep) as usize] =
398+
true;
396399
}
397400
#[cfg(feature = "sector-8m")]
398401
{
399402
proofs[i64::from(RegisteredSealProof::StackedDRG8MiBV1P1) as usize] = true;
403+
proofs
404+
[i64::from(RegisteredSealProof::StackedDRG8MiBV1P1_Feat_SyntheticPoRep) as usize] =
405+
true;
400406
}
401407
#[cfg(feature = "sector-512m")]
402408
{
403409
proofs[i64::from(RegisteredSealProof::StackedDRG512MiBV1P1) as usize] = true;
410+
proofs[i64::from(RegisteredSealProof::StackedDRG512MiBV1P1_Feat_SyntheticPoRep)
411+
as usize] = true;
404412
}
405413
#[cfg(feature = "sector-32g")]
406414
{
407415
proofs[i64::from(RegisteredSealProof::StackedDRG32GiBV1P1) as usize] = true;
416+
proofs[i64::from(RegisteredSealProof::StackedDRG32GiBV1P1_Feat_SyntheticPoRep)
417+
as usize] = true;
408418
}
409419
#[cfg(feature = "sector-64g")]
410420
{
411421
proofs[i64::from(RegisteredSealProof::StackedDRG64GiBV1P1) as usize] = true;
422+
proofs[i64::from(RegisteredSealProof::StackedDRG64GiBV1P1_Feat_SyntheticPoRep)
423+
as usize] = true;
412424
}
413425
ProofSet(proofs)
414426
}

0 commit comments

Comments
 (0)