diff --git a/.circleci/config.yml b/.circleci/config.yml index ca3e97e4..bfc86b83 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,7 +6,7 @@ orbs: executors: golang: docker: - - image: cimg/go:1.20 + - image: cimg/go:1.21 resource_class: small environment: # Build the kernel only for the single architecture. This should reduce @@ -56,7 +56,7 @@ jobs: type: boolean default: true machine: - image: ubuntu-2204:2023.07.2 + image: default resource_class: arm.large working_directory: ~/go/src/github.com/filecoin-project/filecoin-ffi steps: @@ -78,7 +78,7 @@ jobs: type: boolean default: true executor: golang - resource_class: medium + resource_class: medium+ working_directory: ~/go/src/github.com/filecoin-project/filecoin-ffi steps: - configure_environment_variables @@ -232,7 +232,7 @@ commands: - run: name: Install Go command: | - curl https://dl.google.com/go/go1.20.10.darwin-arm64.pkg -o /tmp/go.pkg && \ + curl https://go.dev/dl/go1.21.11.darwin-arm64.pkg -o /tmp/go.pkg && \ sudo installer -pkg /tmp/go.pkg -target / go version - run: @@ -352,13 +352,13 @@ commands: no_output_timeout: 90m - run: name: Run the Go tests - command: GODEBUG=cgocheck=2 RUST_LOG=info go test -p 1 -timeout 60m + command: GOEXPERIMENT=cgocheck2 RUST_LOG=info go test -p 1 -timeout 60m no_output_timeout: 60m compile_tests: steps: - run: name: Build project and tests, but don't actually run the tests (used to verify that build/link works with Darwin) - command: GODEBUG=cgocheck=2 RUST_LOG=info go test -run=^$ + command: GOEXPERIMENT=cgocheck2 RUST_LOG=info go test -run=^$ restore_parameter_cache: steps: - restore_cache: diff --git a/cgo/const.go b/cgo/const.go index 05e84419..4710af40 100644 --- a/cgo/const.go +++ b/cgo/const.go @@ -16,21 +16,26 @@ const ( ) const ( - RegisteredSealProofStackedDrg2KiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1 - RegisteredSealProofStackedDrg8MiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1 - RegisteredSealProofStackedDrg512MiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1 - RegisteredSealProofStackedDrg32GiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1 - RegisteredSealProofStackedDrg64GiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1 - RegisteredSealProofStackedDrg2KiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1_1 - RegisteredSealProofStackedDrg8MiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1_1 - RegisteredSealProofStackedDrg512MiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1_1 - RegisteredSealProofStackedDrg32GiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1_1 - RegisteredSealProofStackedDrg64GiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1_1 - RegisteredSealProofStackedDrg2KiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1_1__FEAT__SYNTHETIC_PO_REP - RegisteredSealProofStackedDrg8MiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1_1__FEAT__SYNTHETIC_PO_REP - RegisteredSealProofStackedDrg512MiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1_1__FEAT__SYNTHETIC_PO_REP - RegisteredSealProofStackedDrg32GiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1_1__FEAT__SYNTHETIC_PO_REP - RegisteredSealProofStackedDrg64GiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg2KiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1 + RegisteredSealProofStackedDrg8MiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1 + RegisteredSealProofStackedDrg512MiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1 + RegisteredSealProofStackedDrg32GiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1 + RegisteredSealProofStackedDrg64GiBV1 = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1 + RegisteredSealProofStackedDrg2KiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1_1 + RegisteredSealProofStackedDrg8MiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1_1 + RegisteredSealProofStackedDrg512MiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1_1 + RegisteredSealProofStackedDrg32GiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1_1 + RegisteredSealProofStackedDrg64GiBV11 = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1_1 + RegisteredSealProofStackedDrg2KiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg8MiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg512MiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg32GiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg64GiBV11_Feat_SyntheticPoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1_1__FEAT__SYNTHETIC_PO_REP + RegisteredSealProofStackedDrg2KiBV1_2_Feat_NonInteractivePoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG2_KI_B_V1_2__FEAT__NON_INTERACTIVE_PO_REP + RegisteredSealProofStackedDrg8MiBV1_2_Feat_NonInteractivePoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG8_MI_B_V1_2__FEAT__NON_INTERACTIVE_PO_REP + RegisteredSealProofStackedDrg512MiBV1_2_Feat_NonInteractivePoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG512_MI_B_V1_2__FEAT__NON_INTERACTIVE_PO_REP + RegisteredSealProofStackedDrg32GiBV1_2_Feat_NonInteractivePoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG32_GI_B_V1_2__FEAT__NON_INTERACTIVE_PO_REP + RegisteredSealProofStackedDrg64GiBV1_2_Feat_NonInteractivePoRep = C.REGISTERED_SEAL_PROOF_STACKED_DRG64_GI_B_V1_2__FEAT__NON_INTERACTIVE_PO_REP ) const ( diff --git a/cgo/proofs.go b/cgo/proofs.go index a2a7f96c..3f4bc4d8 100644 --- a/cgo/proofs.go +++ b/cgo/proofs.go @@ -130,6 +130,15 @@ func SealCommitPhase2(sealCommitPhase1Output SliceRefUint8, sectorId uint64, pro return resp.value.copy(), nil } +func SealCommitPhase2CircuitProofs(sealCommitPhase1Output SliceRefUint8, sectorId uint64) ([]byte, error) { + resp := C.seal_commit_phase2_circuit_proofs(sealCommitPhase1Output, C.uint64_t(sectorId)) + defer resp.destroy() + if err := CheckErr(resp); err != nil { + return nil, err + } + return resp.value.copy(), nil +} + func AggregateSealProofs(registeredProof RegisteredSealProof, registeredAggregation RegisteredAggregationProof, commRs SliceRefByteArray32, seeds SliceRefByteArray32, sealCommitResponses SliceRefSliceBoxedUint8) ([]byte, error) { resp := C.aggregate_seal_proofs(registeredProof, registeredAggregation, commRs, seeds, sealCommitResponses) defer resp.destroy() diff --git a/go.mod b/go.mod index 7086e744..c5649679 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/filecoin-project/go-address v1.1.0 github.com/filecoin-project/go-fil-commcid v0.1.0 - github.com/filecoin-project/go-state-types v0.13.1 + github.com/filecoin-project/go-state-types v0.14.0-rc1 github.com/ipfs/go-block-format v0.0.3 github.com/ipfs/go-cid v0.3.2 github.com/ipfs/go-ipfs-blockstore v1.2.0 diff --git a/go.sum b/go.sum index 63813a98..230d503d 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/filecoin-project/go-crypto v0.0.1 h1:AcvpSGGCgjaY8y1az6AMfKQWreF/pWO2 github.com/filecoin-project/go-crypto v0.0.1/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88OqLYEo6roi+GiIeOh8= github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= -github.com/filecoin-project/go-state-types v0.13.1 h1:4CivvlcHAIoAtFFVVlZtokynaMQu5XLXGoTKhQkfG1I= -github.com/filecoin-project/go-state-types v0.13.1/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY= +github.com/filecoin-project/go-state-types v0.14.0-rc1 h1:kWBGX/uqZmYotYMNmw+R/fIuot/k0KMcEtB7PKFy1SQ= +github.com/filecoin-project/go-state-types v0.14.0-rc1/go.mod h1:cHpOPup9H1g2T29dKHAjC2sc7/Ef5ypjuW9A3I+e9yY= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= diff --git a/proofs.go b/proofs.go index 6e7ab3e3..3b63e6ea 100644 --- a/proofs.go +++ b/proofs.go @@ -414,6 +414,13 @@ func SealCommitPhase2( return cgo.SealCommitPhase2(cgo.AsSliceRefUint8(phase1Output), uint64(sectorNum), &proverID) } +// SealCommitPhase2CircuitProofs runs a non-interactive proof and returns the circuit proof bytes +// rather than the aggregated proof bytes. This is used to aggregate multiple non-interactive +// proofs as the aggregated single proof outputs can't further be aggregated. +func SealCommitPhase2CircuitProofs(phase1Output []byte, sectorNum abi.SectorNumber) ([]byte, error) { + return cgo.SealCommitPhase2CircuitProofs(cgo.AsSliceRefUint8(phase1Output), uint64(sectorNum)) +} + // TODO AggregateSealProofs it only needs InteractiveRandomness out of the aggregateInfo.Infos func AggregateSealProofs(aggregateInfo proof.AggregateSealVerifyProofAndInfos, proofs [][]byte) (out []byte, err error) { sp, err := toFilRegisteredSealProof(aggregateInfo.SealProof) @@ -1030,6 +1037,17 @@ func toFilRegisteredSealProof(p abi.RegisteredSealProof) (cgo.RegisteredSealProo case abi.RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep: return cgo.RegisteredSealProofStackedDrg64GiBV11_Feat_SyntheticPoRep, nil + case abi.RegisteredSealProof_StackedDrg2KiBV1_2_Feat_NiPoRep: + return cgo.RegisteredSealProofStackedDrg2KiBV1_2_Feat_NonInteractivePoRep, nil + case abi.RegisteredSealProof_StackedDrg8MiBV1_2_Feat_NiPoRep: + return cgo.RegisteredSealProofStackedDrg8MiBV1_2_Feat_NonInteractivePoRep, nil + case abi.RegisteredSealProof_StackedDrg512MiBV1_2_Feat_NiPoRep: + return cgo.RegisteredSealProofStackedDrg512MiBV1_2_Feat_NonInteractivePoRep, nil + case abi.RegisteredSealProof_StackedDrg32GiBV1_2_Feat_NiPoRep: + return cgo.RegisteredSealProofStackedDrg32GiBV1_2_Feat_NonInteractivePoRep, nil + case abi.RegisteredSealProof_StackedDrg64GiBV1_2_Feat_NiPoRep: + return cgo.RegisteredSealProofStackedDrg64GiBV1_2_Feat_NonInteractivePoRep, nil + default: return 0, errors.Errorf("no mapping to C.FFIRegisteredSealProof value available for: %v", p) } diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a09295ae..cc22804d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1267,16 +1267,16 @@ dependencies = [ "blstrs", "cid", "fil_logger", - "filecoin-proofs-api 17.0.0", + "filecoin-proofs-api 18.0.1", "filepath", "fvm 2.7.0", "fvm 3.9.0", - "fvm 4.2.0", + "fvm 4.3.0", "fvm_ipld_blockstore", "fvm_ipld_encoding", "fvm_shared 2.6.0", "fvm_shared 3.6.0", - "fvm_shared 4.2.0", + "fvm_shared 4.3.0", "group", "lazy_static", "libc", @@ -1371,9 +1371,9 @@ dependencies = [ [[package]] name = "filecoin-proofs" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603e01ee23938c72e88d9b2e42e5e93305695f695d96869e8a77f0abfe8a58ca" +checksum = "7bc4556330a546dc0453b78a96a0bf4fa1042468c868056d4da6df09e11578e1" dependencies = [ "anyhow", "bellperson", @@ -1396,10 +1396,10 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "storage-proofs-core 17.0.0", - "storage-proofs-porep 17.0.0", - "storage-proofs-post 17.0.0", - "storage-proofs-update 17.0.0", + "storage-proofs-core 18.0.0", + "storage-proofs-porep 18.0.0", + "storage-proofs-post 18.0.0", + "storage-proofs-update 18.0.0", "typenum", ] @@ -1423,20 +1423,20 @@ dependencies = [ [[package]] name = "filecoin-proofs-api" -version = "17.0.0" +version = "18.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6fa943fd047d01f1d73d73a8c23284cec6d2cbc2c06ed2490b002f45fc1a1f" +checksum = "ee014160be200ac673975849fd19a97d62385561875e117974384a9861a78e3c" dependencies = [ "anyhow", "bellperson", "bincode", "blstrs", "filecoin-hashers 12.0.0", - "filecoin-proofs 17.0.0", + "filecoin-proofs 18.0.0", "fr32 10.0.0", "lazy_static", "serde", - "storage-proofs-core 17.0.0", + "storage-proofs-core 18.0.0", ] [[package]] @@ -1619,21 +1619,21 @@ dependencies = [ [[package]] name = "fvm" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b31422270e0665c2f12f91a46e3bf1e164dcab41c7d5d44006418261c71def64" +checksum = "b332a90abacf84345666bf4debc44c3d63392cd4c3add72ddf8624114af32e1f" dependencies = [ "ambassador", "anyhow", "cid", "derive_more", - "filecoin-proofs-api 16.1.0", + "filecoin-proofs-api 18.0.1", "fvm-wasm-instrument 0.4.0", "fvm_ipld_amt", "fvm_ipld_blockstore", "fvm_ipld_encoding", "fvm_ipld_hamt 0.9.0", - "fvm_shared 4.2.0", + "fvm_shared 4.3.0", "lazy_static", "log", "minstant", @@ -1819,9 +1819,9 @@ dependencies = [ [[package]] name = "fvm_shared" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19de4747a883b0f1ed8b9200c188d87ebcc70f7c10c07f7f64d7fc5fb192d085" +checksum = "31841282c98f3acd78c741f1e38ecebc97e72243c4ecb73a658f6529246a35a5" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -1830,7 +1830,7 @@ dependencies = [ "cid", "data-encoding", "data-encoding-macro", - "filecoin-proofs-api 16.1.0", + "filecoin-proofs-api 18.0.1", "fvm_ipld_encoding", "lazy_static", "libsecp256k1", @@ -3225,9 +3225,9 @@ dependencies = [ [[package]] name = "sha2raw" -version = "12.0.0" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feded6280f0d7f7a1ca3844382989af1ea5c64a13a33e684f53d042a3f0764e1" +checksum = "c4fb0d53488062a1046306498d36c54dbfe122869858e2ad325fd72bcb09f31d" dependencies = [ "byteorder", "cpufeatures", @@ -3340,9 +3340,9 @@ dependencies = [ [[package]] name = "storage-proofs-core" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a60aa2117461828118ae1eb23a49c539623149f7a6269c90baaf45d02827aa" +checksum = "e0406d7746764226f576e731e56b8fa3a6f4be1c44349208de96a2c89ffd9efa" dependencies = [ "aes", "anyhow", @@ -3417,9 +3417,9 @@ dependencies = [ [[package]] name = "storage-proofs-porep" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92157c35e945b90e3dafb4dce0d99965d3df55ad69ff86d6ee8d3b8b54df9060" +checksum = "6fae1fe05e2ddfa0edaac80906482c520825c5258f9f0d7fada953bd33d29d9f" dependencies = [ "anyhow", "bellperson", @@ -3453,8 +3453,8 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "sha2raw 12.0.0", - "storage-proofs-core 17.0.0", + "sha2raw 13.0.1", + "storage-proofs-core 18.0.0", "yastl", ] @@ -3483,9 +3483,9 @@ dependencies = [ [[package]] name = "storage-proofs-post" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddea4a60bc3345cd79db304d334f7cc1d224426e90d7a56cecd5af2f3ac832ce" +checksum = "f730bb7fe8f4e6a8f5e9ffef64fbc2e2a2c5bfd842d68c20f27c93c7dc9344dd" dependencies = [ "anyhow", "bellperson", @@ -3498,7 +3498,7 @@ dependencies = [ "rayon", "serde", "sha2 0.10.8", - "storage-proofs-core 17.0.0", + "storage-proofs-core 18.0.0", ] [[package]] @@ -3527,9 +3527,9 @@ dependencies = [ [[package]] name = "storage-proofs-update" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52ccc35b051adf08c76317b5a25308c58110a791570a0df2ee3e72b5be98c6a" +checksum = "992332381b33d7a4e00af874121fdd52982390d6902a51767b4087fceb439321" dependencies = [ "anyhow", "bellperson", @@ -3545,8 +3545,8 @@ dependencies = [ "neptune", "rayon", "serde", - "storage-proofs-core 17.0.0", - "storage-proofs-porep 17.0.0", + "storage-proofs-core 18.0.0", + "storage-proofs-porep 18.0.0", ] [[package]] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 3bf11356..c33ccf73 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -31,8 +31,8 @@ rayon = "1.2.1" anyhow = "1.0.23" serde_json = "1.0.46" rust-gpu-tools = { version = "0.7", optional = true, default-features = false } -fvm4 = { package = "fvm", version = "~4.2.0", default-features = false, features = ["nv23-dev"] } -fvm4_shared = { package = "fvm_shared", version = "~4.2.0" } +fvm4 = { package = "fvm", version = "~4.3.0", default-features = false, features = ["nv23-dev"] } +fvm4_shared = { package = "fvm_shared", version = "~4.3.0" } fvm3 = { package = "fvm", version = "~3.9.0", default-features = false } fvm3_shared = { package = "fvm_shared", version = "~3.6.0" } fvm2 = { package = "fvm", version = "~2.7", default-features = false } @@ -45,7 +45,7 @@ lazy_static = "1.4.0" serde = "1.0.117" serde_tuple = "0.5" safer-ffi = { version = "0.0.7", features = ["proc_macros"] } -filecoin-proofs-api = { version = "17.0", default-features = false } +filecoin-proofs-api = { version = "18.0", default-features = false } yastl = "0.1.2" [dev-dependencies] diff --git a/rust/src/proofs/api.rs b/rust/src/proofs/api.rs index cd00a698..2b145e94 100644 --- a/rust/src/proofs/api.rs +++ b/rust/src/proofs/api.rs @@ -294,6 +294,36 @@ fn seal_commit_phase2( }) } +/// This function generates a variant of the circuit proof for the second phase of the sealing +/// process. It takes as input the output from the first phase of the sealing process +/// [`seal_commit_phase1`] and a sector ID. +/// +/// This variant of `seal_commit_phase2` is intended specifically for returning the circuit proofs +/// of a NonInteractivePoRep proof, such that it can later be aggregated with other +/// NonInteractivePoRep proofs. +/// +/// # Arguments +/// +/// * `seal_commit_phase1_output` - A reference to a slice of bytes representing the output from the +/// first phase of the sealing process. +/// * `sector_id` - A 64-bit integer representing the sector ID. +/// +/// # Returns +/// This function returns a `SealCommitPhase2Response` wrapped in a `repr_c::Box`. This response +/// includes the proof generated in this phase of the sealing process. +#[ffi_export] +fn seal_commit_phase2_circuit_proofs( + seal_commit_phase1_output: c_slice::Ref, + sector_id: u64, +) -> repr_c::Box { + catch_panic_response("seal_commit_phase2_circuit_proofs", || { + let scp1o = serde_json::from_slice(&seal_commit_phase1_output)?; + let result = seal::seal_commit_phase2_circuit_proofs(scp1o, SectorId::from(sector_id))?; + + Ok(result.proof.into_boxed_slice().into()) + }) +} + /// TODO: document #[ffi_export] fn generate_synth_proofs( @@ -1674,6 +1704,7 @@ pub mod tests { RegisteredSealProof::StackedDrg2KiBV1, RegisteredSealProof::StackedDrg2KiBV1_1, RegisteredSealProof::StackedDrg2KiBV1_1_Feat_SyntheticPoRep, + RegisteredSealProof::StackedDrg2KiBV1_2_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..d8bbe4eb 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_2_Feat_NonInteractivePoRep, + StackedDrg8MiBV1_2_Feat_NonInteractivePoRep, + StackedDrg512MiBV1_2_Feat_NonInteractivePoRep, + StackedDrg32GiBV1_2_Feat_NonInteractivePoRep, + StackedDrg64GiBV1_2_Feat_NonInteractivePoRep, } impl From for RegisteredSealProof { @@ -90,6 +95,21 @@ impl From for RegisteredSealProof { StackedDrg64GiBV1_1_Feat_SyntheticPoRep => { RegisteredSealProof::StackedDrg64GiBV1_1_Feat_SyntheticPoRep } + StackedDrg2KiBV1_2_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg2KiBV1_2_Feat_NonInteractivePoRep + } + StackedDrg8MiBV1_2_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg8MiBV1_2_Feat_NonInteractivePoRep + } + StackedDrg512MiBV1_2_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg512MiBV1_2_Feat_NonInteractivePoRep + } + StackedDrg32GiBV1_2_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg32GiBV1_2_Feat_NonInteractivePoRep + } + StackedDrg64GiBV1_2_Feat_NonInteractivePoRep => { + RegisteredSealProof::StackedDrg64GiBV1_2_Feat_NonInteractivePoRep + } } } } @@ -125,6 +145,22 @@ impl From for api::RegisteredSealProof { RegisteredSealProof::StackedDrg64GiBV1_1_Feat_SyntheticPoRep => { StackedDrg64GiBV1_1_Feat_SyntheticPoRep } + + RegisteredSealProof::StackedDrg2KiBV1_2_Feat_NonInteractivePoRep => { + StackedDrg2KiBV1_2_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg8MiBV1_2_Feat_NonInteractivePoRep => { + StackedDrg8MiBV1_2_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg512MiBV1_2_Feat_NonInteractivePoRep => { + StackedDrg512MiBV1_2_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg32GiBV1_2_Feat_NonInteractivePoRep => { + StackedDrg32GiBV1_2_Feat_NonInteractivePoRep + } + RegisteredSealProof::StackedDrg64GiBV1_2_Feat_NonInteractivePoRep => { + StackedDrg64GiBV1_2_Feat_NonInteractivePoRep + } } } }