Skip to content

Commit

Permalink
Clean up print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed Nov 22, 2021
1 parent c2ba302 commit 2e37de1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
5 changes: 0 additions & 5 deletions extern/sector-storage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ func (m *Manager) Remove(ctx context.Context, sector storage.SectorRef) error {
func (m *Manager) ProveReplicaUpdate(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (out storage.ReplicaUpdateProof, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
fmt.Printf("Manager, getting worker\n")

wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTProveReplicaUpdate, sector, sectorKey, newSealed, newUnsealed)
if err != nil {
Expand All @@ -647,7 +646,6 @@ func (m *Manager) ProveReplicaUpdate(ctx context.Context, sector storage.SectorR
waitRes := func() {
p, werr := m.waitWork(ctx, wk)
if werr != nil {
fmt.Printf("yo\n")
waitErr = werr
return
}
Expand Down Expand Up @@ -678,7 +676,6 @@ func (m *Manager) ProveReplicaUpdate(ctx context.Context, sector storage.SectorR
return nil
})
if err != nil {
fmt.Printf("yoyo\n")
return nil, err
}

Expand All @@ -688,7 +685,6 @@ func (m *Manager) ProveReplicaUpdate(ctx context.Context, sector storage.SectorR
func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (out storage.ReplicaUpdateOut, err error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
fmt.Printf("Manager, getting worker\n")

wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTReplicaUpdate, sector, pieces)
if err != nil {
Expand All @@ -703,7 +699,6 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
waitErr = werr
return
}
fmt.Printf("worker out from manager: %v\n", p)
if p != nil {
out = p.(storage.ReplicaUpdateOut)
}
Expand Down
19 changes: 9 additions & 10 deletions extern/sector-storage/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/google/uuid"
"github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-state-types/abi"
Expand Down Expand Up @@ -66,11 +67,11 @@ func newTestStorage(t *testing.T) *testStorage {
}

func (t testStorage) cleanup() {
// for _, path := range t.StoragePaths {
// if err := os.RemoveAll(path.Path); err != nil {
// fmt.Println("Cleanup error:", err)
// }
// }
for _, path := range t.StoragePaths {
if err := os.RemoveAll(path.Path); err != nil {
fmt.Println("Cleanup error:", err)
}
}
}

func (t testStorage) GetStorage() (stores.StorageConfig, error) {
Expand Down Expand Up @@ -243,15 +244,13 @@ func TestSnapDeals(t *testing.T) {
updateProofType, err := sid.ProofType.RegisteredUpdateProof()
require.NoError(t, err)
require.NotNil(t, out)
_ = sectorKey
_ = updateProofType
fmt.Printf("PR\n")
proof, err := m.ProveReplicaUpdate(ctx, sid, sectorKey, out.NewSealed, out.NewUnsealed)
require.NoError(t, err)
require.NotNil(t, proof)
// pass, err := ffiwrapper.ProofVerifier.VerifyReplicaUpdate(ctx, updateProofType, proof, sectorKey, out.NewSealed, out.NewUnsealed)
// require.NoError(t, err)
// assert.True(t, pass)
pass, err := ffiwrapper.ProofVerifier.VerifyReplicaUpdate(ctx, updateProofType, proof, sectorKey, out.NewSealed, out.NewUnsealed)
require.NoError(t, err)
assert.True(t, pass)
}

func TestRedoPC1(t *testing.T) {
Expand Down
5 changes: 0 additions & 5 deletions extern/sector-storage/worker_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sectorstorage
import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"reflect"
Expand Down Expand Up @@ -127,8 +126,6 @@ type localWorkerPathProvider struct {
func (l *localWorkerPathProvider) AcquireSector(ctx context.Context, sector storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) {
paths, storageIDs, err := l.w.storage.AcquireSector(ctx, sector, existing, allocate, sealing, l.op)
if err != nil {
fmt.Printf("local worker path provider failure\n")
panic(err)
return storiface.SectorPaths{}, nil, err
}

Expand All @@ -148,7 +145,6 @@ func (l *localWorkerPathProvider) AcquireSector(ctx context.Context, sector stor
}

sid := storiface.PathByType(storageIDs, fileType)
fmt.Printf("Declaring sector at path: %s\n", sid)
if err := l.w.sindex.StorageDeclareSector(ctx, stores.ID(sid), sector.ID, fileType, l.op == storiface.AcquireMove); err != nil {
log.Errorf("declare sector error: %+v", err)
}
Expand Down Expand Up @@ -322,7 +318,6 @@ func (l *LocalWorker) AddPiece(ctx context.Context, sector storage.SectorRef, ep

func (l *LocalWorker) Fetch(ctx context.Context, sector storage.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) {
return l.asyncCall(ctx, sector, Fetch, func(ctx context.Context, ci storiface.CallID) (interface{}, error) {
fmt.Printf("File type acquired: %b\n", fileType)
_, done, err := (&localWorkerPathProvider{w: l, op: am}).AcquireSector(ctx, sector, fileType, storiface.FTNone, ptype)
if err == nil {
done()
Expand Down

0 comments on commit 2e37de1

Please sign in to comment.