diff --git a/api/api_storage.go b/api/api_storage.go index 69d631a08..11530e5d9 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -24,7 +24,7 @@ import ( "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) // MODIFYING THE API INTERFACE diff --git a/api/docgen/docgen.go b/api/docgen/docgen.go index 8d8f64c01..c6be3782c 100644 --- a/api/docgen/docgen.go +++ b/api/docgen/docgen.go @@ -41,9 +41,9 @@ import ( "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) var ExampleValues = map[reflect.Type]interface{}{ diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 09a655b73..42ac65068 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -39,10 +39,10 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/journal/alerting" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo/imports" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) var ErrNotSupported = xerrors.New("method not supported") diff --git a/cmd/lotus-miner/info.go b/cmd/lotus-miner/info.go index 8b6809942..36cc5c31f 100644 --- a/cmd/lotus-miner/info.go +++ b/cmd/lotus-miner/info.go @@ -34,8 +34,8 @@ import ( "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/journal/alerting" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) var infoCmd = &cli.Command{ diff --git a/cmd/lotus-miner/init.go b/cmd/lotus-miner/init.go index 1e7b07a59..05f521e75 100644 --- a/cmd/lotus-miner/init.go +++ b/cmd/lotus-miner/init.go @@ -50,7 +50,6 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal/fsjournal" @@ -59,6 +58,7 @@ import ( "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/storage" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) var initCmd = &cli.Command{ @@ -303,7 +303,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string maxSectorID := abi.SectorNumber(0) for _, sector := range meta.Sectors { - sectorKey := datastore.NewKey(sealing.SectorStorePrefix).ChildString(fmt.Sprint(sector.SectorID)) + sectorKey := datastore.NewKey(sealing2.SectorStorePrefix).ChildString(fmt.Sprint(sector.SectorID)) dealID, err := findMarketDealID(ctx, api, sector.Deal) if err != nil { @@ -312,10 +312,10 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string commD := sector.CommD commR := sector.CommR - info := &sealing.SectorInfo{ - State: sealing.Proving, + info := &sealing2.SectorInfo{ + State: sealing2.Proving, SectorNumber: sector.SectorID, - Pieces: []sealing.Piece{ + Pieces: []sealing2.Piece{ { Piece: abi.PieceInfo{ Size: abi.PaddedPieceSize(meta.SectorSize), diff --git a/cmd/lotus-miner/sectors.go b/cmd/lotus-miner/sectors.go index edbb62b1f..be5623c27 100644 --- a/cmd/lotus-miner/sectors.go +++ b/cmd/lotus-miner/sectors.go @@ -32,8 +32,8 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/lib/tablewriter" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) var sectorsCmd = &cli.Command{ diff --git a/cmd/lotus-miner/storage.go b/cmd/lotus-miner/storage.go index 80a722f62..6c056f876 100644 --- a/cmd/lotus-miner/storage.go +++ b/cmd/lotus-miner/storage.go @@ -30,8 +30,8 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/lib/tablewriter" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) const metaFile = "sectorstore.json" diff --git a/extern/sector-storage/ffiwrapper/sealer_cgo.go b/extern/sector-storage/ffiwrapper/sealer_cgo.go index cfabaadfb..7d3d4fa7d 100644 --- a/extern/sector-storage/ffiwrapper/sealer_cgo.go +++ b/extern/sector-storage/ffiwrapper/sealer_cgo.go @@ -31,8 +31,8 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/fr32" "github.com/filecoin-project/lotus/extern/sector-storage/partialfile" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - nr "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" "github.com/filecoin-project/lotus/lib/nullreader" + nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" ) var _ Storage = &Sealer{} diff --git a/extern/sector-storage/ffiwrapper/sealer_test.go b/extern/sector-storage/ffiwrapper/sealer_test.go index e878d92d1..c7f6433bc 100644 --- a/extern/sector-storage/ffiwrapper/sealer_test.go +++ b/extern/sector-storage/ffiwrapper/sealer_test.go @@ -31,7 +31,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" + "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" ) func init() { diff --git a/itests/batch_deal_test.go b/itests/batch_deal_test.go index d1a322412..64326c822 100644 --- a/itests/batch_deal_test.go +++ b/itests/batch_deal_test.go @@ -13,13 +13,13 @@ 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/kit" "github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) func TestBatchDealInput(t *testing.T) { diff --git a/itests/kit/deals.go b/itests/kit/deals.go index e256438d0..9c48242c7 100644 --- a/itests/kit/deals.go +++ b/itests/kit/deals.go @@ -28,7 +28,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) type DealHarness struct { diff --git a/itests/kit/node_miner.go b/itests/kit/node_miner.go index ace87b8b5..9c6fa5d73 100644 --- a/itests/kit/node_miner.go +++ b/itests/kit/node_miner.go @@ -26,8 +26,8 @@ import ( "github.com/filecoin-project/lotus/chain/wallet/key" "github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/miner" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) type MinerSubsystem int diff --git a/itests/kit/node_opts.go b/itests/kit/node_opts.go index c692e2aa5..871675ac2 100644 --- a/itests/kit/node_opts.go +++ b/itests/kit/node_opts.go @@ -9,12 +9,12 @@ import ( "github.com/filecoin-project/lotus/chain/wallet/key" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "github.com/filecoin-project/lotus/extern/sector-storage/stores" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) // DefaultPresealsPerBootstrapMiner is the number of preseals that every diff --git a/itests/sector_make_cc_avail_test.go b/itests/sector_make_cc_avail_test.go index 094367e96..437e803b0 100644 --- a/itests/sector_make_cc_avail_test.go +++ b/itests/sector_make_cc_avail_test.go @@ -13,9 +13,9 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/node/config" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestMakeAvailable(t *testing.T) { diff --git a/itests/sector_miner_collateral_test.go b/itests/sector_miner_collateral_test.go index 22c04b5ea..07dad8edd 100644 --- a/itests/sector_miner_collateral_test.go +++ b/itests/sector_miner_collateral_test.go @@ -13,14 +13,14 @@ import ( "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/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/repo" + sealing "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) func TestMinerBalanceCollateral(t *testing.T) { diff --git a/itests/sector_pledge_test.go b/itests/sector_pledge_test.go index 0c76e9076..6f966430d 100644 --- a/itests/sector_pledge_test.go +++ b/itests/sector_pledge_test.go @@ -18,9 +18,9 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/node/impl" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestPledgeSectors(t *testing.T) { diff --git a/itests/sector_prefer_no_upgrade_test.go b/itests/sector_prefer_no_upgrade_test.go index 11fd2c1de..30674b36e 100644 --- a/itests/sector_prefer_no_upgrade_test.go +++ b/itests/sector_prefer_no_upgrade_test.go @@ -13,9 +13,9 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/node/config" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestPreferNoUpgrade(t *testing.T) { diff --git a/itests/sector_revert_available_test.go b/itests/sector_revert_available_test.go index 6827a85fa..559e8e8b0 100644 --- a/itests/sector_revert_available_test.go +++ b/itests/sector_revert_available_test.go @@ -13,8 +13,8 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/itests/kit" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestAbortUpgradeAvailable(t *testing.T) { diff --git a/itests/sector_terminate_test.go b/itests/sector_terminate_test.go index fd685dc53..b7004b312 100644 --- a/itests/sector_terminate_test.go +++ b/itests/sector_terminate_test.go @@ -12,8 +12,8 @@ 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/kit" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestTerminate(t *testing.T) { diff --git a/itests/tape_test.go b/itests/tape_test.go index 3cb1e8339..d179951ed 100644 --- a/itests/tape_test.go +++ b/itests/tape_test.go @@ -12,8 +12,8 @@ import ( "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/kit" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func TestTapeFix(t *testing.T) { diff --git a/lib/rpcenc/reader.go b/lib/rpcenc/reader.go index a4f16982e..99b0faf05 100644 --- a/lib/rpcenc/reader.go +++ b/lib/rpcenc/reader.go @@ -22,8 +22,8 @@ import ( "github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" "github.com/filecoin-project/lotus/lib/httpreader" + "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" ) var log = logging.Logger("rpcenc") diff --git a/lib/rpcenc/reader_test.go b/lib/rpcenc/reader_test.go index 881cbeaae..ac78d1109 100644 --- a/lib/rpcenc/reader_test.go +++ b/lib/rpcenc/reader_test.go @@ -15,7 +15,7 @@ import ( "github.com/filecoin-project/go-jsonrpc" - "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" + "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" ) type ReaderHandler struct { diff --git a/markets/storageadapter/ondealsectorcommitted.go b/markets/storageadapter/ondealsectorcommitted.go index 0567a4514..c41b97c05 100644 --- a/markets/storageadapter/ondealsectorcommitted.go +++ b/markets/storageadapter/ondealsectorcommitted.go @@ -20,7 +20,7 @@ import ( lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) type eventsCalledAPI interface { @@ -28,7 +28,7 @@ type eventsCalledAPI interface { } type dealInfoAPI interface { - GetCurrentDealInfo(ctx context.Context, tok sealing.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing.CurrentDealInfo, error) + GetCurrentDealInfo(ctx context.Context, tok sealing2.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing2.CurrentDealInfo, error) } type diffPreCommitsAPI interface { @@ -41,9 +41,9 @@ type SectorCommittedManager struct { dpc diffPreCommitsAPI } -func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI sealing.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager { - dim := &sealing.CurrentDealInfoManager{ - CDAPI: &sealing.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI}, +func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI sealing2.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager { + dim := &sealing2.CurrentDealInfoManager{ + CDAPI: &sealing2.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI}, } return newSectorCommittedManager(ev, dim, dpcAPI) } @@ -280,7 +280,7 @@ func (mgr *SectorCommittedManager) OnDealSectorCommitted(ctx context.Context, pr return nil } -func dealSectorInReplicaUpdateSuccess(msg *types.Message, rec *types.MessageReceipt, res sealing.CurrentDealInfo) (*abi.SectorNumber, error) { +func dealSectorInReplicaUpdateSuccess(msg *types.Message, rec *types.MessageReceipt, res sealing2.CurrentDealInfo) (*abi.SectorNumber, error) { var params miner.ProveReplicaUpdatesParams if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { return nil, xerrors.Errorf("unmarshal prove replica update: %w", err) @@ -317,7 +317,7 @@ func dealSectorInReplicaUpdateSuccess(msg *types.Message, rec *types.MessageRece } // dealSectorInPreCommitMsg tries to find a sector containing the specified deal -func dealSectorInPreCommitMsg(msg *types.Message, res sealing.CurrentDealInfo) (*abi.SectorNumber, error) { +func dealSectorInPreCommitMsg(msg *types.Message, res sealing2.CurrentDealInfo) (*abi.SectorNumber, error) { switch msg.Method { case builtin.MethodsMiner.PreCommitSector: var params miner.SectorPreCommitInfo @@ -383,7 +383,7 @@ func sectorInCommitMsg(msg *types.Message, sectorNumber abi.SectorNumber) (bool, } } -func (mgr *SectorCommittedManager) checkIfDealAlreadyActive(ctx context.Context, ts *types.TipSet, proposal *market.DealProposal, publishCid cid.Cid) (sealing.CurrentDealInfo, bool, error) { +func (mgr *SectorCommittedManager) checkIfDealAlreadyActive(ctx context.Context, ts *types.TipSet, proposal *market.DealProposal, publishCid cid.Cid) (sealing2.CurrentDealInfo, bool, error) { res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key().Bytes(), proposal, publishCid) if err != nil { // TODO: This may be fine for some errors diff --git a/markets/storageadapter/ondealsectorcommitted_test.go b/markets/storageadapter/ondealsectorcommitted_test.go index 458d2209e..e82035ee6 100644 --- a/markets/storageadapter/ondealsectorcommitted_test.go +++ b/markets/storageadapter/ondealsectorcommitted_test.go @@ -29,7 +29,7 @@ import ( "github.com/filecoin-project/lotus/chain/events" test "github.com/filecoin-project/lotus/chain/events/state/mock" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) func TestOnDealSectorPreCommitted(t *testing.T) { @@ -76,7 +76,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { }, } type testCase struct { - currentDealInfo sealing.CurrentDealInfo + currentDealInfo sealing2.CurrentDealInfo currentDealInfoErr error currentDealInfoErr2 error preCommitDiff *miner.PreCommitChanges @@ -90,7 +90,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { } testCases := map[string]testCase{ "normal sequence": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -108,7 +108,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedCBSectorNumber: sectorNumber, }, "ignores unsuccessful pre-commit message": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -126,7 +126,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedCBCallCount: 0, }, "deal already pre-committed": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -148,7 +148,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedError: xerrors.Errorf("failed to set up called handler: failed to look up deal on chain: something went wrong"), }, "sector already active": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: activeDeal, }, @@ -156,7 +156,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedCBIsActive: true, }, "sector was slashed": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: slashedDeal, PublishMsgTipSet: nil, @@ -165,7 +165,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch), }, "error getting current deal info in called func": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -183,7 +183,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) { expectedCBError: errors.New("handling applied event: something went wrong"), }, "proposed deal epoch timeout": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: activeDeal, }, @@ -298,9 +298,9 @@ func TestOnDealSectorCommitted(t *testing.T) { }, } type testCase struct { - currentDealInfo sealing.CurrentDealInfo + currentDealInfo sealing2.CurrentDealInfo currentDealInfoErr error - currentDealInfo2 sealing.CurrentDealInfo + currentDealInfo2 sealing2.CurrentDealInfo currentDealInfoErr2 error matchStates []matchState dealStartEpochTimeout bool @@ -310,11 +310,11 @@ func TestOnDealSectorCommitted(t *testing.T) { } testCases := map[string]testCase{ "normal sequence": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, - currentDealInfo2: sealing.CurrentDealInfo{ + currentDealInfo2: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: activeDeal, }, @@ -328,11 +328,11 @@ func TestOnDealSectorCommitted(t *testing.T) { expectedCBCallCount: 1, }, "ignores unsuccessful prove-commit message": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, - currentDealInfo2: sealing.CurrentDealInfo{ + currentDealInfo2: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: activeDeal, }, @@ -353,14 +353,14 @@ func TestOnDealSectorCommitted(t *testing.T) { expectedError: xerrors.Errorf("failed to set up called handler: failed to look up deal on chain: something went wrong"), }, "sector already active": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: activeDeal, }, expectedCBCallCount: 1, }, "sector was slashed": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: slashedDeal, }, @@ -368,7 +368,7 @@ func TestOnDealSectorCommitted(t *testing.T) { expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch), }, "error getting current deal info in called func": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -384,7 +384,7 @@ func TestOnDealSectorCommitted(t *testing.T) { expectedCBError: xerrors.Errorf("handling applied event: failed to look up deal on chain: something went wrong"), }, "proposed deal epoch timeout": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -393,11 +393,11 @@ func TestOnDealSectorCommitted(t *testing.T) { expectedCBError: xerrors.Errorf("handling applied event: deal with piece CID %s was not activated by proposed deal start epoch 0", unfinishedDeal.Proposal.PieceCID), }, "got prove-commit but deal not active": { - currentDealInfo: sealing.CurrentDealInfo{ + currentDealInfo: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, - currentDealInfo2: sealing.CurrentDealInfo{ + currentDealInfo2: sealing2.CurrentDealInfo{ DealID: dealID, MarketDeal: unfinishedDeal, }, @@ -568,13 +568,13 @@ func (m *mockPreCommitsAPI) diffPreCommits(ctx context.Context, actor address.Ad type mockDealInfoAPI struct { count int - CurrentDealInfo sealing.CurrentDealInfo + CurrentDealInfo sealing2.CurrentDealInfo Err error - CurrentDealInfo2 sealing.CurrentDealInfo + CurrentDealInfo2 sealing2.CurrentDealInfo Err2 error } -func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tok sealing.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing.CurrentDealInfo, error) { +func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tok sealing2.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing2.CurrentDealInfo, error) { m.count++ if m.count == 2 { return m.CurrentDealInfo2, m.Err2 diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index 0de8de595..6fa198bc0 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -27,11 +27,11 @@ import ( "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/markets/utils" "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules/helpers" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" "github.com/filecoin-project/lotus/storage/sectorblocks" ) @@ -108,7 +108,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema curTime := build.Clock.Now() for build.Clock.Since(curTime) < addPieceRetryTimeout { // Check if there was an error because of too many sectors being sealed - if !xerrors.Is(err, sealing.ErrTooManySectorsSealing) { + if !xerrors.Is(err, sealing2.ErrTooManySectorsSealing) { if err != nil { log.Errorf("failed to addPiece for deal %d, err: %v", deal.DealID, err) } @@ -258,13 +258,13 @@ func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context if err != nil { return 0, 0, 0, xerrors.Errorf("getting sector info: %w", err) } - if si.State == api.SectorState(sealing.Proving) { + if si.State == api.SectorState(sealing2.Proving) { best = r bestSi = si break } } - if bestSi.State == api.SectorState(sealing.UndefinedSectorState) { + if bestSi.State == api.SectorState(sealing2.UndefinedSectorState) { return 0, 0, 0, xerrors.New("no sealed sector found") } return best.SectorID, best.Offset, best.Size.Padded(), nil diff --git a/node/builder_miner.go b/node/builder_miner.go index b5c76598c..f750c8c65 100644 --- a/node/builder_miner.go +++ b/node/builder_miner.go @@ -23,7 +23,6 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/markets/dagstore" "github.com/filecoin-project/lotus/markets/dealfilter" "github.com/filecoin-project/lotus/markets/idxprov" @@ -38,6 +37,7 @@ import ( "github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage/ctladdr" + sealing "github.com/filecoin-project/lotus/storage/pipeline" "github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/wdpost" ) diff --git a/node/impl/storminer.go b/node/impl/storminer.go index e658b8ef5..798f177f4 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -46,14 +46,14 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/storiface" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" mktsdagstore "github.com/filecoin-project/lotus/markets/dagstore" "github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/miner" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage/ctladdr" + sealing "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/wdpost" ) diff --git a/node/modules/dtypes/miner.go b/node/modules/dtypes/miner.go index 9a391223d..24bcc714c 100644 --- a/node/modules/dtypes/miner.go +++ b/node/modules/dtypes/miner.go @@ -11,7 +11,7 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) type MinerAddress address.Address diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 32ce294ce..d0273478e 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -56,8 +56,6 @@ import ( sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/stores" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/markets" "github.com/filecoin-project/lotus/markets/dagstore" @@ -71,6 +69,8 @@ import ( "github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage/ctladdr" + sealing "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/wdpost" ) diff --git a/storage/adapter_events.go b/storage/adapter_events.go index 0f9c62039..fc84bca1d 100644 --- a/storage/adapter_events.go +++ b/storage/adapter_events.go @@ -7,7 +7,7 @@ import ( "github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) var _ sealing.Events = new(EventsAdapter) diff --git a/storage/adapter_storage_miner.go b/storage/adapter_storage_miner.go index d270b7b20..5bc899afd 100644 --- a/storage/adapter_storage_miner.go +++ b/storage/adapter_storage_miner.go @@ -27,10 +27,10 @@ import ( "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) -var _ sealing.SealingAPI = new(SealingAPIAdapter) +var _ sealing2.SealingAPI = new(SealingAPIAdapter) type SealingAPIAdapter struct { delegate fullNodeFilteredAPI @@ -40,7 +40,7 @@ func NewSealingAPIAdapter(api fullNodeFilteredAPI) SealingAPIAdapter { return SealingAPIAdapter{delegate: api} } -func (s SealingAPIAdapter) StateMinerSectorSize(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (abi.SectorSize, error) { +func (s SealingAPIAdapter) StateMinerSectorSize(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (abi.SectorSize, error) { // TODO: update storage-fsm to just StateMinerInfo mi, err := s.StateMinerInfo(ctx, maddr, tok) if err != nil { @@ -49,7 +49,7 @@ func (s SealingAPIAdapter) StateMinerSectorSize(ctx context.Context, maddr addre return mi.SectorSize, nil } -func (s SealingAPIAdapter) StateMinerPreCommitDepositForPower(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok sealing.TipSetToken) (big.Int, error) { +func (s SealingAPIAdapter) StateMinerPreCommitDepositForPower(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok sealing2.TipSetToken) (big.Int, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -58,7 +58,7 @@ func (s SealingAPIAdapter) StateMinerPreCommitDepositForPower(ctx context.Contex return s.delegate.StateMinerPreCommitDepositForPower(ctx, a, pci, tsk) } -func (s SealingAPIAdapter) StateMinerInitialPledgeCollateral(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok sealing.TipSetToken) (big.Int, error) { +func (s SealingAPIAdapter) StateMinerInitialPledgeCollateral(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok sealing2.TipSetToken) (big.Int, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -67,7 +67,7 @@ func (s SealingAPIAdapter) StateMinerInitialPledgeCollateral(ctx context.Context return s.delegate.StateMinerInitialPledgeCollateral(ctx, a, pci, tsk) } -func (s SealingAPIAdapter) StateMinerInfo(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (api.MinerInfo, error) { +func (s SealingAPIAdapter) StateMinerInfo(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (api.MinerInfo, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return api.MinerInfo{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -77,7 +77,7 @@ func (s SealingAPIAdapter) StateMinerInfo(ctx context.Context, maddr address.Add return s.delegate.StateMinerInfo(ctx, maddr, tsk) } -func (s SealingAPIAdapter) StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (big.Int, error) { +func (s SealingAPIAdapter) StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (big.Int, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -86,7 +86,7 @@ func (s SealingAPIAdapter) StateMinerAvailableBalance(ctx context.Context, maddr return s.delegate.StateMinerAvailableBalance(ctx, maddr, tsk) } -func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (address.Address, error) { +func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (address.Address, error) { // TODO: update storage-fsm to just StateMinerInfo mi, err := s.StateMinerInfo(ctx, maddr, tok) if err != nil { @@ -95,7 +95,7 @@ func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr ad return mi.Worker, nil } -func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) ([]api.Deadline, error) { +func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) ([]api.Deadline, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -104,7 +104,7 @@ func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr addres return s.delegate.StateMinerDeadlines(ctx, maddr, tsk) } -func (s SealingAPIAdapter) StateMinerSectorAllocated(ctx context.Context, maddr address.Address, sid abi.SectorNumber, tok sealing.TipSetToken) (bool, error) { +func (s SealingAPIAdapter) StateMinerSectorAllocated(ctx context.Context, maddr address.Address, sid abi.SectorNumber, tok sealing2.TipSetToken) (bool, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return false, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -113,7 +113,7 @@ func (s SealingAPIAdapter) StateMinerSectorAllocated(ctx context.Context, maddr return s.delegate.StateMinerSectorAllocated(ctx, maddr, sid, tsk) } -func (s SealingAPIAdapter) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (bitfield.BitField, error) { +func (s SealingAPIAdapter) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (bitfield.BitField, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return bitfield.BitField{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -134,14 +134,14 @@ func (s SealingAPIAdapter) StateMinerActiveSectors(ctx context.Context, maddr ad return miner.AllPartSectors(state, miner.Partition.ActiveSectors) } -func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (sealing.MsgLookup, error) { +func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (sealing2.MsgLookup, error) { wmsg, err := s.delegate.StateWaitMsg(ctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true) if err != nil { - return sealing.MsgLookup{}, err + return sealing2.MsgLookup{}, err } - return sealing.MsgLookup{ - Receipt: sealing.MessageReceipt{ + return sealing2.MsgLookup{ + Receipt: sealing2.MessageReceipt{ ExitCode: wmsg.Receipt.ExitCode, Return: wmsg.Receipt.Return, GasUsed: wmsg.Receipt.GasUsed, @@ -151,7 +151,7 @@ func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (seal }, nil } -func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*sealing.MsgLookup, error) { +func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*sealing2.MsgLookup, error) { wmsg, err := s.delegate.StateSearchMsg(ctx, types.EmptyTSK, c, api.LookbackNoLimit, true) if err != nil { return nil, err @@ -161,8 +161,8 @@ func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*seal return nil, nil } - return &sealing.MsgLookup{ - Receipt: sealing.MessageReceipt{ + return &sealing2.MsgLookup{ + Receipt: sealing2.MessageReceipt{ ExitCode: wmsg.Receipt.ExitCode, Return: wmsg.Receipt.Return, GasUsed: wmsg.Receipt.GasUsed, @@ -172,7 +172,7 @@ func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*seal }, nil } -func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok sealing.TipSetToken) (cid.Cid, error) { +func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok sealing2.TipSetToken) (cid.Cid, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -240,7 +240,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr return cid.Cid(cr.CommDs[0]), nil } -func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing.TipSetToken) (*minertypes.SectorPreCommitOnChainInfo, error) { +func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing2.TipSetToken) (*minertypes.SectorPreCommitOnChainInfo, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -268,7 +268,7 @@ func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr a return nil, xerrors.Errorf("checking if sector is allocated: %w", err) } if set { - return nil, sealing.ErrSectorAllocated + return nil, sealing2.ErrSectorAllocated } return nil, nil @@ -277,7 +277,7 @@ func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr a return pci, nil } -func (s SealingAPIAdapter) StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing.TipSetToken) (*miner.SectorOnChainInfo, error) { +func (s SealingAPIAdapter) StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing2.TipSetToken) (*miner.SectorOnChainInfo, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -286,7 +286,7 @@ func (s SealingAPIAdapter) StateSectorGetInfo(ctx context.Context, maddr address return s.delegate.StateSectorGetInfo(ctx, maddr, sectorNumber, tsk) } -func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing.TipSetToken) (*sealing.SectorLocation, error) { +func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing2.TipSetToken) (*sealing2.SectorLocation, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -297,7 +297,7 @@ func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr addre return nil, err } if l != nil { - return &sealing.SectorLocation{ + return &sealing2.SectorLocation{ Deadline: l.Deadline, Partition: l.Partition, }, nil @@ -306,7 +306,7 @@ func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr addre return nil, nil // not found } -func (s SealingAPIAdapter) StateMinerPartitions(ctx context.Context, maddr address.Address, dlIdx uint64, tok sealing.TipSetToken) ([]api.Partition, error) { +func (s SealingAPIAdapter) StateMinerPartitions(ctx context.Context, maddr address.Address, dlIdx uint64, tok sealing2.TipSetToken) ([]api.Partition, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) @@ -315,7 +315,7 @@ func (s SealingAPIAdapter) StateMinerPartitions(ctx context.Context, maddr addre return s.delegate.StateMinerPartitions(ctx, maddr, dlIdx, tsk) } -func (s SealingAPIAdapter) StateLookupID(ctx context.Context, addr address.Address, tok sealing.TipSetToken) (address.Address, error) { +func (s SealingAPIAdapter) StateLookupID(ctx context.Context, addr address.Address, tok sealing2.TipSetToken) (address.Address, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return address.Undef, err @@ -324,7 +324,7 @@ func (s SealingAPIAdapter) StateLookupID(ctx context.Context, addr address.Addre return s.delegate.StateLookupID(ctx, addr, tsk) } -func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok sealing.TipSetToken) (*api.MarketDeal, error) { +func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok sealing2.TipSetToken) (*api.MarketDeal, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, err @@ -333,7 +333,7 @@ func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID ab return s.delegate.StateMarketStorageDeal(ctx, dealID, tsk) } -func (s SealingAPIAdapter) StateMarketStorageDealProposal(ctx context.Context, dealID abi.DealID, tok sealing.TipSetToken) (market.DealProposal, error) { +func (s SealingAPIAdapter) StateMarketStorageDealProposal(ctx context.Context, dealID abi.DealID, tok sealing2.TipSetToken) (market.DealProposal, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return market.DealProposal{}, err @@ -347,7 +347,7 @@ func (s SealingAPIAdapter) StateMarketStorageDealProposal(ctx context.Context, d return deal.Proposal, nil } -func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing.TipSetToken) (network.Version, error) { +func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing2.TipSetToken) (network.Version, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return network.VersionMax, err @@ -356,7 +356,7 @@ func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing. return s.delegate.StateNetworkVersion(ctx, tsk) } -func (s SealingAPIAdapter) StateMinerProvingDeadline(ctx context.Context, maddr address.Address, tok sealing.TipSetToken) (*dline.Info, error) { +func (s SealingAPIAdapter) StateMinerProvingDeadline(ctx context.Context, maddr address.Address, tok sealing2.TipSetToken) (*dline.Info, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, err @@ -382,7 +382,7 @@ func (s SealingAPIAdapter) SendMsg(ctx context.Context, from, to address.Address return smsg.Cid(), nil } -func (s SealingAPIAdapter) ChainHead(ctx context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) { +func (s SealingAPIAdapter) ChainHead(ctx context.Context) (sealing2.TipSetToken, abi.ChainEpoch, error) { head, err := s.delegate.ChainHead(ctx) if err != nil { return nil, 0, err @@ -391,7 +391,7 @@ func (s SealingAPIAdapter) ChainHead(ctx context.Context) (sealing.TipSetToken, return head.Key().Bytes(), head.Height(), nil } -func (s SealingAPIAdapter) ChainBaseFee(ctx context.Context, tok sealing.TipSetToken) (abi.TokenAmount, error) { +func (s SealingAPIAdapter) ChainBaseFee(ctx context.Context, tok sealing2.TipSetToken) (abi.TokenAmount, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return big.Zero(), err @@ -409,7 +409,7 @@ func (s SealingAPIAdapter) ChainGetMessage(ctx context.Context, mc cid.Cid) (*ty return s.delegate.ChainGetMessage(ctx, mc) } -func (s SealingAPIAdapter) StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok sealing.TipSetToken) (abi.Randomness, error) { +func (s SealingAPIAdapter) StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok sealing2.TipSetToken) (abi.Randomness, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, err @@ -418,7 +418,7 @@ func (s SealingAPIAdapter) StateGetRandomnessFromBeacon(ctx context.Context, per return s.delegate.StateGetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, tsk) } -func (s SealingAPIAdapter) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok sealing.TipSetToken) (abi.Randomness, error) { +func (s SealingAPIAdapter) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok sealing2.TipSetToken) (abi.Randomness, error) { tsk, err := types.TipSetKeyFromBytes(tok) if err != nil { return nil, err diff --git a/storage/miner.go b/storage/miner.go index 6b6e7ae8c..0b6070b86 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -30,11 +30,11 @@ import ( "github.com/filecoin-project/lotus/chain/types" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/storage/ctladdr" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) var log = logging.Logger("storageminer") @@ -43,7 +43,7 @@ var log = logging.Logger("storageminer") // instantiated in the node builder, along with the WindowPoStScheduler. // // This object is the owner of the sealing pipeline. Most of the actual logic -// lives in the storage-sealing module (sealing.Sealing), and the Miner object +// lives in the pipeline module (sealing.Sealing), and the Miner object // exposes it to the rest of the system by proxying calls. // // Miner#Run starts the sealing FSM. @@ -52,7 +52,7 @@ type Miner struct { feeCfg config.MinerFeeConfig sealer sectorstorage.SectorManager ds datastore.Batching - sc sealing.SectorIDCounter + sc sealing2.SectorIDCounter verif ffiwrapper.Verifier prover ffiwrapper.Prover addrSel *ctladdr.AddressSelector @@ -60,7 +60,7 @@ type Miner struct { maddr address.Address getSealConfig dtypes.GetSealingConfigFunc - sealing *sealing.Sealing + sealing *sealing2.Sealing sealingEvtType journal.EventType @@ -71,8 +71,8 @@ type Miner struct { type SealingStateEvt struct { SectorNumber abi.SectorNumber SectorType abi.RegisteredSealProof - From sealing.SectorState - After sealing.SectorState + From sealing2.SectorState + After sealing2.SectorState Error string } @@ -134,7 +134,7 @@ func NewMiner(api fullNodeFilteredAPI, maddr address.Address, ds datastore.Batching, sealer sectorstorage.SectorManager, - sc sealing.SectorIDCounter, + sc sealing2.SectorIDCounter, verif ffiwrapper.Verifier, prover ffiwrapper.Prover, gsd dtypes.GetSealingConfigFunc, @@ -185,10 +185,10 @@ func (m *Miner) Run(ctx context.Context) error { adaptedAPI := NewSealingAPIAdapter(m.api) // Instantiate a precommit policy. - cfg := sealing.GetSealingConfigFunc(m.getSealConfig) + cfg := sealing2.GetSealingConfigFunc(m.getSealConfig) provingBuffer := md.WPoStProvingPeriod * 2 - pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer) + pcp := sealing2.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer) // address selector. as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) { @@ -196,7 +196,7 @@ func (m *Miner) Run(ctx context.Context) error { } // Instantiate the sealing FSM. - m.sealing = sealing.New(ctx, adaptedAPI, m.feeCfg, evtsAdapter, m.maddr, m.ds, m.sealer, m.sc, m.verif, m.prover, &pcp, cfg, m.handleSealingNotifications, as) + m.sealing = sealing2.New(ctx, adaptedAPI, m.feeCfg, evtsAdapter, m.maddr, m.ds, m.sealer, m.sc, m.verif, m.prover, &pcp, cfg, m.handleSealingNotifications, as) // Run the sealing FSM. go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function @@ -204,7 +204,7 @@ func (m *Miner) Run(ctx context.Context) error { return nil } -func (m *Miner) handleSealingNotifications(before, after sealing.SectorInfo) { +func (m *Miner) handleSealingNotifications(before, after sealing2.SectorInfo) { m.journal.RecordEvent(m.sealingEvtType, func() interface{} { return SealingStateEvt{ SectorNumber: before.SectorNumber, diff --git a/storage/miner_sealing.go b/storage/miner_sealing.go index 59a587fdc..4f92b91ec 100644 --- a/storage/miner_sealing.go +++ b/storage/miner_sealing.go @@ -12,8 +12,8 @@ import ( "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/sectorblocks" ) @@ -27,7 +27,7 @@ func (m *Miner) StartPackingSector(sectorNum abi.SectorNumber) error { return m.sealing.StartPacking(sectorNum) } -func (m *Miner) ListSectors() ([]sealing.SectorInfo, error) { +func (m *Miner) ListSectors() ([]sealing2.SectorInfo, error) { return m.sealing.ListSectors() } @@ -35,7 +35,7 @@ func (m *Miner) PledgeSector(ctx context.Context) (storage.SectorRef, error) { return m.sealing.PledgeSector(ctx) } -func (m *Miner) ForceSectorState(ctx context.Context, id abi.SectorNumber, state sealing.SectorState) error { +func (m *Miner) ForceSectorState(ctx context.Context, id abi.SectorNumber, state sealing2.SectorState) error { return m.sealing.ForceSectorState(ctx, id, state) } diff --git a/extern/storage-sealing/cbor_gen.go b/storage/pipeline/cbor_gen.go similarity index 100% rename from extern/storage-sealing/cbor_gen.go rename to storage/pipeline/cbor_gen.go diff --git a/extern/storage-sealing/checks.go b/storage/pipeline/checks.go similarity index 100% rename from extern/storage-sealing/checks.go rename to storage/pipeline/checks.go diff --git a/extern/storage-sealing/commit_batch.go b/storage/pipeline/commit_batch.go similarity index 86% rename from extern/storage-sealing/commit_batch.go rename to storage/pipeline/commit_batch.go index 09f122fe9..978a87df1 100644 --- a/extern/storage-sealing/commit_batch.go +++ b/storage/pipeline/commit_batch.go @@ -25,8 +25,8 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/node/config" + sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) var aggFeeNum = big.NewInt(110) @@ -63,10 +63,10 @@ type CommitBatcher struct { cutoffs map[abi.SectorNumber]time.Time todo map[abi.SectorNumber]AggregateInput - waiting map[abi.SectorNumber][]chan sealiface.CommitBatchRes + waiting map[abi.SectorNumber][]chan sealiface2.CommitBatchRes notify, stop, stopped chan struct{} - force chan chan []sealiface.CommitBatchRes + force chan chan []sealiface2.CommitBatchRes lk sync.Mutex } @@ -82,10 +82,10 @@ func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBat cutoffs: map[abi.SectorNumber]time.Time{}, todo: map[abi.SectorNumber]AggregateInput{}, - waiting: map[abi.SectorNumber][]chan sealiface.CommitBatchRes{}, + waiting: map[abi.SectorNumber][]chan sealiface2.CommitBatchRes{}, notify: make(chan struct{}, 1), - force: make(chan chan []sealiface.CommitBatchRes), + force: make(chan chan []sealiface2.CommitBatchRes), stop: make(chan struct{}), stopped: make(chan struct{}), } @@ -96,8 +96,8 @@ func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBat } func (b *CommitBatcher) run() { - var forceRes chan []sealiface.CommitBatchRes - var lastMsg []sealiface.CommitBatchRes + var forceRes chan []sealiface2.CommitBatchRes + var lastMsg []sealiface2.CommitBatchRes cfg, err := b.getConfig() if err != nil { @@ -184,7 +184,7 @@ func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration { return wait } -func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, error) { +func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface2.CommitBatchRes, error) { b.lk.Lock() defer b.lk.Unlock() @@ -202,7 +202,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, return nil, nil } - var res []sealiface.CommitBatchRes + var res []sealiface2.CommitBatchRes tok, h, err := b.api.ChainHead(b.mctx) if err != nil { @@ -264,7 +264,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, return res, nil } -func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBatchRes, error) { +func (b *CommitBatcher) processBatch(cfg sealiface2.Config) ([]sealiface2.CommitBatchRes, error) { tok, _, err := b.api.ChainHead(b.mctx) if err != nil { return nil, err @@ -272,7 +272,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa total := len(b.todo) - res := sealiface.CommitBatchRes{ + res := sealiface2.CommitBatchRes{ FailedSectors: map[abi.SectorNumber]string{}, } @@ -318,18 +318,18 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa mid, err := address.IDFromAddress(b.maddr) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting miner id: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("getting miner id: %w", err) } nv, err := b.api.StateNetworkVersion(b.mctx, tok) if err != nil { log.Errorf("getting network version: %s", err) - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting network version: %s", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("getting network version: %s", err) } arp, err := b.aggregateProofType(nv) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate proof type: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("getting aggregate proof type: %w", err) } params.AggregateProof, err = b.prover.AggregateSealProofs(proof.AggregateSealVerifyProofAndInfos{ @@ -339,30 +339,30 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa Infos: infos, }, proofs) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("aggregating proofs: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("aggregating proofs: %w", err) } enc := new(bytes.Buffer) if err := params.MarshalCBOR(enc); err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't serialize ProveCommitAggregateParams: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("couldn't serialize ProveCommitAggregateParams: %w", err) } mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) } maxFee := b.feeCfg.MaxCommitBatchGasFee.FeeForSectors(len(infos)) bf, err := b.api.ChainBaseFee(b.mctx, tok) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get base fee: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("couldn't get base fee: %w", err) } aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), bf) if err != nil { log.Errorf("getting aggregate commit network fee: %s", err) - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate commit network fee: %s", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("getting aggregate commit network fee: %s", err) } aggFee := big.Div(big.Mul(aggFeeRaw, aggFeeNum), aggFeeDen) @@ -370,29 +370,29 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa needFunds := big.Add(collateral, aggFee) needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds) if err != nil { - return []sealiface.CommitBatchRes{res}, err + return []sealiface2.CommitBatchRes{res}, err } goodFunds := big.Add(maxFee, needFunds) from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, needFunds) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err) } mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.ProveCommitAggregate, needFunds, maxFee, enc.Bytes()) if err != nil { - return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) + return []sealiface2.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) } res.Msg = &mcid log.Infow("Sent ProveCommitAggregate message", "cid", mcid, "from", from, "todo", total, "sectors", len(infos)) - return []sealiface.CommitBatchRes{res}, nil + return []sealiface2.CommitBatchRes{res}, nil } -func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.CommitBatchRes, error) { +func (b *CommitBatcher) processIndividually(cfg sealiface2.Config) ([]sealiface2.CommitBatchRes, error) { mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil) if err != nil { return nil, xerrors.Errorf("couldn't get miner info: %w", err) @@ -417,10 +417,10 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C return nil, err } - var res []sealiface.CommitBatchRes + var res []sealiface2.CommitBatchRes for sn, info := range b.todo { - r := sealiface.CommitBatchRes{ + r := sealiface2.CommitBatchRes{ Sectors: []abi.SectorNumber{sn}, FailedSectors: map[abi.SectorNumber]string{}, } @@ -439,7 +439,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C return res, nil } -func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tok TipSetToken) (cid.Cid, error) { +func (b *CommitBatcher) processSingle(cfg sealiface2.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tok TipSetToken) (cid.Cid, error) { enc := new(bytes.Buffer) params := &miner.ProveCommitSectorParams{ SectorNumber: sn, @@ -484,19 +484,19 @@ func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, av } // register commit, wait for batch message, return message CID -func (b *CommitBatcher) AddCommit(ctx context.Context, s SectorInfo, in AggregateInput) (res sealiface.CommitBatchRes, err error) { +func (b *CommitBatcher) AddCommit(ctx context.Context, s SectorInfo, in AggregateInput) (res sealiface2.CommitBatchRes, err error) { sn := s.SectorNumber cu, err := b.getCommitCutoff(s) if err != nil { - return sealiface.CommitBatchRes{}, err + return sealiface2.CommitBatchRes{}, err } b.lk.Lock() b.cutoffs[sn] = cu b.todo[sn] = in - sent := make(chan sealiface.CommitBatchRes, 1) + sent := make(chan sealiface2.CommitBatchRes, 1) b.waiting[sn] = append(b.waiting[sn], sent) select { @@ -509,12 +509,12 @@ func (b *CommitBatcher) AddCommit(ctx context.Context, s SectorInfo, in Aggregat case r := <-sent: return r, nil case <-ctx.Done(): - return sealiface.CommitBatchRes{}, ctx.Err() + return sealiface2.CommitBatchRes{}, ctx.Err() } } -func (b *CommitBatcher) Flush(ctx context.Context) ([]sealiface.CommitBatchRes, error) { - resCh := make(chan []sealiface.CommitBatchRes, 1) +func (b *CommitBatcher) Flush(ctx context.Context) ([]sealiface2.CommitBatchRes, error) { + resCh := make(chan []sealiface2.CommitBatchRes, 1) select { case b.force <- resCh: select { diff --git a/extern/storage-sealing/commit_batch_test.go b/storage/pipeline/commit_batch_test.go similarity index 93% rename from extern/storage-sealing/commit_batch_test.go rename to storage/pipeline/commit_batch_test.go index 59a79d459..433c340a8 100644 --- a/extern/storage-sealing/commit_batch_test.go +++ b/storage/pipeline/commit_batch_test.go @@ -23,9 +23,9 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/mocks" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/mocks" + sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) func TestCommitBatcher(t *testing.T) { @@ -42,8 +42,8 @@ func TestCommitBatcher(t *testing.T) { maxBatch := miner5.MaxAggregatedSectors minBatch := miner5.MinAggregatedSectors - cfg := func() (sealiface.Config, error) { - return sealiface.Config{ + cfg := func() (sealiface2.Config, error) { + return sealiface2.Config{ MaxWaitDealsSectors: 2, MaxSealingSectors: 0, MaxSealingSectorsForDeals: 0, @@ -71,10 +71,10 @@ func TestCommitBatcher(t *testing.T) { } type promise func(t *testing.T) - type action func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise + type action func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise actions := func(as ...action) action { - return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { + return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise { var ps []promise for _, a := range as { p := a(t, s, pcb) @@ -95,13 +95,13 @@ func TestCommitBatcher(t *testing.T) { } addSector := func(sn abi.SectorNumber) action { - return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { - var pcres sealiface.CommitBatchRes + return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise { + var pcres sealiface2.CommitBatchRes var pcerr error done := sync.Mutex{} done.Lock() - si := sealing.SectorInfo{ + si := sealing2.SectorInfo{ SectorNumber: sn, } @@ -113,7 +113,7 @@ func TestCommitBatcher(t *testing.T) { go func() { defer done.Unlock() - pcres, pcerr = pcb.AddCommit(ctx, si, sealing.AggregateInput{ + pcres, pcerr = pcb.AddCommit(ctx, si, sealing2.AggregateInput{ Info: prooftypes.AggregateSealVerifyInfo{ Number: sn, }, @@ -138,7 +138,7 @@ func TestCommitBatcher(t *testing.T) { } waitPending := func(n int) action { - return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { + return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise { require.Eventually(t, func() bool { p, err := pcb.Pending(ctx) require.NoError(t, err) @@ -151,7 +151,7 @@ func TestCommitBatcher(t *testing.T) { //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001, @CHAIN_STATE_MINER_GET_COLLATERAL_001 expectSend := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action { - return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { + return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise { s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil) ti := len(expect) @@ -217,7 +217,7 @@ func TestCommitBatcher(t *testing.T) { } flush := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action { - return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing.CommitBatcher) promise { + return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *sealing2.CommitBatcher) promise { _ = expectSend(expect, aboveBalancer, failOnePCI)(t, s, pcb) batch := len(expect) >= minBatch && aboveBalancer @@ -357,7 +357,7 @@ func TestCommitBatcher(t *testing.T) { // create them mocks pcapi := mocks.NewMockCommitBatcherApi(mockCtrl) - pcb := sealing.NewCommitBatcher(ctx, t0123, pcapi, as, fc, cfg, &fakeProver{}) + pcb := sealing2.NewCommitBatcher(ctx, t0123, pcapi, as, fc, cfg, &fakeProver{}) var promises []promise diff --git a/extern/storage-sealing/constants.go b/storage/pipeline/constants.go similarity index 100% rename from extern/storage-sealing/constants.go rename to storage/pipeline/constants.go diff --git a/extern/storage-sealing/currentdealinfo.go b/storage/pipeline/currentdealinfo.go similarity index 100% rename from extern/storage-sealing/currentdealinfo.go rename to storage/pipeline/currentdealinfo.go diff --git a/extern/storage-sealing/currentdealinfo_test.go b/storage/pipeline/currentdealinfo_test.go similarity index 100% rename from extern/storage-sealing/currentdealinfo_test.go rename to storage/pipeline/currentdealinfo_test.go diff --git a/extern/storage-sealing/events.go b/storage/pipeline/events.go similarity index 100% rename from extern/storage-sealing/events.go rename to storage/pipeline/events.go diff --git a/extern/storage-sealing/fsm.go b/storage/pipeline/fsm.go similarity index 100% rename from extern/storage-sealing/fsm.go rename to storage/pipeline/fsm.go diff --git a/extern/storage-sealing/fsm_events.go b/storage/pipeline/fsm_events.go similarity index 100% rename from extern/storage-sealing/fsm_events.go rename to storage/pipeline/fsm_events.go diff --git a/extern/storage-sealing/fsm_test.go b/storage/pipeline/fsm_test.go similarity index 100% rename from extern/storage-sealing/fsm_test.go rename to storage/pipeline/fsm_test.go diff --git a/extern/storage-sealing/garbage.go b/storage/pipeline/garbage.go similarity index 100% rename from extern/storage-sealing/garbage.go rename to storage/pipeline/garbage.go diff --git a/extern/storage-sealing/gen/main.go b/storage/pipeline/gen/main.go similarity index 80% rename from extern/storage-sealing/gen/main.go rename to storage/pipeline/gen/main.go index 825ce8d28..6da1d96b7 100644 --- a/extern/storage-sealing/gen/main.go +++ b/storage/pipeline/gen/main.go @@ -6,7 +6,7 @@ import ( gen "github.com/whyrusleeping/cbor-gen" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) func main() { diff --git a/extern/storage-sealing/input.go b/storage/pipeline/input.go similarity index 99% rename from extern/storage-sealing/input.go rename to storage/pipeline/input.go index f34277d90..160310945 100644 --- a/extern/storage-sealing/input.go +++ b/storage/pipeline/input.go @@ -21,8 +21,8 @@ import ( "github.com/filecoin-project/lotus/chain/types" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" - "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error { diff --git a/extern/storage-sealing/lib/nullreader/nullreader.go b/storage/pipeline/lib/nullreader/nullreader.go similarity index 100% rename from extern/storage-sealing/lib/nullreader/nullreader.go rename to storage/pipeline/lib/nullreader/nullreader.go diff --git a/extern/storage-sealing/mocks/api.go b/storage/pipeline/mocks/api.go similarity index 90% rename from extern/storage-sealing/mocks/api.go rename to storage/pipeline/mocks/api.go index db7bad01f..4a10068f5 100644 --- a/extern/storage-sealing/mocks/api.go +++ b/storage/pipeline/mocks/api.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/filecoin-project/lotus/extern/storage-sealing (interfaces: SealingAPI) +// Source: github.com/filecoin-project/lotus/extern/pipeline (interfaces: SealingAPI) // Package mocks is a generated GoMock package. package mocks @@ -23,7 +23,7 @@ import ( api "github.com/filecoin-project/lotus/api" types "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" ) // MockSealingAPI is a mock of SealingAPI interface. @@ -50,7 +50,7 @@ func (m *MockSealingAPI) EXPECT() *MockSealingAPIMockRecorder { } // ChainBaseFee mocks base method. -func (m *MockSealingAPI) ChainBaseFee(arg0 context.Context, arg1 sealing.TipSetToken) (big.Int, error) { +func (m *MockSealingAPI) ChainBaseFee(arg0 context.Context, arg1 sealing2.TipSetToken) (big.Int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1) ret0, _ := ret[0].(big.Int) @@ -80,10 +80,10 @@ func (mr *MockSealingAPIMockRecorder) ChainGetMessage(arg0, arg1 interface{}) *g } // ChainHead mocks base method. -func (m *MockSealingAPI) ChainHead(arg0 context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) { +func (m *MockSealingAPI) ChainHead(arg0 context.Context) (sealing2.TipSetToken, abi.ChainEpoch, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ChainHead", arg0) - ret0, _ := ret[0].(sealing.TipSetToken) + ret0, _ := ret[0].(sealing2.TipSetToken) ret1, _ := ret[1].(abi.ChainEpoch) ret2, _ := ret[2].(error) return ret0, ret1, ret2 @@ -126,7 +126,7 @@ func (mr *MockSealingAPIMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5 } // StateComputeDataCommitment mocks base method. -func (m *MockSealingAPI) StateComputeDataCommitment(arg0 context.Context, arg1 address.Address, arg2 abi.RegisteredSealProof, arg3 []abi.DealID, arg4 sealing.TipSetToken) (cid.Cid, error) { +func (m *MockSealingAPI) StateComputeDataCommitment(arg0 context.Context, arg1 address.Address, arg2 abi.RegisteredSealProof, arg3 []abi.DealID, arg4 sealing2.TipSetToken) (cid.Cid, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateComputeDataCommitment", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(cid.Cid) @@ -141,7 +141,7 @@ func (mr *MockSealingAPIMockRecorder) StateComputeDataCommitment(arg0, arg1, arg } // StateGetRandomnessFromBeacon mocks base method. -func (m *MockSealingAPI) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing.TipSetToken) (abi.Randomness, error) { +func (m *MockSealingAPI) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing2.TipSetToken) (abi.Randomness, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(abi.Randomness) @@ -156,7 +156,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromBeacon(arg0, arg1, a } // StateGetRandomnessFromTickets mocks base method. -func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing.TipSetToken) (abi.Randomness, error) { +func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing2.TipSetToken) (abi.Randomness, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(abi.Randomness) @@ -171,7 +171,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromTickets(arg0, arg1, } // StateLookupID mocks base method. -func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (address.Address, error) { +func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (address.Address, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2) ret0, _ := ret[0].(address.Address) @@ -186,7 +186,7 @@ func (mr *MockSealingAPIMockRecorder) StateLookupID(arg0, arg1, arg2 interface{} } // StateMarketStorageDeal mocks base method. -func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 sealing.TipSetToken) (*api.MarketDeal, error) { +func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 sealing2.TipSetToken) (*api.MarketDeal, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2) ret0, _ := ret[0].(*api.MarketDeal) @@ -201,7 +201,7 @@ func (mr *MockSealingAPIMockRecorder) StateMarketStorageDeal(arg0, arg1, arg2 in } // StateMarketStorageDealProposal mocks base method. -func (m *MockSealingAPI) StateMarketStorageDealProposal(arg0 context.Context, arg1 abi.DealID, arg2 sealing.TipSetToken) (market.DealProposal, error) { +func (m *MockSealingAPI) StateMarketStorageDealProposal(arg0 context.Context, arg1 abi.DealID, arg2 sealing2.TipSetToken) (market.DealProposal, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMarketStorageDealProposal", arg0, arg1, arg2) ret0, _ := ret[0].(market.DealProposal) @@ -216,7 +216,7 @@ func (mr *MockSealingAPIMockRecorder) StateMarketStorageDealProposal(arg0, arg1, } // StateMinerActiveSectors mocks base method. -func (m *MockSealingAPI) StateMinerActiveSectors(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (bitfield.BitField, error) { +func (m *MockSealingAPI) StateMinerActiveSectors(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (bitfield.BitField, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerActiveSectors", arg0, arg1, arg2) ret0, _ := ret[0].(bitfield.BitField) @@ -231,7 +231,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerActiveSectors(arg0, arg1, arg2 i } // StateMinerAvailableBalance mocks base method. -func (m *MockSealingAPI) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (big.Int, error) { +func (m *MockSealingAPI) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (big.Int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2) ret0, _ := ret[0].(big.Int) @@ -246,7 +246,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerAvailableBalance(arg0, arg1, arg } // StateMinerInfo mocks base method. -func (m *MockSealingAPI) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (api.MinerInfo, error) { +func (m *MockSealingAPI) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (api.MinerInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2) ret0, _ := ret[0].(api.MinerInfo) @@ -261,7 +261,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{ } // StateMinerInitialPledgeCollateral mocks base method. -func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) { +func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing2.TipSetToken) (big.Int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(big.Int) @@ -276,7 +276,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInitialPledgeCollateral(arg0, ar } // StateMinerPartitions mocks base method. -func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 sealing.TipSetToken) ([]api.Partition, error) { +func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 sealing2.TipSetToken) ([]api.Partition, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3) ret0, _ := ret[0].([]api.Partition) @@ -291,7 +291,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPartitions(arg0, arg1, arg2, arg } // StateMinerPreCommitDepositForPower mocks base method. -func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) { +func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing2.TipSetToken) (big.Int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(big.Int) @@ -306,7 +306,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPreCommitDepositForPower(arg0, a } // StateMinerProvingDeadline mocks base method. -func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (*dline.Info, error) { +func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (*dline.Info, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2) ret0, _ := ret[0].(*dline.Info) @@ -321,7 +321,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerProvingDeadline(arg0, arg1, arg2 } // StateMinerSectorAllocated mocks base method. -func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (bool, error) { +func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing2.TipSetToken) (bool, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(bool) @@ -336,7 +336,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerSectorAllocated(arg0, arg1, arg2 } // StateMinerSectorSize mocks base method. -func (m *MockSealingAPI) StateMinerSectorSize(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (abi.SectorSize, error) { +func (m *MockSealingAPI) StateMinerSectorSize(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (abi.SectorSize, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerSectorSize", arg0, arg1, arg2) ret0, _ := ret[0].(abi.SectorSize) @@ -351,7 +351,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerSectorSize(arg0, arg1, arg2 inte } // StateMinerWorkerAddress mocks base method. -func (m *MockSealingAPI) StateMinerWorkerAddress(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (address.Address, error) { +func (m *MockSealingAPI) StateMinerWorkerAddress(arg0 context.Context, arg1 address.Address, arg2 sealing2.TipSetToken) (address.Address, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateMinerWorkerAddress", arg0, arg1, arg2) ret0, _ := ret[0].(address.Address) @@ -366,7 +366,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerWorkerAddress(arg0, arg1, arg2 i } // StateNetworkVersion mocks base method. -func (m *MockSealingAPI) StateNetworkVersion(arg0 context.Context, arg1 sealing.TipSetToken) (network.Version, error) { +func (m *MockSealingAPI) StateNetworkVersion(arg0 context.Context, arg1 sealing2.TipSetToken) (network.Version, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1) ret0, _ := ret[0].(network.Version) @@ -381,10 +381,10 @@ func (mr *MockSealingAPIMockRecorder) StateNetworkVersion(arg0, arg1 interface{} } // StateSearchMsg mocks base method. -func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 cid.Cid) (*sealing.MsgLookup, error) { +func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 cid.Cid) (*sealing2.MsgLookup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1) - ret0, _ := ret[0].(*sealing.MsgLookup) + ret0, _ := ret[0].(*sealing2.MsgLookup) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -396,7 +396,7 @@ func (mr *MockSealingAPIMockRecorder) StateSearchMsg(arg0, arg1 interface{}) *go } // StateSectorGetInfo mocks base method. -func (m *MockSealingAPI) StateSectorGetInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*miner.SectorOnChainInfo, error) { +func (m *MockSealingAPI) StateSectorGetInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing2.TipSetToken) (*miner.SectorOnChainInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*miner.SectorOnChainInfo) @@ -411,10 +411,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3 } // StateSectorPartition mocks base method. -func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*sealing.SectorLocation, error) { +func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing2.TipSetToken) (*sealing2.SectorLocation, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*sealing.SectorLocation) + ret0, _ := ret[0].(*sealing2.SectorLocation) ret1, _ := ret[1].(error) return ret0, ret1 } @@ -426,7 +426,7 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg } // StateSectorPreCommitInfo mocks base method. -func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) { +func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing2.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo) @@ -441,10 +441,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPreCommitInfo(arg0, arg1, arg2, } // StateWaitMsg mocks base method. -func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid) (sealing.MsgLookup, error) { +func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid) (sealing2.MsgLookup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1) - ret0, _ := ret[0].(sealing.MsgLookup) + ret0, _ := ret[0].(sealing2.MsgLookup) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/extern/storage-sealing/mocks/mock_commit_batcher.go b/storage/pipeline/mocks/mock_commit_batcher.go similarity index 97% rename from extern/storage-sealing/mocks/mock_commit_batcher.go rename to storage/pipeline/mocks/mock_commit_batcher.go index 80e6d0655..51a35c38f 100644 --- a/extern/storage-sealing/mocks/mock_commit_batcher.go +++ b/storage/pipeline/mocks/mock_commit_batcher.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/filecoin-project/lotus/extern/storage-sealing (interfaces: CommitBatcherApi) +// Source: github.com/filecoin-project/lotus/extern/pipeline (interfaces: CommitBatcherApi) // Package mocks is a generated GoMock package. package mocks @@ -18,7 +18,7 @@ import ( network "github.com/filecoin-project/go-state-types/network" api "github.com/filecoin-project/lotus/api" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) // MockCommitBatcherApi is a mock of CommitBatcherApi interface. diff --git a/extern/storage-sealing/mocks/mock_precommit_batcher.go b/storage/pipeline/mocks/mock_precommit_batcher.go similarity index 96% rename from extern/storage-sealing/mocks/mock_precommit_batcher.go rename to storage/pipeline/mocks/mock_precommit_batcher.go index eae9c8339..d6a83c6f9 100644 --- a/extern/storage-sealing/mocks/mock_precommit_batcher.go +++ b/storage/pipeline/mocks/mock_precommit_batcher.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/filecoin-project/lotus/extern/storage-sealing (interfaces: PreCommitBatcherApi) +// Source: github.com/filecoin-project/lotus/extern/pipeline (interfaces: PreCommitBatcherApi) // Package mocks is a generated GoMock package. package mocks @@ -17,7 +17,7 @@ import ( network "github.com/filecoin-project/go-state-types/network" api "github.com/filecoin-project/lotus/api" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" ) // MockPreCommitBatcherApi is a mock of PreCommitBatcherApi interface. diff --git a/extern/storage-sealing/mocks/statemachine.go b/storage/pipeline/mocks/statemachine.go similarity index 94% rename from extern/storage-sealing/mocks/statemachine.go rename to storage/pipeline/mocks/statemachine.go index 9fdabdc87..d5dfc73c7 100644 --- a/extern/storage-sealing/mocks/statemachine.go +++ b/storage/pipeline/mocks/statemachine.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/filecoin-project/lotus/extern/storage-sealing (interfaces: Context) +// Source: github.com/filecoin-project/lotus/extern/pipeline (interfaces: Context) // Package mocks is a generated GoMock package. package mocks diff --git a/extern/storage-sealing/precommit_batch.go b/storage/pipeline/precommit_batch.go similarity index 84% rename from extern/storage-sealing/precommit_batch.go rename to storage/pipeline/precommit_batch.go index dd93175ca..432f8d75d 100644 --- a/extern/storage-sealing/precommit_batch.go +++ b/storage/pipeline/precommit_batch.go @@ -21,8 +21,8 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/node/config" + sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) //go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_precommit_batcher.go -package=mocks . PreCommitBatcherApi @@ -51,10 +51,10 @@ type PreCommitBatcher struct { cutoffs map[abi.SectorNumber]time.Time todo map[abi.SectorNumber]*preCommitEntry - waiting map[abi.SectorNumber][]chan sealiface.PreCommitBatchRes + waiting map[abi.SectorNumber][]chan sealiface2.PreCommitBatchRes notify, stop, stopped chan struct{} - force chan chan []sealiface.PreCommitBatchRes + force chan chan []sealiface2.PreCommitBatchRes lk sync.Mutex } @@ -69,10 +69,10 @@ func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCom cutoffs: map[abi.SectorNumber]time.Time{}, todo: map[abi.SectorNumber]*preCommitEntry{}, - waiting: map[abi.SectorNumber][]chan sealiface.PreCommitBatchRes{}, + waiting: map[abi.SectorNumber][]chan sealiface2.PreCommitBatchRes{}, notify: make(chan struct{}, 1), - force: make(chan chan []sealiface.PreCommitBatchRes), + force: make(chan chan []sealiface2.PreCommitBatchRes), stop: make(chan struct{}), stopped: make(chan struct{}), } @@ -83,8 +83,8 @@ func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCom } func (b *PreCommitBatcher) run() { - var forceRes chan []sealiface.PreCommitBatchRes - var lastRes []sealiface.PreCommitBatchRes + var forceRes chan []sealiface2.PreCommitBatchRes + var lastRes []sealiface2.PreCommitBatchRes cfg, err := b.getConfig() if err != nil { @@ -170,7 +170,7 @@ func (b *PreCommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration return wait } -func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBatchRes, error) { +func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface2.PreCommitBatchRes, error) { b.lk.Lock() defer b.lk.Unlock() @@ -210,7 +210,7 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat } // todo support multiple batches - var res []sealiface.PreCommitBatchRes + var res []sealiface2.PreCommitBatchRes if !individual { res, err = b.processBatch(cfg, tok, bf, nv) } else { @@ -239,7 +239,7 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat return res, nil } -func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.PreCommitBatchRes, error) { +func (b *PreCommitBatcher) processIndividually(cfg sealiface2.Config) ([]sealiface2.PreCommitBatchRes, error) { mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil) if err != nil { return nil, xerrors.Errorf("couldn't get miner info: %w", err) @@ -259,10 +259,10 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac } } - var res []sealiface.PreCommitBatchRes + var res []sealiface2.PreCommitBatchRes for sn, info := range b.todo { - r := sealiface.PreCommitBatchRes{ + r := sealiface2.PreCommitBatchRes{ Sectors: []abi.SectorNumber{sn}, } @@ -279,7 +279,7 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac return res, nil } -func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, params *preCommitEntry) (cid.Cid, error) { +func (b *PreCommitBatcher) processSingle(cfg sealiface2.Config, mi api.MinerInfo, avail *abi.TokenAmount, params *preCommitEntry) (cid.Cid, error) { enc := new(bytes.Buffer) if err := params.pci.MarshalCBOR(enc); err != nil { @@ -315,10 +315,10 @@ func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, return mcid, nil } -func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, bf abi.TokenAmount, nv network.Version) ([]sealiface.PreCommitBatchRes, error) { +func (b *PreCommitBatcher) processBatch(cfg sealiface2.Config, tok TipSetToken, bf abi.TokenAmount, nv network.Version) ([]sealiface2.PreCommitBatchRes, error) { params := miner.PreCommitSectorBatchParams{} deposit := big.Zero() - var res sealiface.PreCommitBatchRes + var res sealiface2.PreCommitBatchRes for _, p := range b.todo { if len(params.Sectors) >= cfg.MaxPreCommitBatch { @@ -333,12 +333,12 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b enc := new(bytes.Buffer) if err := params.MarshalCBOR(enc); err != nil { - return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("couldn't serialize PreCommitSectorBatchParams: %w", err) + return []sealiface2.PreCommitBatchRes{res}, xerrors.Errorf("couldn't serialize PreCommitSectorBatchParams: %w", err) } mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil) if err != nil { - return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) + return []sealiface2.PreCommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) } maxFee := b.feeCfg.MaxPreCommitBatchGasFee.FeeForSectors(len(params.Sectors)) @@ -346,7 +346,7 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b aggFeeRaw, err := policy.AggregatePreCommitNetworkFee(nv, len(params.Sectors), bf) if err != nil { log.Errorf("getting aggregate precommit network fee: %s", err) - return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("getting aggregate precommit network fee: %s", err) + return []sealiface2.PreCommitBatchRes{res}, xerrors.Errorf("getting aggregate precommit network fee: %s", err) } aggFee := big.Div(big.Mul(aggFeeRaw, aggFeeNum), aggFeeDen) @@ -354,39 +354,39 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b needFunds := big.Add(deposit, aggFee) needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds) if err != nil { - return []sealiface.PreCommitBatchRes{res}, err + return []sealiface2.PreCommitBatchRes{res}, err } goodFunds := big.Add(maxFee, needFunds) from, _, err := b.addrSel(b.mctx, mi, api.PreCommitAddr, goodFunds, deposit) if err != nil { - return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err) + return []sealiface2.PreCommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err) } mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.PreCommitSectorBatch, needFunds, maxFee, enc.Bytes()) if err != nil { - return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) + return []sealiface2.PreCommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) } res.Msg = &mcid log.Infow("Sent PreCommitSectorBatch message", "cid", mcid, "from", from, "sectors", len(b.todo)) - return []sealiface.PreCommitBatchRes{res}, nil + return []sealiface2.PreCommitBatchRes{res}, nil } // register PreCommit, wait for batch message, return message CID -func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, deposit abi.TokenAmount, in *miner.SectorPreCommitInfo) (res sealiface.PreCommitBatchRes, err error) { +func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, deposit abi.TokenAmount, in *miner.SectorPreCommitInfo) (res sealiface2.PreCommitBatchRes, err error) { _, curEpoch, err := b.api.ChainHead(b.mctx) if err != nil { log.Errorf("getting chain head: %s", err) - return sealiface.PreCommitBatchRes{}, err + return sealiface2.PreCommitBatchRes{}, err } cutoff, err := getPreCommitCutoff(curEpoch, s) if err != nil { - return sealiface.PreCommitBatchRes{}, xerrors.Errorf("failed to calculate cutoff: %w", err) + return sealiface2.PreCommitBatchRes{}, xerrors.Errorf("failed to calculate cutoff: %w", err) } sn := s.SectorNumber @@ -398,7 +398,7 @@ func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, depos pci: in, } - sent := make(chan sealiface.PreCommitBatchRes, 1) + sent := make(chan sealiface2.PreCommitBatchRes, 1) b.waiting[sn] = append(b.waiting[sn], sent) select { @@ -411,12 +411,12 @@ func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, depos case c := <-sent: return c, nil case <-ctx.Done(): - return sealiface.PreCommitBatchRes{}, ctx.Err() + return sealiface2.PreCommitBatchRes{}, ctx.Err() } } -func (b *PreCommitBatcher) Flush(ctx context.Context) ([]sealiface.PreCommitBatchRes, error) { - resCh := make(chan []sealiface.PreCommitBatchRes, 1) +func (b *PreCommitBatcher) Flush(ctx context.Context) ([]sealiface2.PreCommitBatchRes, error) { + resCh := make(chan []sealiface2.PreCommitBatchRes, 1) select { case b.force <- resCh: select { diff --git a/extern/storage-sealing/precommit_batch_test.go b/storage/pipeline/precommit_batch_test.go similarity index 91% rename from extern/storage-sealing/precommit_batch_test.go rename to storage/pipeline/precommit_batch_test.go index 29e02650e..38ce59eda 100644 --- a/extern/storage-sealing/precommit_batch_test.go +++ b/storage/pipeline/precommit_batch_test.go @@ -21,10 +21,10 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/mocks" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/node/config" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/mocks" + sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) var fc = config.MinerFeeConfig{ @@ -48,8 +48,8 @@ func TestPrecommitBatcher(t *testing.T) { maxBatch := miner6.PreCommitSectorBatchMaxSize - cfg := func() (sealiface.Config, error) { - return sealiface.Config{ + cfg := func() (sealiface2.Config, error) { + return sealiface2.Config{ MaxWaitDealsSectors: 2, MaxSealingSectors: 0, MaxSealingSectorsForDeals: 0, @@ -75,10 +75,10 @@ func TestPrecommitBatcher(t *testing.T) { } type promise func(t *testing.T) - type action func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise + type action func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise actions := func(as ...action) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { var ps []promise for _, a := range as { p := a(t, s, pcb) @@ -99,13 +99,13 @@ func TestPrecommitBatcher(t *testing.T) { } addSector := func(sn abi.SectorNumber) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { - var pcres sealiface.PreCommitBatchRes + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { + var pcres sealiface2.PreCommitBatchRes var pcerr error done := sync.Mutex{} done.Lock() - si := sealing.SectorInfo{ + si := sealing2.SectorInfo{ SectorNumber: sn, } @@ -139,7 +139,7 @@ func TestPrecommitBatcher(t *testing.T) { } waitPending := func(n int) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { require.Eventually(t, func() bool { p, err := pcb.Pending(ctx) require.NoError(t, err) @@ -152,7 +152,7 @@ func TestPrecommitBatcher(t *testing.T) { //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001 expectSend := func(expect []abi.SectorNumber) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil) s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(10001), nil) s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) @@ -173,7 +173,7 @@ func TestPrecommitBatcher(t *testing.T) { //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 *sealing.PreCommitBatcher) promise { + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil) s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(9999), nil) s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) @@ -194,7 +194,7 @@ func TestPrecommitBatcher(t *testing.T) { } flush := func(expect []abi.SectorNumber) action { - return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing.PreCommitBatcher) promise { + return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *sealing2.PreCommitBatcher) promise { _ = expectSend(expect)(t, s, pcb) r, err := pcb.Flush(ctx) @@ -261,7 +261,7 @@ func TestPrecommitBatcher(t *testing.T) { // create them mocks pcapi := mocks.NewMockPreCommitBatcherApi(mockCtrl) - pcb := sealing.NewPreCommitBatcher(ctx, t0123, pcapi, as, fc, cfg) + pcb := sealing2.NewPreCommitBatcher(ctx, t0123, pcapi, as, fc, cfg) var promises []promise diff --git a/extern/storage-sealing/precommit_policy.go b/storage/pipeline/precommit_policy.go similarity index 100% rename from extern/storage-sealing/precommit_policy.go rename to storage/pipeline/precommit_policy.go diff --git a/extern/storage-sealing/precommit_policy_test.go b/storage/pipeline/precommit_policy_test.go similarity index 85% rename from extern/storage-sealing/precommit_policy_test.go rename to storage/pipeline/precommit_policy_test.go index 38553d461..0886f0d98 100644 --- a/extern/storage-sealing/precommit_policy_test.go +++ b/storage/pipeline/precommit_policy_test.go @@ -17,8 +17,8 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/policy" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) type fakeChain struct { @@ -29,7 +29,7 @@ type fakeConfigStub struct { CCSectorLifetime time.Duration } -func fakeConfigGetter(stub *fakeConfigStub) sealing.GetSealingConfigFunc { +func fakeConfigGetter(stub *fakeConfigStub) sealing2.GetSealingConfigFunc { return func() (sealiface.Config, error) { if stub == nil { return sealiface.Config{}, nil @@ -41,11 +41,11 @@ func fakeConfigGetter(stub *fakeConfigStub) sealing.GetSealingConfigFunc { } } -func (f *fakeChain) StateNetworkVersion(ctx context.Context, tok sealing.TipSetToken) (network.Version, error) { +func (f *fakeChain) StateNetworkVersion(ctx context.Context, tok sealing2.TipSetToken) (network.Version, error) { return build.NewestNetworkVersion, nil } -func (f *fakeChain) ChainHead(ctx context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) { +func (f *fakeChain) ChainHead(ctx context.Context) (sealing2.TipSetToken, abi.ChainEpoch, error) { return []byte{1, 2, 3}, f.h, nil } @@ -60,7 +60,7 @@ func TestBasicPolicyEmptySector(t *testing.T) { cfg := fakeConfigGetter(nil) h := abi.ChainEpoch(55) pBuffer := abi.ChainEpoch(2) - pcp := sealing.NewBasicPreCommitPolicy(&fakeChain{h: h}, cfg, pBuffer) + pcp := sealing2.NewBasicPreCommitPolicy(&fakeChain{h: h}, cfg, pBuffer) exp, err := pcp.Expiration(context.Background()) require.NoError(t, err) @@ -77,7 +77,7 @@ func TestCustomCCSectorConfig(t *testing.T) { cfg := fakeConfigGetter(&cfgStub) h := abi.ChainEpoch(55) pBuffer := abi.ChainEpoch(2) - pcp := sealing.NewBasicPreCommitPolicy(&fakeChain{h: h}, cfg, pBuffer) + pcp := sealing2.NewBasicPreCommitPolicy(&fakeChain{h: h}, cfg, pBuffer) exp, err := pcp.Expiration(context.Background()) require.NoError(t, err) @@ -89,11 +89,11 @@ func TestCustomCCSectorConfig(t *testing.T) { func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) { cfg := fakeConfigGetter(nil) - policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ + policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{ h: abi.ChainEpoch(55), }, cfg, 2) longestDealEpochEnd := abi.ChainEpoch(547300) - pieces := []sealing.Piece{ + pieces := []sealing2.Piece{ { Piece: abi.PieceInfo{ Size: abi.PaddedPieceSize(1024), @@ -130,11 +130,11 @@ func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) { func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) { cfg := fakeConfigGetter(nil) - policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ + policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{ h: abi.ChainEpoch(55), }, cfg, 0) - pieces := []sealing.Piece{ + pieces := []sealing2.Piece{ { Piece: abi.PieceInfo{ Size: abi.PaddedPieceSize(1024), @@ -159,11 +159,11 @@ func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) { func TestMissingDealIsIgnored(t *testing.T) { cfg := fakeConfigGetter(nil) - policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ + policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{ h: abi.ChainEpoch(55), }, cfg, 0) - pieces := []sealing.Piece{ + pieces := []sealing2.Piece{ { Piece: abi.PieceInfo{ Size: abi.PaddedPieceSize(1024), diff --git a/extern/storage-sealing/sealiface/batching.go b/storage/pipeline/sealiface/batching.go similarity index 100% rename from extern/storage-sealing/sealiface/batching.go rename to storage/pipeline/sealiface/batching.go diff --git a/extern/storage-sealing/sealiface/config.go b/storage/pipeline/sealiface/config.go similarity index 100% rename from extern/storage-sealing/sealiface/config.go rename to storage/pipeline/sealiface/config.go diff --git a/extern/storage-sealing/sealing.go b/storage/pipeline/sealing.go similarity index 99% rename from extern/storage-sealing/sealing.go rename to storage/pipeline/sealing.go index c7b156b16..111c5e7a2 100644 --- a/extern/storage-sealing/sealing.go +++ b/storage/pipeline/sealing.go @@ -29,8 +29,8 @@ import ( "github.com/filecoin-project/lotus/chain/types" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/node/config" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) const SectorStorePrefix = "/sectors" diff --git a/extern/storage-sealing/sector_state.go b/storage/pipeline/sector_state.go similarity index 100% rename from extern/storage-sealing/sector_state.go rename to storage/pipeline/sector_state.go diff --git a/extern/storage-sealing/states_failed.go b/storage/pipeline/states_failed.go similarity index 100% rename from extern/storage-sealing/states_failed.go rename to storage/pipeline/states_failed.go diff --git a/extern/storage-sealing/states_failed_test.go b/storage/pipeline/states_failed_test.go similarity index 83% rename from extern/storage-sealing/states_failed_test.go rename to storage/pipeline/states_failed_test.go index 9aef97b28..55905330e 100644 --- a/extern/storage-sealing/states_failed_test.go +++ b/storage/pipeline/states_failed_test.go @@ -20,8 +20,8 @@ import ( api2 "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/actors/builtin/market" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" - "github.com/filecoin-project/lotus/extern/storage-sealing/mocks" + sealing2 "github.com/filecoin-project/lotus/storage/pipeline" + mocks2 "github.com/filecoin-project/lotus/storage/pipeline/mocks" ) func TestStateRecoverDealIDs(t *testing.T) { @@ -31,14 +31,14 @@ func TestStateRecoverDealIDs(t *testing.T) { ctx := context.Background() - api := mocks.NewMockSealingAPI(mockCtrl) + api := mocks2.NewMockSealingAPI(mockCtrl) - fakeSealing := &sealing.Sealing{ + fakeSealing := &sealing2.Sealing{ Api: api, - DealInfo: &sealing.CurrentDealInfoManager{CDAPI: api}, + DealInfo: &sealing2.CurrentDealInfoManager{CDAPI: api}, } - sctx := mocks.NewMockContext(mockCtrl) + sctx := mocks2.NewMockContext(mockCtrl) sctx.EXPECT().Context().AnyTimes().Return(ctx) api.EXPECT().ChainHead(ctx).Times(2).Return(nil, abi.ChainEpoch(10), nil) @@ -55,8 +55,8 @@ func TestStateRecoverDealIDs(t *testing.T) { // expect GetCurrentDealInfo { - api.EXPECT().StateSearchMsg(ctx, pc).Return(&sealing.MsgLookup{ - Receipt: sealing.MessageReceipt{ + api.EXPECT().StateSearchMsg(ctx, pc).Return(&sealing2.MsgLookup{ + Receipt: sealing2.MessageReceipt{ ExitCode: exitcode.Ok, Return: cborRet(&market0.PublishStorageDealsReturn{ IDs: []abi.DealID{dealId}, @@ -70,12 +70,12 @@ func TestStateRecoverDealIDs(t *testing.T) { } - sctx.EXPECT().Send(sealing.SectorRemove{}).Return(nil) + sctx.EXPECT().Send(sealing2.SectorRemove{}).Return(nil) // TODO sctx should satisfy an interface so it can be useable for mocking. This will fail because we are passing in an empty context now to get this to build. // https://github.com/filecoin-project/lotus/issues/7867 - err := fakeSealing.HandleRecoverDealIDs(statemachine.Context{}, sealing.SectorInfo{ - Pieces: []sealing.Piece{ + err := fakeSealing.HandleRecoverDealIDs(statemachine.Context{}, sealing2.SectorInfo{ + Pieces: []sealing2.Piece{ { DealInfo: &api2.PieceDealInfo{ DealID: dealId, diff --git a/extern/storage-sealing/states_proving.go b/storage/pipeline/states_proving.go similarity index 100% rename from extern/storage-sealing/states_proving.go rename to storage/pipeline/states_proving.go diff --git a/extern/storage-sealing/states_replica_update.go b/storage/pipeline/states_replica_update.go similarity index 100% rename from extern/storage-sealing/states_replica_update.go rename to storage/pipeline/states_replica_update.go diff --git a/extern/storage-sealing/states_sealing.go b/storage/pipeline/states_sealing.go similarity index 99% rename from extern/storage-sealing/states_sealing.go rename to storage/pipeline/states_sealing.go index 4ce82fa2b..1b21e7c73 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -22,7 +22,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/policy" - "github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" + "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" ) var DealSectorPriority = 1024 diff --git a/extern/storage-sealing/stats.go b/storage/pipeline/stats.go similarity index 97% rename from extern/storage-sealing/stats.go rename to storage/pipeline/stats.go index 050204519..696cd56a5 100644 --- a/extern/storage-sealing/stats.go +++ b/storage/pipeline/stats.go @@ -9,8 +9,8 @@ import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/metrics" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) type statSectorState int diff --git a/extern/storage-sealing/terminate_batch.go b/storage/pipeline/terminate_batch.go similarity index 100% rename from extern/storage-sealing/terminate_batch.go rename to storage/pipeline/terminate_batch.go diff --git a/extern/storage-sealing/types.go b/storage/pipeline/types.go similarity index 98% rename from extern/storage-sealing/types.go rename to storage/pipeline/types.go index 28002e8cb..c068d54e1 100644 --- a/extern/storage-sealing/types.go +++ b/storage/pipeline/types.go @@ -14,7 +14,7 @@ import ( "github.com/filecoin-project/lotus/api" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" - "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" + "github.com/filecoin-project/lotus/storage/pipeline/sealiface" ) //go:generate go run github.com/golang/mock/mockgen -destination=mocks/statemachine.go -package=mocks . Context diff --git a/extern/storage-sealing/types_test.go b/storage/pipeline/types_test.go similarity index 100% rename from extern/storage-sealing/types_test.go rename to storage/pipeline/types_test.go diff --git a/extern/storage-sealing/upgrade_queue.go b/storage/pipeline/upgrade_queue.go similarity index 100% rename from extern/storage-sealing/upgrade_queue.go rename to storage/pipeline/upgrade_queue.go diff --git a/extern/storage-sealing/utils.go b/storage/pipeline/utils.go similarity index 97% rename from extern/storage-sealing/utils.go rename to storage/pipeline/utils.go index 3dc4c4d1e..24a67423e 100644 --- a/extern/storage-sealing/utils.go +++ b/storage/pipeline/utils.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/storage/pipeline/sealiface" ) func fillersFromRem(in abi.UnpaddedPieceSize) ([]abi.UnpaddedPieceSize, error) { diff --git a/extern/storage-sealing/utils_test.go b/storage/pipeline/utils_test.go similarity index 100% rename from extern/storage-sealing/utils_test.go rename to storage/pipeline/utils_test.go diff --git a/testplans/lotus-soup/rfwp/chain_state.go b/testplans/lotus-soup/rfwp/chain_state.go index 929870e26..96ad91743 100644 --- a/testplans/lotus-soup/rfwp/chain_state.go +++ b/testplans/lotus-soup/rfwp/chain_state.go @@ -26,7 +26,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" - sealing "github.com/filecoin-project/lotus/extern/storage-sealing" + sealing "github.com/filecoin-project/lotus/storage/pipeline" "github.com/filecoin-project/lotus/testplans/lotus-soup/testkit" tsync "github.com/filecoin-project/lotus/tools/stats/sync" )