diff --git a/lib/sectorbuilder/sectorbuilder.go b/lib/sectorbuilder/sectorbuilder.go index 28b7a71b9..b8c015cdc 100644 --- a/lib/sectorbuilder/sectorbuilder.go +++ b/lib/sectorbuilder/sectorbuilder.go @@ -282,37 +282,6 @@ func (sb *SectorBuilder) SealCommit(sectorID uint64, ticket SealTicket, seed Sea return nil, xerrors.Errorf("StandaloneSealCommit: %w", err) } - pmeta := make([]sectorbuilder.PieceMetadata, len(pieces)) - for i, piece := range pieces { - pmeta[i] = sectorbuilder.PieceMetadata{ - Key: pieceKeys[i], - Size: piece.Size, - CommP: piece.CommP, - } - } - - /* sealedPath, err := sb.sealedSectorPath(sectorID) - if err != nil { - return nil, err - } - - err = sectorbuilder.ImportSealedSector( - sb.handle, - sectorID, - cacheDir, - sealedPath, - ticket, - seed, - rspco.CommR, - rspco.CommD, - rspco.CommC, - rspco.CommRLast, - proof, - pmeta, - ) - if err != nil { - return nil, xerrors.Errorf("ImportSealedSector: %w", err) - }*/ return proof, nil } diff --git a/lib/sectorbuilder/sectorbuilder_test.go b/lib/sectorbuilder/sectorbuilder_test.go index 4f5c111fb..39e0a2bd1 100644 --- a/lib/sectorbuilder/sectorbuilder_test.go +++ b/lib/sectorbuilder/sectorbuilder_test.go @@ -21,7 +21,6 @@ import ( ) const sectorSize = 1024 - type seal struct { sid uint64 @@ -77,7 +76,7 @@ func (s *seal) commit(t *testing.T, sb *sectorbuilder.SectorBuilder, done func() done() } -func (s *seal) post(t *testing.T, sb *sectorbuilder.SectorBuilder) { +func (s *seal) post(t *testing.T, sb *sectorbuilder.SectorBuilder) time.Time { cSeed := [32]byte{0, 9, 2, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9} ssi := sectorbuilder.NewSortedPublicSectorInfo([]sectorbuilder.PublicSectorInfo{{ @@ -90,6 +89,12 @@ func (s *seal) post(t *testing.T, sb *sectorbuilder.SectorBuilder) { t.Fatalf("%+v", err) } + genCandidates := time.Now() + + if len(candndates) != 1 { + t.Fatal("expected 1 candidate") + } + postProof, err := sb.ComputeElectionPoSt(ssi, cSeed[:], candndates) if err != nil { t.Fatalf("%+v", err) @@ -102,6 +107,8 @@ func (s *seal) post(t *testing.T, sb *sectorbuilder.SectorBuilder) { if !ok { t.Fatal("bad post") } + + return genCandidates } func TestSealAndVerify(t *testing.T) { @@ -147,11 +154,19 @@ func TestSealAndVerify(t *testing.T) { s := seal{sid: si} + start := time.Now() + s.precommit(t, sb, 1, func() {}) + precommit := time.Now() + s.commit(t, sb, func() {}) - s.post(t, sb) + commit := time.Now() + + genCandidiates := s.post(t, sb) + + epost := time.Now() // Restart sectorbuilder, re-run post sb.Destroy() @@ -161,6 +176,11 @@ func TestSealAndVerify(t *testing.T) { } s.post(t, sb) + + fmt.Printf("PreCommit: %s\n", precommit.Sub(start).String()) + fmt.Printf("Commit: %s\n", commit.Sub(precommit).String()) + fmt.Printf("GenCandidates: %s\n", genCandidiates.Sub(commit).String()) + fmt.Printf("EPoSt: %s\n", epost.Sub(genCandidiates).String()) } func TestSealAndVerify2(t *testing.T) {