Skip to content

Commit

Permalink
update ffi
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Mar 10, 2021
1 parent a6af81f commit 6e66b28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
Submodule filecoin-ffi updated 3 files
+5 −4 go.mod
+30 −35 go.sum
+41 −11 proofs.go
24 changes: 14 additions & 10 deletions extern/sector-storage/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"math/rand"
"sync"

proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
proof3 "github.com/filecoin-project/specs-actors/v3/actors/runtime/proof"

ffiwrapper2 "github.com/filecoin-project/go-commp-utils/ffiwrapper"
commcid "github.com/filecoin-project/go-fil-commcid"
Expand Down Expand Up @@ -291,12 +291,12 @@ func AddOpFinish(ctx context.Context) (context.Context, func()) {
}
}

func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, error) {
func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof3.SectorInfo, randomness abi.PoStRandomness) ([]proof3.PoStProof, error) {
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWinningPoStProof, randomness), nil
}

func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, []abi.SectorID, error) {
si := make([]proof2.SectorInfo, 0, len(sectorInfo))
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof3.SectorInfo, randomness abi.PoStRandomness) ([]proof3.PoStProof, []abi.SectorID, error) {
si := make([]proof3.SectorInfo, 0, len(sectorInfo))
var skipped []abi.SectorID

var err error
Expand Down Expand Up @@ -324,7 +324,7 @@ func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorI
return generateFakePoSt(si, abi.RegisteredSealProof.RegisteredWindowPoStProof, randomness), skipped, nil
}

func generateFakePoStProof(sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) []byte {
func generateFakePoStProof(sectorInfo []proof3.SectorInfo, randomness abi.PoStRandomness) []byte {
hasher := sha256.New()
_, _ = hasher.Write(randomness)
for _, info := range sectorInfo {
Expand All @@ -337,13 +337,13 @@ func generateFakePoStProof(sectorInfo []proof2.SectorInfo, randomness abi.PoStRa

}

func generateFakePoSt(sectorInfo []proof2.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []proof2.PoStProof {
func generateFakePoSt(sectorInfo []proof3.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []proof3.PoStProof {
wp, err := rpt(sectorInfo[0].SealProof)
if err != nil {
panic(err)
}

return []proof2.PoStProof{
return []proof3.PoStProof{
{
PoStProof: wp,
ProofBytes: generateFakePoStProof(sectorInfo, randomness),
Expand Down Expand Up @@ -468,7 +468,7 @@ func (mgr *SectorMgr) ReturnFetch(ctx context.Context, callID storiface.CallID,
panic("not supported")
}

func (m mockVerif) VerifySeal(svi proof2.SealVerifyInfo) (bool, error) {
func (m mockVerif) VerifySeal(svi proof3.SealVerifyInfo) (bool, error) {
plen, err := svi.SealProof.ProofSize()
if err != nil {
return false, err
Expand All @@ -488,11 +488,15 @@ func (m mockVerif) VerifySeal(svi proof2.SealVerifyInfo) (bool, error) {
return true, nil
}

func (m mockVerif) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) {
func (m mockVerif) VerifyAggregateSeals(aggregate proof3.AggregateSealVerifyProofAndInfos) (bool, error) {
panic("implement me")
}

func (m mockVerif) VerifyWinningPoSt(ctx context.Context, info proof3.WinningPoStVerifyInfo) (bool, error) {
return true, nil
}

func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) {
func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof3.WindowPoStVerifyInfo) (bool, error) {
if len(info.Proofs) != 1 {
return false, xerrors.Errorf("expected 1 proof entry")
}
Expand Down

0 comments on commit 6e66b28

Please sign in to comment.