Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package ffi
import (
"github.com/filecoin-project/filecoin-ffi/cgo"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
"github.com/filecoin-project/go-state-types/proof"
)

type FallbackChallenges struct {
Expand Down
9 changes: 3 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ go 1.17
require (
github.com/filecoin-project/go-address v0.0.6
github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-state-types v0.1.3
github.com/filecoin-project/specs-actors v0.9.14
github.com/filecoin-project/specs-actors/v5 v5.0.4
github.com/filecoin-project/specs-actors/v7 v7.0.0-rc1.0.20220118005651-2470cb39827e
github.com/filecoin-project/go-state-types v0.1.4
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-cid v0.1.0
github.com/ipfs/go-ipfs-blockstore v1.1.2
Expand All @@ -27,7 +24,7 @@ require (
github.com/ipfs/go-datastore v0.5.0 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-ipld-cbor v0.0.5 // indirect
github.com/ipfs/go-ipld-cbor v0.0.6-0.20211211231443-5d9b9e1f6fa8 // indirect
github.com/ipfs/go-ipld-format v0.2.0 // indirect
github.com/ipfs/go-log v1.0.4 // indirect
github.com/ipfs/go-log/v2 v2.0.5 // indirect
Expand All @@ -49,7 +46,7 @@ require (
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a // indirect
github.com/whyrusleeping/cbor-gen v0.0.0-20210713220151-be142a5ae1a8 // indirect
github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 // indirect
go.uber.org/atomic v1.6.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.14.1 // indirect
Expand Down
213 changes: 7 additions & 206 deletions go.sum

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@ import (
"os"
"runtime"

"github.com/filecoin-project/go-state-types/proof"

"github.com/ipfs/go-cid"
"github.com/pkg/errors"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
commcid "github.com/filecoin-project/go-fil-commcid"
"github.com/filecoin-project/go-state-types/abi"
proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"

"github.com/filecoin-project/filecoin-ffi/cgo"
)

// VerifySeal returns true if the sealing operation from which its inputs were
// derived was valid, and false if not.
func VerifySeal(info proof5.SealVerifyInfo) (bool, error) {
func VerifySeal(info proof.SealVerifyInfo) (bool, error) {
sp, err := toFilRegisteredSealProof(info.SealProof)
if err != nil {
return false, err
Expand All @@ -53,7 +54,7 @@ func VerifySeal(info proof5.SealVerifyInfo) (bool, error) {
return cgo.VerifySeal(sp, &commR, &commD, &proverID, &randomness, &interactiveRandomness, uint64(info.SectorID.Number), cgo.AsSliceRefUint8(info.Proof))
}

func VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProofAndInfos) (bool, error) {
func VerifyAggregateSeals(aggregate proof.AggregateSealVerifyProofAndInfos) (bool, error) {
if len(aggregate.Infos) == 0 {
return false, xerrors.New("no seal verify infos")
}
Expand Down Expand Up @@ -102,7 +103,7 @@ func VerifyAggregateSeals(aggregate proof5.AggregateSealVerifyProofAndInfos) (bo

// VerifyWinningPoSt returns true if the Winning PoSt-generation operation from which its
// inputs were derived was valid, and false if not.
func VerifyWinningPoSt(info proof5.WinningPoStVerifyInfo) (bool, error) {
func VerifyWinningPoSt(info proof.WinningPoStVerifyInfo) (bool, error) {
filPublicReplicaInfos, err := toFilPublicReplicaInfos(info.ChallengedSectors, "winning")
if err != nil {
return false, errors.Wrap(err, "failed to create public replica info array for FFI")
Expand All @@ -129,7 +130,7 @@ func VerifyWinningPoSt(info proof5.WinningPoStVerifyInfo) (bool, error) {

// VerifyWindowPoSt returns true if the Winning PoSt-generation operation from which its
// inputs were derived was valid, and false if not.
func VerifyWindowPoSt(info proof5.WindowPoStVerifyInfo) (bool, error) {
func VerifyWindowPoSt(info proof.WindowPoStVerifyInfo) (bool, error) {
filPublicReplicaInfos, err := toFilPublicReplicaInfos(info.ChallengedSectors, "window")
if err != nil {
return false, errors.Wrap(err, "failed to create public replica info array for FFI")
Expand Down Expand Up @@ -409,7 +410,7 @@ func SealCommitPhase2(
}

// TODO AggregateSealProofs it only needs InteractiveRandomness out of the aggregateInfo.Infos
func AggregateSealProofs(aggregateInfo proof5.AggregateSealVerifyProofAndInfos, proofs [][]byte) (out []byte, err error) {
func AggregateSealProofs(aggregateInfo proof.AggregateSealVerifyProofAndInfos, proofs [][]byte) (out []byte, err error) {
sp, err := toFilRegisteredSealProof(aggregateInfo.SealProof)
if err != nil {
return nil, err
Expand Down Expand Up @@ -539,7 +540,7 @@ func GenerateWinningPoSt(
minerID abi.ActorID,
privateSectorInfo SortedPrivateSectorInfo,
randomness abi.PoStRandomness,
) ([]proof5.PoStProof, error) {
) ([]proof.PoStProof, error) {
filReplicas, cleanup, err := toFilPrivateReplicaInfos(privateSectorInfo.Values(), "winning")
if err != nil {
return nil, errors.Wrap(err, "failed to create private replica info array for FFI")
Expand Down Expand Up @@ -569,7 +570,7 @@ func GenerateWindowPoSt(
minerID abi.ActorID,
privateSectorInfo SortedPrivateSectorInfo,
randomness abi.PoStRandomness,
) ([]proof5.PoStProof, []abi.SectorNumber, error) {
) ([]proof.PoStProof, []abi.SectorNumber, error) {
filReplicas, cleanup, err := toFilPrivateReplicaInfos(privateSectorInfo.Values(), "window")
if err != nil {
return nil, nil, errors.Wrap(err, "failed to create private replica info array for FFI")
Expand Down Expand Up @@ -689,7 +690,7 @@ func toFilPublicPieceInfos(src []abi.PieceInfo) ([]cgo.PublicPieceInfo, error) {
return out, nil
}

func toFilPublicReplicaInfos(src []proof5.SectorInfo, typ string) ([]cgo.PublicReplicaInfo, error) {
func toFilPublicReplicaInfos(src []proof.SectorInfo, typ string) ([]cgo.PublicReplicaInfo, error) {
out := make([]cgo.PublicReplicaInfo, len(src))

for idx := range out {
Expand Down Expand Up @@ -794,16 +795,16 @@ func fromFilPoStFaultySectors(ptr []uint64) []abi.SectorNumber {
return snums
}

func fromFilPoStProofs(src []cgo.PoStProofGo) ([]proof5.PoStProof, error) {
out := make([]proof5.PoStProof, len(src))
func fromFilPoStProofs(src []cgo.PoStProofGo) ([]proof.PoStProof, error) {
out := make([]proof.PoStProof, len(src))

for idx := range out {
pp, err := fromFilRegisteredPoStProof(src[idx].RegisteredProof)
if err != nil {
return nil, err
}

out[idx] = proof5.PoStProof{
out[idx] = proof.PoStProof{
PoStProof: pp,
ProofBytes: src[idx].Proof,
}
Expand All @@ -812,7 +813,7 @@ func fromFilPoStProofs(src []cgo.PoStProofGo) ([]proof5.PoStProof, error) {
return out, nil
}

func toFilPoStProofs(src []proof5.PoStProof) ([]cgo.PoStProof, error) {
func toFilPoStProofs(src []proof.PoStProof) ([]cgo.PoStProof, error) {
out := make([]cgo.PoStProof, len(src))
for idx := range out {
pp, err := toFilRegisteredPoStProof(src[idx].PoStProof)
Expand Down
2 changes: 1 addition & 1 deletion sector_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/filecoin-ffi/cgo"
commcid "github.com/filecoin-project/go-fil-commcid"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
"github.com/filecoin-project/go-state-types/proof"
"github.com/ipfs/go-cid"
"github.com/pkg/errors"
"golang.org/x/xerrors"
Expand Down
3 changes: 2 additions & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"encoding/json"
"sort"

"github.com/filecoin-project/go-state-types/proof"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/ipfs/go-cid"
)

Expand Down
13 changes: 7 additions & 6 deletions workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"os"
"path/filepath"

prooftypes "github.com/filecoin-project/go-state-types/proof"

"github.com/filecoin-project/go-state-types/abi"
prf "github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/ipfs/go-cid"
)

Expand Down Expand Up @@ -138,7 +139,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
t.RequireNoError(err)

// verify the 'ole proofy
isValid, err := VerifySeal(prf.SealVerifyInfo{
isValid, err := VerifySeal(prooftypes.SealVerifyInfo{
SectorID: abi.SectorID{
Miner: minerID,
Number: sectorNum,
Expand Down Expand Up @@ -218,7 +219,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
// generate a PoSt over the proving set before importing, just to exercise
// the new API
privateInfo := NewSortedPrivateSectorInfo(PrivateSectorInfo{
SectorInfo: prf.SectorInfo{
SectorInfo: prooftypes.SectorInfo{
SectorNumber: sectorNum,
SealedCID: sealedCID,
},
Expand All @@ -227,7 +228,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
SealedSectorPath: sealedSectorFile.Name(),
})

provingSet := []prf.SectorInfo{{
provingSet := []prooftypes.SectorInfo{{
SealProof: sealProofType,
SectorNumber: sectorNum,
SealedCID: sealedCID,
Expand All @@ -237,15 +238,15 @@ func WorkflowProofsLifecycle(t TestHelper) {
indicesInProvingSet, err := GenerateWinningPoStSectorChallenge(winningPostProofType, minerID, randomness[:], uint64(len(provingSet)))
t.RequireNoError(err)

var challengedSectors []prf.SectorInfo
var challengedSectors []prooftypes.SectorInfo
for idx := range indicesInProvingSet {
challengedSectors = append(challengedSectors, provingSet[indicesInProvingSet[idx]])
}

proofs, err := GenerateWinningPoSt(minerID, privateInfo, randomness[:])
t.RequireNoError(err)

isValid, err = VerifyWinningPoSt(prf.WinningPoStVerifyInfo{
isValid, err = VerifyWinningPoSt(prooftypes.WinningPoStVerifyInfo{
Randomness: randomness[:],
Proofs: proofs,
ChallengedSectors: challengedSectors,
Expand Down