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-01-02 19:08:49 +00:00
|
|
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
2019-10-04 19:55:33 +00:00
|
|
|
"golang.org/x/xerrors"
|
|
|
|
"gopkg.in/urfave/cli.v2"
|
2020-01-08 20:31:35 +00:00
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/build"
|
2019-10-04 19:55:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var fetchParamCmd = &cli.Command{
|
|
|
|
Name: "fetch-params",
|
|
|
|
Usage: "Fetch proving parameters",
|
2019-11-08 06:06:08 +00:00
|
|
|
Flags: []cli.Flag{
|
2019-12-11 02:06:28 +00:00
|
|
|
&cli.StringFlag{
|
2019-12-04 19:44:15 +00:00
|
|
|
Name: "proving-params",
|
2019-12-11 02:06:28 +00:00
|
|
|
Usage: "download params used creating proofs for given size, i.e. 32GiB",
|
2019-11-14 01:15:33 +00:00
|
|
|
},
|
2019-11-08 06:06:08 +00:00
|
|
|
},
|
2019-10-04 19:55:33 +00:00
|
|
|
Action: func(cctx *cli.Context) error {
|
2019-12-16 19:44:48 +00:00
|
|
|
sectorSizeInt, err := units.RAMInBytes(cctx.String("proving-params"))
|
2019-12-11 02:06:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
sectorSize := uint64(sectorSizeInt)
|
2020-01-08 20:31:35 +00:00
|
|
|
err = paramfetch.GetParams(build.ParametersJson, 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
|
|
|
|
},
|
|
|
|
}
|