Skip to content

Commit

Permalink
Merge pull request #7479 from filecoin-project/feat/prov-check-by-sto…
Browse files Browse the repository at this point in the history
…rage

Add storage-id flag to proving check
  • Loading branch information
magik6k authored Oct 19, 2021
2 parents c2d4dca + bfcfb19 commit ba17195
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
36 changes: 32 additions & 4 deletions cmd/lotus-miner/proving.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
"github.com/filecoin-project/specs-storage/storage"
)

Expand Down Expand Up @@ -360,6 +361,10 @@ var provingCheckProvableCmd = &cli.Command{
Name: "slow",
Usage: "run slower checks",
},
&cli.StringFlag{
Name: "storage-id",
Usage: "filter sectors by storage path (path id)",
},
},
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
Expand Down Expand Up @@ -408,6 +413,21 @@ var provingCheckProvableCmd = &cli.Command{
tw := tabwriter.NewWriter(os.Stdout, 2, 4, 2, ' ', 0)
_, _ = fmt.Fprintln(tw, "deadline\tpartition\tsector\tstatus")

var filter map[abi.SectorID]struct{}

if cctx.IsSet("storage-id") {
sl, err := sapi.StorageList(ctx)
if err != nil {
return err
}
decls := sl[stores.ID(cctx.String("storage-id"))]

filter = map[abi.SectorID]struct{}{}
for _, decl := range decls {
filter[decl.SectorID] = struct{}{}
}
}

for parIdx, par := range partitions {
sectors := make(map[abi.SectorNumber]struct{})

Expand All @@ -418,13 +438,21 @@ var provingCheckProvableCmd = &cli.Command{

var tocheck []storage.SectorRef
for _, info := range sectorInfos {
si := abi.SectorID{
Miner: abi.ActorID(mid),
Number: info.SectorNumber,
}

if filter != nil {
if _, found := filter[si]; !found {
continue
}
}

sectors[info.SectorNumber] = struct{}{}
tocheck = append(tocheck, storage.SectorRef{
ProofType: info.SealProof,
ID: abi.SectorID{
Miner: abi.ActorID(mid),
Number: info.SectorNumber,
},
ID: si,
})
}

Expand Down
7 changes: 4 additions & 3 deletions documentation/en/cli-lotus-miner.md
Original file line number Diff line number Diff line change
Expand Up @@ -1913,9 +1913,10 @@ USAGE:
lotus-miner proving check [command options] <deadlineIdx>
OPTIONS:
--only-bad print only bad sectors (default: false)
--slow run slower checks (default: false)
--help, -h show help (default: false)
--only-bad print only bad sectors (default: false)
--slow run slower checks (default: false)
--storage-id value filter sectors by storage path (path id)
--help, -h show help (default: false)
```

Expand Down

0 comments on commit ba17195

Please sign in to comment.