Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
- Add comment to clarify the reason for loop in testkit
- Trim common prefix in state printed in CLI commands for better
  readability
- Upgrade to a tagged release of `go-fil-markets` that includes indexing
  work; see: filecoin-project/go-fil-markets#673
- Fix typo in CLI usage.
- Add comments to note that it is safe to use fx `OnStart` context when
  starting the provider engine.
- Fix string concatenation in error message formatting.
  • Loading branch information
masih committed Mar 2, 2022
1 parent 77a954c commit 769b0f3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions cmd/lotus-miner/dagstore.go
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
"strings"

"github.com/fatih/color"
"github.com/ipfs/go-cid"
Expand Down Expand Up @@ -259,10 +260,11 @@ func printTableShards(shards []api.DagstoreShardInfo) error {
m := map[string]interface{}{
"Key": s.Key,
"State": func() string {
trimmedState := strings.TrimPrefix(s.State, "ShardState")
if c, ok := colors[s.State]; ok {
return color.New(c).Sprint(s.State)
return color.New(c).Sprint(trimmedState)
}
return s.State
return trimmedState
}(),
"Error": s.Error,
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-miner/index_provider.go
Expand Up @@ -60,7 +60,7 @@ var indexProvAnnounceCmd = &cli.Command{

var indexProvAnnounceAllCmd = &cli.Command{
Name: "announce-all",
Usage: "Announce all active deals to indexers so they can download its indices",
Usage: "Announce all active deals to indexers so they can download the indices",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "color",
Expand Down
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -38,7 +38,7 @@ require (
github.com/filecoin-project/go-data-transfer v1.14.0
github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8
github.com/filecoin-project/go-fil-markets v1.20.0
github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-legs v0.3.4
github.com/filecoin-project/go-padreader v0.0.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -335,8 +335,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8 h1:cuV4t78W8tUgmqvsc6T6qbWuycg7GzPcNsTdAOxrTns=
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8/go.mod h1:OeR49x+NPMfZMMgOresxzecMAgUB+lna2kwJABPwnt8=
github.com/filecoin-project/go-fil-markets v1.20.0 h1:kP9A2otcRe4mTfL++GF0+d4PoFDI92E38lhM8GXFT9I=
github.com/filecoin-project/go-fil-markets v1.20.0/go.mod h1:OeR49x+NPMfZMMgOresxzecMAgUB+lna2kwJABPwnt8=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
Expand Down
1 change: 1 addition & 0 deletions itests/kit/client.go
Expand Up @@ -112,6 +112,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode *TestFullNode)
require.NoError(t, err)
path := filepath.Join(tmpdir, "outfile.dat")

// Wait for client retrieve to succeed.
for {
out = clientCLI.RunCmd("client", "retrieve", dataCid.String(), path)
fmt.Println("retrieve:\n", out)
Expand Down
2 changes: 1 addition & 1 deletion markets/dagstore/wrapper.go
Expand Up @@ -419,7 +419,7 @@ func (w *Wrapper) GetPiecesContainingBlock(blockCID cid.Cid) ([]cid.Cid, error)
c, err := cid.Parse(k.String())
if err != nil {
prefix := fmt.Sprintf("getting pieces containing block %s:", blockCID)
return nil, xerrors.Errorf(prefix+" converting shard key %s to piece cid: %w", k, err)
return nil, xerrors.Errorf("%s converting shard key %s to piece cid: %w", prefix, k, err)
}

pieceCids = append(pieceCids, c)
Expand Down
3 changes: 3 additions & 0 deletions node/modules/storageminer_idxprov.go
Expand Up @@ -54,6 +54,9 @@ func IndexProvider(cfg config.IndexProviderConfig) func(params IdxProv, marketHo

args.Lifecycle.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
// Note that the OnStart context is cancelled after startup. Its use in e.Start is
// to start up gossipsub publishers and restore cache, all of which are completed
// before e.Start returns. Therefore, it is fine to reuse the give context.
if err := e.Start(ctx); err != nil {
return xerrors.Errorf("starting indexer provider engine: %w", err)
}
Expand Down

0 comments on commit 769b0f3

Please sign in to comment.