chore: Fix more imports with '2' suffix

This commit is contained in:
Łukasz Magiera 2022-06-14 21:23:17 +02:00
parent 7864e1470e
commit 39cede946c
10 changed files with 91 additions and 91 deletions

View File

@ -55,7 +55,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/paths" "github.com/filecoin-project/lotus/storage/paths"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
@ -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(sealing2.SectorStorePrefix).ChildString(fmt.Sprint(sector.SectorID)) sectorKey := datastore.NewKey(pipeline.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 := &sealing2.SectorInfo{ info := &pipeline.SectorInfo{
State: sealing2.Proving, State: pipeline.Proving,
SectorNumber: sector.SectorID, SectorNumber: sector.SectorID,
Pieces: []sealing2.Piece{ Pieces: []pipeline.Piece{
{ {
Piece: abi.PieceInfo{ Piece: abi.PieceInfo{
Size: abi.PaddedPieceSize(meta.SectorSize), Size: abi.PaddedPieceSize(meta.SectorSize),

View File

@ -11,14 +11,14 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
mock2 "github.com/filecoin-project/specs-actors/v2/support/mock" mock "github.com/filecoin-project/specs-actors/v2/support/mock"
atesting2 "github.com/filecoin-project/specs-actors/v2/support/testing" atesting2 "github.com/filecoin-project/specs-actors/v2/support/testing"
) )
func TestSingleton(t *testing.T) { func TestSingleton(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_BUILDER_001 //stm: @CHAIN_ACTOR_CHAOS_BUILDER_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -33,7 +33,7 @@ func TestSingleton(t *testing.T) {
func TestCallerValidationNone(t *testing.T) { func TestCallerValidationNone(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001 //stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -46,7 +46,7 @@ func TestCallerValidationIs(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001 //stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001
caller := atesting2.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting2.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
rt.SetCaller(caller, builtin2.AccountActorCodeID) rt.SetCaller(caller, builtin2.AccountActorCodeID)
@ -76,7 +76,7 @@ func TestCallerValidationType(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001 //stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001
caller := atesting2.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting2.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
rt.SetCaller(caller, builtin2.AccountActorCodeID) rt.SetCaller(caller, builtin2.AccountActorCodeID)
@ -102,7 +102,7 @@ func TestCallerValidationType(t *testing.T) {
func TestCallerValidationInvalidBranch(t *testing.T) { func TestCallerValidationInvalidBranch(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001 //stm: @CHAIN_ACTOR_CHAOS_CALLER_VALIDATION_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -117,7 +117,7 @@ func TestDeleteActor(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CREATE_ACTOR_001 //stm: @CHAIN_ACTOR_CHAOS_CREATE_ACTOR_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
beneficiary := atesting2.NewIDAddr(t, 101) beneficiary := atesting2.NewIDAddr(t, 101)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -131,7 +131,7 @@ func TestDeleteActor(t *testing.T) {
func TestMutateStateInTransaction(t *testing.T) { func TestMutateStateInTransaction(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001 //stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -159,7 +159,7 @@ func TestMutateStateInTransaction(t *testing.T) {
func TestMutateStateAfterTransaction(t *testing.T) { func TestMutateStateAfterTransaction(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001 //stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -194,7 +194,7 @@ func TestMutateStateAfterTransaction(t *testing.T) {
func TestMutateStateReadonly(t *testing.T) { func TestMutateStateReadonly(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001 //stm: @CHAIN_ACTOR_CHAOS_CREATE_STATE_001, @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -229,7 +229,7 @@ func TestMutateStateReadonly(t *testing.T) {
func TestMutateStateInvalidBranch(t *testing.T) { func TestMutateStateInvalidBranch(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001 //stm: @CHAIN_ACTOR_CHAOS_MUTATE_STATE_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -244,7 +244,7 @@ func TestMutateStateInvalidBranch(t *testing.T) {
func TestAbortWith(t *testing.T) { func TestAbortWith(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_ABORT_WITH_001 //stm: @CHAIN_ACTOR_CHAOS_ABORT_WITH_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -263,7 +263,7 @@ func TestAbortWith(t *testing.T) {
func TestAbortWithUncontrolled(t *testing.T) { func TestAbortWithUncontrolled(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_ABORT_WITH_001 //stm: @CHAIN_ACTOR_CHAOS_ABORT_WITH_001
receiver := atesting2.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -282,7 +282,7 @@ func TestInspectRuntime(t *testing.T) {
//stm: @CHAIN_ACTOR_CHAOS_INSPECT_RUNTIME_001, @CHAIN_ACTOR_CHAOS_CREATE_STATE_001 //stm: @CHAIN_ACTOR_CHAOS_INSPECT_RUNTIME_001, @CHAIN_ACTOR_CHAOS_CREATE_STATE_001
caller := atesting2.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting2.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock2.NewBuilder(context.Background(), receiver) builder := mock.NewBuilder(context.Background(), receiver)
var a Actor var a Actor

View File

@ -58,7 +58,7 @@ import (
"github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/paths"
sectorstorage "github.com/filecoin-project/lotus/storage/sealer" sectorstorage "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
mock2 "github.com/filecoin-project/lotus/storage/sealer/mock" mock "github.com/filecoin-project/lotus/storage/sealer/mock"
) )
func init() { func init() {
@ -246,7 +246,7 @@ func (n *Ensemble) Miner(minerNode *TestMiner, full *TestFullNode, opts ...NodeO
// Create the preseal commitment. // Create the preseal commitment.
if n.options.mockProofs { if n.options.mockProofs {
genm, k, err = mock2.PreSeal(proofType, actorAddr, sectors) genm, k, err = mock.PreSeal(proofType, actorAddr, sectors)
} else { } else {
genm, k, err = seed.PreSeal(actorAddr, proofType, 0, sectors, tdir, []byte("make genesis mem random"), nil, true) genm, k, err = seed.PreSeal(actorAddr, proofType, 0, sectors, tdir, []byte("make genesis mem random"), nil, true)
} }
@ -363,8 +363,8 @@ func (n *Ensemble) Start() *Ensemble {
// Are we mocking proofs? // Are we mocking proofs?
if n.options.mockProofs { if n.options.mockProofs {
opts = append(opts, opts = append(opts,
node.Override(new(ffiwrapper.Verifier), mock2.MockVerifier), node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
node.Override(new(ffiwrapper.Prover), mock2.MockProver), node.Override(new(ffiwrapper.Prover), mock.MockProver),
) )
} }
@ -636,15 +636,15 @@ func (n *Ensemble) Start() *Ensemble {
if n.options.mockProofs { if n.options.mockProofs {
opts = append(opts, opts = append(opts,
node.Override(new(*mock2.SectorMgr), func() (*mock2.SectorMgr, error) { node.Override(new(*mock.SectorMgr), func() (*mock.SectorMgr, error) {
return mock2.NewMockSectorMgr(presealSectors), nil return mock.NewMockSectorMgr(presealSectors), nil
}), }),
node.Override(new(sectorstorage.SectorManager), node.From(new(*mock2.SectorMgr))), node.Override(new(sectorstorage.SectorManager), node.From(new(*mock.SectorMgr))),
node.Override(new(sectorstorage.Unsealer), node.From(new(*mock2.SectorMgr))), node.Override(new(sectorstorage.Unsealer), node.From(new(*mock.SectorMgr))),
node.Override(new(sectorstorage.PieceProvider), node.From(new(*mock2.SectorMgr))), node.Override(new(sectorstorage.PieceProvider), node.From(new(*mock.SectorMgr))),
node.Override(new(ffiwrapper.Verifier), mock2.MockVerifier), node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
node.Override(new(ffiwrapper.Prover), mock2.MockProver), node.Override(new(ffiwrapper.Prover), mock.MockProver),
node.Unset(new(*sectorstorage.Manager)), node.Unset(new(*sectorstorage.Manager)),
) )
} }

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"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline" pipeline "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 sealing2.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing2.CurrentDealInfo, error) GetCurrentDealInfo(ctx context.Context, tok pipeline.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.CurrentDealInfo, error)
} }
type diffPreCommitsAPI interface { type diffPreCommitsAPI interface {
@ -41,9 +41,9 @@ type SectorCommittedManager struct {
dpc diffPreCommitsAPI dpc diffPreCommitsAPI
} }
func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI sealing2.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager { func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI pipeline.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager {
dim := &sealing2.CurrentDealInfoManager{ dim := &pipeline.CurrentDealInfoManager{
CDAPI: &sealing2.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI}, CDAPI: &pipeline.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 sealing2.CurrentDealInfo) (*abi.SectorNumber, error) { func dealSectorInReplicaUpdateSuccess(msg *types.Message, rec *types.MessageReceipt, res pipeline.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 sealing2.CurrentDealInfo) (*abi.SectorNumber, error) { func dealSectorInPreCommitMsg(msg *types.Message, res pipeline.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) (sealing2.CurrentDealInfo, bool, error) { func (mgr *SectorCommittedManager) checkIfDealAlreadyActive(ctx context.Context, ts *types.TipSet, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.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"
sealing2 "github.com/filecoin-project/lotus/storage/pipeline" pipeline "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 sealing2.CurrentDealInfo currentDealInfo pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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 sealing2.CurrentDealInfo currentDealInfo pipeline.CurrentDealInfo
currentDealInfoErr error currentDealInfoErr error
currentDealInfo2 sealing2.CurrentDealInfo currentDealInfo2 pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing2.CurrentDealInfo{ currentDealInfo2: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing2.CurrentDealInfo{ currentDealInfo2: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: activeDeal, MarketDeal: activeDeal,
}, },
expectedCBCallCount: 1, expectedCBCallCount: 1,
}, },
"sector was slashed": { "sector was slashed": {
currentDealInfo: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.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: sealing2.CurrentDealInfo{ currentDealInfo: pipeline.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: unfinishedDeal, MarketDeal: unfinishedDeal,
}, },
currentDealInfo2: sealing2.CurrentDealInfo{ currentDealInfo2: pipeline.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 sealing2.CurrentDealInfo CurrentDealInfo pipeline.CurrentDealInfo
Err error Err error
CurrentDealInfo2 sealing2.CurrentDealInfo CurrentDealInfo2 pipeline.CurrentDealInfo
Err2 error Err2 error
} }
func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tok sealing2.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (sealing2.CurrentDealInfo, error) { func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tok pipeline.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.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

@ -31,7 +31,7 @@ import (
"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" pipeline "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, sealing2.ErrTooManySectorsSealing) { if !xerrors.Is(err, pipeline.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(sealing2.Proving) { if si.State == api.SectorState(pipeline.Proving) {
best = r best = r
bestSi = si bestSi = si
break break
} }
} }
if bestSi.State == api.SectorState(sealing2.UndefinedSectorState) { if bestSi.State == api.SectorState(pipeline.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

@ -529,8 +529,8 @@ func TestPaychGetRestartAfterCreateChannelMsg(t *testing.T) {
mock.close() mock.close()
// Create a new manager with the same datastore // Create a new manager with the same datastore
mock2 := newMockManagerAPI() mock := newMockManagerAPI()
defer mock2.close() defer mock.close()
act := &types.Actor{ act := &types.Actor{
Code: builtin.AccountActorCodeID, Code: builtin.AccountActorCodeID,
@ -538,9 +538,9 @@ func TestPaychGetRestartAfterCreateChannelMsg(t *testing.T) {
Nonce: 0, Nonce: 0,
Balance: types.NewInt(20), Balance: types.NewInt(20),
} }
mock2.setPaychState(ch, act, paychmock.NewMockPayChState(from, to, abi.ChainEpoch(0), make(map[uint64]paych.LaneState))) mock.setPaychState(ch, act, paychmock.NewMockPayChState(from, to, abi.ChainEpoch(0), make(map[uint64]paych.LaneState)))
mgr2, err := newManager(store, mock2) mgr2, err := newManager(store, mock)
require.NoError(t, err) require.NoError(t, err)
// Should have no channels yet (message sent but channel not created) // Should have no channels yet (message sent but channel not created)
@ -586,7 +586,7 @@ func TestPaychGetRestartAfterCreateChannelMsg(t *testing.T) {
}() }()
// 3. Send create channel response // 3. Send create channel response
mock2.receiveMsgResponse(createMsgCid, response) mock.receiveMsgResponse(createMsgCid, response)
<-done <-done
} }
@ -634,16 +634,16 @@ func TestPaychGetRestartAfterAddFundsMsg(t *testing.T) {
require.NoError(t, mgr.Stop()) require.NoError(t, mgr.Stop())
// Create a new manager with the same datastore // Create a new manager with the same datastore
mock2 := newMockManagerAPI() mock := newMockManagerAPI()
defer mock2.close() defer mock.close()
mock2.setPaychState(ch, act, paychmock.NewMockPayChState(from, to, abi.ChainEpoch(0), make(map[uint64]paych.LaneState))) mock.setPaychState(ch, act, paychmock.NewMockPayChState(from, to, abi.ChainEpoch(0), make(map[uint64]paych.LaneState)))
mgr2, err := newManager(store, mock2) mgr2, err := newManager(store, mock)
require.NoError(t, err) require.NoError(t, err)
// Send success add funds response // Send success add funds response
mock2.receiveMsgResponse(mcid2, types.MessageReceipt{ mock.receiveMsgResponse(mcid2, types.MessageReceipt{
ExitCode: 0, ExitCode: 0,
Return: []byte{}, Return: []byte{},
}) })

View File

@ -30,7 +30,7 @@ import (
"github.com/filecoin-project/lotus/lib/nullreader" "github.com/filecoin-project/lotus/lib/nullreader"
nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
fr322 "github.com/filecoin-project/lotus/storage/sealer/fr32" fr32 "github.com/filecoin-project/lotus/storage/sealer/fr32"
"github.com/filecoin-project/lotus/storage/sealer/partialfile" "github.com/filecoin-project/lotus/storage/sealer/partialfile"
storiface "github.com/filecoin-project/lotus/storage/sealer/storiface" storiface "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
@ -237,7 +237,7 @@ func (sb *Sealer) AddPiece(ctx context.Context, sector storage.SectorRef, existi
return abi.PieceInfo{}, xerrors.Errorf("getting partial file writer: %w", err) return abi.PieceInfo{}, xerrors.Errorf("getting partial file writer: %w", err)
} }
pw := fr322.NewPadWriter(w) pw := fr32.NewPadWriter(w)
pr := io.TeeReader(io.LimitReader(file, int64(pieceSize)), pw) pr := io.TeeReader(io.LimitReader(file, int64(pieceSize)), pw)
@ -537,11 +537,11 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, off
defer close(outWait) defer close(outWait)
defer opr.Close() // nolint defer opr.Close() // nolint
padwriter := fr322.NewPadWriter(out) padwriter := fr32.NewPadWriter(out)
bsize := uint64(size.Padded()) bsize := uint64(size.Padded())
if bsize > uint64(runtime.NumCPU())*fr322.MTTresh { if bsize > uint64(runtime.NumCPU())*fr32.MTTresh {
bsize = uint64(runtime.NumCPU()) * fr322.MTTresh bsize = uint64(runtime.NumCPU()) * fr32.MTTresh
} }
bw := bufio.NewWriterSize(padwriter, int(abi.PaddedPieceSize(bsize).Unpadded())) bw := bufio.NewWriterSize(padwriter, int(abi.PaddedPieceSize(bsize).Unpadded()))
@ -644,7 +644,7 @@ func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storag
return false, xerrors.Errorf("getting partial file reader: %w", err) return false, xerrors.Errorf("getting partial file reader: %w", err)
} }
upr, err := fr322.NewUnpadReader(f, size.Padded()) upr, err := fr32.NewUnpadReader(f, size.Padded())
if err != nil { if err != nil {
return false, xerrors.Errorf("creating unpadded reader: %w", err) return false, xerrors.Errorf("creating unpadded reader: %w", err)
} }

View File

@ -10,7 +10,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
fr322 "github.com/filecoin-project/lotus/storage/sealer/fr32" fr32 "github.com/filecoin-project/lotus/storage/sealer/fr32"
) )
func TestUnpadReader(t *testing.T) { func TestUnpadReader(t *testing.T) {
@ -19,9 +19,9 @@ func TestUnpadReader(t *testing.T) {
raw := bytes.Repeat([]byte{0x77}, int(ps)) raw := bytes.Repeat([]byte{0x77}, int(ps))
padOut := make([]byte, ps.Padded()) padOut := make([]byte, ps.Padded())
fr322.Pad(raw, padOut) fr32.Pad(raw, padOut)
r, err := fr322.NewUnpadReader(bytes.NewReader(padOut), ps.Padded()) r, err := fr32.NewUnpadReader(bytes.NewReader(padOut), ps.Padded())
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -15,13 +15,13 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/dagstore/mount"
ffiwrapper "github.com/filecoin-project/go-commp-utils/ffiwrapper" commpffi "github.com/filecoin-project/go-commp-utils/ffiwrapper"
commcid "github.com/filecoin-project/go-fil-commcid" commcid "github.com/filecoin-project/go-fil-commcid"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
ffiwrapper3 "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" ffiwrapper "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
storiface "github.com/filecoin-project/lotus/storage/sealer/storiface" storiface "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
@ -90,7 +90,7 @@ func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID storage.SectorRef,
var b bytes.Buffer var b bytes.Buffer
tr := io.TeeReader(r, &b) tr := io.TeeReader(r, &b)
c, err := ffiwrapper.GeneratePieceCIDFromFile(sectorID.ProofType, tr, size) c, err := commpffi.GeneratePieceCIDFromFile(sectorID.ProofType, tr, size)
if err != nil { if err != nil {
return abi.PieceInfo{}, xerrors.Errorf("failed to generate piece cid: %w", err) return abi.PieceInfo{}, xerrors.Errorf("failed to generate piece cid: %w", err)
} }
@ -722,7 +722,7 @@ func (m mockVerifProver) VerifyWindowPoSt(ctx context.Context, info prooftypes.W
} }
func (m mockVerifProver) GenerateDataCommitment(pt abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) { func (m mockVerifProver) GenerateDataCommitment(pt abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) {
return ffiwrapper3.GenerateUnsealedCID(pt, pieces) return ffiwrapper.GenerateUnsealedCID(pt, pieces)
} }
func (m mockVerifProver) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) { func (m mockVerifProver) GenerateWinningPoStSectorChallenge(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, eligibleSectorCount uint64) ([]uint64, error) {
@ -736,5 +736,5 @@ var MockVerifier = mockVerifProver{
var MockProver = MockVerifier var MockProver = MockVerifier
var _ storage.Sealer = &SectorMgr{} var _ storage.Sealer = &SectorMgr{}
var _ ffiwrapper3.Verifier = MockVerifier var _ ffiwrapper.Verifier = MockVerifier
var _ ffiwrapper3.Prover = MockProver var _ ffiwrapper.Prover = MockProver