From d94b1ca7216b3c9f20370b755d49bae3bd90ac55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 8 Aug 2023 18:51:30 +0200 Subject: [PATCH] itests: Drop sealing itests for legacy network versions --- .circleci/config.yml | 12 --- itests/kit/ensemble_opts_nv.go | 14 ---- itests/sdr_upgrade_test.go | 117 ---------------------------- itests/sector_pledge_test.go | 47 ----------- itests/tape_test.go | 71 ----------------- itests/wdpost_test.go | 137 --------------------------------- 6 files changed, 398 deletions(-) delete mode 100644 itests/sdr_upgrade_test.go delete mode 100644 itests/tape_test.go diff --git a/.circleci/config.yml b/.circleci/config.yml index 9489c9896..960e47e33 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -870,12 +870,6 @@ workflows: - build suite: itest-remove_verifreg_datacap target: "./itests/remove_verifreg_datacap_test.go" - - test: - name: test-itest-sdr_upgrade - requires: - - build - suite: itest-sdr_upgrade - target: "./itests/sdr_upgrade_test.go" - test: name: test-itest-sealing_resources requires: @@ -942,12 +936,6 @@ workflows: - build suite: itest-splitstore target: "./itests/splitstore_test.go" - - test: - name: test-itest-tape - requires: - - build - suite: itest-tape - target: "./itests/tape_test.go" - test: name: test-itest-verifreg requires: diff --git a/itests/kit/ensemble_opts_nv.go b/itests/kit/ensemble_opts_nv.go index 027720229..d81bd5d7e 100644 --- a/itests/kit/ensemble_opts_nv.go +++ b/itests/kit/ensemble_opts_nv.go @@ -23,20 +23,6 @@ func GenesisNetworkVersion(nv network.Version) EnsembleOpt { }) } -func SDRUpgradeAt(calico, persian abi.ChainEpoch) EnsembleOpt { - return UpgradeSchedule(stmgr.Upgrade{ - Network: network.Version6, - Height: -1, - }, stmgr.Upgrade{ - Network: network.Version7, - Height: calico, - Migration: filcns.UpgradeCalico, - }, stmgr.Upgrade{ - Network: network.Version8, - Height: persian, - }) -} - func LatestActorsAt(upgradeHeight abi.ChainEpoch) EnsembleOpt { /* inline-gen template return UpgradeSchedule(stmgr.Upgrade{ diff --git a/itests/sdr_upgrade_test.go b/itests/sdr_upgrade_test.go deleted file mode 100644 index d92d4edc9..000000000 --- a/itests/sdr_upgrade_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// stm: #integration -package itests - -import ( - "context" - "sort" - "sync/atomic" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "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/kit" - bminer "github.com/filecoin-project/lotus/miner" -) - -func TestSDRUpgrade(t *testing.T) { - //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, - //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 - //stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001 - //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 - - //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 - //stm: @CHAIN_STATE_NETWORK_VERSION_001 - - //stm: @MINER_SECTOR_LIST_001 - kit.QuietMiningLogs() - - // oldDelay := policy.GetPreCommitChallengeDelay() - // policy.SetPreCommitChallengeDelay(5) - // t.Cleanup(func() { - // policy.SetPreCommitChallengeDelay(oldDelay) - // }) - - blocktime := 50 * time.Millisecond - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - client, miner, ens := kit.EnsembleMinimal(t, - kit.MockProofs(), - kit.SDRUpgradeAt(500, 1000), - ) - ens.InterconnectAll() - - build.Clock.Sleep(time.Second) - - pledge := make(chan struct{}) - mine := int64(1) - done := make(chan struct{}) - go func() { - defer close(done) - round := 0 - for atomic.LoadInt64(&mine) != 0 { - build.Clock.Sleep(blocktime) - if err := miner.MineOne(ctx, bminer.MineReq{Done: func(bool, abi.ChainEpoch, error) { - - }}); err != nil { - t.Error(err) - } - - // 3 sealing rounds: before, during after. - if round >= 3 { - continue - } - - head, err := client.ChainHead(ctx) - assert.NoError(t, err) - - // rounds happen every 100 blocks, with a 50 block offset. - if head.Height() >= abi.ChainEpoch(round*500+50) { - round++ - pledge <- struct{}{} - - ver, err := client.StateNetworkVersion(ctx, head.Key()) - assert.NoError(t, err) - switch round { - case 1: - assert.Equal(t, network.Version6, ver) - case 2: - assert.Equal(t, network.Version7, ver) - case 3: - assert.Equal(t, network.Version8, ver) - } - } - - } - }() - - // before. - miner.PledgeSectors(ctx, 9, 0, pledge) - - s, err := miner.SectorsListNonGenesis(ctx) - require.NoError(t, err) - sort.Slice(s, func(i, j int) bool { - return s[i] < s[j] - }) - - for i, id := range s { - info, err := miner.SectorsStatus(ctx, id, true) - require.NoError(t, err) - expectProof := abi.RegisteredSealProof_StackedDrg2KiBV1 - if i >= 3 { - // after - expectProof = abi.RegisteredSealProof_StackedDrg2KiBV1_1 - } - assert.Equal(t, expectProof, info.SealProof, "sector %d, id %d", i, id) - } - - atomic.StoreInt64(&mine, 0) - <-done -} diff --git a/itests/sector_pledge_test.go b/itests/sector_pledge_test.go index 2ac1298d0..a2e74ef72 100644 --- a/itests/sector_pledge_test.go +++ b/itests/sector_pledge_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/network" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" "github.com/filecoin-project/lotus/api" @@ -196,49 +195,3 @@ func TestPledgeMaxBatching(t *testing.T) { t.Run("Force max prove commit aggregate size", runTest) } - -func TestPledgeBeforeNv13(t *testing.T) { - //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, - //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 - //stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001 - //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 - - //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 - blocktime := 50 * time.Millisecond - - runTest := func(t *testing.T, nSectors int) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), - kit.GenesisNetworkVersion(network.Version12)) - ens.InterconnectAll().BeginMining(blocktime) - - client.WaitTillChain(ctx, kit.HeightAtLeast(10)) - - toCheck := miner.StartPledge(ctx, nSectors, 0, nil) - - for len(toCheck) > 0 { - states := map[api.SectorState]int{} - - for n := range toCheck { - st, err := miner.SectorsStatus(ctx, n, false) - require.NoError(t, err) - states[st.State]++ - if st.State == api.SectorState(sealing.Proving) { - delete(toCheck, n) - } - if strings.Contains(string(st.State), "Fail") { - t.Fatal("sector in a failed state", st.State) - } - } - - build.Clock.Sleep(100 * time.Millisecond) - fmt.Printf("WaitSeal: %d %+v\n", len(toCheck), states) - } - } - - t.Run("100-before-nv13", func(t *testing.T) { - runTest(t, 100) - }) -} diff --git a/itests/tape_test.go b/itests/tape_test.go deleted file mode 100644 index e0db4882c..000000000 --- a/itests/tape_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// stm: #integration -package itests - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/go-state-types/network" - - "github.com/filecoin-project/lotus/api" - "github.com/filecoin-project/lotus/build" - "github.com/filecoin-project/lotus/itests/kit" - sealing "github.com/filecoin-project/lotus/storage/pipeline" -) - -func TestTapeFix(t *testing.T) { - //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, - //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 - //stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001 - //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 - - //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 - kit.QuietMiningLogs() - - var blocktime = 2 * time.Millisecond - - // The "before" case is disabled, because we need the builder to mock 32 GiB sectors to accurately repro this case - // TODO: Make the mock sector size configurable and reenable this - // t.Run("before", func(t *testing.T) { testTapeFix(t, b, blocktime, false) }) - t.Run("after", func(t *testing.T) { testTapeFix(t, blocktime, true) }) -} - -func testTapeFix(t *testing.T, blocktime time.Duration, after bool) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - networkVersion := network.Version4 - if after { - networkVersion = network.Version5 - } - - _, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.GenesisNetworkVersion(networkVersion)) - ens.InterconnectAll().BeginMining(blocktime) - - sid, err := miner.PledgeSector(ctx) - require.NoError(t, err) - - t.Log("All sectors is fsm") - - // If before, we expect the precommit to fail - successState := api.SectorState(sealing.CommitFailed) - failureState := api.SectorState(sealing.Proving) - if after { - // otherwise, it should succeed. - successState, failureState = failureState, successState - } - - for { - st, err := miner.SectorsStatus(ctx, sid.Number, false) - require.NoError(t, err) - if st.State == successState { - break - } - require.NotEqual(t, failureState, st.State) - build.Clock.Sleep(100 * time.Millisecond) - t.Log("WaitSeal") - } -} diff --git a/itests/wdpost_test.go b/itests/wdpost_test.go index c66653866..2a6fc866e 100644 --- a/itests/wdpost_test.go +++ b/itests/wdpost_test.go @@ -224,70 +224,6 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, require.Equal(t, nSectors+kit.DefaultPresealsPerBootstrapMiner-2+1, int(sectors)) // -2 not recovered sectors + 1 just pledged } -func TestWindowPostBaseFeeNoBurn(t *testing.T) { - //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, - //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 - //stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001 - //stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001 - - //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 - kit.Expensive(t) - - kit.QuietMiningLogs() - - var ( - blocktime = 2 * time.Millisecond - nSectors = 10 - ) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - och := build.UpgradeClausHeight - build.UpgradeClausHeight = 0 - t.Cleanup(func() { build.UpgradeClausHeight = och }) - - client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.GenesisNetworkVersion(network.Version9)) - ens.InterconnectAll().BeginMining(blocktime) - - maddr, err := miner.ActorAddress(ctx) - require.NoError(t, err) - - //stm: @CHAIN_STATE_MINER_INFO_001 - mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK) - require.NoError(t, err) - - miner.PledgeSectors(ctx, nSectors, 0, nil) - //stm: @CHAIN_STATE_GET_ACTOR_001 - wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) - require.NoError(t, err) - en := wact.Nonce - - // wait for a new message to be sent from worker address, it will be a PoSt - -waitForProof: - for { - //stm: @CHAIN_STATE_GET_ACTOR_001 - wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) - require.NoError(t, err) - if wact.Nonce > en { - break waitForProof - } - - build.Clock.Sleep(blocktime) - } - - //stm: @CHAIN_STATE_LIST_MESSAGES_001 - slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0) - require.NoError(t, err) - - //stm: @CHAIN_STATE_REPLAY_001 - pmr, err := client.StateReplay(ctx, types.EmptyTSK, slm[0]) - require.NoError(t, err) - - require.Equal(t, pmr.GasCost.BaseFeeBurn, big.Zero()) -} - func TestWindowPostBaseFeeBurn(t *testing.T) { //stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001, //stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01 @@ -345,79 +281,6 @@ waitForProof: require.NotEqual(t, pmr.GasCost.BaseFeeBurn, big.Zero()) } -// Tests that V1_1 proofs are generated and accepted in nv19, and V1 proofs are accepted -func TestWindowPostV1P1NV19(t *testing.T) { - kit.QuietMiningLogs() - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - blocktime := 2 * time.Millisecond - - client, miner, ens := kit.EnsembleMinimal(t, kit.GenesisNetworkVersion(network.Version19)) - ens.InterconnectAll().BeginMining(blocktime) - - maddr, err := miner.ActorAddress(ctx) - require.NoError(t, err) - - mi, err := client.StateMinerInfo(ctx, maddr, types.EmptyTSK) - require.NoError(t, err) - - wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) - require.NoError(t, err) - en := wact.Nonce - - // wait for a new message to be sent from worker address, it will be a PoSt - -waitForProof: - for { - wact, err := client.StateGetActor(ctx, mi.Worker, types.EmptyTSK) - require.NoError(t, err) - if wact.Nonce > en { - break waitForProof - } - - build.Clock.Sleep(blocktime) - } - - slm, err := client.StateListMessages(ctx, &api.MessageMatch{To: maddr}, types.EmptyTSK, 0) - require.NoError(t, err) - - pmr, err := client.StateSearchMsg(ctx, types.EmptyTSK, slm[0], -1, false) - require.NoError(t, err) - - inclTs, err := client.ChainGetTipSet(ctx, pmr.TipSet) - require.NoError(t, err) - - inclTsParents, err := client.ChainGetTipSet(ctx, inclTs.Parents()) - require.NoError(t, err) - - nv, err := client.StateNetworkVersion(ctx, pmr.TipSet) - require.NoError(t, err) - require.Equal(t, network.Version19, nv) - - require.True(t, pmr.Receipt.ExitCode.IsSuccess()) - - slmsg, err := client.ChainGetMessage(ctx, slm[0]) - require.NoError(t, err) - - var params miner11.SubmitWindowedPoStParams - require.NoError(t, params.UnmarshalCBOR(bytes.NewBuffer(slmsg.Params))) - require.Equal(t, abi.RegisteredPoStProof_StackedDrgWindow2KiBV1_1, params.Proofs[0].PoStProof) - - // "Turn" this into a V1 proof -- the proof will be invalid, but won't be validated, and so the call should succeed - params.Proofs[0].PoStProof = abi.RegisteredPoStProof_StackedDrgWindow2KiBV1 - v1PostParams := new(bytes.Buffer) - require.NoError(t, params.MarshalCBOR(v1PostParams)) - - slmsg.Params = v1PostParams.Bytes() - - // Simulate call on inclTsParents's parents, so that the partition isn't already proven - call, err := client.StateCall(ctx, slmsg, inclTsParents.Parents()) - require.NoError(t, err) - require.True(t, call.MsgRct.ExitCode.IsSuccess()) -} - // Tests that V1_1 proofs are generated and accepted in nv20, and that V1 proofs are NOT func TestWindowPostV1P1NV20(t *testing.T) { kit.QuietMiningLogs()