Add param fetch to lotus-shed

This commit is contained in:
Travis Person 2020-05-07 05:20:17 +00:00
parent 97130684a2
commit 14bbbe4feb
2 changed files with 35 additions and 0 deletions

View File

@ -25,6 +25,7 @@ func main() {
staterootStatsCmd, staterootStatsCmd,
importCarCmd, importCarCmd,
commpToCidCmd, commpToCidCmd,
fetchParamCmd,
} }
app := &cli.App{ app := &cli.App{

34
cmd/lotus-shed/params.go Normal file
View File

@ -0,0 +1,34 @@
package main
import (
"github.com/docker/go-units"
paramfetch "github.com/filecoin-project/go-paramfetch"
"golang.org/x/xerrors"
"gopkg.in/urfave/cli.v2"
"github.com/filecoin-project/lotus/build"
)
var fetchParamCmd = &cli.Command{
Name: "fetch-params",
Usage: "Fetch proving parameters",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "proving-params",
Usage: "download params used creating proofs for given size, i.e. 32GiB",
},
},
Action: func(cctx *cli.Context) error {
sectorSizeInt, err := units.RAMInBytes(cctx.String("proving-params"))
if err != nil {
return err
}
sectorSize := uint64(sectorSizeInt)
err = paramfetch.GetParams(build.ParametersJson(), sectorSize)
if err != nil {
return xerrors.Errorf("fetching proof parameters: %w", err)
}
return nil
},
}