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