35 lines
948 B
Go
35 lines
948 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/docker/go-units"
|
|
"github.com/urfave/cli/v2"
|
|
"golang.org/x/xerrors"
|
|
|
|
paramfetch "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.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 {
|
|
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
|
|
},
|
|
}
|