From 69332e1189bcbe379a39dbde4b8c27014ac2c0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 7 Jul 2020 17:36:22 +0100 Subject: [PATCH] sanity check: make sure proof parameters are present; add Makefile for easy download. --- Makefile | 7 +++++++ lotus-soup/main.go | 28 +++------------------------- lotus-soup/sanity.go | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 25 deletions(-) create mode 100644 Makefile create mode 100644 lotus-soup/sanity.go diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..cc33cc2ca --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +SHELL = /bin/bash + +.DEFAULT_GOAL := download-proofs + +download-proofs: + go run github.com/filecoin-project/go-paramfetch/paramfetch 2048 ./docker-images/proof-parameters.json +.PHONY: download-proofs \ No newline at end of file diff --git a/lotus-soup/main.go b/lotus-soup/main.go index 9947ef24f..17e2828b3 100644 --- a/lotus-soup/main.go +++ b/lotus-soup/main.go @@ -14,31 +14,9 @@ var cases = map[string]interface{}{ "paych-stress": testkit.WrapTestEnvironment(paych.Stress), } -func init() { - build.BlockDelaySecs = 2 - build.PropagationDelaySecs = 4 - - _ = logging.SetLogLevel("*", "WARN") - _ = logging.SetLogLevel("dht/RtRefreshManager", "ERROR") // noisy - _ = logging.SetLogLevel("bitswap", "ERROR") // noisy - - _ = os.Setenv("BELLMAN_NO_GPU", "1") - - build.InsecurePoStValidation = true - build.DisableBuiltinAssets = true - - // MessageConfidence is the amount of tipsets we wait after a message is - // mined, e.g. payment channel creation, to be considered committed. - build.MessageConfidence = 1 - - power.ConsensusMinerMinPower = big.NewInt(2048) - miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - verifreg.MinVerifiedDealSize = big.NewInt(256) - -} - func main() { + sanityCheck() + run.InvokeMap(cases) } + diff --git a/lotus-soup/sanity.go b/lotus-soup/sanity.go new file mode 100644 index 000000000..b06a653c5 --- /dev/null +++ b/lotus-soup/sanity.go @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "io/ioutil" + "os" +) + +func sanityCheck() { + enhanceMsg := func(msg string, a ...interface{}) string { + return fmt.Sprintf("sanity check: "+msg+"; if running on local:exec, make sure to run `make` from the root of the oni repo", a...) + } + + dir := "/var/tmp/filecoin-proof-parameters" + stat, err := os.Stat(dir) + if os.IsNotExist(err) { + panic(enhanceMsg("proofs parameters not available in /var/tmp/filecoin-proof-parameters")) + } + if err != nil { + panic(enhanceMsg("failed to stat /var/tmp/filecoin-proof-parameters: %s", err)) + } + + if !stat.IsDir() { + panic(enhanceMsg("/var/tmp/filecoin-proof-parameters is not a directory; aborting")) + } + + files, err := ioutil.ReadDir(dir) + if err != nil { + panic(enhanceMsg("failed list directory /var/tmp/filecoin-proof-parameters: %s", err)) + } + + if len(files) == 0 { + panic(enhanceMsg("no files in /var/tmp/filecoin-proof-parameters")) + } +}