From 6850784b1efe56e23bdd746368fce92609b734de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 17 Apr 2020 16:00:21 +0200 Subject: [PATCH] Move GenerateWinningPoStSectorChallenge to Verifier --- ffiwrapper/types.go | 2 ++ ffiwrapper/verifier_cgo.go | 10 +++++----- go.mod | 2 +- go.sum | 4 ++-- mock/mock.go | 8 ++++---- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ffiwrapper/types.go b/ffiwrapper/types.go index 876226429..98612175d 100644 --- a/ffiwrapper/types.go +++ b/ffiwrapper/types.go @@ -37,6 +37,8 @@ type Verifier interface { VerifySeal(abi.SealVerifyInfo) (bool, error) VerifyWinningPoSt(ctx context.Context, info abi.WinningPoStVerifyInfo) (bool, error) VerifyWindowPoSt(ctx context.Context, info abi.WindowPoStVerifyInfo) (bool, error) + + GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error) } var ErrSectorNotFound = errors.New("sector not found") diff --git a/ffiwrapper/verifier_cgo.go b/ffiwrapper/verifier_cgo.go index 662ff8d67..bf9a60c50 100644 --- a/ffiwrapper/verifier_cgo.go +++ b/ffiwrapper/verifier_cgo.go @@ -14,11 +14,6 @@ import ( "github.com/filecoin-project/sector-storage/stores" ) -func (sb *Sealer) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { - randomness[31] = 0 // TODO: Not correct, fixme - return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount) -} - func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) { randomness[31] = 0 // TODO: Not correct, fixme privsectors, err := sb.pubSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredProof.RegisteredWinningPoStProof) // TODO: FAULTS? @@ -98,3 +93,8 @@ func (proofVerifier) VerifyWindowPoSt(ctx context.Context, info abi.WindowPoStVe return ffi.VerifyWindowPoSt(info) } + +func (proofVerifier) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { + randomness[31] = 0 // TODO: Not correct, fixme + return ffi.GenerateWinningPoStSectorChallenge(proofType, minerID, randomness, eligibleSectorCount) +} diff --git a/go.mod b/go.mod index fb39fc9ae..c18f6874f 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/filecoin-project/go-paramfetch v0.0.1 github.com/filecoin-project/lotus v0.2.10 github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504 - github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 + github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102 github.com/gorilla/mux v1.7.4 github.com/hashicorp/go-multierror v1.0.0 github.com/ipfs/go-cid v0.0.5 diff --git a/go.sum b/go.sum index 81e4bf5ee..41c719485 100644 --- a/go.sum +++ b/go.sum @@ -107,8 +107,8 @@ github.com/filecoin-project/lotus v0.2.10 h1:ijrj/nYdKu5GiMo9r1+Zcp2A4jKHSOMZ2WN github.com/filecoin-project/lotus v0.2.10/go.mod h1:om5PQA9ZT0lf16qI7Fz/ZGLn4LDCMqPC8ntZA9uncRE= github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504 h1:mwuAaqxKThl70+7FkGdFKVLdwaQZQ8XmscKdhSBBtnc= github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504/go.mod h1:mdJraXq5vMy0+/FqVQIrnNlpQ/Em6zeu06G/ltQ0/lA= -github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs= -github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE= +github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102 h1:T3f/zkuvgtgqcXrb0NO3BicuveGOxxUAMPa/Yif2kuE= +github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1/go.mod h1:0eHX/BVySxPc6SE2mZRoppGq7qcEagxdmQnA3dzork8= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= diff --git a/mock/mock.go b/mock/mock.go index d55b40f5a..5ed879ce0 100644 --- a/mock/mock.go +++ b/mock/mock.go @@ -258,10 +258,6 @@ func AddOpFinish(ctx context.Context) (context.Context, func()) { } } -func (mgr *SectorMgr) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { - panic("implement me") -} - func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) { panic("implement me") } @@ -330,6 +326,10 @@ func (m mockVerif) GenerateDataCommitment(pt abi.RegisteredProof, pieces []abi.P return ffiwrapper.GenerateUnsealedCID(pt, pieces) } +func (m mockVerif) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { + panic("implement me") +} + var MockVerifier = mockVerif{} var _ ffiwrapper.Verifier = MockVerifier