move init to node.go

This commit is contained in:
Anton Evangelatov 2020-06-25 12:33:52 +02:00
parent 9f9c30d406
commit 831cd2e71d
2 changed files with 26 additions and 39 deletions

View File

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

View File

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