From bb758854fbba13a84bcd7685e33b724213039eb8 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Wed, 24 Jun 2020 16:46:12 +0200 Subject: [PATCH] move init to main, add more logging --- lotus-soup/baseline.go | 10 ++++++---- lotus-soup/main.go | 26 ++++++++++++++++++++++++++ lotus-soup/node.go | 16 ---------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/lotus-soup/baseline.go b/lotus-soup/baseline.go index ea2c0de31..60ab2a543 100644 --- a/lotus-soup/baseline.go +++ b/lotus-soup/baseline.go @@ -82,15 +82,15 @@ func runBaselineMiner(t *TestEnvironment) error { go func() { defer close(done) for mine { - time.Sleep(10 * time.Millisecond) - //t.RecordMessage("mine one block") + time.Sleep(10 * time.Second) + t.RecordMessage("mine one block") if err := miner.MineOne(ctx, func(bool) {}); err != nil { panic(err) } } }() - time.Sleep(300 * time.Second) + time.Sleep(3600 * time.Second) mine = false fmt.Println("shutting down mining") <-done @@ -122,6 +122,8 @@ func runBaselineClient(t *TestEnvironment) error { t.RecordMessage("client connected to miner") + time.Sleep(10 * time.Second) + // generate random data data := make([]byte, 1600) rand.New(rand.NewSource(time.Now().UnixNano())).Read(data) @@ -137,7 +139,7 @@ func runBaselineClient(t *TestEnvironment) error { t.RecordMessage("started deal: %s", deal) // TODO: this sleep is only necessary because deals don't immediately get logged in the dealstore, we should fix this - time.Sleep(3 * time.Second) + time.Sleep(5 * time.Second) t.RecordMessage("wait to be sealed") waitDealSealed(ctx, client, deal) diff --git a/lotus-soup/main.go b/lotus-soup/main.go index e0906be1e..1593948fe 100644 --- a/lotus-soup/main.go +++ b/lotus-soup/main.go @@ -3,14 +3,40 @@ package main import ( "fmt" + "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("vm", "WARN") + logging.SetLogLevel("miner", "WARN") + logging.SetLogLevel("chainstore", "WARN") + logging.SetLogLevel("chain", "WARN") + logging.SetLogLevel("sub", "WARN") + logging.SetLogLevel("storageminer", "WARN") + + 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) +} + func main() { run.InvokeMap(testplans) } diff --git a/lotus-soup/node.go b/lotus-soup/node.go index 00d78b4cb..e7527084c 100644 --- a/lotus-soup/node.go +++ b/lotus-soup/node.go @@ -14,7 +14,6 @@ import ( "github.com/testground/sdk-go/runtime" "github.com/testground/sdk-go/sync" - 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" @@ -40,13 +39,11 @@ 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/builtin/verifreg" "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/crypto" ) @@ -95,19 +92,6 @@ type MinerAddresses struct { ActorAddr address.Address } -func init() { - logging.SetLogLevel("vm", "WARN") - - 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) -} - func prepareBootstrapper(t *TestEnvironment) (*Node, error) { ctx, cancel := context.WithTimeout(context.Background(), PrepareNodeTimeout) defer cancel()