From 18407d03cfecd232ff977b7b130426199c35aac2 Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Wed, 17 Apr 2024 13:48:03 +0200 Subject: [PATCH] feat: add support for Non-interactive PoRep This commit adds support for ni-porep. Also Rust >= 1.70 is needed due to the dependency on `home` v0.5.9 and fix the corresponding new Clippy warnings. --- .circleci/config.yml | 2 +- rust/Cargo.lock | 30 +++++++++--------------------- rust/Cargo.toml | 7 +++++++ rust/rust-toolchain.toml | 2 +- rust/src/fvm/engine.rs | 2 +- rust/src/proofs/api.rs | 1 + rust/src/proofs/types.rs | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 56 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 76654935..9456c318 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -152,7 +152,7 @@ jobs: - publish_darwin_release rustfmt: docker: - - image: cimg/rust:1.67 + - image: cimg/rust:1.70 resource_class: small steps: - checkout diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a5e912b6..c94a92d6 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1193,8 +1193,7 @@ dependencies = [ [[package]] name = "filecoin-hashers" version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a96fbc8232ba762026e6b4687dedf08ba1b3830148c919a158c21d7720fb62" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "bellperson", @@ -1213,8 +1212,7 @@ dependencies = [ [[package]] name = "filecoin-proofs" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a4daf099aade347b0f23c1dd5b644aad340a223d5b65c37840faedda3092f" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "bellperson", @@ -1247,8 +1245,7 @@ dependencies = [ [[package]] name = "filecoin-proofs-api" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cef9a819a3125ab92269da594daf2f742a3f6b1e03a2493c13a0bda4514b03" +source = "git+https://github.com/filecoin-project/rust-filecoin-proofs-api?branch=ni-porep#0287a2a5c51e1f673ef6704253b7356c4256cf62" dependencies = [ "anyhow", "bellperson", @@ -1325,8 +1322,7 @@ dependencies = [ [[package]] name = "fr32" version = "9.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca9913cf6179723cdc69827661a36d9ac3fea4c6c8c0ee71536417e5b2cf5d6" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "blstrs", @@ -2997,8 +2993,7 @@ dependencies = [ [[package]] name = "sha2raw" version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05310f1b1ceedfef5da1f80b6690342aec43713a79d1c303fa7b451f4e313de" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "byteorder", "cpufeatures", @@ -3077,8 +3072,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "storage-proofs-core" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568106d9e94bd28082551873fe36e0295de24770e67cecdd25f345a1b39664f7" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "aes", "anyhow", @@ -3112,8 +3106,7 @@ dependencies = [ [[package]] name = "storage-proofs-porep" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4d3d0dd1f03de0f4a3ea54ceed7d79c62e3c7963abe2014db0934e828514b54" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "bellperson", @@ -3155,19 +3148,15 @@ dependencies = [ [[package]] name = "storage-proofs-post" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4817014940a69e7e84aa459afa3d7a0b81090a312d9918089f14810e988ac24" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "bellperson", - "blake2b_simd", "blstrs", "byteorder", "ff", "filecoin-hashers", - "fr32", "generic-array", - "hex", "log", "rayon", "serde", @@ -3178,8 +3167,7 @@ dependencies = [ [[package]] name = "storage-proofs-update" version = "16.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5374a6a435d62e23700a08e124a8b4756ddd937fd6152289346481bfdbac21f5" +source = "git+https://github.com/filecoin-project/rust-fil-proofs#3f018b51b6327b135830899d237a7ba181942d7e" dependencies = [ "anyhow", "bellperson", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 17fb80cc..f4fcb6d6 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -63,3 +63,10 @@ c-headers = ["safer-ffi/headers"] # This feature enables a fixed number of discarded rows for TreeR. The `FIL_PROOFS_ROWS_TO_DISCARD` # setting is ignored, no `TemporaryAux` file will be written. fixed-rows-to-discard = ["filecoin-proofs-api/fixed-rows-to-discard"] + +[patch.crates-io] +filecoin-proofs-api = { git = "https://github.com/filecoin-project/rust-filecoin-proofs-api", branch = "ni-porep" } +filecoin-proofs = { git = "https://github.com/filecoin-project/rust-fil-proofs" } +filecoin-hashers = { git = "https://github.com/filecoin-project/rust-fil-proofs" } +fr32 = { git = "https://github.com/filecoin-project/rust-fil-proofs" } +storage-proofs-core = { git = "https://github.com/filecoin-project/rust-fil-proofs" } diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml index 83e2ab48..5299106e 100644 --- a/rust/rust-toolchain.toml +++ b/rust/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.67.1" +channel = "1.70.0" components = ["clippy", "rustfmt"] diff --git a/rust/src/fvm/engine.rs b/rust/src/fvm/engine.rs index 7a03fb2b..be35abe4 100644 --- a/rust/src/fvm/engine.rs +++ b/rust/src/fvm/engine.rs @@ -71,7 +71,7 @@ impl TryFrom for EngineVersion { 16 | 17 => Ok(EngineVersion::V1), 18 | 19 | 20 => Ok(EngineVersion::V2), 21 | 22 => Ok(EngineVersion::V3), - _ => return Err(anyhow!("network version not supported")), + _ => Err(anyhow!("network version not supported")), } } } diff --git a/rust/src/proofs/api.rs b/rust/src/proofs/api.rs index 28a9abc4..05f9c64e 100644 --- a/rust/src/proofs/api.rs +++ b/rust/src/proofs/api.rs @@ -1674,6 +1674,7 @@ pub mod tests { RegisteredSealProof::StackedDrg2KiBV1, RegisteredSealProof::StackedDrg2KiBV1_1, RegisteredSealProof::StackedDrg2KiBV1_1_Feat_SyntheticPoRep, + RegisteredSealProof::StackedDrg2KiBV1_1_Feat_NonInteractivePoRep, ]; for version in versions { info!("test_sealing_versions[{:?}]", version); diff --git a/rust/src/proofs/types.rs b/rust/src/proofs/types.rs index 99417b72..fc815d43 100644 --- a/rust/src/proofs/types.rs +++ b/rust/src/proofs/types.rs @@ -59,6 +59,11 @@ pub enum RegisteredSealProof { StackedDrg512MiBV1_1_Feat_SyntheticPoRep, StackedDrg32GiBV1_1_Feat_SyntheticPoRep, StackedDrg64GiBV1_1_Feat_SyntheticPoRep, + StackedDrg2KiBV1_1_Feat_NonInteractivePoRep, + StackedDrg8MiBV1_1_Feat_NonInteractivePoRep, + StackedDrg512MiBV1_1_Feat_NonInteractivePoRep, + StackedDrg32GiBV1_1_Feat_NonInteractivePoRep, + StackedDrg64GiBV1_1_Feat_NonInteractivePoRep, } impl From for RegisteredSealProof { @@ -90,6 +95,21 @@ impl From for RegisteredSealProof { StackedDrg64GiBV1_1_Feat_SyntheticPoRep => { RegisteredSealProof::StackedDrg64GiBV1_1_Feat_SyntheticPoRep } + StackedDrg2KiBV1_1_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg2KiBV1_1_Feat_NonInteractivePoRep + } + StackedDrg8MiBV1_1_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg8MiBV1_1_Feat_NonInteractivePoRep + } + StackedDrg512MiBV1_1_Feat_NonInteractivecPoRep => { + RegisteredSealProof::StackedDrg512MiBV1_1_Feat_NonInteractivePoRep + } + StackedDrg32GiBV1_1_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg32GiBV1_1_Feat_NonInteractivePoRep + } + StackedDrg64GiBV1_1_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg64GiBV1_1_Feat_NonInteractivePoRep + } } } } @@ -125,6 +145,22 @@ impl From for api::RegisteredSealProof { RegisteredSealProof::StackedDrg64GiBV1_1_Feat_SyntheticPoRep => { StackedDrg64GiBV1_1_Feat_SyntheticPoRep } + + RegisteredSealProof::StackedDrg2KiBV1_1_Feat_NonInteractivePoRep => { + StackedDrg2KiBV1_1_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg8MiBV1_1_Feat_NonInteractivePoRep => { + StackedDrg8MiBV1_1_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg512MiBV1_1_Feat_NonInteractivePoRep => { + StackedDrg512MiBV1_1_Feat_NonInteractivecPoRep + } + RegisteredSealProof::StackedDrg32GiBV1_1_Feat_NonInteractivePoRep => { + StackedDrg32GiBV1_1_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg64GiBV1_1_Feat_NonInteractivePoRep => { + StackedDrg64GiBV1_1_Feat_NonInteractivePoRep + } } } }