lotus/cli/params.go
Andrew Jackson (Ajax) 3c4e22ff0c gen fix
2023-11-13 17:59:34 -06:00

34 lines
856 B
Go

package cli
import (
"github.com/docker/go-units"
"github.com/urfave/cli/v2"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/lotus/build"
)
var FetchParamCmd = &cli.Command{
Name: "fetch-params",
Usage: "Fetch proving parameters",
ArgsUsage: "[sectorSize]",
Action: func(cctx *cli.Context) error {
if cctx.NArg() != 1 {
return IncorrectNumArgs(cctx)
}
sectorSizeInt, err := units.RAMInBytes(cctx.Args().First())
if err != nil {
return xerrors.Errorf("error parsing sector size (specify as \"32GiB\", for instance): %w", err)
}
sectorSize := uint64(sectorSizeInt)
err = paramfetch.GetParams(ReqContext(cctx), build.ParametersJSON(), build.SrsJSON(), sectorSize)
if err != nil {
return xerrors.Errorf("fetching proof parameters: %w", err)
}
return nil
},
}