diff --git a/itests/batch_deal_test.go b/itests/batch_deal_test.go index 68b276a0c..21db9f08d 100644 --- a/itests/batch_deal_test.go +++ b/itests/batch_deal_test.go @@ -61,7 +61,6 @@ func TestBatchDealInput(t *testing.T) { sc.MaxSealingSectorsForDeals = 3 sc.AlwaysKeepUnsealedCopy = true sc.WaitDealsDelay = time.Hour - sc.BatchPreCommits = false sc.AggregateCommits = false return sc, nil diff --git a/itests/sector_miner_collateral_test.go b/itests/sector_miner_collateral_test.go index 8d7abacee..579b4e535 100644 --- a/itests/sector_miner_collateral_test.go +++ b/itests/sector_miner_collateral_test.go @@ -51,7 +51,6 @@ func TestMinerBalanceCollateral(t *testing.T) { sc.AlwaysKeepUnsealedCopy = true sc.WaitDealsDelay = time.Hour - sc.BatchPreCommits = batching sc.AggregateCommits = batching sc.PreCommitBatchWait = time.Hour diff --git a/itests/worker_test.go b/itests/worker_test.go index 2b440f382..c4f885fb0 100644 --- a/itests/worker_test.go +++ b/itests/worker_test.go @@ -744,7 +744,6 @@ func TestWorkerPledgeExpireCommit(t *testing.T) { ctx := context.Background() client, miner, worker, ens := kit.EnsembleWorker(t, kit.WithAllSubsystems(), kit.ThroughRPC(), kit.WithNoLocalSealing(true), kit.MutateSealingConfig(func(sc *config.SealingConfig) { - sc.BatchPreCommits = false sc.AggregateCommits = true }), kit.ConstructorOpts( diff --git a/storage/pipeline/fsm_test.go b/storage/pipeline/fsm_test.go index f12b66f93..4dfc8548d 100644 --- a/storage/pipeline/fsm_test.go +++ b/storage/pipeline/fsm_test.go @@ -54,10 +54,10 @@ func TestHappyPath(t *testing.T) { require.Equal(m.t, m.state.State, PreCommit2) m.planSingle(SectorPreCommit2{}) - require.Equal(m.t, m.state.State, PreCommitting) + require.Equal(m.t, m.state.State, SubmitPreCommitBatch) - m.planSingle(SectorPreCommitted{}) - require.Equal(m.t, m.state.State, PreCommitWait) + m.planSingle(SectorPreCommitBatchSent{}) + require.Equal(m.t, m.state.State, PreCommitBatchWait) m.planSingle(SectorPreCommitLanded{}) require.Equal(m.t, m.state.State, WaitSeed) @@ -77,7 +77,7 @@ func TestHappyPath(t *testing.T) { m.planSingle(SectorFinalized{}) require.Equal(m.t, m.state.State, Proving) - expected := []SectorState{Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, SubmitCommit, CommitWait, FinalizeSector, Proving} + expected := []SectorState{Packing, GetTicket, PreCommit1, PreCommit2, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, SubmitCommit, CommitWait, FinalizeSector, Proving} for i, n := range notif { if n.before.State != expected[i] { t.Fatalf("expected before state: %s, got: %s", expected[i], n.before.State) @@ -116,10 +116,10 @@ func TestHappyPathFinalizeEarly(t *testing.T) { require.Equal(m.t, m.state.State, PreCommit2) m.planSingle(SectorPreCommit2{}) - require.Equal(m.t, m.state.State, PreCommitting) + require.Equal(m.t, m.state.State, SubmitPreCommitBatch) - m.planSingle(SectorPreCommitted{}) - require.Equal(m.t, m.state.State, PreCommitWait) + m.planSingle(SectorPreCommitBatchSent{}) + require.Equal(m.t, m.state.State, PreCommitBatchWait) m.planSingle(SectorPreCommitLanded{}) require.Equal(m.t, m.state.State, WaitSeed) @@ -145,7 +145,7 @@ func TestHappyPathFinalizeEarly(t *testing.T) { m.planSingle(SectorFinalized{}) require.Equal(m.t, m.state.State, Proving) - expected := []SectorState{Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, WaitSeed, Committing, CommitFinalize, SubmitCommit, SubmitCommitAggregate, CommitAggregateWait, FinalizeSector, Proving} + expected := []SectorState{Packing, GetTicket, PreCommit1, PreCommit2, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, SubmitCommit, SubmitCommitAggregate, CommitAggregateWait, FinalizeSector, Proving} for i, n := range notif { if n.before.State != expected[i] { t.Fatalf("expected before state: %s, got: %s", expected[i], n.before.State) @@ -220,10 +220,10 @@ func TestSeedRevert(t *testing.T) { require.Equal(m.t, m.state.State, PreCommit2) m.planSingle(SectorPreCommit2{}) - require.Equal(m.t, m.state.State, PreCommitting) + require.Equal(m.t, m.state.State, SubmitPreCommitBatch) - m.planSingle(SectorPreCommitted{}) - require.Equal(m.t, m.state.State, PreCommitWait) + m.planSingle(SectorPreCommitBatchSent{}) + require.Equal(m.t, m.state.State, PreCommitBatchWait) m.planSingle(SectorPreCommitLanded{}) require.Equal(m.t, m.state.State, WaitSeed) diff --git a/storage/pipeline/precommit_batch_test.go b/storage/pipeline/precommit_batch_test.go index d75104f7a..74dbd7ec7 100644 --- a/storage/pipeline/precommit_batch_test.go +++ b/storage/pipeline/precommit_batch_test.go @@ -4,6 +4,7 @@ package sealing_test import ( "bytes" "context" + "github.com/filecoin-project/go-state-types/network" "sort" "sync" "testing" @@ -16,7 +17,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" - "github.com/filecoin-project/go-state-types/network" miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" "github.com/filecoin-project/lotus/api" @@ -113,7 +113,7 @@ func TestPrecommitBatcher(t *testing.T) { basefee = big.NewInt(10001) } - s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil) + s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil).MaxTimes(2) // once in AddPreCommit go func() { defer done.Unlock() @@ -182,28 +182,6 @@ func TestPrecommitBatcher(t *testing.T) { expectInitialCalls := func() action { return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise { s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(10001), 1), nil) - s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) - return nil - } - } - - //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001 - expectSendsSingle := func(expect []abi.SectorNumber) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise { - s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(9999), 1), nil) - s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) - - s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil) - for _, number := range expect { - numClone := number - s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool { - b := i.(*types.Message) - var params miner6.PreCommitSectorParams - require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params))) - require.Equal(t, numClone, params.SectorNumber) - return true - }), gomock.Any()).Return(dummySmsg, nil) - } return nil } } @@ -239,14 +217,14 @@ func TestPrecommitBatcher(t *testing.T) { }{ "addSingle": { actions: []action{ - addSector(0, false), + addSector(0, true), waitPending(1), flush([]abi.SectorNumber{0}), }, }, "addTwo": { actions: []action{ - addSectors(getSectors(2), false), + addSectors(getSectors(2), true), waitPending(2), flush(getSectors(2)), }, @@ -267,10 +245,10 @@ func TestPrecommitBatcher(t *testing.T) { addSectors(getSectors(maxBatch), true), }, }, - "addMax-belowBaseFee": { + "addOne-belowBaseFee": { actions: []action{ - expectSendsSingle(getSectors(maxBatch)), - addSectors(getSectors(maxBatch), false), + expectSend(getSectors(1), false), + addSectors(getSectors(1), false), }, }, } @@ -286,6 +264,7 @@ func TestPrecommitBatcher(t *testing.T) { // create them mocks pcapi := mocks.NewMockPreCommitBatcherApi(mockCtrl) + pcapi.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version20, nil).AnyTimes() pcb := pipeline.NewPreCommitBatcher(ctx, t0123, pcapi, as, fc, cfg)