rename {kit2=>kit}.

This commit is contained in:
Raúl Kripalani 2021-06-18 19:45:29 +01:00
parent a7d8d15c13
commit 8a418bf982
34 changed files with 205 additions and 206 deletions

View File

@ -12,7 +12,7 @@ import (
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -21,7 +21,7 @@ func TestAPI(t *testing.T) {
runAPITest(t) runAPITest(t)
}) })
t.Run("rpc", func(t *testing.T) { t.Run("rpc", func(t *testing.T) {
runAPITest(t, kit2.ThroughRPC()) runAPITest(t, kit.ThroughRPC())
}) })
} }
@ -48,7 +48,7 @@ func (ts *apiSuite) testVersion(t *testing.T) {
lapi.RunningNodeType = lapi.NodeUnknown lapi.RunningNodeType = lapi.NodeUnknown
}) })
full, _, _ := kit2.EnsembleMinimal(t, ts.opts...) full, _, _ := kit.EnsembleMinimal(t, ts.opts...)
v, err := full.Version(context.Background()) v, err := full.Version(context.Background())
require.NoError(t, err) require.NoError(t, err)
@ -61,7 +61,7 @@ func (ts *apiSuite) testVersion(t *testing.T) {
func (ts *apiSuite) testID(t *testing.T) { func (ts *apiSuite) testID(t *testing.T) {
ctx := context.Background() ctx := context.Background()
full, _, _ := kit2.EnsembleMinimal(t, ts.opts...) full, _, _ := kit.EnsembleMinimal(t, ts.opts...)
id, err := full.ID(ctx) id, err := full.ID(ctx)
if err != nil { if err != nil {
@ -73,7 +73,7 @@ func (ts *apiSuite) testID(t *testing.T) {
func (ts *apiSuite) testConnectTwo(t *testing.T) { func (ts *apiSuite) testConnectTwo(t *testing.T) {
ctx := context.Background() ctx := context.Background()
one, two, _, ens := kit2.EnsembleTwoOne(t, ts.opts...) one, two, _, ens := kit.EnsembleTwoOne(t, ts.opts...)
p, err := one.NetPeers(ctx) p, err := one.NetPeers(ctx)
require.NoError(t, err) require.NoError(t, err)
@ -97,7 +97,7 @@ func (ts *apiSuite) testConnectTwo(t *testing.T) {
func (ts *apiSuite) testSearchMsg(t *testing.T) { func (ts *apiSuite) testSearchMsg(t *testing.T) {
ctx := context.Background() ctx := context.Background()
full, _, ens := kit2.EnsembleMinimal(t, ts.opts...) full, _, ens := kit.EnsembleMinimal(t, ts.opts...)
senderAddr, err := full.WalletDefaultAddress(ctx) senderAddr, err := full.WalletDefaultAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
@ -127,7 +127,7 @@ func (ts *apiSuite) testSearchMsg(t *testing.T) {
func (ts *apiSuite) testMining(t *testing.T) { func (ts *apiSuite) testMining(t *testing.T) {
ctx := context.Background() ctx := context.Background()
full, miner, _ := kit2.EnsembleMinimal(t, ts.opts...) full, miner, _ := kit.EnsembleMinimal(t, ts.opts...)
newHeads, err := full.ChainNotify(ctx) newHeads, err := full.ChainNotify(ctx)
require.NoError(t, err) require.NoError(t, err)
@ -138,7 +138,7 @@ func (ts *apiSuite) testMining(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, int64(h1.Height()), int64(baseHeight)) require.Equal(t, int64(h1.Height()), int64(baseHeight))
bm := kit2.NewBlockMiner(t, miner) bm := kit.NewBlockMiner(t, miner)
bm.MineUntilBlock(ctx, full, nil) bm.MineUntilBlock(ctx, full, nil)
require.NoError(t, err) require.NoError(t, err)
@ -170,7 +170,7 @@ func (ts *apiSuite) testMiningReal(t *testing.T) {
func (ts *apiSuite) testNonGenesisMiner(t *testing.T) { func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
ctx := context.Background() ctx := context.Background()
full, genesisMiner, ens := kit2.EnsembleMinimal(t, ts.opts...) full, genesisMiner, ens := kit.EnsembleMinimal(t, ts.opts...)
ens.BeginMining(4 * time.Millisecond) ens.BeginMining(4 * time.Millisecond)
@ -180,8 +180,8 @@ func (ts *apiSuite) testNonGenesisMiner(t *testing.T) {
_, err = full.StateMinerInfo(ctx, gaa, types.EmptyTSK) _, err = full.StateMinerInfo(ctx, gaa, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
var newMiner kit2.TestMiner var newMiner kit.TestMiner
ens.Miner(&newMiner, full, kit2.OwnerAddr(full.DefaultKey)).Start() ens.Miner(&newMiner, full, kit.OwnerAddr(full.DefaultKey)).Start()
ta, err := newMiner.ActorAddress(ctx) ta, err := newMiner.ActorAddress(ctx)
require.NoError(t, err) require.NoError(t, err)

View File

@ -10,7 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/markets/storageadapter"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
@ -18,7 +18,7 @@ import (
) )
func TestBatchDealInput(t *testing.T) { func TestBatchDealInput(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (
blockTime = 10 * time.Millisecond blockTime = 10 * time.Millisecond
@ -37,7 +37,7 @@ func TestBatchDealInput(t *testing.T) {
maxDealsPerMsg := uint64(deals) maxDealsPerMsg := uint64(deals)
// Set max deals per publish deals message to maxDealsPerMsg // Set max deals per publish deals message to maxDealsPerMsg
opts := kit2.ConstructorOpts(node.Options( opts := kit.ConstructorOpts(node.Options(
node.Override( node.Override(
new(*storageadapter.DealPublisher), new(*storageadapter.DealPublisher),
storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{
@ -56,9 +56,9 @@ func TestBatchDealInput(t *testing.T) {
}, nil }, nil
}), }),
)) ))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
err := miner.MarketSetAsk(ctx, big.Zero(), big.Zero(), 200, 128, 32<<30) err := miner.MarketSetAsk(ctx, big.Zero(), big.Zero(), 200, 128, 32<<30)
require.NoError(t, err) require.NoError(t, err)
@ -87,7 +87,7 @@ func TestBatchDealInput(t *testing.T) {
// Starts a deal and waits until it's published // Starts a deal and waits until it's published
runDealTillSeal := func(rseed int) { runDealTillSeal := func(rseed int) {
res, _, _, err := kit2.CreateImportFile(ctx, client, rseed, piece) res, _, _, err := kit.CreateImportFile(ctx, client, rseed, piece)
require.NoError(t, err) require.NoError(t, err)
deal := dh.StartDeal(ctx, res.Root, false, dealStartEpoch) deal := dh.StartDeal(ctx, res.Root, false, dealStartEpoch)

View File

@ -6,16 +6,15 @@ import (
"testing" "testing"
"time" "time"
"github.com/filecoin-project/lotus/itests/kit2"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require"
) )
func TestCCUpgrade(t *testing.T) { func TestCCUpgrade(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
for _, height := range []abi.ChainEpoch{ for _, height := range []abi.ChainEpoch{
-1, // before -1, // before
@ -34,8 +33,8 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
ctx := context.Background() ctx := context.Background()
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(upgradeHeight)) opts := kit.ConstructorOpts(kit.LatestActorsAt(upgradeHeight))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
@ -43,7 +42,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
t.Fatal(err) t.Fatal(err)
} }
CC := abi.SectorNumber(kit2.DefaultPresealsPerBootstrapMiner + 1) CC := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1)
Upgraded := CC + 1 Upgraded := CC + 1
miner.PledgeSectors(ctx, 1, 0, nil) miner.PledgeSectors(ctx, 1, 0, nil)
@ -62,7 +61,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
err = miner.SectorMarkForUpgrade(ctx, sl[0]) err = miner.SectorMarkForUpgrade(ctx, sl[0])
require.NoError(t, err) require.NoError(t, err)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
dh.MakeOnlineDeal(context.Background(), 6, false, 0) dh.MakeOnlineDeal(context.Background(), 6, false, 0)

View File

@ -6,16 +6,16 @@ import (
"time" "time"
"github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
) )
// TestClient does a basic test to exercise the client CLI commands. // TestClient does a basic test to exercise the client CLI commands.
func TestClient(t *testing.T) { func TestClient(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1") _ = os.Setenv("BELLMAN_NO_GPU", "1")
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond
client, _, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), kit2.ThroughRPC()) client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
kit2.RunClientTest(t, cli.Commands, client) kit.RunClientTest(t, cli.Commands, client)
} }

View File

@ -21,7 +21,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/mock" "github.com/filecoin-project/lotus/extern/sector-storage/mock"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/impl"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -57,7 +57,7 @@ func TestDeadlineToggling(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_DEADLINE_TOGGLING=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_DEADLINE_TOGGLING=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
const sectorsC, sectorsD, sectorsB = 10, 9, 8 const sectorsC, sectorsD, sectorsB = 10, 9, 8
@ -71,22 +71,22 @@ func TestDeadlineToggling(t *testing.T) {
defer cancel() defer cancel()
var ( var (
client kit2.TestFullNode client kit.TestFullNode
minerA kit2.TestMiner minerA kit.TestMiner
minerB kit2.TestMiner minerB kit.TestMiner
minerC kit2.TestMiner minerC kit.TestMiner
minerD kit2.TestMiner minerD kit.TestMiner
minerE kit2.TestMiner minerE kit.TestMiner
) )
opts := []kit2.NodeOpt{kit2.ConstructorOpts(kit2.NetworkUpgradeAt(network.Version12, upgradeH))} opts := []kit.NodeOpt{kit.ConstructorOpts(kit.NetworkUpgradeAt(network.Version12, upgradeH))}
ens := kit2.NewEnsemble(t, kit2.MockProofs()). ens := kit.NewEnsemble(t, kit.MockProofs()).
FullNode(&client, opts...). FullNode(&client, opts...).
Miner(&minerA, &client, opts...). Miner(&minerA, &client, opts...).
Start(). Start().
InterconnectAll() InterconnectAll()
ens.BeginMining(blocktime) ens.BeginMining(blocktime)
opts = append(opts, kit2.OwnerAddr(client.DefaultKey)) opts = append(opts, kit.OwnerAddr(client.DefaultKey))
ens.Miner(&minerB, &client, opts...). ens.Miner(&minerB, &client, opts...).
Miner(&minerC, &client, opts...). Miner(&minerC, &client, opts...).
Start() Start()
@ -204,7 +204,7 @@ func TestDeadlineToggling(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// first round of miner checks // first round of miner checks
checkMiner(maddrA, types.NewInt(uint64(ssz)*kit2.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK) checkMiner(maddrA, types.NewInt(uint64(ssz)*kit.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK)
checkMiner(maddrC, types.NewInt(uint64(ssz)*sectorsC), true, true, types.EmptyTSK) checkMiner(maddrC, types.NewInt(uint64(ssz)*sectorsC), true, true, types.EmptyTSK)
checkMiner(maddrB, types.NewInt(0), false, false, types.EmptyTSK) checkMiner(maddrB, types.NewInt(0), false, false, types.EmptyTSK)
@ -231,7 +231,7 @@ func TestDeadlineToggling(t *testing.T) {
params := &miner.SectorPreCommitInfo{ params := &miner.SectorPreCommitInfo{
Expiration: 2880 * 300, Expiration: 2880 * 300,
SectorNumber: 22, SectorNumber: 22,
SealProof: kit2.TestSpt, SealProof: kit.TestSpt,
SealedCID: cr, SealedCID: cr,
SealRandEpoch: head.Height() - 200, SealRandEpoch: head.Height() - 200,
@ -281,7 +281,7 @@ func TestDeadlineToggling(t *testing.T) {
} }
// second round of miner checks // second round of miner checks
checkMiner(maddrA, types.NewInt(uint64(ssz)*kit2.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK) checkMiner(maddrA, types.NewInt(uint64(ssz)*kit.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK)
checkMiner(maddrC, types.NewInt(0), true, true, types.EmptyTSK) checkMiner(maddrC, types.NewInt(0), true, true, types.EmptyTSK)
checkMiner(maddrB, types.NewInt(uint64(ssz)*sectorsB), true, true, types.EmptyTSK) checkMiner(maddrB, types.NewInt(uint64(ssz)*sectorsB), true, true, types.EmptyTSK)
checkMiner(maddrD, types.NewInt(uint64(ssz)*sectorsD), true, true, types.EmptyTSK) checkMiner(maddrD, types.NewInt(uint64(ssz)*sectorsD), true, true, types.EmptyTSK)
@ -352,7 +352,7 @@ func TestDeadlineToggling(t *testing.T) {
build.Clock.Sleep(blocktime) build.Clock.Sleep(blocktime)
} }
checkMiner(maddrA, types.NewInt(uint64(ssz)*kit2.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK) checkMiner(maddrA, types.NewInt(uint64(ssz)*kit.DefaultPresealsPerBootstrapMiner), true, true, types.EmptyTSK)
checkMiner(maddrC, types.NewInt(0), true, true, types.EmptyTSK) checkMiner(maddrC, types.NewInt(0), true, true, types.EmptyTSK)
checkMiner(maddrB, types.NewInt(0), true, true, types.EmptyTSK) checkMiner(maddrB, types.NewInt(0), true, true, types.EmptyTSK)
checkMiner(maddrD, types.NewInt(0), false, false, types.EmptyTSK) checkMiner(maddrD, types.NewInt(0), false, false, types.EmptyTSK)

View File

@ -14,7 +14,7 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/markets/storageadapter"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
@ -27,7 +27,7 @@ func TestDealCyclesConcurrent(t *testing.T) {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blockTime := 10 * time.Millisecond blockTime := 10 * time.Millisecond
@ -37,9 +37,9 @@ func TestDealCyclesConcurrent(t *testing.T) {
startEpoch := abi.ChainEpoch(2 << 12) startEpoch := abi.ChainEpoch(2 << 12)
runTest := func(t *testing.T, n int, fastRetrieval bool, carExport bool) { runTest := func(t *testing.T, n int, fastRetrieval bool, carExport bool) {
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
runConcurrentDeals(t, dh, fullDealCyclesOpts{ runConcurrentDeals(t, dh, fullDealCyclesOpts{
n: n, n: n,
@ -67,7 +67,7 @@ type fullDealCyclesOpts struct {
startEpoch abi.ChainEpoch startEpoch abi.ChainEpoch
} }
func runConcurrentDeals(t *testing.T, dh *kit2.DealHarness, opts fullDealCyclesOpts) { func runConcurrentDeals(t *testing.T, dh *kit.DealHarness, opts fullDealCyclesOpts) {
errgrp, _ := errgroup.WithContext(context.Background()) errgrp, _ := errgroup.WithContext(context.Background())
for i := 0; i < opts.n; i++ { for i := 0; i < opts.n; i++ {
i := i i := i
@ -81,7 +81,7 @@ func runConcurrentDeals(t *testing.T, dh *kit2.DealHarness, opts fullDealCyclesO
}() }()
deal, res, inPath := dh.MakeOnlineDeal(context.Background(), 5+i, opts.fastRetrieval, opts.startEpoch) deal, res, inPath := dh.MakeOnlineDeal(context.Background(), 5+i, opts.fastRetrieval, opts.startEpoch)
outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, opts.carExport) outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, opts.carExport)
kit2.AssertFilesEqual(t, inPath, outPath) kit.AssertFilesEqual(t, inPath, outPath)
return nil return nil
}) })
} }
@ -93,13 +93,13 @@ func TestDealsWithSealingAndRPC(t *testing.T) {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var blockTime = 1 * time.Second var blockTime = 1 * time.Second
client, miner, ens := kit2.EnsembleMinimal(t, kit2.ThroughRPC()) // no mock proofs. client, miner, ens := kit.EnsembleMinimal(t, kit.ThroughRPC()) // no mock proofs.
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
t.Run("stdretrieval", func(t *testing.T) { t.Run("stdretrieval", func(t *testing.T) {
runConcurrentDeals(t, dh, fullDealCyclesOpts{n: 1}) runConcurrentDeals(t, dh, fullDealCyclesOpts{n: 1})
@ -123,7 +123,7 @@ func TestPublishDealsBatching(t *testing.T) {
startEpoch = abi.ChainEpoch(2 << 12) startEpoch = abi.ChainEpoch(2 << 12)
) )
kit2.QuietMiningLogs() kit.QuietMiningLogs()
opts := node.Override(new(*storageadapter.DealPublisher), opts := node.Override(new(*storageadapter.DealPublisher),
storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{
@ -132,10 +132,10 @@ func TestPublishDealsBatching(t *testing.T) {
}), }),
) )
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), kit2.ConstructorOpts(opts)) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ConstructorOpts(opts))
ens.InterconnectAll().BeginMining(10 * time.Millisecond) ens.InterconnectAll().BeginMining(10 * time.Millisecond)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
// Starts a deal and waits until it's published // Starts a deal and waits until it's published
runDealTillPublish := func(rseed int) { runDealTillPublish := func(rseed int) {
@ -210,23 +210,23 @@ func TestFirstDealEnablesMining(t *testing.T) {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (
client kit2.TestFullNode client kit.TestFullNode
genMiner kit2.TestMiner // bootstrap genMiner kit.TestMiner // bootstrap
provider kit2.TestMiner // no sectors, will need to create one provider kit.TestMiner // no sectors, will need to create one
) )
ens := kit2.NewEnsemble(t, kit2.MockProofs()) ens := kit.NewEnsemble(t, kit.MockProofs())
ens.FullNode(&client) ens.FullNode(&client)
ens.Miner(&genMiner, &client) ens.Miner(&genMiner, &client)
ens.Miner(&provider, &client, kit2.PresealSectors(0)) ens.Miner(&provider, &client, kit.PresealSectors(0))
ens.Start().InterconnectAll().BeginMining(50 * time.Millisecond) ens.Start().InterconnectAll().BeginMining(50 * time.Millisecond)
ctx := context.Background() ctx := context.Background()
dh := kit2.NewDealHarness(t, &client, &provider) dh := kit.NewDealHarness(t, &client, &provider)
ref, _ := client.CreateImportFile(ctx, 5, 0) ref, _ := client.CreateImportFile(ctx, 5, 0)
@ -241,7 +241,7 @@ func TestFirstDealEnablesMining(t *testing.T) {
providerMined := make(chan struct{}) providerMined := make(chan struct{})
go func() { go func() {
_ = client.WaitTillChain(ctx, kit2.BlockMinedBy(provider.ActorAddr)) _ = client.WaitTillChain(ctx, kit.BlockMinedBy(provider.ActorAddr))
close(providerMined) close(providerMined)
}() }()
@ -266,10 +266,10 @@ func TestOfflineDealFlow(t *testing.T) {
runTest := func(t *testing.T, fastRet bool) { runTest := func(t *testing.T, fastRet bool) {
ctx := context.Background() ctx := context.Background()
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
// Create a random file and import on the client. // Create a random file and import on the client.
res, inFile := client.CreateImportFile(ctx, 1, 0) res, inFile := client.CreateImportFile(ctx, 1, 0)
@ -333,7 +333,7 @@ func TestOfflineDealFlow(t *testing.T) {
// Retrieve the deal // Retrieve the deal
outFile := dh.PerformRetrieval(ctx, proposalCid, rootCid, false) outFile := dh.PerformRetrieval(ctx, proposalCid, rootCid, false)
kit2.AssertFilesEqual(t, inFile, outFile) kit.AssertFilesEqual(t, inFile, outFile)
} }
t.Run("stdretrieval", func(t *testing.T) { runTest(t, false) }) t.Run("stdretrieval", func(t *testing.T) { runTest(t, false) })
@ -345,14 +345,14 @@ func TestZeroPricePerByteRetrieval(t *testing.T) {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (
blockTime = 10 * time.Millisecond blockTime = 10 * time.Millisecond
startEpoch = abi.ChainEpoch(2 << 12) startEpoch = abi.ChainEpoch(2 << 12)
) )
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
ctx := context.Background() ctx := context.Background()
@ -364,7 +364,7 @@ func TestZeroPricePerByteRetrieval(t *testing.T) {
err = miner.MarketSetRetrievalAsk(ctx, ask) err = miner.MarketSetRetrievalAsk(ctx, ask)
require.NoError(t, err) require.NoError(t, err)
dh := kit2.NewDealHarness(t, client, miner) dh := kit.NewDealHarness(t, client, miner)
runConcurrentDeals(t, dh, fullDealCyclesOpts{ runConcurrentDeals(t, dh, fullDealCyclesOpts{
n: 1, n: 1,
startEpoch: startEpoch, startEpoch: startEpoch,

View File

@ -8,6 +8,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -23,7 +24,6 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/gateway" "github.com/filecoin-project/lotus/gateway"
"github.com/filecoin-project/lotus/itests/kit2"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
@ -44,7 +44,7 @@ func init() {
// TestGatewayWalletMsig tests that API calls to wallet and msig can be made on a lite // TestGatewayWalletMsig tests that API calls to wallet and msig can be made on a lite
// node that is connected through a gateway to a full API node // node that is connected through a gateway to a full API node
func TestGatewayWalletMsig(t *testing.T) { func TestGatewayWalletMsig(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
@ -176,7 +176,7 @@ func TestGatewayWalletMsig(t *testing.T) {
// TestGatewayMsigCLI tests that msig CLI calls can be made // TestGatewayMsigCLI tests that msig CLI calls can be made
// on a lite node that is connected through a gateway to a full API node // on a lite node that is connected through a gateway to a full API node
func TestGatewayMsigCLI(t *testing.T) { func TestGatewayMsigCLI(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
@ -188,7 +188,7 @@ func TestGatewayMsigCLI(t *testing.T) {
} }
func TestGatewayDealFlow(t *testing.T) { func TestGatewayDealFlow(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
@ -202,26 +202,26 @@ func TestGatewayDealFlow(t *testing.T) {
// so that the deal starts sealing in time // so that the deal starts sealing in time
dealStartEpoch := abi.ChainEpoch(2 << 12) dealStartEpoch := abi.ChainEpoch(2 << 12)
dh := kit2.NewDealHarness(t, nodes.lite, nodes.miner) dh := kit.NewDealHarness(t, nodes.lite, nodes.miner)
dealCid, res, _ := dh.MakeOnlineDeal(ctx, 6, false, dealStartEpoch) dealCid, res, _ := dh.MakeOnlineDeal(ctx, 6, false, dealStartEpoch)
dh.PerformRetrieval(ctx, dealCid, res.Root, false) dh.PerformRetrieval(ctx, dealCid, res.Root, false)
} }
func TestGatewayCLIDealFlow(t *testing.T) { func TestGatewayCLIDealFlow(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit)
defer nodes.closer() defer nodes.closer()
kit2.RunClientTest(t, cli.Commands, nodes.lite) kit.RunClientTest(t, cli.Commands, nodes.lite)
} }
type testNodes struct { type testNodes struct {
lite *kit2.TestFullNode lite *kit.TestFullNode
full *kit2.TestFullNode full *kit.TestFullNode
miner *kit2.TestMiner miner *kit.TestMiner
closer jsonrpc.ClientCloser closer jsonrpc.ClientCloser
} }
@ -259,9 +259,9 @@ func startNodes(
var closer jsonrpc.ClientCloser var closer jsonrpc.ClientCloser
var ( var (
full *kit2.TestFullNode full *kit.TestFullNode
miner *kit2.TestMiner miner *kit.TestMiner
lite kit2.TestFullNode lite kit.TestFullNode
) )
// - Create one full node and one lite node // - Create one full node and one lite node
@ -270,8 +270,8 @@ func startNodes(
// - Connect lite node -> gateway server -> full node // - Connect lite node -> gateway server -> full node
// create the full node and the miner. // create the full node and the miner.
var ens *kit2.Ensemble var ens *kit.Ensemble
full, miner, ens = kit2.EnsembleMinimal(t, kit2.MockProofs()) full, miner, ens = kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
// Create a gateway server in front of the full node // Create a gateway server in front of the full node
@ -279,7 +279,7 @@ func startNodes(
handler, err := gateway.Handler(gwapi) handler, err := gateway.Handler(gwapi)
require.NoError(t, err) require.NoError(t, err)
srv, _ := kit2.CreateRPCServer(t, handler) srv, _ := kit.CreateRPCServer(t, handler)
// Create a gateway client API that connects to the gateway server // Create a gateway client API that connects to the gateway server
var gapi api.Gateway var gapi api.Gateway
@ -287,9 +287,9 @@ func startNodes(
require.NoError(t, err) require.NoError(t, err)
ens.FullNode(&lite, ens.FullNode(&lite,
kit2.LiteNode(), kit.LiteNode(),
kit2.ThroughRPC(), kit.ThroughRPC(),
kit2.ConstructorOpts( kit.ConstructorOpts(
node.Override(new(api.Gateway), gapi), node.Override(new(api.Gateway), gapi),
), ),
).Start().InterconnectAll() ).Start().InterconnectAll()
@ -297,7 +297,7 @@ func startNodes(
return &testNodes{lite: &lite, full: full, miner: miner, closer: closer} return &testNodes{lite: &lite, full: full, miner: miner, closer: closer}
} }
func sendFunds(ctx context.Context, fromNode *kit2.TestFullNode, fromAddr address.Address, toAddr address.Address, amt types.BigInt) error { func sendFunds(ctx context.Context, fromNode *kit.TestFullNode, fromAddr address.Address, toAddr address.Address, amt types.BigInt) error {
msg := &types.Message{ msg := &types.Message{
From: fromAddr, From: fromAddr,
To: toAddr, To: toAddr,

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
type TestDealState int type TestDealState int

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"time" "time"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import "testing" import "testing"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"github.com/filecoin-project/lotus/lib/lotuslog" "github.com/filecoin-project/lotus/lib/lotuslog"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package kit2 package kit
import ( import (
"context" "context"

View File

@ -11,25 +11,25 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// TestMultisig does a basic test to exercise the multisig CLI commands // TestMultisig does a basic test to exercise the multisig CLI commands
func TestMultisig(t *testing.T) { func TestMultisig(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond
client, _, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), kit2.ThroughRPC()) client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
runMultisigTests(t, client) runMultisigTests(t, client)
} }
func runMultisigTests(t *testing.T, clientNode *kit2.TestFullNode) { func runMultisigTests(t *testing.T, clientNode *kit.TestFullNode) {
// Create mock CLI // Create mock CLI
ctx := context.Background() ctx := context.Background()
mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) mockCLI := kit.NewMockCLI(ctx, t, cli.Commands)
clientCLI := mockCLI.Client(clientNode.ListenAddr) clientCLI := mockCLI.Client(clientNode.ListenAddr)
// Create some wallets on the node to use for testing multisig // Create some wallets on the node to use for testing multisig
@ -40,7 +40,7 @@ func runMultisigTests(t *testing.T, clientNode *kit2.TestFullNode) {
walletAddrs = append(walletAddrs, addr) walletAddrs = append(walletAddrs, addr)
kit2.SendFunds(ctx, t, clientNode, addr, types.NewInt(1e15)) kit.SendFunds(ctx, t, clientNode, addr, types.NewInt(1e15))
} }
// Create an msig with three of the addresses and threshold of two sigs // Create an msig with three of the addresses and threshold of two sigs

View File

@ -7,6 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -23,22 +24,21 @@ import (
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit2"
) )
func TestPaymentChannelsAPI(t *testing.T) { func TestPaymentChannelsAPI(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
ctx := context.Background() ctx := context.Background()
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond
var ( var (
paymentCreator kit2.TestFullNode paymentCreator kit.TestFullNode
paymentReceiver kit2.TestFullNode paymentReceiver kit.TestFullNode
miner kit2.TestMiner miner kit.TestMiner
) )
ens := kit2.NewEnsemble(t, kit2.MockProofs()). ens := kit.NewEnsemble(t, kit.MockProofs()).
FullNode(&paymentCreator). FullNode(&paymentCreator).
FullNode(&paymentReceiver). FullNode(&paymentReceiver).
Miner(&miner, &paymentCreator). Miner(&miner, &paymentCreator).
@ -51,7 +51,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
receiverAddr, err := paymentReceiver.WalletNew(ctx, types.KTSecp256k1) receiverAddr, err := paymentReceiver.WalletNew(ctx, types.KTSecp256k1)
require.NoError(t, err) require.NoError(t, err)
kit2.SendFunds(ctx, t, &paymentCreator, receiverAddr, abi.NewTokenAmount(1e18)) kit.SendFunds(ctx, t, &paymentCreator, receiverAddr, abi.NewTokenAmount(1e18))
// setup the payment channel // setup the payment channel
createrAddr, err := paymentCreator.WalletDefaultAddress(ctx) createrAddr, err := paymentCreator.WalletDefaultAddress(ctx)
@ -200,7 +200,7 @@ func TestPaymentChannelsAPI(t *testing.T) {
require.EqualValues(t, abi.NewTokenAmount(expectedRefund), delta, "did not send correct funds from creator: expected %d, got %d", expectedRefund, delta) require.EqualValues(t, abi.NewTokenAmount(expectedRefund), delta, "did not send correct funds from creator: expected %d, got %d", expectedRefund, delta)
} }
func waitForBlocks(ctx context.Context, t *testing.T, bm *kit2.BlockMiner, paymentReceiver kit2.TestFullNode, receiverAddr address.Address, count int) { func waitForBlocks(ctx context.Context, t *testing.T, bm *kit.BlockMiner, paymentReceiver kit.TestFullNode, receiverAddr address.Address, count int) {
// We need to add null blocks in batches, if we add too many the chain can't sync // We need to add null blocks in batches, if we add too many the chain can't sync
batchSize := 60 batchSize := 60
for i := 0; i < count; i += batchSize { for i := 0; i < count; i += batchSize {
@ -225,7 +225,7 @@ func waitForBlocks(ctx context.Context, t *testing.T, bm *kit2.BlockMiner, payme
} }
} }
func waitForMessage(ctx context.Context, t *testing.T, paymentCreator kit2.TestFullNode, msgCid cid.Cid, duration time.Duration, desc string) *api.MsgLookup { func waitForMessage(ctx context.Context, t *testing.T, paymentCreator kit.TestFullNode, msgCid cid.Cid, duration time.Duration, desc string) *api.MsgLookup {
ctx, cancel := context.WithTimeout(ctx, duration) ctx, cancel := context.WithTimeout(ctx, duration)
defer cancel() defer cancel()

View File

@ -11,7 +11,7 @@ import (
"time" "time"
"github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
@ -37,19 +37,19 @@ func init() {
// commands // commands
func TestPaymentChannelsBasic(t *testing.T) { func TestPaymentChannelsBasic(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1") _ = os.Setenv("BELLMAN_NO_GPU", "1")
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
var ( var (
paymentCreator kit2.TestFullNode paymentCreator kit.TestFullNode
paymentReceiver kit2.TestFullNode paymentReceiver kit.TestFullNode
) )
creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime)
// Create mock CLI // Create mock CLI
mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) mockCLI := kit.NewMockCLI(ctx, t, cli.Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr) receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr)
@ -94,18 +94,18 @@ type voucherSpec struct {
// TestPaymentChannelStatus tests the payment channel status CLI command // TestPaymentChannelStatus tests the payment channel status CLI command
func TestPaymentChannelStatus(t *testing.T) { func TestPaymentChannelStatus(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1") _ = os.Setenv("BELLMAN_NO_GPU", "1")
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
var ( var (
paymentCreator kit2.TestFullNode paymentCreator kit.TestFullNode
paymentReceiver kit2.TestFullNode paymentReceiver kit.TestFullNode
) )
creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime)
// Create mock CLI // Create mock CLI
mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) mockCLI := kit.NewMockCLI(ctx, t, cli.Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
// creator: paych status-by-from-to <creator> <receiver> // creator: paych status-by-from-to <creator> <receiver>
@ -174,18 +174,18 @@ func TestPaymentChannelStatus(t *testing.T) {
// channel voucher commands // channel voucher commands
func TestPaymentChannelVouchers(t *testing.T) { func TestPaymentChannelVouchers(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1") _ = os.Setenv("BELLMAN_NO_GPU", "1")
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
var ( var (
paymentCreator kit2.TestFullNode paymentCreator kit.TestFullNode
paymentReceiver kit2.TestFullNode paymentReceiver kit.TestFullNode
) )
creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime)
// Create mock CLI // Create mock CLI
mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) mockCLI := kit.NewMockCLI(ctx, t, cli.Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr) receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr)
@ -306,18 +306,18 @@ func TestPaymentChannelVouchers(t *testing.T) {
// is greater than what's left in the channel, voucher create fails // is greater than what's left in the channel, voucher create fails
func TestPaymentChannelVoucherCreateShortfall(t *testing.T) { func TestPaymentChannelVoucherCreateShortfall(t *testing.T) {
_ = os.Setenv("BELLMAN_NO_GPU", "1") _ = os.Setenv("BELLMAN_NO_GPU", "1")
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 5 * time.Millisecond blocktime := 5 * time.Millisecond
ctx := context.Background() ctx := context.Background()
var ( var (
paymentCreator kit2.TestFullNode paymentCreator kit.TestFullNode
paymentReceiver kit2.TestFullNode paymentReceiver kit.TestFullNode
) )
creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime)
// Create mock CLI // Create mock CLI
mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) mockCLI := kit.NewMockCLI(ctx, t, cli.Commands)
creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr)
// creator: paych add-funds <creator> <receiver> <amount> // creator: paych add-funds <creator> <receiver> <amount>
@ -385,7 +385,7 @@ func checkVoucherOutput(t *testing.T, list string, vouchers []voucherSpec) {
} }
// waitForHeight waits for the node to reach the given chain epoch // waitForHeight waits for the node to reach the given chain epoch
func waitForHeight(ctx context.Context, t *testing.T, node kit2.TestFullNode, height abi.ChainEpoch) { func waitForHeight(ctx context.Context, t *testing.T, node kit.TestFullNode, height abi.ChainEpoch) {
atHeight := make(chan struct{}) atHeight := make(chan struct{})
chainEvents := events.NewEvents(ctx, node) chainEvents := events.NewEvents(ctx, node)
err := chainEvents.ChainAt(func(ctx context.Context, ts *types.TipSet, curH abi.ChainEpoch) error { err := chainEvents.ChainAt(func(ctx context.Context, ts *types.TipSet, curH abi.ChainEpoch) error {
@ -403,7 +403,7 @@ func waitForHeight(ctx context.Context, t *testing.T, node kit2.TestFullNode, he
} }
// getPaychState gets the state of the payment channel with the given address // getPaychState gets the state of the payment channel with the given address
func getPaychState(ctx context.Context, t *testing.T, node kit2.TestFullNode, chAddr address.Address) paych.State { func getPaychState(ctx context.Context, t *testing.T, node kit.TestFullNode, chAddr address.Address) paych.State {
act, err := node.StateGetActor(ctx, chAddr, types.EmptyTSK) act, err := node.StateGetActor(ctx, chAddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)
@ -414,10 +414,10 @@ func getPaychState(ctx context.Context, t *testing.T, node kit2.TestFullNode, ch
return chState return chState
} }
func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCreator *kit2.TestFullNode, paymentReceiver *kit2.TestFullNode, blocktime time.Duration) (address.Address, address.Address) { func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCreator *kit.TestFullNode, paymentReceiver *kit.TestFullNode, blocktime time.Duration) (address.Address, address.Address) {
var miner kit2.TestMiner var miner kit.TestMiner
opts := kit2.ThroughRPC() opts := kit.ThroughRPC()
kit2.NewEnsemble(t, kit2.MockProofs()). kit.NewEnsemble(t, kit.MockProofs()).
FullNode(paymentCreator, opts). FullNode(paymentCreator, opts).
FullNode(paymentReceiver, opts). FullNode(paymentReceiver, opts).
Miner(&miner, paymentCreator). Miner(&miner, paymentCreator).
@ -428,7 +428,7 @@ func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCr
// Send some funds to the second node // Send some funds to the second node
receiverAddr, err := paymentReceiver.WalletDefaultAddress(ctx) receiverAddr, err := paymentReceiver.WalletDefaultAddress(ctx)
require.NoError(t, err) require.NoError(t, err)
kit2.SendFunds(ctx, t, paymentCreator, receiverAddr, abi.NewTokenAmount(1e18)) kit.SendFunds(ctx, t, paymentCreator, receiverAddr, abi.NewTokenAmount(1e18))
// Get the first node's address // Get the first node's address
creatorAddr, err := paymentCreator.WalletDefaultAddress(ctx) creatorAddr, err := paymentCreator.WalletDefaultAddress(ctx)

View File

@ -10,14 +10,14 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
bminer "github.com/filecoin-project/lotus/miner" bminer "github.com/filecoin-project/lotus/miner"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestSDRUpgrade(t *testing.T) { func TestSDRUpgrade(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
// oldDelay := policy.GetPreCommitChallengeDelay() // oldDelay := policy.GetPreCommitChallengeDelay()
// policy.SetPreCommitChallengeDelay(5) // policy.SetPreCommitChallengeDelay(5)
@ -30,8 +30,8 @@ func TestSDRUpgrade(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.SDRUpgradeAt(500, 1000)) opts := kit.ConstructorOpts(kit.SDRUpgradeAt(500, 1000))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll() ens.InterconnectAll()
build.Clock.Sleep(time.Second) build.Clock.Sleep(time.Second)

View File

@ -7,16 +7,16 @@ import (
"testing" "testing"
"time" "time"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit2"
) )
func TestPledgeSectors(t *testing.T) { func TestPledgeSectors(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blockTime := 50 * time.Millisecond blockTime := 50 * time.Millisecond
@ -24,7 +24,7 @@ func TestPledgeSectors(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
_, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) _, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
miner.PledgeSectors(ctx, nSectors, 0, nil) miner.PledgeSectors(ctx, nSectors, 0, nil)
@ -54,11 +54,11 @@ func TestPledgeBatching(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) opts := kit.ConstructorOpts(kit.LatestActorsAt(-1))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)
client.WaitTillChain(ctx, kit2.HeightAtLeast(10)) client.WaitTillChain(ctx, kit.HeightAtLeast(10))
toCheck := miner.StartPledge(ctx, nSectors, 0, nil) toCheck := miner.StartPledge(ctx, nSectors, 0, nil)
@ -111,11 +111,11 @@ func TestPledgeBeforeNv13(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(1000000000)) opts := kit.ConstructorOpts(kit.LatestActorsAt(1000000000))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
client.WaitTillChain(ctx, kit2.HeightAtLeast(10)) client.WaitTillChain(ctx, kit.HeightAtLeast(10))
toCheck := miner.StartPledge(ctx, nSectors, 0, nil) toCheck := miner.StartPledge(ctx, nSectors, 0, nil)

View File

@ -10,7 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -19,7 +19,7 @@ func TestTerminate(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
const blocktime = 2 * time.Millisecond const blocktime = 2 * time.Millisecond
@ -28,8 +28,8 @@ func TestTerminate(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) opts := kit.ConstructorOpts(kit.LatestActorsAt(-1))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
@ -57,7 +57,7 @@ func TestTerminate(t *testing.T) {
waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
} }
@ -140,7 +140,7 @@ loop:
waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)

View File

@ -10,13 +10,13 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/stmgr"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
func TestTapeFix(t *testing.T) { func TestTapeFix(t *testing.T) {
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var blocktime = 2 * time.Millisecond var blocktime = 2 * time.Millisecond
@ -42,8 +42,8 @@ func testTapeFix(t *testing.T, blocktime time.Duration, after bool) {
}) })
} }
nopts := kit2.ConstructorOpts(node.Override(new(stmgr.UpgradeSchedule), upgradeSchedule)) nopts := kit.ConstructorOpts(node.Override(new(stmgr.UpgradeSchedule), upgradeSchedule))
_, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), nopts) _, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), nopts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
sid, err := miner.PledgeSector(ctx) sid, err := miner.PledgeSector(ctx)

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
"github.com/filecoin-project/lotus/itests/kit"
verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg" verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -18,7 +19,6 @@ import (
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit2"
"github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/impl"
) )
@ -39,10 +39,10 @@ func TestVerifiedClientTopUp(t *testing.T) {
bal, err := types.ParseFIL("100fil") bal, err := types.ParseFIL("100fil")
require.NoError(t, err) require.NoError(t, err)
node, _, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), node, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(),
kit2.RootVerifier(rootKey, abi.NewTokenAmount(bal.Int64())), kit.RootVerifier(rootKey, abi.NewTokenAmount(bal.Int64())),
kit2.Account(verifierKey, abi.NewTokenAmount(bal.Int64())), // assign some balance to the verifier so they can send an AddClient message. kit.Account(verifierKey, abi.NewTokenAmount(bal.Int64())), // assign some balance to the verifier so they can send an AddClient message.
kit2.ConstructorOpts(kit2.InstantaneousNetworkVersion(nv))) kit.ConstructorOpts(kit.InstantaneousNetworkVersion(nv)))
ens.InterconnectAll().BeginMining(blockTime) ens.InterconnectAll().BeginMining(blockTime)

View File

@ -15,7 +15,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
minerActor "github.com/filecoin-project/lotus/chain/actors/builtin/miner" minerActor "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
proof3 "github.com/filecoin-project/specs-actors/v3/actors/runtime/proof" proof3 "github.com/filecoin-project/specs-actors/v3/actors/runtime/proof"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -25,7 +25,7 @@ func TestWindowPostDispute(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 2 * time.Millisecond blocktime := 2 * time.Millisecond
@ -33,20 +33,20 @@ func TestWindowPostDispute(t *testing.T) {
defer cancel() defer cancel()
var ( var (
client kit2.TestFullNode client kit.TestFullNode
chainMiner kit2.TestMiner chainMiner kit.TestMiner
evilMiner kit2.TestMiner evilMiner kit.TestMiner
) )
// First, we configure two miners. After sealing, we're going to turn off the first miner so // First, we configure two miners. After sealing, we're going to turn off the first miner so
// it doesn't submit proofs. // it doesn't submit proofs.
// //
// Then we're going to manually submit bad proofs. // Then we're going to manually submit bad proofs.
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) opts := kit.ConstructorOpts(kit.LatestActorsAt(-1))
ens := kit2.NewEnsemble(t, kit2.MockProofs()). ens := kit.NewEnsemble(t, kit.MockProofs()).
FullNode(&client, opts). FullNode(&client, opts).
Miner(&chainMiner, &client, opts). Miner(&chainMiner, &client, opts).
Miner(&evilMiner, &client, opts, kit2.PresealSectors(0)). Miner(&evilMiner, &client, opts, kit.PresealSectors(0)).
Start() Start()
{ {
@ -87,7 +87,7 @@ func TestWindowPostDispute(t *testing.T) {
waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
p, err := client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, evilMinerAddr, types.EmptyTSK)
@ -232,15 +232,15 @@ func TestWindowPostDisputeFails(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
blocktime := 2 * time.Millisecond blocktime := 2 * time.Millisecond
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) opts := kit.ConstructorOpts(kit.LatestActorsAt(-1))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
defaultFrom, err := client.WalletDefaultAddress(ctx) defaultFrom, err := client.WalletDefaultAddress(ctx)
@ -260,12 +260,12 @@ func TestWindowPostDisputeFails(t *testing.T) {
waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
ssz, err := miner.ActorSectorSize(ctx, maddr) ssz, err := miner.ActorSectorSize(ctx, maddr)
require.NoError(t, err) require.NoError(t, err)
expectedPower := types.NewInt(uint64(ssz) * (kit2.DefaultPresealsPerBootstrapMiner + 10)) expectedPower := types.NewInt(uint64(ssz) * (kit.DefaultPresealsPerBootstrapMiner + 10))
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
require.NoError(t, err) require.NoError(t, err)

View File

@ -18,7 +18,7 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/mock" "github.com/filecoin-project/lotus/extern/sector-storage/mock"
"github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/impl"
) )
@ -27,7 +27,7 @@ func TestWindowedPost(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (
blocktime = 2 * time.Millisecond blocktime = 2 * time.Millisecond
@ -50,8 +50,8 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(upgradeHeight)) opts := kit.ConstructorOpts(kit.LatestActorsAt(upgradeHeight))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
miner.PledgeSectors(ctx, nSectors, 0, nil) miner.PledgeSectors(ctx, nSectors, 0, nil)
@ -69,7 +69,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err := client.StateMinerPower(ctx, maddr, types.EmptyTSK)
@ -79,7 +79,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
require.Equal(t, p.MinerPower.RawBytePower, types.NewInt(uint64(ssz)*uint64(nSectors+kit2.DefaultPresealsPerBootstrapMiner))) require.Equal(t, p.MinerPower.RawBytePower, types.NewInt(uint64(ssz)*uint64(nSectors+kit.DefaultPresealsPerBootstrapMiner)))
t.Log("Drop some sectors") t.Log("Drop some sectors")
@ -145,7 +145,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts = client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
@ -154,7 +154,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
sectors := p.MinerPower.RawBytePower.Uint64() / uint64(ssz) sectors := p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
require.Equal(t, nSectors+kit2.DefaultPresealsPerBootstrapMiner-3, int(sectors)) // -3 just removed sectors require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-3, int(sectors)) // -3 just removed sectors
t.Log("Recover one sector") t.Log("Recover one sector")
@ -167,7 +167,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d", waitUntil) t.Logf("End for head.Height > %d", waitUntil)
ts = client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts = client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK)
@ -176,7 +176,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz) sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
require.Equal(t, nSectors+kit2.DefaultPresealsPerBootstrapMiner-2, int(sectors)) // -2 not recovered sectors require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-2, int(sectors)) // -2 not recovered sectors
// pledge a sector after recovery // pledge a sector after recovery
@ -190,7 +190,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2
t.Logf("End for head.Height > %d\n", waitUntil) t.Logf("End for head.Height > %d\n", waitUntil)
ts := client.WaitTillChain(ctx, kit2.HeightAtLeast(waitUntil)) ts := client.WaitTillChain(ctx, kit.HeightAtLeast(waitUntil))
t.Logf("Now head.Height = %d", ts.Height()) t.Logf("Now head.Height = %d", ts.Height())
} }
@ -200,7 +200,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.Equal(t, p.MinerPower, p.TotalPower) require.Equal(t, p.MinerPower, p.TotalPower)
sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz) sectors = p.MinerPower.RawBytePower.Uint64() / uint64(ssz)
require.Equal(t, nSectors+kit2.DefaultPresealsPerBootstrapMiner-2+1, int(sectors)) // -2 not recovered sectors + 1 just pledged require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-2+1, int(sectors)) // -2 not recovered sectors + 1 just pledged
} }
func TestWindowPostBaseFeeNoBurn(t *testing.T) { func TestWindowPostBaseFeeNoBurn(t *testing.T) {
@ -208,7 +208,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (
blocktime = 2 * time.Millisecond blocktime = 2 * time.Millisecond
@ -221,7 +221,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) {
och := build.UpgradeClausHeight och := build.UpgradeClausHeight
build.UpgradeClausHeight = 10 build.UpgradeClausHeight = 10
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)
@ -264,15 +264,15 @@ func TestWindowPostBaseFeeBurn(t *testing.T) {
t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run")
} }
kit2.QuietMiningLogs() kit.QuietMiningLogs()
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
blocktime := 2 * time.Millisecond blocktime := 2 * time.Millisecond
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) opts := kit.ConstructorOpts(kit.LatestActorsAt(-1))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blocktime) ens.InterconnectAll().BeginMining(blocktime)
maddr, err := miner.ActorAddress(ctx) maddr, err := miner.ActorAddress(ctx)