From 6399499e9be0b91183b343e35334ab3a0e03c035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 26 Mar 2020 00:04:40 +0100 Subject: [PATCH] Fix sealing sectors with multiple pieces --- api/test/deals.go | 2 +- chain/gen/gen.go | 5 ----- go.mod | 2 +- go.sum | 4 ++-- storage/sectorstorage/mock/mock.go | 13 +++---------- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/api/test/deals.go b/api/test/deals.go index 0f90fa87c..695000b70 100644 --- a/api/test/deals.go +++ b/api/test/deals.go @@ -43,7 +43,7 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration) { } time.Sleep(time.Second) - data := make([]byte, 1600) + data := make([]byte, 600) rand.New(rand.NewSource(5)).Read(data) r := bytes.NewReader(data) diff --git a/chain/gen/gen.go b/chain/gen/gen.go index c14c62b7d..c48a924eb 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -36,8 +36,6 @@ import ( "github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/node/repo" - "github.com/filecoin-project/lotus/storage/sectorstorage/mock" - "go.opencensus.io/trace" "golang.org/x/xerrors" ) @@ -689,9 +687,6 @@ var _ sectorbuilder.Verifier = (*genFakeVerifier)(nil) func (m genFakeVerifier) VerifyElectionPost(ctx context.Context, pvi abi.PoStVerifyInfo) (bool, error) { panic("nyi") } -func (m genFakeVerifier) GenerateDataCommitment(ssize abi.PaddedPieceSize, pieces []abi.PieceInfo) (cid.Cid, error) { - return mock.MockVerifier.GenerateDataCommitment(ssize, pieces) -} func (m genFakeVerifier) VerifySeal(svi abi.SealVerifyInfo) (bool, error) { return true, nil diff --git a/go.mod b/go.mod index e9c35cb3e..c8bad4191 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/filecoin-project/go-fil-markets v0.0.0-20200318012938-6403a5bda668 github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 - github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317221918-42574fc2aab9 + github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200325225948-053034f69825 github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 github.com/filecoin-project/go-statestore v0.1.0 github.com/filecoin-project/specs-actors v0.0.0-20200321055844-54fa2e8da1c2 diff --git a/go.sum b/go.sum index 78d4c8071..35a5154e7 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.m github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA= github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200311224656-7d83652bdbed/go.mod h1:xAd/X905Ncgj8kkHsP2pmQUf6MQT2qJTDcOEfkwCjYc= -github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317221918-42574fc2aab9 h1:ROfxm5X9dMATYk6MvNe8WBcL2yaelpgGEvve5CnZ1+g= -github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200317221918-42574fc2aab9/go.mod h1:3c3MEU9GHLlau37+MmefFNunTo9sVEKfjaJuHBgksdY= +github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200325225948-053034f69825 h1:T+ghJLZsXXn7UYoYFXCmoVlGcVOJo7e5VgTP6EnGlpg= +github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200325225948-053034f69825/go.mod h1:3c3MEU9GHLlau37+MmefFNunTo9sVEKfjaJuHBgksdY= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9 h1:k9qVR9ItcziSB2rxtlkN/MDWNlbsI6yzec+zjUatLW0= github.com/filecoin-project/go-statemachine v0.0.0-20200226041606-2074af6d51d9/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIiWBRilQjQ+5IiwdQ= diff --git a/storage/sectorstorage/mock/mock.go b/storage/sectorstorage/mock/mock.go index fdaae7f80..ca50ed189 100644 --- a/storage/sectorstorage/mock/mock.go +++ b/storage/sectorstorage/mock/mock.go @@ -159,7 +159,7 @@ func (sb *SectorMgr) SealPreCommit1(ctx context.Context, sid abi.SectorID, ticke } } - commd, err := MockVerifier.GenerateDataCommitment(abi.PaddedPieceSize(sb.sectorSize), pis) + commd, err := MockVerifier.GenerateDataCommitment(sb.proofType, pis) if err != nil { return nil, err } @@ -354,15 +354,8 @@ func (m mockVerif) VerifySeal(svi abi.SealVerifyInfo) (bool, error) { return true, nil } -func (m mockVerif) GenerateDataCommitment(ssize abi.PaddedPieceSize, pieces []abi.PieceInfo) (cid.Cid, error) { - if len(pieces) != 1 { - panic("todo") - } - if pieces[0].Size != ssize { - fmt.Println("wrong sizes? ", pieces[0].Size, ssize) - panic("todo") - } - return pieces[0].PieceCID, nil +func (m mockVerif) GenerateDataCommitment(pt abi.RegisteredProof, pieces []abi.PieceInfo) (cid.Cid, error) { + return sectorbuilder.GenerateUnsealedCID(pt, pieces) } var MockVerifier = mockVerif{}