lotus/cli/params.go

34 lines
928 B
Go
Raw Normal View History

2019-10-04 19:55:33 +00:00
package cli
import (
"github.com/docker/go-units"
2020-01-02 19:08:49 +00:00
paramfetch "github.com/filecoin-project/go-paramfetch"
2019-10-04 19:55:33 +00:00
"golang.org/x/xerrors"
"gopkg.in/urfave/cli.v2"
"github.com/filecoin-project/lotus/build"
2019-10-04 19:55:33 +00:00
)
var fetchParamCmd = &cli.Command{
2020-06-12 05:13:11 +00:00
Name: "fetch-params",
Usage: "Fetch proving parameters",
ArgsUsage: "[sectorSize]",
2019-10-04 19:55:33 +00:00
Action: func(cctx *cli.Context) error {
2020-06-12 05:13:11 +00:00
if !cctx.Args().Present() {
return xerrors.Errorf("must pass sector size to fetch params for (specify as \"32GiB\", for instance)")
}
sectorSizeInt, err := units.RAMInBytes(cctx.Args().First())
if err != nil {
2020-06-12 05:13:11 +00:00
return xerrors.Errorf("error parsing sector size (specify as \"32GiB\", for instance): %w", err)
}
sectorSize := uint64(sectorSizeInt)
err = paramfetch.GetParams(ReqContext(cctx), build.ParametersJson(), sectorSize)
if err != nil {
2019-10-04 19:55:33 +00:00
return xerrors.Errorf("fetching proof parameters: %w", err)
}
return nil
},
}