diff --git a/api/test/deals.go b/api/test/deals.go index 735c6063b..237a8f627 100644 --- a/api/test/deals.go +++ b/api/test/deals.go @@ -67,7 +67,7 @@ func TestDealFlow(t *testing.T, b APIBuilder) { time.Sleep(time.Second) fmt.Println("mining a block now") if err := sn[0].MineOne(ctx); err != nil { - t.Fatal(err) + t.Error(err) } } }() diff --git a/build/bootstrap.go b/build/bootstrap.go index 9d9c3e9f1..ca6cc26ce 100644 --- a/build/bootstrap.go +++ b/build/bootstrap.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/filecoin-project/lotus/lib/addrutil" + "golang.org/x/xerrors" rice "github.com/GeertJohan/go.rice" "github.com/libp2p/go-libp2p-core/peer" @@ -16,6 +17,10 @@ func BuiltinBootstrap() ([]peer.AddrInfo, error) { b := rice.MustFindBox("bootstrap") err := b.Walk("", func(path string, info os.FileInfo, err error) error { + if err != nil { + return xerrors.Errorf("failed to walk box: %w", err) + } + if !strings.HasSuffix(path, ".pi") { return nil } diff --git a/chain/deals/client.go b/chain/deals/client.go index 946e6cb93..988bc52b6 100644 --- a/chain/deals/client.go +++ b/chain/deals/client.go @@ -199,6 +199,9 @@ func (c *Client) Start(ctx context.Context, p ClientDealProposal) (cid.Cid, erro } commP, pieceSize, err := c.commP(ctx, p.Data) + if err != nil { + return cid.Undef, xerrors.Errorf("computing commP failed: %w", err) + } dealProposal := &actors.StorageDealProposal{ PieceRef: commP, diff --git a/chain/deals/provider.go b/chain/deals/provider.go index ec9a08d60..7716d88e4 100644 --- a/chain/deals/provider.go +++ b/chain/deals/provider.go @@ -80,7 +80,7 @@ type minerDealUpdate struct { var ( // ErrDataTransferFailed means a data transfer for a deal failed - ErrDataTransferFailed = errors.New("Deal data transfer failed") + ErrDataTransferFailed = errors.New("deal data transfer failed") ) func NewProvider(ds dtypes.MetadataDS, sminer *storage.Miner, secb *sectorblocks.SectorBlocks, dag dtypes.StagingDAG, dataTransfer dtypes.ProviderDataTransfer, fullNode api.FullNode) (*Provider, error) { diff --git a/chain/deals/provider_states.go b/chain/deals/provider_states.go index 2ac1c9f6a..56843e7d0 100644 --- a/chain/deals/provider_states.go +++ b/chain/deals/provider_states.go @@ -168,6 +168,9 @@ func (p *Provider) accept(ctx context.Context, deal MinerDeal) (func(*MinerDeal) deal.Ref, allSelector, ) + if err != nil { + return nil, xerrors.Errorf("failed to open pull data channel: %w", err) + } return nil, nil } diff --git a/chain/deals/request_validation_test.go b/chain/deals/request_validation_test.go index 87f41c8f5..3f466f69a 100644 --- a/chain/deals/request_validation_test.go +++ b/chain/deals/request_validation_test.go @@ -69,6 +69,9 @@ func newClientDeal(minerID peer.ID, state api.DealState) (deals.ClientDeal, erro return deals.ClientDeal{}, err } minerAddr, err := address.NewIDAddress(uint64(rand.Int())) + if err != nil { + return deals.ClientDeal{}, err + } return deals.ClientDeal{ Proposal: newProposal, diff --git a/chain/store/store.go b/chain/store/store.go index 0c2f339b1..b371ec6e1 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -273,7 +273,7 @@ func (cs *ChainStore) reorgWorker(ctx context.Context) chan<- reorg { } func (cs *ChainStore) takeHeaviestTipSet(ctx context.Context, ts *types.TipSet) error { - ctx, span := trace.StartSpan(ctx, "takeHeaviestTipSet") + _, span := trace.StartSpan(ctx, "takeHeaviestTipSet") defer span.End() if cs.heaviest != nil { // buf diff --git a/chain/types/blockheader.go b/chain/types/blockheader.go index aec7d8514..7ba5ef436 100644 --- a/chain/types/blockheader.go +++ b/chain/types/blockheader.go @@ -112,7 +112,7 @@ func (blk *BlockHeader) SigningBytes() ([]byte, error) { } func (blk *BlockHeader) CheckBlockSignature(ctx context.Context, worker address.Address) error { - ctx, span := trace.StartSpan(ctx, "checkBlockSignature") + _, span := trace.StartSpan(ctx, "checkBlockSignature") defer span.End() sigb, err := blk.SigningBytes() diff --git a/cli/state.go b/cli/state.go index 5b25e1db4..8de612128 100644 --- a/cli/state.go +++ b/cli/state.go @@ -23,6 +23,7 @@ var stateCmd = &cli.Command{ stateListMinersCmd, stateGetActorCmd, stateLookupIDCmd, + stateReplaySetCmd, }, } diff --git a/lib/sectorbuilder/files.go b/lib/sectorbuilder/files.go index 7c27af9db..c19fb3861 100644 --- a/lib/sectorbuilder/files.go +++ b/lib/sectorbuilder/files.go @@ -81,7 +81,8 @@ func toReadableFile(r io.Reader, n int64) (*os.File, func() error, error) { go func() { defer wait.Unlock() - copied, werr := io.CopyN(w, r, n) + var copied int64 + copied, werr = io.CopyN(w, r, n) if werr != nil { log.Warnf("toReadableFile: copy error: %+v", werr) } diff --git a/lotuspond/outmux.go b/lotuspond/outmux.go index 13b8899c0..406001078 100644 --- a/lotuspond/outmux.go +++ b/lotuspond/outmux.go @@ -6,15 +6,12 @@ import ( "io" "net/http" "strings" - "sync" "github.com/gorilla/websocket" "github.com/opentracing/opentracing-go/log" ) type outmux struct { - lk sync.Mutex - errpw *io.PipeWriter outpw *io.PipeWriter @@ -127,5 +124,4 @@ func (m *outmux) ServeHTTP(w http.ResponseWriter, r *http.Request) { } m.new <- c - return } diff --git a/node/hello/hello.go b/node/hello/hello.go index 880ef96f1..cec56a48f 100644 --- a/node/hello/hello.go +++ b/node/hello/hello.go @@ -12,7 +12,7 @@ import ( "github.com/libp2p/go-libp2p-core/host" inet "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/peer" - protocol "github.com/libp2p/go-libp2p-protocol" + protocol "github.com/libp2p/go-libp2p-core/protocol" "github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain/store" diff --git a/node/modules/chain.go b/node/modules/chain.go index 728b4e7a1..ed5a5f4a1 100644 --- a/node/modules/chain.go +++ b/node/modules/chain.go @@ -11,8 +11,8 @@ import ( "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" "github.com/libp2p/go-libp2p-core/host" + peer "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/routing" - peer "github.com/libp2p/go-libp2p-peer" pubsub "github.com/libp2p/go-libp2p-pubsub" "go.uber.org/fx" "golang.org/x/xerrors"