diff --git a/cmd/postcli/main.go b/cmd/postcli/main.go index d2a3326f9..08d5f63cd 100644 --- a/cmd/postcli/main.go +++ b/cmd/postcli/main.go @@ -47,6 +47,9 @@ var ( commitmentAtxId []byte reset bool + nonces uint + threads uint + logLevel zapcore.Level ErrKeyFileExists = errors.New("key file already exists") @@ -74,6 +77,9 @@ func parseFlags() { flag.StringVar(&commitmentAtxIdHex, "commitmentAtxId", "", "commitment atx id, in hex (required)") numUnits := flag.Uint64("numUnits", uint64(opts.NumUnits), "number of units") + flag.UintVar(&nonces, "nonces", 16, "number of nonces for -genproof") + flag.UintVar(&threads, "threads", 1, "number of threads for -genproof") + flag.IntVar(&opts.FromFileIdx, "fromFile", 0, "index of the first file to init (inclusive)") var to int flag.IntVar(&to, "toFile", math.MaxInt, "index of the last file to init (inclusive). Will init to the end of declared space if not provided.") @@ -246,7 +252,7 @@ func main() { if genProof { log.Println("cli: generating proof as a sanity test") - proof, proofMetadata, err := proving.Generate(ctx, shared.ZeroChallenge, cfg, logger, proving.WithDataSource(cfg, id, commitmentAtxId, opts.DataDir)) + proof, proofMetadata, err := proving.Generate(ctx, shared.ZeroChallenge, cfg, logger, proving.WithDataSource(cfg, id, commitmentAtxId, opts.DataDir), proving.WithNonces(nonces), proving.WithThreads(threads)) if err != nil { log.Fatalln("proof generation error", err) } diff --git a/proving/proving.go b/proving/proving.go index c95b9e3b2..66b4eabfe 100644 --- a/proving/proving.go +++ b/proving/proving.go @@ -5,6 +5,7 @@ import ( "context" "encoding/hex" "fmt" + "log" "go.uber.org/zap" @@ -34,6 +35,8 @@ func Generate(ctx context.Context, ch shared.Challenge, cfg config.Config, logge provingOpts = append(provingOpts, postrs.WithPowCreator(options.powCreatorId)) } + log.Printf("Generating proof with: %d nonces and %d threads.\n", options.nonces, options.threads) + logger.Info("proving: start generating proof") result, err := postrs.GenerateProof(options.datadir, ch, logger, options.nonces, options.threads, cfg.K1, cfg.K2, cfg.PowDifficulty, options.powFlags, provingOpts...) if err != nil { return nil, nil, fmt.Errorf("generating proof: %w", err)