lotus/cli/params.go

35 lines
857 B
Go
Raw Normal View History

2019-10-04 19:55:33 +00:00
package cli
import (
"github.com/docker/go-units"
"github.com/urfave/cli/v2"
2020-06-05 22:59:01 +00:00
"golang.org/x/xerrors"
"github.com/filecoin-project/go-paramfetch"
2022-06-14 15:00:51 +00:00
"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 {
if cctx.NArg() != 1 {
return IncorrectNumArgs(cctx)
2020-06-12 05:13:11 +00:00
}
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)
2021-03-10 15:16:44 +00:00
err = paramfetch.GetParams(ReqContext(cctx), build.ParametersJSON(), build.SrsJSON(), sectorSize)
if err != nil {
2019-10-04 19:55:33 +00:00
return xerrors.Errorf("fetching proof parameters: %w", err)
}
return nil
},
}