From 66bb5f7c92bd2c430bcd6ecd1be40dae459dbd87 Mon Sep 17 00:00:00 2001 From: nemo Date: Thu, 14 Sep 2023 11:07:17 -0400 Subject: [PATCH] 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 --- Cargo.lock | 40 +++++++++---------- Cargo.toml | 2 +- actors/miner/src/commd.rs | 15 ++++--- actors/miner/src/policy.rs | 26 ++++++++++-- .../tests/miner_actor_test_commitment.rs | 3 ++ runtime/src/runtime/policy.rs | 14 ++++++- 6 files changed, 69 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0f243faf5..d0233c278 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -396,9 +396,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" dependencies = [ "serde", ] @@ -470,9 +470,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.29" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" dependencies = [ "num-traits", ] @@ -1082,9 +1082,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0245617f11b8178fa50b52e433e2c34ac69f39116b62c8be2437decf2edf1986" +checksum = "c6e9e8acd0ed348403cc73a670c24daba3226c40b98dc1a41903766b3ab6240a" dependencies = [ "ethers-core", "once_cell", @@ -1113,9 +1113,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22c54db0d393393e732a5b20273e4f8ab89f0cce501c84e75fab9c126799a6e6" +checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" dependencies = [ "Inflector", "const-hex", @@ -1135,9 +1135,9 @@ dependencies = [ [[package]] name = "ethers-contract-derive" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ee4f216184a1304b707ed258f4f70aa40bf7e1522ab8963d127a8d516eaa1a" +checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" dependencies = [ "Inflector", "const-hex", @@ -1151,9 +1151,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c29523f73c12753165781c6e5dc11c84d3e44c080a15f7c6cfbd70b514cb6f1" +checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" dependencies = [ "arrayvec", "bytes", @@ -1181,9 +1181,9 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aab5af432b3fe5b7756b60df5c9ddeb85a13414575ad8a9acd707c24f0a77a5" +checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" dependencies = [ "ethers-core", "reqwest", @@ -1223,9 +1223,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.9" +version = "2.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c84664b294e47fc2860d6db0db0246f79c4c724e552549631bb9505b834bee" +checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" dependencies = [ "async-trait", "auto_impl", @@ -3035,9 +3035,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.6" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b4a26fb934017f2e774ad9a16b40cca8faec288e0233496c6a47f266d49f024" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" dependencies = [ "arrayvec", "bitvec", @@ -3049,9 +3049,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.6" +version = "3.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65cebc1b089c96df6203a76279a82b4bbf04fa23659c4093cac6fd245c25d1f" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" dependencies = [ "proc-macro-crate", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 71e54a685..c83543736 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/actors/miner/src/commd.rs b/actors/miner/src/commd.rs index 9d3333984..ba983e51c 100644 --- a/actors/miner/src/commd.rs +++ b/actors/miner/src/commd.rs @@ -68,11 +68,16 @@ fn zero_commd(seal_proof: RegisteredSealProof) -> Result { 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")); } diff --git a/actors/miner/src/policy.rs b/actors/miner/src/policy.rs index 1c6f1bda3..abbf3b2c0 100644 --- a/actors/miner/src/policy.rs +++ b/actors/miner/src/policy.rs @@ -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, } } @@ -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, } } diff --git a/actors/miner/tests/miner_actor_test_commitment.rs b/actors/miner/tests/miner_actor_test_commitment.rs index 7d528036a..9ea3633a7 100644 --- a/actors/miner/tests/miner_actor_test_commitment.rs +++ b/actors/miner/tests/miner_actor_test_commitment.rs @@ -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 { diff --git a/runtime/src/runtime/policy.rs b/runtime/src/runtime/policy.rs index f1180e009..21c492fe7 100644 --- a/runtime/src/runtime/policy.rs +++ b/runtime/src/runtime/policy.rs @@ -352,7 +352,7 @@ pub struct ProofSet(Vec); 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 @@ -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) }