From 14bbbe4febd2f55d49851f33b7779bc06690b013 Mon Sep 17 00:00:00 2001 From: Travis Person Date: Thu, 7 May 2020 05:20:17 +0000 Subject: [PATCH] Add param fetch to lotus-shed --- cmd/lotus-shed/main.go | 1 + cmd/lotus-shed/params.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 cmd/lotus-shed/params.go diff --git a/cmd/lotus-shed/main.go b/cmd/lotus-shed/main.go index c56b2e396..60d2bfb3b 100644 --- a/cmd/lotus-shed/main.go +++ b/cmd/lotus-shed/main.go @@ -25,6 +25,7 @@ func main() { staterootStatsCmd, importCarCmd, commpToCidCmd, + fetchParamCmd, } app := &cli.App{ diff --git a/cmd/lotus-shed/params.go b/cmd/lotus-shed/params.go new file mode 100644 index 000000000..ff00f2b4f --- /dev/null +++ b/cmd/lotus-shed/params.go @@ -0,0 +1,34 @@ +package main + +import ( + "github.com/docker/go-units" + paramfetch "github.com/filecoin-project/go-paramfetch" + "golang.org/x/xerrors" + "gopkg.in/urfave/cli.v2" + + "github.com/filecoin-project/lotus/build" +) + +var fetchParamCmd = &cli.Command{ + Name: "fetch-params", + Usage: "Fetch proving parameters", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: "proving-params", + Usage: "download params used creating proofs for given size, i.e. 32GiB", + }, + }, + Action: func(cctx *cli.Context) error { + sectorSizeInt, err := units.RAMInBytes(cctx.String("proving-params")) + if err != nil { + return err + } + sectorSize := uint64(sectorSizeInt) + err = paramfetch.GetParams(build.ParametersJson(), sectorSize) + if err != nil { + return xerrors.Errorf("fetching proof parameters: %w", err) + } + + return nil + }, +}