lotus/cli/params.go

34 lines
930 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"
"github.com/urfave/cli/v2"
2020-06-05 22:59:01 +00:00
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/build"
2019-10-04 19:55:33 +00:00
)
2021-03-23 23:27:34 +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
},
}