storage: Move extern/storage-sealing to storage/pipeline

This commit is contained in:
Łukasz Magiera 2022-06-14 19:41:59 +02:00
parent cf835fcc0c
commit 98a48a47f8
73 changed files with 279 additions and 279 deletions

View File

@ -24,7 +24,7 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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 // MODIFYING THE API INTERFACE

View File

@ -41,9 +41,9 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo/imports" "github.com/filecoin-project/lotus/node/repo/imports"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
var ExampleValues = map[reflect.Type]interface{}{ var ExampleValues = map[reflect.Type]interface{}{

View File

@ -39,10 +39,10 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "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/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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/journal/alerting"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo/imports" "github.com/filecoin-project/lotus/node/repo/imports"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
var ErrNotSupported = xerrors.New("method not supported") var ErrNotSupported = xerrors.New("method not supported")

View File

@ -34,8 +34,8 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks" "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" "github.com/filecoin-project/lotus/journal/alerting"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
var infoCmd = &cli.Command{ var infoCmd = &cli.Command{

View File

@ -50,7 +50,6 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "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/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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/genesis"
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
"github.com/filecoin-project/lotus/journal/fsjournal" "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/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
) )
var initCmd = &cli.Command{ var initCmd = &cli.Command{
@ -303,7 +303,7 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
maxSectorID := abi.SectorNumber(0) maxSectorID := abi.SectorNumber(0)
for _, sector := range meta.Sectors { 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) dealID, err := findMarketDealID(ctx, api, sector.Deal)
if err != nil { if err != nil {
@ -312,10 +312,10 @@ func migratePreSealMeta(ctx context.Context, api v1api.FullNode, metadata string
commD := sector.CommD commD := sector.CommD
commR := sector.CommR commR := sector.CommR
info := &sealing.SectorInfo{ info := &sealing2.SectorInfo{
State: sealing.Proving, State: sealing2.Proving,
SectorNumber: sector.SectorID, SectorNumber: sector.SectorID,
Pieces: []sealing.Piece{ Pieces: []sealing2.Piece{
{ {
Piece: abi.PieceInfo{ Piece: abi.PieceInfo{
Size: abi.PaddedPieceSize(meta.SectorSize), Size: abi.PaddedPieceSize(meta.SectorSize),

View File

@ -32,8 +32,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/lib/tablewriter" "github.com/filecoin-project/lotus/lib/tablewriter"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
var sectorsCmd = &cli.Command{ var sectorsCmd = &cli.Command{

View File

@ -30,8 +30,8 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "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/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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" "github.com/filecoin-project/lotus/lib/tablewriter"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
const metaFile = "sectorstore.json" const metaFile = "sectorstore.json"

View File

@ -31,8 +31,8 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/fr32" "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/partialfile"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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" "github.com/filecoin-project/lotus/lib/nullreader"
nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
) )
var _ Storage = &Sealer{} var _ Storage = &Sealer{}

View File

@ -31,7 +31,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/policy" "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/ffiwrapper/basicfs"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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() { func init() {

View File

@ -13,13 +13,13 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/markets/storageadapter"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
func TestBatchDealInput(t *testing.T) { func TestBatchDealInput(t *testing.T) {

View File

@ -28,7 +28,7 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
type DealHarness struct { type DealHarness struct {

View File

@ -26,8 +26,8 @@ import (
"github.com/filecoin-project/lotus/chain/wallet/key" "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/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "github.com/filecoin-project/lotus/extern/sector-storage/storiface"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/miner" "github.com/filecoin-project/lotus/miner"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
type MinerSubsystem int type MinerSubsystem int

View File

@ -9,12 +9,12 @@ import (
"github.com/filecoin-project/lotus/chain/wallet/key" "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/sealtasks"
"github.com/filecoin-project/lotus/extern/sector-storage/stores" "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"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
// DefaultPresealsPerBootstrapMiner is the number of preseals that every // DefaultPresealsPerBootstrapMiner is the number of preseals that every

View File

@ -13,9 +13,9 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "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/itests/kit"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestMakeAvailable(t *testing.T) { func TestMakeAvailable(t *testing.T) {

View File

@ -13,14 +13,14 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo" "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) { func TestMinerBalanceCollateral(t *testing.T) {

View File

@ -18,9 +18,9 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/impl"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestPledgeSectors(t *testing.T) { func TestPledgeSectors(t *testing.T) {

View File

@ -13,9 +13,9 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "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/itests/kit"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestPreferNoUpgrade(t *testing.T) { func TestPreferNoUpgrade(t *testing.T) {

View File

@ -13,8 +13,8 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "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/itests/kit"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestAbortUpgradeAvailable(t *testing.T) { func TestAbortUpgradeAvailable(t *testing.T) {

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestTerminate(t *testing.T) { func TestTerminate(t *testing.T) {

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
func TestTapeFix(t *testing.T) { func TestTapeFix(t *testing.T) {

View File

@ -22,8 +22,8 @@ import (
"github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/abi" "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/lib/httpreader"
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
) )
var log = logging.Logger("rpcenc") var log = logging.Logger("rpcenc")

View File

@ -15,7 +15,7 @@ import (
"github.com/filecoin-project/go-jsonrpc" "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 { type ReaderHandler struct {

View File

@ -20,7 +20,7 @@ import (
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/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"
) )
type eventsCalledAPI interface { type eventsCalledAPI interface {
@ -28,7 +28,7 @@ type eventsCalledAPI interface {
} }
type dealInfoAPI 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 { type diffPreCommitsAPI interface {
@ -41,9 +41,9 @@ type SectorCommittedManager struct {
dpc diffPreCommitsAPI dpc diffPreCommitsAPI
} }
func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI sealing.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager { func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI sealing2.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager {
dim := &sealing.CurrentDealInfoManager{ dim := &sealing2.CurrentDealInfoManager{
CDAPI: &sealing.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI}, CDAPI: &sealing2.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI},
} }
return newSectorCommittedManager(ev, dim, dpcAPI) return newSectorCommittedManager(ev, dim, dpcAPI)
} }
@ -280,7 +280,7 @@ func (mgr *SectorCommittedManager) OnDealSectorCommitted(ctx context.Context, pr
return nil 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 var params miner.ProveReplicaUpdatesParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return nil, xerrors.Errorf("unmarshal prove replica update: %w", err) 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 // 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 { switch msg.Method {
case builtin.MethodsMiner.PreCommitSector: case builtin.MethodsMiner.PreCommitSector:
var params miner.SectorPreCommitInfo 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) res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key().Bytes(), proposal, publishCid)
if err != nil { if err != nil {
// TODO: This may be fine for some errors // TODO: This may be fine for some errors

View File

@ -29,7 +29,7 @@ import (
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
test "github.com/filecoin-project/lotus/chain/events/state/mock" test "github.com/filecoin-project/lotus/chain/events/state/mock"
"github.com/filecoin-project/lotus/chain/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"
) )
func TestOnDealSectorPreCommitted(t *testing.T) { func TestOnDealSectorPreCommitted(t *testing.T) {
@ -76,7 +76,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
}, },
} }
type testCase struct { type testCase struct {
currentDealInfo sealing.CurrentDealInfo currentDealInfo sealing2.CurrentDealInfo
currentDealInfoErr error currentDealInfoErr error
currentDealInfoErr2 error currentDealInfoErr2 error
preCommitDiff *miner.PreCommitChanges preCommitDiff *miner.PreCommitChanges
@ -90,7 +90,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
} }
testCases := map[string]testCase{ testCases := map[string]testCase{
"normal sequence": { "normal sequence": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
@ -108,7 +108,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
expectedCBSectorNumber: sectorNumber, expectedCBSectorNumber: sectorNumber,
}, },
"ignores unsuccessful pre-commit message": { "ignores unsuccessful pre-commit message": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
@ -126,7 +126,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
expectedCBCallCount: 0, expectedCBCallCount: 0,
}, },
"deal already pre-committed": { "deal already pre-committed": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, 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"), expectedError: xerrors.Errorf("failed to set up called handler: failed to look up deal on chain: something went wrong"),
}, },
"sector already active": { "sector already active": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, MarketDeal: activeDeal,
}, },
@ -156,7 +156,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
expectedCBIsActive: true, expectedCBIsActive: true,
}, },
"sector was slashed": { "sector was slashed": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: slashedDeal, MarketDeal: slashedDeal,
PublishMsgTipSet: nil, 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), 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": { "error getting current deal info in called func": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
@ -183,7 +183,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
expectedCBError: errors.New("handling applied event: something went wrong"), expectedCBError: errors.New("handling applied event: something went wrong"),
}, },
"proposed deal epoch timeout": { "proposed deal epoch timeout": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, MarketDeal: activeDeal,
}, },
@ -298,9 +298,9 @@ func TestOnDealSectorCommitted(t *testing.T) {
}, },
} }
type testCase struct { type testCase struct {
currentDealInfo sealing.CurrentDealInfo currentDealInfo sealing2.CurrentDealInfo
currentDealInfoErr error currentDealInfoErr error
currentDealInfo2 sealing.CurrentDealInfo currentDealInfo2 sealing2.CurrentDealInfo
currentDealInfoErr2 error currentDealInfoErr2 error
matchStates []matchState matchStates []matchState
dealStartEpochTimeout bool dealStartEpochTimeout bool
@ -310,11 +310,11 @@ func TestOnDealSectorCommitted(t *testing.T) {
} }
testCases := map[string]testCase{ testCases := map[string]testCase{
"normal sequence": { "normal sequence": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing.CurrentDealInfo{ currentDealInfo2: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, MarketDeal: activeDeal,
}, },
@ -328,11 +328,11 @@ func TestOnDealSectorCommitted(t *testing.T) {
expectedCBCallCount: 1, expectedCBCallCount: 1,
}, },
"ignores unsuccessful prove-commit message": { "ignores unsuccessful prove-commit message": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing.CurrentDealInfo{ currentDealInfo2: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, 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"), expectedError: xerrors.Errorf("failed to set up called handler: failed to look up deal on chain: something went wrong"),
}, },
"sector already active": { "sector already active": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, MarketDeal: activeDeal,
}, },
expectedCBCallCount: 1, expectedCBCallCount: 1,
}, },
"sector was slashed": { "sector was slashed": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: slashedDeal, 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), 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": { "error getting current deal info in called func": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, 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"), expectedCBError: xerrors.Errorf("handling applied event: failed to look up deal on chain: something went wrong"),
}, },
"proposed deal epoch timeout": { "proposed deal epoch timeout": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, 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), 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": { "got prove-commit but deal not active": {
currentDealInfo: sealing.CurrentDealInfo{ currentDealInfo: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing.CurrentDealInfo{ currentDealInfo2: sealing2.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
@ -568,13 +568,13 @@ func (m *mockPreCommitsAPI) diffPreCommits(ctx context.Context, actor address.Ad
type mockDealInfoAPI struct { type mockDealInfoAPI struct {
count int count int
CurrentDealInfo sealing.CurrentDealInfo CurrentDealInfo sealing2.CurrentDealInfo
Err error Err error
CurrentDealInfo2 sealing.CurrentDealInfo CurrentDealInfo2 sealing2.CurrentDealInfo
Err2 error 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++ m.count++
if m.count == 2 { if m.count == 2 {
return m.CurrentDealInfo2, m.Err2 return m.CurrentDealInfo2, m.Err2

View File

@ -27,11 +27,11 @@ import (
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/lib/sigs"
"github.com/filecoin-project/lotus/markets/utils" "github.com/filecoin-project/lotus/markets/utils"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules/helpers" "github.com/filecoin-project/lotus/node/modules/helpers"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/sectorblocks"
) )
@ -108,7 +108,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema
curTime := build.Clock.Now() curTime := build.Clock.Now()
for build.Clock.Since(curTime) < addPieceRetryTimeout { for build.Clock.Since(curTime) < addPieceRetryTimeout {
// Check if there was an error because of too many sectors being sealed // 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 { if err != nil {
log.Errorf("failed to addPiece for deal %d, err: %v", deal.DealID, err) 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 { if err != nil {
return 0, 0, 0, xerrors.Errorf("getting sector info: %w", err) 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 best = r
bestSi = si bestSi = si
break 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 0, 0, 0, xerrors.New("no sealed sector found")
} }
return best.SectorID, best.Offset, best.Size.Padded(), nil return best.SectorID, best.Offset, best.Size.Padded(), nil

View File

@ -23,7 +23,6 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "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/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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/dagstore"
"github.com/filecoin-project/lotus/markets/dealfilter" "github.com/filecoin-project/lotus/markets/dealfilter"
"github.com/filecoin-project/lotus/markets/idxprov" "github.com/filecoin-project/lotus/markets/idxprov"
@ -38,6 +37,7 @@ import (
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/ctladdr" "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/sectorblocks"
"github.com/filecoin-project/lotus/storage/wdpost" "github.com/filecoin-project/lotus/storage/wdpost"
) )

View File

@ -46,14 +46,14 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil" "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/stores"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "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" mktsdagstore "github.com/filecoin-project/lotus/markets/dagstore"
"github.com/filecoin-project/lotus/markets/storageadapter" "github.com/filecoin-project/lotus/markets/storageadapter"
"github.com/filecoin-project/lotus/miner" "github.com/filecoin-project/lotus/miner"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/ctladdr" "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/sectorblocks"
"github.com/filecoin-project/lotus/storage/wdpost" "github.com/filecoin-project/lotus/storage/wdpost"
) )

View File

@ -11,7 +11,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi" "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 type MinerAddress address.Address

View File

@ -56,8 +56,6 @@ import (
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" 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/ffiwrapper"
"github.com/filecoin-project/lotus/extern/sector-storage/stores" "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/journal"
"github.com/filecoin-project/lotus/markets" "github.com/filecoin-project/lotus/markets"
"github.com/filecoin-project/lotus/markets/dagstore" "github.com/filecoin-project/lotus/markets/dagstore"
@ -71,6 +69,8 @@ import (
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/ctladdr" "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" "github.com/filecoin-project/lotus/storage/wdpost"
) )

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
var _ sealing.Events = new(EventsAdapter) var _ sealing.Events = new(EventsAdapter)

View File

@ -27,10 +27,10 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/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"
) )
var _ sealing.SealingAPI = new(SealingAPIAdapter) var _ sealing2.SealingAPI = new(SealingAPIAdapter)
type SealingAPIAdapter struct { type SealingAPIAdapter struct {
delegate fullNodeFilteredAPI delegate fullNodeFilteredAPI
@ -40,7 +40,7 @@ func NewSealingAPIAdapter(api fullNodeFilteredAPI) SealingAPIAdapter {
return SealingAPIAdapter{delegate: api} 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 // TODO: update storage-fsm to just StateMinerInfo
mi, err := s.StateMinerInfo(ctx, maddr, tok) mi, err := s.StateMinerInfo(ctx, maddr, tok)
if err != nil { if err != nil {
@ -49,7 +49,7 @@ func (s SealingAPIAdapter) StateMinerSectorSize(ctx context.Context, maddr addre
return mi.SectorSize, nil 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return api.MinerInfo{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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 // TODO: update storage-fsm to just StateMinerInfo
mi, err := s.StateMinerInfo(ctx, maddr, tok) mi, err := s.StateMinerInfo(ctx, maddr, tok)
if err != nil { if err != nil {
@ -95,7 +95,7 @@ func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr ad
return mi.Worker, nil 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return false, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return bitfield.BitField{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) wmsg, err := s.delegate.StateWaitMsg(ctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
if err != nil { if err != nil {
return sealing.MsgLookup{}, err return sealing2.MsgLookup{}, err
} }
return sealing.MsgLookup{ return sealing2.MsgLookup{
Receipt: sealing.MessageReceipt{ Receipt: sealing2.MessageReceipt{
ExitCode: wmsg.Receipt.ExitCode, ExitCode: wmsg.Receipt.ExitCode,
Return: wmsg.Receipt.Return, Return: wmsg.Receipt.Return,
GasUsed: wmsg.Receipt.GasUsed, GasUsed: wmsg.Receipt.GasUsed,
@ -151,7 +151,7 @@ func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (seal
}, nil }, 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) wmsg, err := s.delegate.StateSearchMsg(ctx, types.EmptyTSK, c, api.LookbackNoLimit, true)
if err != nil { if err != nil {
return nil, err return nil, err
@ -161,8 +161,8 @@ func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*seal
return nil, nil return nil, nil
} }
return &sealing.MsgLookup{ return &sealing2.MsgLookup{
Receipt: sealing.MessageReceipt{ Receipt: sealing2.MessageReceipt{
ExitCode: wmsg.Receipt.ExitCode, ExitCode: wmsg.Receipt.ExitCode,
Return: wmsg.Receipt.Return, Return: wmsg.Receipt.Return,
GasUsed: wmsg.Receipt.GasUsed, GasUsed: wmsg.Receipt.GasUsed,
@ -172,7 +172,7 @@ func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*seal
}, nil }, 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) return nil, xerrors.Errorf("checking if sector is allocated: %w", err)
} }
if set { if set {
return nil, sealing.ErrSectorAllocated return nil, sealing2.ErrSectorAllocated
} }
return nil, nil return nil, nil
@ -277,7 +277,7 @@ func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr a
return pci, nil 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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 return nil, err
} }
if l != nil { if l != nil {
return &sealing.SectorLocation{ return &sealing2.SectorLocation{
Deadline: l.Deadline, Deadline: l.Deadline,
Partition: l.Partition, Partition: l.Partition,
}, nil }, nil
@ -306,7 +306,7 @@ func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr addre
return nil, nil // not found 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return address.Undef, err 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, err return nil, err
@ -333,7 +333,7 @@ func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID ab
return s.delegate.StateMarketStorageDeal(ctx, dealID, tsk) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return market.DealProposal{}, err return market.DealProposal{}, err
@ -347,7 +347,7 @@ func (s SealingAPIAdapter) StateMarketStorageDealProposal(ctx context.Context, d
return deal.Proposal, nil 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return network.VersionMax, err return network.VersionMax, err
@ -356,7 +356,7 @@ func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok sealing.
return s.delegate.StateNetworkVersion(ctx, tsk) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, err return nil, err
@ -382,7 +382,7 @@ func (s SealingAPIAdapter) SendMsg(ctx context.Context, from, to address.Address
return smsg.Cid(), nil 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) head, err := s.delegate.ChainHead(ctx)
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
@ -391,7 +391,7 @@ func (s SealingAPIAdapter) ChainHead(ctx context.Context) (sealing.TipSetToken,
return head.Key().Bytes(), head.Height(), nil 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return big.Zero(), err 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) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, err return nil, err
@ -418,7 +418,7 @@ func (s SealingAPIAdapter) StateGetRandomnessFromBeacon(ctx context.Context, per
return s.delegate.StateGetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, tsk) 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) tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -30,11 +30,11 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" 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/ffiwrapper"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/storage/ctladdr" "github.com/filecoin-project/lotus/storage/ctladdr"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
) )
var log = logging.Logger("storageminer") var log = logging.Logger("storageminer")
@ -43,7 +43,7 @@ var log = logging.Logger("storageminer")
// instantiated in the node builder, along with the WindowPoStScheduler. // instantiated in the node builder, along with the WindowPoStScheduler.
// //
// This object is the owner of the sealing pipeline. Most of the actual logic // 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. // exposes it to the rest of the system by proxying calls.
// //
// Miner#Run starts the sealing FSM. // Miner#Run starts the sealing FSM.
@ -52,7 +52,7 @@ type Miner struct {
feeCfg config.MinerFeeConfig feeCfg config.MinerFeeConfig
sealer sectorstorage.SectorManager sealer sectorstorage.SectorManager
ds datastore.Batching ds datastore.Batching
sc sealing.SectorIDCounter sc sealing2.SectorIDCounter
verif ffiwrapper.Verifier verif ffiwrapper.Verifier
prover ffiwrapper.Prover prover ffiwrapper.Prover
addrSel *ctladdr.AddressSelector addrSel *ctladdr.AddressSelector
@ -60,7 +60,7 @@ type Miner struct {
maddr address.Address maddr address.Address
getSealConfig dtypes.GetSealingConfigFunc getSealConfig dtypes.GetSealingConfigFunc
sealing *sealing.Sealing sealing *sealing2.Sealing
sealingEvtType journal.EventType sealingEvtType journal.EventType
@ -71,8 +71,8 @@ type Miner struct {
type SealingStateEvt struct { type SealingStateEvt struct {
SectorNumber abi.SectorNumber SectorNumber abi.SectorNumber
SectorType abi.RegisteredSealProof SectorType abi.RegisteredSealProof
From sealing.SectorState From sealing2.SectorState
After sealing.SectorState After sealing2.SectorState
Error string Error string
} }
@ -134,7 +134,7 @@ func NewMiner(api fullNodeFilteredAPI,
maddr address.Address, maddr address.Address,
ds datastore.Batching, ds datastore.Batching,
sealer sectorstorage.SectorManager, sealer sectorstorage.SectorManager,
sc sealing.SectorIDCounter, sc sealing2.SectorIDCounter,
verif ffiwrapper.Verifier, verif ffiwrapper.Verifier,
prover ffiwrapper.Prover, prover ffiwrapper.Prover,
gsd dtypes.GetSealingConfigFunc, gsd dtypes.GetSealingConfigFunc,
@ -185,10 +185,10 @@ func (m *Miner) Run(ctx context.Context) error {
adaptedAPI := NewSealingAPIAdapter(m.api) adaptedAPI := NewSealingAPIAdapter(m.api)
// Instantiate a precommit policy. // Instantiate a precommit policy.
cfg := sealing.GetSealingConfigFunc(m.getSealConfig) cfg := sealing2.GetSealingConfigFunc(m.getSealConfig)
provingBuffer := md.WPoStProvingPeriod * 2 provingBuffer := md.WPoStProvingPeriod * 2
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer) pcp := sealing2.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer)
// address selector. // address selector.
as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) { 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. // 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. // Run the sealing FSM.
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function 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 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{} { m.journal.RecordEvent(m.sealingEvtType, func() interface{} {
return SealingStateEvt{ return SealingStateEvt{
SectorNumber: before.SectorNumber, SectorNumber: before.SectorNumber,

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/sectorblocks"
) )
@ -27,7 +27,7 @@ func (m *Miner) StartPackingSector(sectorNum abi.SectorNumber) error {
return m.sealing.StartPacking(sectorNum) return m.sealing.StartPacking(sectorNum)
} }
func (m *Miner) ListSectors() ([]sealing.SectorInfo, error) { func (m *Miner) ListSectors() ([]sealing2.SectorInfo, error) {
return m.sealing.ListSectors() return m.sealing.ListSectors()
} }
@ -35,7 +35,7 @@ func (m *Miner) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
return m.sealing.PledgeSector(ctx) 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) return m.sealing.ForceSectorState(ctx, id, state)
} }

View File

@ -25,8 +25,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "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/node/config"
sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
var aggFeeNum = big.NewInt(110) var aggFeeNum = big.NewInt(110)
@ -63,10 +63,10 @@ type CommitBatcher struct {
cutoffs map[abi.SectorNumber]time.Time cutoffs map[abi.SectorNumber]time.Time
todo map[abi.SectorNumber]AggregateInput todo map[abi.SectorNumber]AggregateInput
waiting map[abi.SectorNumber][]chan sealiface.CommitBatchRes waiting map[abi.SectorNumber][]chan sealiface2.CommitBatchRes
notify, stop, stopped chan struct{} notify, stop, stopped chan struct{}
force chan chan []sealiface.CommitBatchRes force chan chan []sealiface2.CommitBatchRes
lk sync.Mutex lk sync.Mutex
} }
@ -82,10 +82,10 @@ func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBat
cutoffs: map[abi.SectorNumber]time.Time{}, cutoffs: map[abi.SectorNumber]time.Time{},
todo: map[abi.SectorNumber]AggregateInput{}, todo: map[abi.SectorNumber]AggregateInput{},
waiting: map[abi.SectorNumber][]chan sealiface.CommitBatchRes{}, waiting: map[abi.SectorNumber][]chan sealiface2.CommitBatchRes{},
notify: make(chan struct{}, 1), notify: make(chan struct{}, 1),
force: make(chan chan []sealiface.CommitBatchRes), force: make(chan chan []sealiface2.CommitBatchRes),
stop: make(chan struct{}), stop: make(chan struct{}),
stopped: 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() { func (b *CommitBatcher) run() {
var forceRes chan []sealiface.CommitBatchRes var forceRes chan []sealiface2.CommitBatchRes
var lastMsg []sealiface.CommitBatchRes var lastMsg []sealiface2.CommitBatchRes
cfg, err := b.getConfig() cfg, err := b.getConfig()
if err != nil { if err != nil {
@ -184,7 +184,7 @@ func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration {
return wait return wait
} }
func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, error) { func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface2.CommitBatchRes, error) {
b.lk.Lock() b.lk.Lock()
defer b.lk.Unlock() defer b.lk.Unlock()
@ -202,7 +202,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
return nil, nil return nil, nil
} }
var res []sealiface.CommitBatchRes var res []sealiface2.CommitBatchRes
tok, h, err := b.api.ChainHead(b.mctx) tok, h, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
@ -264,7 +264,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
return res, nil 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) tok, _, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
return nil, err return nil, err
@ -272,7 +272,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
total := len(b.todo) total := len(b.todo)
res := sealiface.CommitBatchRes{ res := sealiface2.CommitBatchRes{
FailedSectors: map[abi.SectorNumber]string{}, FailedSectors: map[abi.SectorNumber]string{},
} }
@ -318,18 +318,18 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
mid, err := address.IDFromAddress(b.maddr) mid, err := address.IDFromAddress(b.maddr)
if err != nil { 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) nv, err := b.api.StateNetworkVersion(b.mctx, tok)
if err != nil { if err != nil {
log.Errorf("getting network version: %s", err) 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) arp, err := b.aggregateProofType(nv)
if err != nil { 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{ params.AggregateProof, err = b.prover.AggregateSealProofs(proof.AggregateSealVerifyProofAndInfos{
@ -339,30 +339,30 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
Infos: infos, Infos: infos,
}, proofs) }, proofs)
if err != nil { 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) enc := new(bytes.Buffer)
if err := params.MarshalCBOR(enc); err != nil { 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) mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
if err != 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)) maxFee := b.feeCfg.MaxCommitBatchGasFee.FeeForSectors(len(infos))
bf, err := b.api.ChainBaseFee(b.mctx, tok) bf, err := b.api.ChainBaseFee(b.mctx, tok)
if err != nil { 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) aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), bf)
if err != nil { if err != nil {
log.Errorf("getting aggregate commit network fee: %s", err) 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) 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 := big.Add(collateral, aggFee)
needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds) needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds)
if err != nil { if err != nil {
return []sealiface.CommitBatchRes{res}, err return []sealiface2.CommitBatchRes{res}, err
} }
goodFunds := big.Add(maxFee, needFunds) goodFunds := big.Add(maxFee, needFunds)
from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, needFunds) from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, needFunds)
if err != nil { 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()) mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.ProveCommitAggregate, needFunds, maxFee, enc.Bytes())
if err != nil { 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 res.Msg = &mcid
log.Infow("Sent ProveCommitAggregate message", "cid", mcid, "from", from, "todo", total, "sectors", len(infos)) 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) mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
if err != nil { if err != nil {
return nil, xerrors.Errorf("couldn't get miner info: %w", err) 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 return nil, err
} }
var res []sealiface.CommitBatchRes var res []sealiface2.CommitBatchRes
for sn, info := range b.todo { for sn, info := range b.todo {
r := sealiface.CommitBatchRes{ r := sealiface2.CommitBatchRes{
Sectors: []abi.SectorNumber{sn}, Sectors: []abi.SectorNumber{sn},
FailedSectors: map[abi.SectorNumber]string{}, FailedSectors: map[abi.SectorNumber]string{},
} }
@ -439,7 +439,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
return res, nil 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) enc := new(bytes.Buffer)
params := &miner.ProveCommitSectorParams{ params := &miner.ProveCommitSectorParams{
SectorNumber: sn, 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 // 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 sn := s.SectorNumber
cu, err := b.getCommitCutoff(s) cu, err := b.getCommitCutoff(s)
if err != nil { if err != nil {
return sealiface.CommitBatchRes{}, err return sealiface2.CommitBatchRes{}, err
} }
b.lk.Lock() b.lk.Lock()
b.cutoffs[sn] = cu b.cutoffs[sn] = cu
b.todo[sn] = in b.todo[sn] = in
sent := make(chan sealiface.CommitBatchRes, 1) sent := make(chan sealiface2.CommitBatchRes, 1)
b.waiting[sn] = append(b.waiting[sn], sent) b.waiting[sn] = append(b.waiting[sn], sent)
select { select {
@ -509,12 +509,12 @@ func (b *CommitBatcher) AddCommit(ctx context.Context, s SectorInfo, in Aggregat
case r := <-sent: case r := <-sent:
return r, nil return r, nil
case <-ctx.Done(): case <-ctx.Done():
return sealiface.CommitBatchRes{}, ctx.Err() return sealiface2.CommitBatchRes{}, ctx.Err()
} }
} }
func (b *CommitBatcher) Flush(ctx context.Context) ([]sealiface.CommitBatchRes, error) { func (b *CommitBatcher) Flush(ctx context.Context) ([]sealiface2.CommitBatchRes, error) {
resCh := make(chan []sealiface.CommitBatchRes, 1) resCh := make(chan []sealiface2.CommitBatchRes, 1)
select { select {
case b.force <- resCh: case b.force <- resCh:
select { select {

View File

@ -23,9 +23,9 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/extern/storage-sealing/mocks" "github.com/filecoin-project/lotus/storage/pipeline/mocks"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" sealiface2 "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
func TestCommitBatcher(t *testing.T) { func TestCommitBatcher(t *testing.T) {
@ -42,8 +42,8 @@ func TestCommitBatcher(t *testing.T) {
maxBatch := miner5.MaxAggregatedSectors maxBatch := miner5.MaxAggregatedSectors
minBatch := miner5.MinAggregatedSectors minBatch := miner5.MinAggregatedSectors
cfg := func() (sealiface.Config, error) { cfg := func() (sealiface2.Config, error) {
return sealiface.Config{ return sealiface2.Config{
MaxWaitDealsSectors: 2, MaxWaitDealsSectors: 2,
MaxSealingSectors: 0, MaxSealingSectors: 0,
MaxSealingSectorsForDeals: 0, MaxSealingSectorsForDeals: 0,
@ -71,10 +71,10 @@ func TestCommitBatcher(t *testing.T) {
} }
type promise func(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 { 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 var ps []promise
for _, a := range as { for _, a := range as {
p := a(t, s, pcb) p := a(t, s, pcb)
@ -95,13 +95,13 @@ func TestCommitBatcher(t *testing.T) {
} }
addSector := func(sn abi.SectorNumber) action { addSector := func(sn abi.SectorNumber) 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 pcres sealiface.CommitBatchRes var pcres sealiface2.CommitBatchRes
var pcerr error var pcerr error
done := sync.Mutex{} done := sync.Mutex{}
done.Lock() done.Lock()
si := sealing.SectorInfo{ si := sealing2.SectorInfo{
SectorNumber: sn, SectorNumber: sn,
} }
@ -113,7 +113,7 @@ func TestCommitBatcher(t *testing.T) {
go func() { go func() {
defer done.Unlock() defer done.Unlock()
pcres, pcerr = pcb.AddCommit(ctx, si, sealing.AggregateInput{ pcres, pcerr = pcb.AddCommit(ctx, si, sealing2.AggregateInput{
Info: prooftypes.AggregateSealVerifyInfo{ Info: prooftypes.AggregateSealVerifyInfo{
Number: sn, Number: sn,
}, },
@ -138,7 +138,7 @@ func TestCommitBatcher(t *testing.T) {
} }
waitPending := func(n int) action { 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 { require.Eventually(t, func() bool {
p, err := pcb.Pending(ctx) p, err := pcb.Pending(ctx)
require.NoError(t, err) 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 //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 { 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) s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil)
ti := len(expect) ti := len(expect)
@ -217,7 +217,7 @@ func TestCommitBatcher(t *testing.T) {
} }
flush := func(expect []abi.SectorNumber, aboveBalancer, failOnePCI bool) action { 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) _ = expectSend(expect, aboveBalancer, failOnePCI)(t, s, pcb)
batch := len(expect) >= minBatch && aboveBalancer batch := len(expect) >= minBatch && aboveBalancer
@ -357,7 +357,7 @@ func TestCommitBatcher(t *testing.T) {
// create them mocks // create them mocks
pcapi := mocks.NewMockCommitBatcherApi(mockCtrl) 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 var promises []promise

View File

@ -6,7 +6,7 @@ import (
gen "github.com/whyrusleeping/cbor-gen" 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() { func main() {

View File

@ -21,8 +21,8 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" 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/ffiwrapper"
"github.com/filecoin-project/lotus/extern/storage-sealing/lib/nullreader" "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error { func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error {

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // 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 is a generated GoMock package.
package mocks package mocks
@ -23,7 +23,7 @@ import (
api "github.com/filecoin-project/lotus/api" api "github.com/filecoin-project/lotus/api"
types "github.com/filecoin-project/lotus/chain/types" 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. // MockSealingAPI is a mock of SealingAPI interface.
@ -50,7 +50,7 @@ func (m *MockSealingAPI) EXPECT() *MockSealingAPIMockRecorder {
} }
// ChainBaseFee mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1) ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -80,10 +80,10 @@ func (mr *MockSealingAPIMockRecorder) ChainGetMessage(arg0, arg1 interface{}) *g
} }
// ChainHead mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainHead", arg0) ret := m.ctrl.Call(m, "ChainHead", arg0)
ret0, _ := ret[0].(sealing.TipSetToken) ret0, _ := ret[0].(sealing2.TipSetToken)
ret1, _ := ret[1].(abi.ChainEpoch) ret1, _ := ret[1].(abi.ChainEpoch)
ret2, _ := ret[2].(error) ret2, _ := ret[2].(error)
return ret0, ret1, ret2 return ret0, ret1, ret2
@ -126,7 +126,7 @@ func (mr *MockSealingAPIMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5
} }
// StateComputeDataCommitment mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateComputeDataCommitment", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "StateComputeDataCommitment", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(cid.Cid) ret0, _ := ret[0].(cid.Cid)
@ -141,7 +141,7 @@ func (mr *MockSealingAPIMockRecorder) StateComputeDataCommitment(arg0, arg1, arg
} }
// StateGetRandomnessFromBeacon mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(abi.Randomness) ret0, _ := ret[0].(abi.Randomness)
@ -156,7 +156,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromBeacon(arg0, arg1, a
} }
// StateGetRandomnessFromTickets mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(abi.Randomness) ret0, _ := ret[0].(abi.Randomness)
@ -171,7 +171,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromTickets(arg0, arg1,
} }
// StateLookupID mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2)
ret0, _ := ret[0].(address.Address) ret0, _ := ret[0].(address.Address)
@ -186,7 +186,7 @@ func (mr *MockSealingAPIMockRecorder) StateLookupID(arg0, arg1, arg2 interface{}
} }
// StateMarketStorageDeal mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.MarketDeal) ret0, _ := ret[0].(*api.MarketDeal)
@ -201,7 +201,7 @@ func (mr *MockSealingAPIMockRecorder) StateMarketStorageDeal(arg0, arg1, arg2 in
} }
// StateMarketStorageDealProposal mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMarketStorageDealProposal", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMarketStorageDealProposal", arg0, arg1, arg2)
ret0, _ := ret[0].(market.DealProposal) ret0, _ := ret[0].(market.DealProposal)
@ -216,7 +216,7 @@ func (mr *MockSealingAPIMockRecorder) StateMarketStorageDealProposal(arg0, arg1,
} }
// StateMinerActiveSectors mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerActiveSectors", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerActiveSectors", arg0, arg1, arg2)
ret0, _ := ret[0].(bitfield.BitField) ret0, _ := ret[0].(bitfield.BitField)
@ -231,7 +231,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerActiveSectors(arg0, arg1, arg2 i
} }
// StateMinerAvailableBalance mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -246,7 +246,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerAvailableBalance(arg0, arg1, arg
} }
// StateMinerInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
ret0, _ := ret[0].(api.MinerInfo) ret0, _ := ret[0].(api.MinerInfo)
@ -261,7 +261,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{
} }
// StateMinerInitialPledgeCollateral mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -276,7 +276,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInitialPledgeCollateral(arg0, ar
} }
// StateMinerPartitions mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].([]api.Partition) ret0, _ := ret[0].([]api.Partition)
@ -291,7 +291,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPartitions(arg0, arg1, arg2, arg
} }
// StateMinerPreCommitDepositForPower mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -306,7 +306,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPreCommitDepositForPower(arg0, a
} }
// StateMinerProvingDeadline mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2)
ret0, _ := ret[0].(*dline.Info) ret0, _ := ret[0].(*dline.Info)
@ -321,7 +321,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerProvingDeadline(arg0, arg1, arg2
} }
// StateMinerSectorAllocated mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(bool) ret0, _ := ret[0].(bool)
@ -336,7 +336,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerSectorAllocated(arg0, arg1, arg2
} }
// StateMinerSectorSize mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerSectorSize", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerSectorSize", arg0, arg1, arg2)
ret0, _ := ret[0].(abi.SectorSize) ret0, _ := ret[0].(abi.SectorSize)
@ -351,7 +351,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerSectorSize(arg0, arg1, arg2 inte
} }
// StateMinerWorkerAddress mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerWorkerAddress", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerWorkerAddress", arg0, arg1, arg2)
ret0, _ := ret[0].(address.Address) ret0, _ := ret[0].(address.Address)
@ -366,7 +366,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerWorkerAddress(arg0, arg1, arg2 i
} }
// StateNetworkVersion mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1) ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
ret0, _ := ret[0].(network.Version) ret0, _ := ret[0].(network.Version)
@ -381,10 +381,10 @@ func (mr *MockSealingAPIMockRecorder) StateNetworkVersion(arg0, arg1 interface{}
} }
// StateSearchMsg mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1) ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1)
ret0, _ := ret[0].(*sealing.MsgLookup) ret0, _ := ret[0].(*sealing2.MsgLookup)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -396,7 +396,7 @@ func (mr *MockSealingAPIMockRecorder) StateSearchMsg(arg0, arg1 interface{}) *go
} }
// StateSectorGetInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*miner.SectorOnChainInfo) ret0, _ := ret[0].(*miner.SectorOnChainInfo)
@ -411,10 +411,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3
} }
// StateSectorPartition mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*sealing.SectorLocation) ret0, _ := ret[0].(*sealing2.SectorLocation)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -426,7 +426,7 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg
} }
// StateSectorPreCommitInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo) ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
@ -441,10 +441,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPreCommitInfo(arg0, arg1, arg2,
} }
// StateWaitMsg mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1) ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1)
ret0, _ := ret[0].(sealing.MsgLookup) ret0, _ := ret[0].(sealing2.MsgLookup)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // 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 is a generated GoMock package.
package mocks package mocks
@ -18,7 +18,7 @@ import (
network "github.com/filecoin-project/go-state-types/network" network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api" 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. // MockCommitBatcherApi is a mock of CommitBatcherApi interface.

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // 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 is a generated GoMock package.
package mocks package mocks
@ -17,7 +17,7 @@ import (
network "github.com/filecoin-project/go-state-types/network" network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api" 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. // MockPreCommitBatcherApi is a mock of PreCommitBatcherApi interface.

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // 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 is a generated GoMock package.
package mocks package mocks

View File

@ -21,8 +21,8 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/node/config" "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 //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 cutoffs map[abi.SectorNumber]time.Time
todo map[abi.SectorNumber]*preCommitEntry todo map[abi.SectorNumber]*preCommitEntry
waiting map[abi.SectorNumber][]chan sealiface.PreCommitBatchRes waiting map[abi.SectorNumber][]chan sealiface2.PreCommitBatchRes
notify, stop, stopped chan struct{} notify, stop, stopped chan struct{}
force chan chan []sealiface.PreCommitBatchRes force chan chan []sealiface2.PreCommitBatchRes
lk sync.Mutex lk sync.Mutex
} }
@ -69,10 +69,10 @@ func NewPreCommitBatcher(mctx context.Context, maddr address.Address, api PreCom
cutoffs: map[abi.SectorNumber]time.Time{}, cutoffs: map[abi.SectorNumber]time.Time{},
todo: map[abi.SectorNumber]*preCommitEntry{}, todo: map[abi.SectorNumber]*preCommitEntry{},
waiting: map[abi.SectorNumber][]chan sealiface.PreCommitBatchRes{}, waiting: map[abi.SectorNumber][]chan sealiface2.PreCommitBatchRes{},
notify: make(chan struct{}, 1), notify: make(chan struct{}, 1),
force: make(chan chan []sealiface.PreCommitBatchRes), force: make(chan chan []sealiface2.PreCommitBatchRes),
stop: make(chan struct{}), stop: make(chan struct{}),
stopped: 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() { func (b *PreCommitBatcher) run() {
var forceRes chan []sealiface.PreCommitBatchRes var forceRes chan []sealiface2.PreCommitBatchRes
var lastRes []sealiface.PreCommitBatchRes var lastRes []sealiface2.PreCommitBatchRes
cfg, err := b.getConfig() cfg, err := b.getConfig()
if err != nil { if err != nil {
@ -170,7 +170,7 @@ func (b *PreCommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration
return wait return wait
} }
func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBatchRes, error) { func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface2.PreCommitBatchRes, error) {
b.lk.Lock() b.lk.Lock()
defer b.lk.Unlock() defer b.lk.Unlock()
@ -210,7 +210,7 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
} }
// todo support multiple batches // todo support multiple batches
var res []sealiface.PreCommitBatchRes var res []sealiface2.PreCommitBatchRes
if !individual { if !individual {
res, err = b.processBatch(cfg, tok, bf, nv) res, err = b.processBatch(cfg, tok, bf, nv)
} else { } else {
@ -239,7 +239,7 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
return res, nil 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) mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
if err != nil { if err != nil {
return nil, xerrors.Errorf("couldn't get miner info: %w", err) 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 { for sn, info := range b.todo {
r := sealiface.PreCommitBatchRes{ r := sealiface2.PreCommitBatchRes{
Sectors: []abi.SectorNumber{sn}, Sectors: []abi.SectorNumber{sn},
} }
@ -279,7 +279,7 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac
return res, nil 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) enc := new(bytes.Buffer)
if err := params.pci.MarshalCBOR(enc); err != nil { 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 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{} params := miner.PreCommitSectorBatchParams{}
deposit := big.Zero() deposit := big.Zero()
var res sealiface.PreCommitBatchRes var res sealiface2.PreCommitBatchRes
for _, p := range b.todo { for _, p := range b.todo {
if len(params.Sectors) >= cfg.MaxPreCommitBatch { if len(params.Sectors) >= cfg.MaxPreCommitBatch {
@ -333,12 +333,12 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b
enc := new(bytes.Buffer) enc := new(bytes.Buffer)
if err := params.MarshalCBOR(enc); err != nil { 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) mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
if err != 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)) 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) aggFeeRaw, err := policy.AggregatePreCommitNetworkFee(nv, len(params.Sectors), bf)
if err != nil { if err != nil {
log.Errorf("getting aggregate precommit network fee: %s", err) 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) 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 := big.Add(deposit, aggFee)
needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds) needFunds, err = collateralSendAmount(b.mctx, b.api, b.maddr, cfg, needFunds)
if err != nil { if err != nil {
return []sealiface.PreCommitBatchRes{res}, err return []sealiface2.PreCommitBatchRes{res}, err
} }
goodFunds := big.Add(maxFee, needFunds) goodFunds := big.Add(maxFee, needFunds)
from, _, err := b.addrSel(b.mctx, mi, api.PreCommitAddr, goodFunds, deposit) from, _, err := b.addrSel(b.mctx, mi, api.PreCommitAddr, goodFunds, deposit)
if err != nil { 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()) mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.PreCommitSectorBatch, needFunds, maxFee, enc.Bytes())
if err != nil { 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 res.Msg = &mcid
log.Infow("Sent PreCommitSectorBatch message", "cid", mcid, "from", from, "sectors", len(b.todo)) 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 // 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) _, curEpoch, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
log.Errorf("getting chain head: %s", err) log.Errorf("getting chain head: %s", err)
return sealiface.PreCommitBatchRes{}, err return sealiface2.PreCommitBatchRes{}, err
} }
cutoff, err := getPreCommitCutoff(curEpoch, s) cutoff, err := getPreCommitCutoff(curEpoch, s)
if err != nil { 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 sn := s.SectorNumber
@ -398,7 +398,7 @@ func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, depos
pci: in, pci: in,
} }
sent := make(chan sealiface.PreCommitBatchRes, 1) sent := make(chan sealiface2.PreCommitBatchRes, 1)
b.waiting[sn] = append(b.waiting[sn], sent) b.waiting[sn] = append(b.waiting[sn], sent)
select { select {
@ -411,12 +411,12 @@ func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, depos
case c := <-sent: case c := <-sent:
return c, nil return c, nil
case <-ctx.Done(): case <-ctx.Done():
return sealiface.PreCommitBatchRes{}, ctx.Err() return sealiface2.PreCommitBatchRes{}, ctx.Err()
} }
} }
func (b *PreCommitBatcher) Flush(ctx context.Context) ([]sealiface.PreCommitBatchRes, error) { func (b *PreCommitBatcher) Flush(ctx context.Context) ([]sealiface2.PreCommitBatchRes, error) {
resCh := make(chan []sealiface.PreCommitBatchRes, 1) resCh := make(chan []sealiface2.PreCommitBatchRes, 1)
select { select {
case b.force <- resCh: case b.force <- resCh:
select { select {

View File

@ -21,10 +21,10 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "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" "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{ var fc = config.MinerFeeConfig{
@ -48,8 +48,8 @@ func TestPrecommitBatcher(t *testing.T) {
maxBatch := miner6.PreCommitSectorBatchMaxSize maxBatch := miner6.PreCommitSectorBatchMaxSize
cfg := func() (sealiface.Config, error) { cfg := func() (sealiface2.Config, error) {
return sealiface.Config{ return sealiface2.Config{
MaxWaitDealsSectors: 2, MaxWaitDealsSectors: 2,
MaxSealingSectors: 0, MaxSealingSectors: 0,
MaxSealingSectorsForDeals: 0, MaxSealingSectorsForDeals: 0,
@ -75,10 +75,10 @@ func TestPrecommitBatcher(t *testing.T) {
} }
type promise func(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 { 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 var ps []promise
for _, a := range as { for _, a := range as {
p := a(t, s, pcb) p := a(t, s, pcb)
@ -99,13 +99,13 @@ func TestPrecommitBatcher(t *testing.T) {
} }
addSector := func(sn abi.SectorNumber) action { addSector := func(sn 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 {
var pcres sealiface.PreCommitBatchRes var pcres sealiface2.PreCommitBatchRes
var pcerr error var pcerr error
done := sync.Mutex{} done := sync.Mutex{}
done.Lock() done.Lock()
si := sealing.SectorInfo{ si := sealing2.SectorInfo{
SectorNumber: sn, SectorNumber: sn,
} }
@ -139,7 +139,7 @@ func TestPrecommitBatcher(t *testing.T) {
} }
waitPending := func(n int) action { 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 { require.Eventually(t, func() bool {
p, err := pcb.Pending(ctx) p, err := pcb.Pending(ctx)
require.NoError(t, err) require.NoError(t, err)
@ -152,7 +152,7 @@ func TestPrecommitBatcher(t *testing.T) {
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001 //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSend := func(expect []abi.SectorNumber) action { 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().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(10001), nil) s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(10001), nil)
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, 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 //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSendsSingle := func(expect []abi.SectorNumber) action { 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().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(9999), nil) s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(9999), nil)
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, 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 { 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) _ = expectSend(expect)(t, s, pcb)
r, err := pcb.Flush(ctx) r, err := pcb.Flush(ctx)
@ -261,7 +261,7 @@ func TestPrecommitBatcher(t *testing.T) {
// create them mocks // create them mocks
pcapi := mocks.NewMockPreCommitBatcherApi(mockCtrl) 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 var promises []promise

View File

@ -17,8 +17,8 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
type fakeChain struct { type fakeChain struct {
@ -29,7 +29,7 @@ type fakeConfigStub struct {
CCSectorLifetime time.Duration CCSectorLifetime time.Duration
} }
func fakeConfigGetter(stub *fakeConfigStub) sealing.GetSealingConfigFunc { func fakeConfigGetter(stub *fakeConfigStub) sealing2.GetSealingConfigFunc {
return func() (sealiface.Config, error) { return func() (sealiface.Config, error) {
if stub == nil { if stub == nil {
return sealiface.Config{}, 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 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 return []byte{1, 2, 3}, f.h, nil
} }
@ -60,7 +60,7 @@ func TestBasicPolicyEmptySector(t *testing.T) {
cfg := fakeConfigGetter(nil) cfg := fakeConfigGetter(nil)
h := abi.ChainEpoch(55) h := abi.ChainEpoch(55)
pBuffer := abi.ChainEpoch(2) 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()) exp, err := pcp.Expiration(context.Background())
require.NoError(t, err) require.NoError(t, err)
@ -77,7 +77,7 @@ func TestCustomCCSectorConfig(t *testing.T) {
cfg := fakeConfigGetter(&cfgStub) cfg := fakeConfigGetter(&cfgStub)
h := abi.ChainEpoch(55) h := abi.ChainEpoch(55)
pBuffer := abi.ChainEpoch(2) 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()) exp, err := pcp.Expiration(context.Background())
require.NoError(t, err) require.NoError(t, err)
@ -89,11 +89,11 @@ func TestCustomCCSectorConfig(t *testing.T) {
func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) { func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) {
cfg := fakeConfigGetter(nil) cfg := fakeConfigGetter(nil)
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{
h: abi.ChainEpoch(55), h: abi.ChainEpoch(55),
}, cfg, 2) }, cfg, 2)
longestDealEpochEnd := abi.ChainEpoch(547300) longestDealEpochEnd := abi.ChainEpoch(547300)
pieces := []sealing.Piece{ pieces := []sealing2.Piece{
{ {
Piece: abi.PieceInfo{ Piece: abi.PieceInfo{
Size: abi.PaddedPieceSize(1024), Size: abi.PaddedPieceSize(1024),
@ -130,11 +130,11 @@ func TestBasicPolicyMostConstrictiveSchedule(t *testing.T) {
func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) { func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) {
cfg := fakeConfigGetter(nil) cfg := fakeConfigGetter(nil)
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{
h: abi.ChainEpoch(55), h: abi.ChainEpoch(55),
}, cfg, 0) }, cfg, 0)
pieces := []sealing.Piece{ pieces := []sealing2.Piece{
{ {
Piece: abi.PieceInfo{ Piece: abi.PieceInfo{
Size: abi.PaddedPieceSize(1024), Size: abi.PaddedPieceSize(1024),
@ -159,11 +159,11 @@ func TestBasicPolicyIgnoresExistingScheduleIfExpired(t *testing.T) {
func TestMissingDealIsIgnored(t *testing.T) { func TestMissingDealIsIgnored(t *testing.T) {
cfg := fakeConfigGetter(nil) cfg := fakeConfigGetter(nil)
policy := sealing.NewBasicPreCommitPolicy(&fakeChain{ policy := sealing2.NewBasicPreCommitPolicy(&fakeChain{
h: abi.ChainEpoch(55), h: abi.ChainEpoch(55),
}, cfg, 0) }, cfg, 0)
pieces := []sealing.Piece{ pieces := []sealing2.Piece{
{ {
Piece: abi.PieceInfo{ Piece: abi.PieceInfo{
Size: abi.PaddedPieceSize(1024), Size: abi.PaddedPieceSize(1024),

View File

@ -29,8 +29,8 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" 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/ffiwrapper"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
const SectorStorePrefix = "/sectors" const SectorStorePrefix = "/sectors"

View File

@ -20,8 +20,8 @@ import (
api2 "github.com/filecoin-project/lotus/api" api2 "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing2 "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/extern/storage-sealing/mocks" mocks2 "github.com/filecoin-project/lotus/storage/pipeline/mocks"
) )
func TestStateRecoverDealIDs(t *testing.T) { func TestStateRecoverDealIDs(t *testing.T) {
@ -31,14 +31,14 @@ func TestStateRecoverDealIDs(t *testing.T) {
ctx := context.Background() ctx := context.Background()
api := mocks.NewMockSealingAPI(mockCtrl) api := mocks2.NewMockSealingAPI(mockCtrl)
fakeSealing := &sealing.Sealing{ fakeSealing := &sealing2.Sealing{
Api: api, 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) sctx.EXPECT().Context().AnyTimes().Return(ctx)
api.EXPECT().ChainHead(ctx).Times(2).Return(nil, abi.ChainEpoch(10), nil) api.EXPECT().ChainHead(ctx).Times(2).Return(nil, abi.ChainEpoch(10), nil)
@ -55,8 +55,8 @@ func TestStateRecoverDealIDs(t *testing.T) {
// expect GetCurrentDealInfo // expect GetCurrentDealInfo
{ {
api.EXPECT().StateSearchMsg(ctx, pc).Return(&sealing.MsgLookup{ api.EXPECT().StateSearchMsg(ctx, pc).Return(&sealing2.MsgLookup{
Receipt: sealing.MessageReceipt{ Receipt: sealing2.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: cborRet(&market0.PublishStorageDealsReturn{ Return: cborRet(&market0.PublishStorageDealsReturn{
IDs: []abi.DealID{dealId}, 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. // 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 // https://github.com/filecoin-project/lotus/issues/7867
err := fakeSealing.HandleRecoverDealIDs(statemachine.Context{}, sealing.SectorInfo{ err := fakeSealing.HandleRecoverDealIDs(statemachine.Context{}, sealing2.SectorInfo{
Pieces: []sealing.Piece{ Pieces: []sealing2.Piece{
{ {
DealInfo: &api2.PieceDealInfo{ DealInfo: &api2.PieceDealInfo{
DealID: dealId, DealID: dealId,

View File

@ -22,7 +22,7 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy" "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 var DealSectorPriority = 1024

View File

@ -9,8 +9,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "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/metrics"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
type statSectorState int type statSectorState int

View File

@ -14,7 +14,7 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" 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 //go:generate go run github.com/golang/mock/mockgen -destination=mocks/statemachine.go -package=mocks . Context

View File

@ -10,7 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
) )
func fillersFromRem(in abi.UnpaddedPieceSize) ([]abi.UnpaddedPieceSize, error) { func fillersFromRem(in abi.UnpaddedPieceSize) ([]abi.UnpaddedPieceSize, error) {

View File

@ -26,7 +26,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/extern/storage-sealing" sealing "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/testplans/lotus-soup/testkit" "github.com/filecoin-project/lotus/testplans/lotus-soup/testkit"
tsync "github.com/filecoin-project/lotus/tools/stats/sync" tsync "github.com/filecoin-project/lotus/tools/stats/sync"
) )