From 831cd2e71dc2ac0123415457b75d863c73e93eb6 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Thu, 25 Jun 2020 12:33:52 +0200 Subject: [PATCH] move init to node.go --- lotus-soup/main.go | 25 ------------------------- lotus-soup/node.go | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 39 deletions(-) diff --git a/lotus-soup/main.go b/lotus-soup/main.go index fe54d84ae..e0906be1e 100644 --- a/lotus-soup/main.go +++ b/lotus-soup/main.go @@ -2,40 +2,15 @@ package main import ( "fmt" - "os" - "github.com/filecoin-project/lotus/build" - "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/abi/big" - "github.com/filecoin-project/specs-actors/actors/builtin/power" - "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/testground/sdk-go/run" "github.com/testground/sdk-go/runtime" - - saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" - logging "github.com/ipfs/go-log/v2" ) var testplans = map[string]interface{}{ "lotus-baseline": doRun(baselineRoles), } -func init() { - logging.SetLogLevel("*", "ERROR") - - build.DisableBuiltinAssets = true - - // Note: I don't understand the significance of this, but the node test does it. - power.ConsensusMinerMinPower = big.NewInt(2048) - saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - verifreg.MinVerifiedDealSize = big.NewInt(256) - - build.InsecurePoStValidation = true - os.Setenv("BELLMAN_NO_GPU", "1") -} - func main() { run.InvokeMap(testplans) } diff --git a/lotus-soup/node.go b/lotus-soup/node.go index 20ef05c8b..ddeba9f64 100644 --- a/lotus-soup/node.go +++ b/lotus-soup/node.go @@ -4,25 +4,15 @@ import ( "bytes" "context" "crypto/rand" + "os" //"encoding/json" "fmt" "io/ioutil" "time" - "github.com/testground/sdk-go/run" - "github.com/testground/sdk-go/runtime" - "github.com/testground/sdk-go/sync" - - libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto" - "github.com/libp2p/go-libp2p-core/peer" - ma "github.com/multiformats/go-multiaddr" - - "github.com/ipfs/go-datastore" - "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-storedcounter" - "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -39,14 +29,38 @@ import ( "github.com/filecoin-project/lotus/node/modules/lp2p" modtest "github.com/filecoin-project/lotus/node/modules/testing" "github.com/filecoin-project/lotus/node/repo" - "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin" saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" + "github.com/filecoin-project/specs-actors/actors/builtin/power" + "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/specs-actors/actors/crypto" + "github.com/ipfs/go-datastore" + logging "github.com/ipfs/go-log/v2" + libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto" + "github.com/libp2p/go-libp2p-core/peer" + ma "github.com/multiformats/go-multiaddr" + "github.com/testground/sdk-go/run" + "github.com/testground/sdk-go/runtime" + "github.com/testground/sdk-go/sync" ) +func init() { + logging.SetLogLevel("*", "ERROR") + + os.Setenv("BELLMAN_NO_GPU", "1") + + build.InsecurePoStValidation = true + build.DisableBuiltinAssets = true + + power.ConsensusMinerMinPower = big.NewInt(2048) + saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ + abi.RegisteredSealProof_StackedDrg2KiBV1: {}, + } + verifreg.MinVerifiedDealSize = big.NewInt(256) +} + var ( PrepareNodeTimeout = time.Minute @@ -168,7 +182,6 @@ func prepareBootstrapper(t *TestEnvironment) (*Node, error) { } n.stop = stop - // this dance to construct the bootstrapper multiaddr is quite vexing. var bootstrapperAddr ma.Multiaddr bootstrapperAddrs, err := n.fullApi.NetAddrsListen(ctx) @@ -268,7 +281,6 @@ func prepareMiner(t *TestEnvironment) (*Node, error) { // prepare the repo minerRepo := repo.NewMemory(nil) - // V00D00 People DaNC3! lr, err := minerRepo.Lock(repo.StorageMiner) if err != nil { return nil, err