From 8a418bf9828f8f112396ca88d130f1e5be4e198b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 18 Jun 2021 19:45:29 +0100 Subject: [PATCH] rename {kit2=>kit}. --- itests/api_test.go | 22 +++++----- itests/batch_deal_test.go | 12 +++--- itests/ccupgrade_test.go | 17 ++++---- itests/cli_test.go | 8 ++-- itests/deadlines_test.go | 30 +++++++------- itests/deals_test.go | 52 ++++++++++++------------ itests/gateway_test.go | 40 +++++++++--------- itests/{kit2 => kit}/blockminer.go | 2 +- itests/{kit2 => kit}/client.go | 2 +- itests/{kit2 => kit}/deals.go | 2 +- itests/{kit2 => kit}/deals_state.go | 2 +- itests/{kit2 => kit}/ensemble.go | 2 +- itests/{kit2 => kit}/ensemble_opts.go | 2 +- itests/{kit2 => kit}/ensemble_presets.go | 2 +- itests/{kit2 => kit}/files.go | 2 +- itests/{kit2 => kit}/funds.go | 2 +- itests/{kit2 => kit}/init.go | 2 +- itests/{kit2 => kit}/log.go | 2 +- itests/{kit2 => kit}/mockcli.go | 2 +- itests/{kit2 => kit}/node_full.go | 2 +- itests/{kit2 => kit}/node_miner.go | 2 +- itests/{kit2 => kit}/node_opts.go | 2 +- itests/{kit2 => kit}/node_opts_nv.go | 2 +- itests/{kit2 => kit}/rpc.go | 2 +- itests/multisig_test.go | 12 +++--- itests/paych_api_test.go | 18 ++++---- itests/paych_cli_test.go | 48 +++++++++++----------- itests/sdr_upgrade_test.go | 8 ++-- itests/sector_pledge_test.go | 18 ++++---- itests/sector_terminate_test.go | 12 +++--- itests/tape_test.go | 8 ++-- itests/verifreg_test.go | 10 ++--- itests/wdpost_dispute_test.go | 28 ++++++------- itests/wdpost_test.go | 34 ++++++++-------- 34 files changed, 205 insertions(+), 206 deletions(-) rename itests/{kit2 => kit}/blockminer.go (99%) rename itests/{kit2 => kit}/client.go (99%) rename itests/{kit2 => kit}/deals.go (99%) rename itests/{kit2 => kit}/deals_state.go (98%) rename itests/{kit2 => kit}/ensemble.go (99%) rename itests/{kit2 => kit}/ensemble_opts.go (99%) rename itests/{kit2 => kit}/ensemble_presets.go (99%) rename itests/{kit2 => kit}/files.go (98%) rename itests/{kit2 => kit}/funds.go (98%) rename itests/{kit2 => kit}/init.go (98%) rename itests/{kit2 => kit}/log.go (97%) rename itests/{kit2 => kit}/mockcli.go (99%) rename itests/{kit2 => kit}/node_full.go (99%) rename itests/{kit2 => kit}/node_miner.go (99%) rename itests/{kit2 => kit}/node_opts.go (99%) rename itests/{kit2 => kit}/node_opts_nv.go (99%) rename itests/{kit2 => kit}/rpc.go (99%) diff --git a/itests/api_test.go b/itests/api_test.go index f8567bd2a..45c137a8d 100644 --- a/itests/api_test.go +++ b/itests/api_test.go @@ -12,7 +12,7 @@ import ( lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "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" ) @@ -21,7 +21,7 @@ func TestAPI(t *testing.T) { runAPITest(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 }) - full, _, _ := kit2.EnsembleMinimal(t, ts.opts...) + full, _, _ := kit.EnsembleMinimal(t, ts.opts...) v, err := full.Version(context.Background()) require.NoError(t, err) @@ -61,7 +61,7 @@ func (ts *apiSuite) testVersion(t *testing.T) { func (ts *apiSuite) testID(t *testing.T) { ctx := context.Background() - full, _, _ := kit2.EnsembleMinimal(t, ts.opts...) + full, _, _ := kit.EnsembleMinimal(t, ts.opts...) id, err := full.ID(ctx) if err != nil { @@ -73,7 +73,7 @@ func (ts *apiSuite) testID(t *testing.T) { func (ts *apiSuite) testConnectTwo(t *testing.T) { ctx := context.Background() - one, two, _, ens := kit2.EnsembleTwoOne(t, ts.opts...) + one, two, _, ens := kit.EnsembleTwoOne(t, ts.opts...) p, err := one.NetPeers(ctx) require.NoError(t, err) @@ -97,7 +97,7 @@ func (ts *apiSuite) testConnectTwo(t *testing.T) { func (ts *apiSuite) testSearchMsg(t *testing.T) { ctx := context.Background() - full, _, ens := kit2.EnsembleMinimal(t, ts.opts...) + full, _, ens := kit.EnsembleMinimal(t, ts.opts...) senderAddr, err := full.WalletDefaultAddress(ctx) require.NoError(t, err) @@ -127,7 +127,7 @@ func (ts *apiSuite) testSearchMsg(t *testing.T) { func (ts *apiSuite) testMining(t *testing.T) { ctx := context.Background() - full, miner, _ := kit2.EnsembleMinimal(t, ts.opts...) + full, miner, _ := kit.EnsembleMinimal(t, ts.opts...) newHeads, err := full.ChainNotify(ctx) require.NoError(t, err) @@ -138,7 +138,7 @@ func (ts *apiSuite) testMining(t *testing.T) { require.NoError(t, err) require.Equal(t, int64(h1.Height()), int64(baseHeight)) - bm := kit2.NewBlockMiner(t, miner) + bm := kit.NewBlockMiner(t, miner) bm.MineUntilBlock(ctx, full, nil) require.NoError(t, err) @@ -170,7 +170,7 @@ func (ts *apiSuite) testMiningReal(t *testing.T) { func (ts *apiSuite) testNonGenesisMiner(t *testing.T) { ctx := context.Background() - full, genesisMiner, ens := kit2.EnsembleMinimal(t, ts.opts...) + full, genesisMiner, ens := kit.EnsembleMinimal(t, ts.opts...) ens.BeginMining(4 * time.Millisecond) @@ -180,8 +180,8 @@ func (ts *apiSuite) testNonGenesisMiner(t *testing.T) { _, err = full.StateMinerInfo(ctx, gaa, types.EmptyTSK) require.NoError(t, err) - var newMiner kit2.TestMiner - ens.Miner(&newMiner, full, kit2.OwnerAddr(full.DefaultKey)).Start() + var newMiner kit.TestMiner + ens.Miner(&newMiner, full, kit.OwnerAddr(full.DefaultKey)).Start() ta, err := newMiner.ActorAddress(ctx) require.NoError(t, err) diff --git a/itests/batch_deal_test.go b/itests/batch_deal_test.go index 9cc4d7ac1..300a44fa2 100644 --- a/itests/batch_deal_test.go +++ b/itests/batch_deal_test.go @@ -10,7 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "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/node" "github.com/filecoin-project/lotus/node/modules/dtypes" @@ -18,7 +18,7 @@ import ( ) func TestBatchDealInput(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() var ( blockTime = 10 * time.Millisecond @@ -37,7 +37,7 @@ func TestBatchDealInput(t *testing.T) { maxDealsPerMsg := uint64(deals) // Set max deals per publish deals message to maxDealsPerMsg - opts := kit2.ConstructorOpts(node.Options( + opts := kit.ConstructorOpts(node.Options( node.Override( new(*storageadapter.DealPublisher), storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{ @@ -56,9 +56,9 @@ func TestBatchDealInput(t *testing.T) { }, nil }), )) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) 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) require.NoError(t, err) @@ -87,7 +87,7 @@ func TestBatchDealInput(t *testing.T) { // Starts a deal and waits until it's published runDealTillSeal := func(rseed int) { - res, _, _, err := kit2.CreateImportFile(ctx, client, rseed, piece) + res, _, _, err := kit.CreateImportFile(ctx, client, rseed, piece) require.NoError(t, err) deal := dh.StartDeal(ctx, res.Root, false, dealStartEpoch) diff --git a/itests/ccupgrade_test.go b/itests/ccupgrade_test.go index 2c35b425d..e9961dc3a 100644 --- a/itests/ccupgrade_test.go +++ b/itests/ccupgrade_test.go @@ -6,16 +6,15 @@ import ( "testing" "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/lotus/chain/types" + "github.com/filecoin-project/lotus/itests/kit" + + "github.com/stretchr/testify/require" ) func TestCCUpgrade(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() for _, height := range []abi.ChainEpoch{ -1, // before @@ -34,8 +33,8 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) { ctx := context.Background() blockTime := 5 * time.Millisecond - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(upgradeHeight)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(upgradeHeight)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blockTime) maddr, err := miner.ActorAddress(ctx) @@ -43,7 +42,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) { t.Fatal(err) } - CC := abi.SectorNumber(kit2.DefaultPresealsPerBootstrapMiner + 1) + CC := abi.SectorNumber(kit.DefaultPresealsPerBootstrapMiner + 1) Upgraded := CC + 1 miner.PledgeSectors(ctx, 1, 0, nil) @@ -62,7 +61,7 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) { err = miner.SectorMarkForUpgrade(ctx, sl[0]) require.NoError(t, err) - dh := kit2.NewDealHarness(t, client, miner) + dh := kit.NewDealHarness(t, client, miner) dh.MakeOnlineDeal(context.Background(), 6, false, 0) diff --git a/itests/cli_test.go b/itests/cli_test.go index 5c9cf0f69..0bd1ec3b4 100644 --- a/itests/cli_test.go +++ b/itests/cli_test.go @@ -6,16 +6,16 @@ import ( "time" "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. func TestClient(t *testing.T) { _ = os.Setenv("BELLMAN_NO_GPU", "1") - kit2.QuietMiningLogs() + kit.QuietMiningLogs() 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) - kit2.RunClientTest(t, cli.Commands, client) + kit.RunClientTest(t, cli.Commands, client) } diff --git a/itests/deadlines_test.go b/itests/deadlines_test.go index 3c8303ac0..00c737b72 100644 --- a/itests/deadlines_test.go +++ b/itests/deadlines_test.go @@ -21,7 +21,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/types" "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" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" "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") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() const sectorsC, sectorsD, sectorsB = 10, 9, 8 @@ -71,22 +71,22 @@ func TestDeadlineToggling(t *testing.T) { defer cancel() var ( - client kit2.TestFullNode - minerA kit2.TestMiner - minerB kit2.TestMiner - minerC kit2.TestMiner - minerD kit2.TestMiner - minerE kit2.TestMiner + client kit.TestFullNode + minerA kit.TestMiner + minerB kit.TestMiner + minerC kit.TestMiner + minerD kit.TestMiner + minerE kit.TestMiner ) - opts := []kit2.NodeOpt{kit2.ConstructorOpts(kit2.NetworkUpgradeAt(network.Version12, upgradeH))} - ens := kit2.NewEnsemble(t, kit2.MockProofs()). + opts := []kit.NodeOpt{kit.ConstructorOpts(kit.NetworkUpgradeAt(network.Version12, upgradeH))} + ens := kit.NewEnsemble(t, kit.MockProofs()). FullNode(&client, opts...). Miner(&minerA, &client, opts...). Start(). InterconnectAll() ens.BeginMining(blocktime) - opts = append(opts, kit2.OwnerAddr(client.DefaultKey)) + opts = append(opts, kit.OwnerAddr(client.DefaultKey)) ens.Miner(&minerB, &client, opts...). Miner(&minerC, &client, opts...). Start() @@ -204,7 +204,7 @@ func TestDeadlineToggling(t *testing.T) { require.NoError(t, err) // 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(maddrB, types.NewInt(0), false, false, types.EmptyTSK) @@ -231,7 +231,7 @@ func TestDeadlineToggling(t *testing.T) { params := &miner.SectorPreCommitInfo{ Expiration: 2880 * 300, SectorNumber: 22, - SealProof: kit2.TestSpt, + SealProof: kit.TestSpt, SealedCID: cr, SealRandEpoch: head.Height() - 200, @@ -281,7 +281,7 @@ func TestDeadlineToggling(t *testing.T) { } // 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(maddrB, types.NewInt(uint64(ssz)*sectorsB), 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) } - 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(maddrB, types.NewInt(0), true, true, types.EmptyTSK) checkMiner(maddrD, types.NewInt(0), false, false, types.EmptyTSK) diff --git a/itests/deals_test.go b/itests/deals_test.go index af0ef68c4..3903968d4 100644 --- a/itests/deals_test.go +++ b/itests/deals_test.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/builtin/market" "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/node" 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") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blockTime := 10 * time.Millisecond @@ -37,9 +37,9 @@ func TestDealCyclesConcurrent(t *testing.T) { startEpoch := abi.ChainEpoch(2 << 12) 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) - dh := kit2.NewDealHarness(t, client, miner) + dh := kit.NewDealHarness(t, client, miner) runConcurrentDeals(t, dh, fullDealCyclesOpts{ n: n, @@ -67,7 +67,7 @@ type fullDealCyclesOpts struct { 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()) for i := 0; i < opts.n; 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) outPath := dh.PerformRetrieval(context.Background(), deal, res.Root, opts.carExport) - kit2.AssertFilesEqual(t, inPath, outPath) + kit.AssertFilesEqual(t, inPath, outPath) return nil }) } @@ -93,13 +93,13 @@ func TestDealsWithSealingAndRPC(t *testing.T) { t.Skip("skipping test in short mode") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() 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) - dh := kit2.NewDealHarness(t, client, miner) + dh := kit.NewDealHarness(t, client, miner) t.Run("stdretrieval", func(t *testing.T) { runConcurrentDeals(t, dh, fullDealCyclesOpts{n: 1}) @@ -123,7 +123,7 @@ func TestPublishDealsBatching(t *testing.T) { startEpoch = abi.ChainEpoch(2 << 12) ) - kit2.QuietMiningLogs() + kit.QuietMiningLogs() opts := node.Override(new(*storageadapter.DealPublisher), 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) - dh := kit2.NewDealHarness(t, client, miner) + dh := kit.NewDealHarness(t, client, miner) // Starts a deal and waits until it's published runDealTillPublish := func(rseed int) { @@ -210,23 +210,23 @@ func TestFirstDealEnablesMining(t *testing.T) { t.Skip("skipping test in short mode") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() var ( - client kit2.TestFullNode - genMiner kit2.TestMiner // bootstrap - provider kit2.TestMiner // no sectors, will need to create one + client kit.TestFullNode + genMiner kit.TestMiner // bootstrap + 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.Miner(&genMiner, &client) - ens.Miner(&provider, &client, kit2.PresealSectors(0)) + ens.Miner(&provider, &client, kit.PresealSectors(0)) ens.Start().InterconnectAll().BeginMining(50 * time.Millisecond) ctx := context.Background() - dh := kit2.NewDealHarness(t, &client, &provider) + dh := kit.NewDealHarness(t, &client, &provider) ref, _ := client.CreateImportFile(ctx, 5, 0) @@ -241,7 +241,7 @@ func TestFirstDealEnablesMining(t *testing.T) { providerMined := make(chan struct{}) go func() { - _ = client.WaitTillChain(ctx, kit2.BlockMinedBy(provider.ActorAddr)) + _ = client.WaitTillChain(ctx, kit.BlockMinedBy(provider.ActorAddr)) close(providerMined) }() @@ -266,10 +266,10 @@ func TestOfflineDealFlow(t *testing.T) { runTest := func(t *testing.T, fastRet bool) { ctx := context.Background() - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs()) 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. res, inFile := client.CreateImportFile(ctx, 1, 0) @@ -333,7 +333,7 @@ func TestOfflineDealFlow(t *testing.T) { // Retrieve the deal 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) }) @@ -345,14 +345,14 @@ func TestZeroPricePerByteRetrieval(t *testing.T) { t.Skip("skipping test in short mode") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() var ( blockTime = 10 * time.Millisecond 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) ctx := context.Background() @@ -364,7 +364,7 @@ func TestZeroPricePerByteRetrieval(t *testing.T) { err = miner.MarketSetRetrievalAsk(ctx, ask) require.NoError(t, err) - dh := kit2.NewDealHarness(t, client, miner) + dh := kit.NewDealHarness(t, client, miner) runConcurrentDeals(t, dh, fullDealCyclesOpts{ n: 1, startEpoch: startEpoch, diff --git a/itests/gateway_test.go b/itests/gateway_test.go index 36df41d54..dfbe5bed5 100644 --- a/itests/gateway_test.go +++ b/itests/gateway_test.go @@ -8,6 +8,7 @@ import ( "testing" "time" + "github.com/filecoin-project/lotus/itests/kit" "github.com/stretchr/testify/require" "golang.org/x/xerrors" @@ -23,7 +24,6 @@ import ( "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/gateway" - "github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/node" 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 // node that is connected through a gateway to a full API node func TestGatewayWalletMsig(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() @@ -176,7 +176,7 @@ func TestGatewayWalletMsig(t *testing.T) { // TestGatewayMsigCLI tests that msig CLI calls can be made // on a lite node that is connected through a gateway to a full API node func TestGatewayMsigCLI(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() @@ -188,7 +188,7 @@ func TestGatewayMsigCLI(t *testing.T) { } func TestGatewayDealFlow(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() @@ -202,26 +202,26 @@ func TestGatewayDealFlow(t *testing.T) { // so that the deal starts sealing in time 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) dh.PerformRetrieval(ctx, dealCid, res.Root, false) } func TestGatewayCLIDealFlow(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() nodes := startNodesWithFunds(ctx, t, blocktime, maxLookbackCap, maxStateWaitLookbackLimit) defer nodes.closer() - kit2.RunClientTest(t, cli.Commands, nodes.lite) + kit.RunClientTest(t, cli.Commands, nodes.lite) } type testNodes struct { - lite *kit2.TestFullNode - full *kit2.TestFullNode - miner *kit2.TestMiner + lite *kit.TestFullNode + full *kit.TestFullNode + miner *kit.TestMiner closer jsonrpc.ClientCloser } @@ -259,9 +259,9 @@ func startNodes( var closer jsonrpc.ClientCloser var ( - full *kit2.TestFullNode - miner *kit2.TestMiner - lite kit2.TestFullNode + full *kit.TestFullNode + miner *kit.TestMiner + lite kit.TestFullNode ) // - Create one full node and one lite node @@ -270,8 +270,8 @@ func startNodes( // - Connect lite node -> gateway server -> full node // create the full node and the miner. - var ens *kit2.Ensemble - full, miner, ens = kit2.EnsembleMinimal(t, kit2.MockProofs()) + var ens *kit.Ensemble + full, miner, ens = kit.EnsembleMinimal(t, kit.MockProofs()) ens.InterconnectAll().BeginMining(blocktime) // Create a gateway server in front of the full node @@ -279,7 +279,7 @@ func startNodes( handler, err := gateway.Handler(gwapi) 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 var gapi api.Gateway @@ -287,9 +287,9 @@ func startNodes( require.NoError(t, err) ens.FullNode(&lite, - kit2.LiteNode(), - kit2.ThroughRPC(), - kit2.ConstructorOpts( + kit.LiteNode(), + kit.ThroughRPC(), + kit.ConstructorOpts( node.Override(new(api.Gateway), gapi), ), ).Start().InterconnectAll() @@ -297,7 +297,7 @@ func startNodes( 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{ From: fromAddr, To: toAddr, diff --git a/itests/kit2/blockminer.go b/itests/kit/blockminer.go similarity index 99% rename from itests/kit2/blockminer.go rename to itests/kit/blockminer.go index 04d425dd6..2c9bd47c6 100644 --- a/itests/kit2/blockminer.go +++ b/itests/kit/blockminer.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/client.go b/itests/kit/client.go similarity index 99% rename from itests/kit2/client.go rename to itests/kit/client.go index 78a7034fe..3a16f5204 100644 --- a/itests/kit2/client.go +++ b/itests/kit/client.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/deals.go b/itests/kit/deals.go similarity index 99% rename from itests/kit2/deals.go rename to itests/kit/deals.go index 2e015a9c7..98e6efee2 100644 --- a/itests/kit2/deals.go +++ b/itests/kit/deals.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/deals_state.go b/itests/kit/deals_state.go similarity index 98% rename from itests/kit2/deals_state.go rename to itests/kit/deals_state.go index be3a9e4db..617a6d28e 100644 --- a/itests/kit2/deals_state.go +++ b/itests/kit/deals_state.go @@ -1,4 +1,4 @@ -package kit2 +package kit type TestDealState int diff --git a/itests/kit2/ensemble.go b/itests/kit/ensemble.go similarity index 99% rename from itests/kit2/ensemble.go rename to itests/kit/ensemble.go index 44580920f..1accdbd61 100644 --- a/itests/kit2/ensemble.go +++ b/itests/kit/ensemble.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "bytes" diff --git a/itests/kit2/ensemble_opts.go b/itests/kit/ensemble_opts.go similarity index 99% rename from itests/kit2/ensemble_opts.go rename to itests/kit/ensemble_opts.go index 8c6d66d9e..9233aadd8 100644 --- a/itests/kit2/ensemble_opts.go +++ b/itests/kit/ensemble_opts.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "time" diff --git a/itests/kit2/ensemble_presets.go b/itests/kit/ensemble_presets.go similarity index 99% rename from itests/kit2/ensemble_presets.go rename to itests/kit/ensemble_presets.go index 28a4b5d92..7cae12a68 100644 --- a/itests/kit2/ensemble_presets.go +++ b/itests/kit/ensemble_presets.go @@ -1,4 +1,4 @@ -package kit2 +package kit import "testing" diff --git a/itests/kit2/files.go b/itests/kit/files.go similarity index 98% rename from itests/kit2/files.go rename to itests/kit/files.go index 1e1509858..48592b518 100644 --- a/itests/kit2/files.go +++ b/itests/kit/files.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "bytes" diff --git a/itests/kit2/funds.go b/itests/kit/funds.go similarity index 98% rename from itests/kit2/funds.go rename to itests/kit/funds.go index b29963353..417cf9ce1 100644 --- a/itests/kit2/funds.go +++ b/itests/kit/funds.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/init.go b/itests/kit/init.go similarity index 98% rename from itests/kit2/init.go rename to itests/kit/init.go index dfc5a13f2..8df4922b8 100644 --- a/itests/kit2/init.go +++ b/itests/kit/init.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "fmt" diff --git a/itests/kit2/log.go b/itests/kit/log.go similarity index 97% rename from itests/kit2/log.go rename to itests/kit/log.go index f255d0639..3dce3af9d 100644 --- a/itests/kit2/log.go +++ b/itests/kit/log.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "github.com/filecoin-project/lotus/lib/lotuslog" diff --git a/itests/kit2/mockcli.go b/itests/kit/mockcli.go similarity index 99% rename from itests/kit2/mockcli.go rename to itests/kit/mockcli.go index 592c97333..c0f218920 100644 --- a/itests/kit2/mockcli.go +++ b/itests/kit/mockcli.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "bytes" diff --git a/itests/kit2/node_full.go b/itests/kit/node_full.go similarity index 99% rename from itests/kit2/node_full.go rename to itests/kit/node_full.go index 3dadb4d8d..83586e188 100644 --- a/itests/kit2/node_full.go +++ b/itests/kit/node_full.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/node_miner.go b/itests/kit/node_miner.go similarity index 99% rename from itests/kit2/node_miner.go rename to itests/kit/node_miner.go index 1cd65e20e..d3f0d2e3c 100644 --- a/itests/kit2/node_miner.go +++ b/itests/kit/node_miner.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/node_opts.go b/itests/kit/node_opts.go similarity index 99% rename from itests/kit2/node_opts.go rename to itests/kit/node_opts.go index b2dacd3cc..c36ca3e26 100644 --- a/itests/kit2/node_opts.go +++ b/itests/kit/node_opts.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "github.com/filecoin-project/go-state-types/abi" diff --git a/itests/kit2/node_opts_nv.go b/itests/kit/node_opts_nv.go similarity index 99% rename from itests/kit2/node_opts_nv.go rename to itests/kit/node_opts_nv.go index 5ffd94f5e..d4c84b4f1 100644 --- a/itests/kit2/node_opts_nv.go +++ b/itests/kit/node_opts_nv.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/kit2/rpc.go b/itests/kit/rpc.go similarity index 99% rename from itests/kit2/rpc.go rename to itests/kit/rpc.go index 873b64257..dab45df07 100644 --- a/itests/kit2/rpc.go +++ b/itests/kit/rpc.go @@ -1,4 +1,4 @@ -package kit2 +package kit import ( "context" diff --git a/itests/multisig_test.go b/itests/multisig_test.go index 9b1f59673..0afdf5f0a 100644 --- a/itests/multisig_test.go +++ b/itests/multisig_test.go @@ -11,25 +11,25 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/types" "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" ) // TestMultisig does a basic test to exercise the multisig CLI commands func TestMultisig(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() 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) runMultisigTests(t, client) } -func runMultisigTests(t *testing.T, clientNode *kit2.TestFullNode) { +func runMultisigTests(t *testing.T, clientNode *kit.TestFullNode) { // Create mock CLI ctx := context.Background() - mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) + mockCLI := kit.NewMockCLI(ctx, t, cli.Commands) clientCLI := mockCLI.Client(clientNode.ListenAddr) // 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) - 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 diff --git a/itests/paych_api_test.go b/itests/paych_api_test.go index 86a156790..668eb14aa 100644 --- a/itests/paych_api_test.go +++ b/itests/paych_api_test.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/lotus/itests/kit" "github.com/ipfs/go-cid" "github.com/stretchr/testify/require" @@ -23,22 +24,21 @@ import ( "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/itests/kit2" ) func TestPaymentChannelsAPI(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() ctx := context.Background() blockTime := 5 * time.Millisecond var ( - paymentCreator kit2.TestFullNode - paymentReceiver kit2.TestFullNode - miner kit2.TestMiner + paymentCreator kit.TestFullNode + paymentReceiver kit.TestFullNode + miner kit.TestMiner ) - ens := kit2.NewEnsemble(t, kit2.MockProofs()). + ens := kit.NewEnsemble(t, kit.MockProofs()). FullNode(&paymentCreator). FullNode(&paymentReceiver). Miner(&miner, &paymentCreator). @@ -51,7 +51,7 @@ func TestPaymentChannelsAPI(t *testing.T) { receiverAddr, err := paymentReceiver.WalletNew(ctx, types.KTSecp256k1) 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 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) } -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 batchSize := 60 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) defer cancel() diff --git a/itests/paych_cli_test.go b/itests/paych_cli_test.go index 84ccee95a..8a0690449 100644 --- a/itests/paych_cli_test.go +++ b/itests/paych_cli_test.go @@ -11,7 +11,7 @@ import ( "time" "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-state-types/abi" @@ -37,19 +37,19 @@ func init() { // commands func TestPaymentChannelsBasic(t *testing.T) { _ = os.Setenv("BELLMAN_NO_GPU", "1") - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() var ( - paymentCreator kit2.TestFullNode - paymentReceiver kit2.TestFullNode + paymentCreator kit.TestFullNode + paymentReceiver kit.TestFullNode ) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) // Create mock CLI - mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) + mockCLI := kit.NewMockCLI(ctx, t, cli.Commands) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) receiverCLI := mockCLI.Client(paymentReceiver.ListenAddr) @@ -94,18 +94,18 @@ type voucherSpec struct { // TestPaymentChannelStatus tests the payment channel status CLI command func TestPaymentChannelStatus(t *testing.T) { _ = os.Setenv("BELLMAN_NO_GPU", "1") - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() var ( - paymentCreator kit2.TestFullNode - paymentReceiver kit2.TestFullNode + paymentCreator kit.TestFullNode + paymentReceiver kit.TestFullNode ) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) // Create mock CLI - mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) + mockCLI := kit.NewMockCLI(ctx, t, cli.Commands) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) // creator: paych status-by-from-to @@ -174,18 +174,18 @@ func TestPaymentChannelStatus(t *testing.T) { // channel voucher commands func TestPaymentChannelVouchers(t *testing.T) { _ = os.Setenv("BELLMAN_NO_GPU", "1") - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() var ( - paymentCreator kit2.TestFullNode - paymentReceiver kit2.TestFullNode + paymentCreator kit.TestFullNode + paymentReceiver kit.TestFullNode ) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) // Create mock CLI - mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) + mockCLI := kit.NewMockCLI(ctx, t, cli.Commands) creatorCLI := mockCLI.Client(paymentCreator.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 func TestPaymentChannelVoucherCreateShortfall(t *testing.T) { _ = os.Setenv("BELLMAN_NO_GPU", "1") - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 5 * time.Millisecond ctx := context.Background() var ( - paymentCreator kit2.TestFullNode - paymentReceiver kit2.TestFullNode + paymentCreator kit.TestFullNode + paymentReceiver kit.TestFullNode ) creatorAddr, receiverAddr := startPaychCreatorReceiverMiner(ctx, t, &paymentCreator, &paymentReceiver, blocktime) // Create mock CLI - mockCLI := kit2.NewMockCLI(ctx, t, cli.Commands) + mockCLI := kit.NewMockCLI(ctx, t, cli.Commands) creatorCLI := mockCLI.Client(paymentCreator.ListenAddr) // creator: paych add-funds @@ -385,7 +385,7 @@ func checkVoucherOutput(t *testing.T, list string, vouchers []voucherSpec) { } // 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{}) chainEvents := events.NewEvents(ctx, node) 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 -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) require.NoError(t, err) @@ -414,10 +414,10 @@ func getPaychState(ctx context.Context, t *testing.T, node kit2.TestFullNode, ch return chState } -func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCreator *kit2.TestFullNode, paymentReceiver *kit2.TestFullNode, blocktime time.Duration) (address.Address, address.Address) { - var miner kit2.TestMiner - opts := kit2.ThroughRPC() - kit2.NewEnsemble(t, kit2.MockProofs()). +func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCreator *kit.TestFullNode, paymentReceiver *kit.TestFullNode, blocktime time.Duration) (address.Address, address.Address) { + var miner kit.TestMiner + opts := kit.ThroughRPC() + kit.NewEnsemble(t, kit.MockProofs()). FullNode(paymentCreator, opts). FullNode(paymentReceiver, opts). Miner(&miner, paymentCreator). @@ -428,7 +428,7 @@ func startPaychCreatorReceiverMiner(ctx context.Context, t *testing.T, paymentCr // Send some funds to the second node receiverAddr, err := paymentReceiver.WalletDefaultAddress(ctx) 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 creatorAddr, err := paymentCreator.WalletDefaultAddress(ctx) diff --git a/itests/sdr_upgrade_test.go b/itests/sdr_upgrade_test.go index 008c2ce61..3aa685b09 100644 --- a/itests/sdr_upgrade_test.go +++ b/itests/sdr_upgrade_test.go @@ -10,14 +10,14 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/network" "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" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestSDRUpgrade(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() // oldDelay := policy.GetPreCommitChallengeDelay() // policy.SetPreCommitChallengeDelay(5) @@ -30,8 +30,8 @@ func TestSDRUpgrade(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.SDRUpgradeAt(500, 1000)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.SDRUpgradeAt(500, 1000)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll() build.Clock.Sleep(time.Second) diff --git a/itests/sector_pledge_test.go b/itests/sector_pledge_test.go index 8e87f2658..d911dcb68 100644 --- a/itests/sector_pledge_test.go +++ b/itests/sector_pledge_test.go @@ -7,16 +7,16 @@ import ( "testing" "time" + "github.com/filecoin-project/lotus/itests/kit" "github.com/stretchr/testify/require" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/itests/kit2" ) func TestPledgeSectors(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blockTime := 50 * time.Millisecond @@ -24,7 +24,7 @@ func TestPledgeSectors(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - _, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) + _, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs()) ens.InterconnectAll().BeginMining(blockTime) miner.PledgeSectors(ctx, nSectors, 0, nil) @@ -54,11 +54,11 @@ func TestPledgeBatching(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(-1)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blockTime) - client.WaitTillChain(ctx, kit2.HeightAtLeast(10)) + client.WaitTillChain(ctx, kit.HeightAtLeast(10)) toCheck := miner.StartPledge(ctx, nSectors, 0, nil) @@ -111,11 +111,11 @@ func TestPledgeBeforeNv13(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(1000000000)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(1000000000)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blocktime) - client.WaitTillChain(ctx, kit2.HeightAtLeast(10)) + client.WaitTillChain(ctx, kit.HeightAtLeast(10)) toCheck := miner.StartPledge(ctx, nSectors, 0, nil) diff --git a/itests/sector_terminate_test.go b/itests/sector_terminate_test.go index faf12228c..94d438437 100644 --- a/itests/sector_terminate_test.go +++ b/itests/sector_terminate_test.go @@ -10,7 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/chain/types" 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" ) @@ -19,7 +19,7 @@ func TestTerminate(t *testing.T) { t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() const blocktime = 2 * time.Millisecond @@ -28,8 +28,8 @@ func TestTerminate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(-1)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blocktime) maddr, err := miner.ActorAddress(ctx) @@ -57,7 +57,7 @@ func TestTerminate(t *testing.T) { waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 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()) } @@ -140,7 +140,7 @@ loop: waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 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()) p, err = client.StateMinerPower(ctx, maddr, types.EmptyTSK) diff --git a/itests/tape_test.go b/itests/tape_test.go index 6fb3def15..08970152f 100644 --- a/itests/tape_test.go +++ b/itests/tape_test.go @@ -10,13 +10,13 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/stmgr" 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/stretchr/testify/require" ) func TestTapeFix(t *testing.T) { - kit2.QuietMiningLogs() + kit.QuietMiningLogs() 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)) - _, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), nopts) + nopts := kit.ConstructorOpts(node.Override(new(stmgr.UpgradeSchedule), upgradeSchedule)) + _, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), nopts) ens.InterconnectAll().BeginMining(blocktime) sid, err := miner.PledgeSector(ctx) diff --git a/itests/verifreg_test.go b/itests/verifreg_test.go index 108da6ecf..28a72263e 100644 --- a/itests/verifreg_test.go +++ b/itests/verifreg_test.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/network" "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" "github.com/stretchr/testify/require" @@ -18,7 +19,6 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/verifreg" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/itests/kit2" "github.com/filecoin-project/lotus/node/impl" ) @@ -39,10 +39,10 @@ func TestVerifiedClientTopUp(t *testing.T) { bal, err := types.ParseFIL("100fil") require.NoError(t, err) - node, _, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), - kit2.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. - kit2.ConstructorOpts(kit2.InstantaneousNetworkVersion(nv))) + node, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), + kit.RootVerifier(rootKey, abi.NewTokenAmount(bal.Int64())), + kit.Account(verifierKey, abi.NewTokenAmount(bal.Int64())), // assign some balance to the verifier so they can send an AddClient message. + kit.ConstructorOpts(kit.InstantaneousNetworkVersion(nv))) ens.InterconnectAll().BeginMining(blockTime) diff --git a/itests/wdpost_dispute_test.go b/itests/wdpost_dispute_test.go index 49b41c7e0..742972fc6 100644 --- a/itests/wdpost_dispute_test.go +++ b/itests/wdpost_dispute_test.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" minerActor "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "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" "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") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 2 * time.Millisecond @@ -33,20 +33,20 @@ func TestWindowPostDispute(t *testing.T) { defer cancel() var ( - client kit2.TestFullNode - chainMiner kit2.TestMiner - evilMiner kit2.TestMiner + client kit.TestFullNode + chainMiner kit.TestMiner + evilMiner kit.TestMiner ) // First, we configure two miners. After sealing, we're going to turn off the first miner so // it doesn't submit proofs. // // Then we're going to manually submit bad proofs. - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) - ens := kit2.NewEnsemble(t, kit2.MockProofs()). + opts := kit.ConstructorOpts(kit.LatestActorsAt(-1)) + ens := kit.NewEnsemble(t, kit.MockProofs()). FullNode(&client, opts). Miner(&chainMiner, &client, opts). - Miner(&evilMiner, &client, opts, kit2.PresealSectors(0)). + Miner(&evilMiner, &client, opts, kit.PresealSectors(0)). Start() { @@ -87,7 +87,7 @@ func TestWindowPostDispute(t *testing.T) { waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2 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()) 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") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() blocktime := 2 * time.Millisecond ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(-1)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blocktime) defaultFrom, err := client.WalletDefaultAddress(ctx) @@ -260,12 +260,12 @@ func TestWindowPostDisputeFails(t *testing.T) { waitUntil := di.PeriodStart + di.WPoStProvingPeriod*2 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()) ssz, err := miner.ActorSectorSize(ctx, maddr) 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) require.NoError(t, err) diff --git a/itests/wdpost_test.go b/itests/wdpost_test.go index 608c377ca..8a4b8ec23 100644 --- a/itests/wdpost_test.go +++ b/itests/wdpost_test.go @@ -18,7 +18,7 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" "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" ) @@ -27,7 +27,7 @@ func TestWindowedPost(t *testing.T) { t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() var ( blocktime = 2 * time.Millisecond @@ -50,8 +50,8 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, ctx, cancel := context.WithCancel(context.Background()) defer cancel() - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(upgradeHeight)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(upgradeHeight)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blocktime) 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 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()) 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.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") @@ -145,7 +145,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2 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()) 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) 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") @@ -167,7 +167,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, waitUntil = di.PeriodStart + di.WPoStProvingPeriod + 2 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()) 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) 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 @@ -190,7 +190,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, waitUntil := di.PeriodStart + di.WPoStProvingPeriod + 2 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()) } @@ -200,7 +200,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, require.Equal(t, p.MinerPower, p.TotalPower) 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) { @@ -208,7 +208,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) { t.Skip("this takes a few minutes, set LOTUS_TEST_WINDOW_POST=1 to run") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() var ( blocktime = 2 * time.Millisecond @@ -221,7 +221,7 @@ func TestWindowPostBaseFeeNoBurn(t *testing.T) { och := build.UpgradeClausHeight build.UpgradeClausHeight = 10 - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs()) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs()) ens.InterconnectAll().BeginMining(blocktime) 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") } - kit2.QuietMiningLogs() + kit.QuietMiningLogs() ctx, cancel := context.WithCancel(context.Background()) defer cancel() blocktime := 2 * time.Millisecond - opts := kit2.ConstructorOpts(kit2.LatestActorsAt(-1)) - client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts) + opts := kit.ConstructorOpts(kit.LatestActorsAt(-1)) + client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), opts) ens.InterconnectAll().BeginMining(blocktime) maddr, err := miner.ActorAddress(ctx)