sanity check: make sure proof parameters are present; add Makefile for easy download.

This commit is contained in:
Raúl Kripalani 2020-07-07 17:36:22 +01:00
parent 6eb5e24988
commit 69332e1189
3 changed files with 45 additions and 25 deletions

7
Makefile Normal file
View File

@ -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

View File

@ -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)
}

35
lotus-soup/sanity.go Normal file
View File

@ -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"))
}
}