Merge pull request #8871 from filecoin-project/chore/drop-pipeline-adapters
chore: sealing pipeline: Remove adapter code (storage refactors part 2)
This commit is contained in:
commit
2c3dbb239a
@ -457,10 +457,15 @@ type FullNode interface {
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// StateMinerAvailableBalance returns the portion of a miner's balance that can be withdrawn or spent
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) //perm:read
|
||||
// StateMinerSectorAllocated checks if a sector is allocated
|
||||
// StateMinerSectorAllocated checks if a sector number is marked as allocated.
|
||||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error) //perm:read
|
||||
// StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector
|
||||
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) //perm:read
|
||||
// StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector.
|
||||
// Returns nil and no error if the sector isn't precommitted.
|
||||
//
|
||||
// Note that the sector number may be allocated while PreCommitInfo is nil. This means that either allocated sector
|
||||
// numbers were compacted, and the sector number was marked as allocated in order to reduce size of the allocated
|
||||
// sectors bitfield, or that the sector was precommitted, but the precommit has expired.
|
||||
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) //perm:read
|
||||
// StateSectorGetInfo returns the on-chain info for the specified miner's sector. Returns null in case the sector info isn't found
|
||||
// NOTE: returned info.Expiration may not be accurate in some cases, use StateSectorExpiration to get accurate
|
||||
// expiration epoch
|
||||
@ -517,6 +522,8 @@ type FullNode interface {
|
||||
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*MarketDeal, error) //perm:read
|
||||
// StateMarketStorageDeal returns information about the indicated deal
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read
|
||||
// StateComputeDataCID computes DataCID from a set of on-chain deals
|
||||
StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) //perm:read
|
||||
// StateLookupID retrieves the ID address of the given address
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read
|
||||
// StateAccountKey returns the public key address of the given ID address for secp and bls accounts
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -52,7 +51,7 @@ type StorageMiner interface {
|
||||
|
||||
ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) //perm:admin
|
||||
|
||||
ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) //perm:admin
|
||||
ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) //perm:admin
|
||||
|
||||
// Temp api for testing
|
||||
PledgeSector(context.Context) (abi.SectorID, error) //perm:write
|
||||
@ -63,9 +62,9 @@ type StorageMiner interface {
|
||||
// Add piece to an open sector. If no sectors with enough space are open,
|
||||
// either a new sector will be created, or this call will block until more
|
||||
// sectors can be created.
|
||||
SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storage.Data, d PieceDealInfo) (SectorOffset, error) //perm:admin
|
||||
SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d PieceDealInfo) (SectorOffset, error) //perm:admin
|
||||
|
||||
SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error //perm:admin
|
||||
SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error //perm:admin
|
||||
|
||||
// List all staged sectors
|
||||
SectorsList(context.Context) ([]abi.SectorNumber, error) //perm:read
|
||||
@ -124,23 +123,23 @@ type StorageMiner interface {
|
||||
WorkerJobs(context.Context) (map[uuid.UUID][]storiface.WorkerJob, error) //perm:admin
|
||||
|
||||
//storiface.WorkerReturn
|
||||
ReturnDataCid(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnAddPiece(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFinalizeSector(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, vanillaProofs storage.ReplicaVanillaProofs, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storage.ReplicaUpdateProof, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnGenerateSectorKeyFromData(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFinalizeReplicaUpdate(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFetch(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnDataCid(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnAddPiece(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFinalizeSector(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, vanillaProofs storiface.ReplicaVanillaProofs, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storiface.ReplicaUpdateProof, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnGenerateSectorKeyFromData(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFinalizeReplicaUpdate(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err *storiface.CallError) error //perm:admin retry:true
|
||||
ReturnFetch(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
|
||||
|
||||
// SealingSchedDiag dumps internal sealing scheduler state
|
||||
SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error) //perm:admin
|
||||
@ -272,7 +271,7 @@ type StorageMiner interface {
|
||||
// the path specified when calling CreateBackup is within the base path
|
||||
CreateBackup(ctx context.Context, fpath string) error //perm:admin
|
||||
|
||||
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin
|
||||
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin
|
||||
|
||||
ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -34,22 +33,22 @@ type Worker interface {
|
||||
Info(context.Context) (storiface.WorkerInfo, error) //perm:admin
|
||||
|
||||
// storiface.WorkerCalls
|
||||
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) //perm:admin
|
||||
AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) //perm:admin
|
||||
SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
||||
SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storiface.CallID, error) //perm:admin
|
||||
SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) //perm:admin
|
||||
SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storiface.CallID, error) //perm:admin
|
||||
FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) //perm:admin
|
||||
FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) //perm:admin
|
||||
ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
||||
ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin
|
||||
GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) //perm:admin
|
||||
MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
|
||||
UnsealPiece(context.Context, storage.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
Fetch(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin
|
||||
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin
|
||||
AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin
|
||||
SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
||||
SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) //perm:admin
|
||||
SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) //perm:admin
|
||||
SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) //perm:admin
|
||||
FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
|
||||
FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin
|
||||
ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin
|
||||
ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin
|
||||
GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) //perm:admin
|
||||
MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin
|
||||
UnsealPiece(context.Context, storiface.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin
|
||||
Fetch(context.Context, storiface.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin
|
||||
|
||||
GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) //perm:admin
|
||||
GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin
|
||||
|
@ -2348,6 +2348,21 @@ func (mr *MockFullNodeMockRecorder) StateCompute(arg0, arg1, arg2, arg3 interfac
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateCompute", reflect.TypeOf((*MockFullNode)(nil).StateCompute), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateComputeDataCID mocks base method.
|
||||
func (m *MockFullNode) StateComputeDataCID(arg0 context.Context, arg1 address.Address, arg2 abi.RegisteredSealProof, arg3 []abi.DealID, arg4 types.TipSetKey) (cid.Cid, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateComputeDataCID", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateComputeDataCID indicates an expected call of StateComputeDataCID.
|
||||
func (mr *MockFullNodeMockRecorder) StateComputeDataCID(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateComputeDataCID", reflect.TypeOf((*MockFullNode)(nil).StateComputeDataCID), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// StateDealProviderCollateralBounds mocks base method.
|
||||
func (m *MockFullNode) StateDealProviderCollateralBounds(arg0 context.Context, arg1 abi.PaddedPieceSize, arg2 bool, arg3 types.TipSetKey) (api.DealCollateralBounds, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -2934,10 +2949,10 @@ func (mr *MockFullNodeMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg3
|
||||
}
|
||||
|
||||
// StateSectorPreCommitInfo mocks base method.
|
||||
func (m *MockFullNode) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) {
|
||||
func (m *MockFullNode) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(miner.SectorPreCommitOnChainInfo)
|
||||
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
186
api/proxy_gen.go
186
api/proxy_gen.go
@ -30,7 +30,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
@ -350,6 +349,8 @@ type FullNodeStruct struct {
|
||||
|
||||
StateCompute func(p0 context.Context, p1 abi.ChainEpoch, p2 []*types.Message, p3 types.TipSetKey) (*ComputeStateOutput, error) `perm:"read"`
|
||||
|
||||
StateComputeDataCID func(p0 context.Context, p1 address.Address, p2 abi.RegisteredSealProof, p3 []abi.DealID, p4 types.TipSetKey) (cid.Cid, error) `perm:"read"`
|
||||
|
||||
StateDealProviderCollateralBounds func(p0 context.Context, p1 abi.PaddedPieceSize, p2 bool, p3 types.TipSetKey) (DealCollateralBounds, error) `perm:"read"`
|
||||
|
||||
StateDecodeParams func(p0 context.Context, p1 address.Address, p2 abi.MethodNum, p3 []byte, p4 types.TipSetKey) (interface{}, error) `perm:"read"`
|
||||
@ -428,7 +429,7 @@ type FullNodeStruct struct {
|
||||
|
||||
StateSectorPartition func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"`
|
||||
|
||||
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
||||
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
||||
|
||||
StateVMCirculatingSupplyInternal func(p0 context.Context, p1 types.TipSetKey) (CirculatingSupply, error) `perm:"read"`
|
||||
|
||||
@ -653,9 +654,9 @@ type StorageMinerStruct struct {
|
||||
|
||||
ActorSectorSize func(p0 context.Context, p1 address.Address) (abi.SectorSize, error) `perm:"read"`
|
||||
|
||||
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"`
|
||||
CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"`
|
||||
|
||||
ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) `perm:"admin"`
|
||||
ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) `perm:"admin"`
|
||||
|
||||
ComputeProof func(p0 context.Context, p1 []builtin.ExtendedSectorInfo, p2 abi.PoStRandomness, p3 abi.ChainEpoch, p4 abinetwork.Version) ([]builtin.PoStProof, error) `perm:"read"`
|
||||
|
||||
@ -773,23 +774,23 @@ type StorageMinerStruct struct {
|
||||
|
||||
ReturnMoveStorage func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnProveReplicaUpdate1 func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnProveReplicaUpdate1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnProveReplicaUpdate2 func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnProveReplicaUpdate2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnReadPiece func(p0 context.Context, p1 storiface.CallID, p2 bool, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnReleaseUnsealed func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnReplicaUpdate func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnReplicaUpdate func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnSealCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnSealCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnSealCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnSealCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnSealPreCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnSealPreCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnSealPreCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error `perm:"admin"`
|
||||
ReturnSealPreCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
ReturnUnsealPiece func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"`
|
||||
|
||||
@ -801,7 +802,7 @@ type StorageMinerStruct struct {
|
||||
|
||||
SectorAbortUpgrade func(p0 context.Context, p1 abi.SectorNumber) error `perm:"admin"`
|
||||
|
||||
SectorAddPieceToAny func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) `perm:"admin"`
|
||||
SectorAddPieceToAny func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) `perm:"admin"`
|
||||
|
||||
SectorCommitFlush func(p0 context.Context) ([]sealiface.CommitBatchRes, error) `perm:"admin"`
|
||||
|
||||
@ -843,7 +844,7 @@ type StorageMinerStruct struct {
|
||||
|
||||
SectorsSummary func(p0 context.Context) (map[SectorState]int, error) `perm:"read"`
|
||||
|
||||
SectorsUnsealPiece func(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error `perm:"admin"`
|
||||
SectorsUnsealPiece func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error `perm:"admin"`
|
||||
|
||||
SectorsUpdate func(p0 context.Context, p1 abi.SectorNumber, p2 SectorState) error `perm:"admin"`
|
||||
|
||||
@ -912,19 +913,19 @@ type WalletStub struct {
|
||||
|
||||
type WorkerStruct struct {
|
||||
Internal struct {
|
||||
AddPiece func(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) `perm:"admin"`
|
||||
AddPiece func(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
DataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) `perm:"admin"`
|
||||
DataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
Enabled func(p0 context.Context) (bool, error) `perm:"admin"`
|
||||
|
||||
Fetch func(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) `perm:"admin"`
|
||||
Fetch func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
FinalizeReplicaUpdate func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
FinalizeReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
FinalizeSector func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
FinalizeSector func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
GenerateSectorKeyFromData func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
GenerateSectorKeyFromData func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
GenerateWindowPoSt func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 int, p5 abi.PoStRandomness) (storiface.WindowPoStResult, error) `perm:"admin"`
|
||||
|
||||
@ -932,29 +933,29 @@ type WorkerStruct struct {
|
||||
|
||||
Info func(p0 context.Context) (storiface.WorkerInfo, error) `perm:"admin"`
|
||||
|
||||
MoveStorage func(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) `perm:"admin"`
|
||||
MoveStorage func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
Paths func(p0 context.Context) ([]storiface.StoragePath, error) `perm:"admin"`
|
||||
|
||||
ProcessSession func(p0 context.Context) (uuid.UUID, error) `perm:"admin"`
|
||||
|
||||
ProveReplicaUpdate1 func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
ProveReplicaUpdate1 func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
ProveReplicaUpdate2 func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) `perm:"admin"`
|
||||
ProveReplicaUpdate2 func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
ReleaseUnsealed func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
ReleaseUnsealed func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
Remove func(p0 context.Context, p1 abi.SectorID) error `perm:"admin"`
|
||||
|
||||
ReplicaUpdate func(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"`
|
||||
ReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
SealCommit1 func(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) `perm:"admin"`
|
||||
SealCommit1 func(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
SealCommit2 func(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) `perm:"admin"`
|
||||
SealCommit2 func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
SealPreCommit1 func(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"`
|
||||
SealPreCommit1 func(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
SealPreCommit2 func(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) `perm:"admin"`
|
||||
SealPreCommit2 func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
Session func(p0 context.Context) (uuid.UUID, error) `perm:"admin"`
|
||||
|
||||
@ -968,7 +969,7 @@ type WorkerStruct struct {
|
||||
|
||||
TaskTypes func(p0 context.Context) (map[sealtasks.TaskType]struct{}, error) `perm:"admin"`
|
||||
|
||||
UnsealPiece func(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
UnsealPiece func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) `perm:"admin"`
|
||||
|
||||
Version func(p0 context.Context) (Version, error) `perm:"admin"`
|
||||
|
||||
@ -2453,6 +2454,17 @@ func (s *FullNodeStub) StateCompute(p0 context.Context, p1 abi.ChainEpoch, p2 []
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateComputeDataCID(p0 context.Context, p1 address.Address, p2 abi.RegisteredSealProof, p3 []abi.DealID, p4 types.TipSetKey) (cid.Cid, error) {
|
||||
if s.Internal.StateComputeDataCID == nil {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateComputeDataCID(p0, p1, p2, p3, p4)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateComputeDataCID(p0 context.Context, p1 address.Address, p2 abi.RegisteredSealProof, p3 []abi.DealID, p4 types.TipSetKey) (cid.Cid, error) {
|
||||
return *new(cid.Cid), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateDealProviderCollateralBounds(p0 context.Context, p1 abi.PaddedPieceSize, p2 bool, p3 types.TipSetKey) (DealCollateralBounds, error) {
|
||||
if s.Internal.StateDealProviderCollateralBounds == nil {
|
||||
return *new(DealCollateralBounds), ErrNotSupported
|
||||
@ -2882,15 +2894,15 @@ func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Addre
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateSectorPreCommitInfo(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) {
|
||||
func (s *FullNodeStruct) StateSectorPreCommitInfo(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
if s.Internal.StateSectorPreCommitInfo == nil {
|
||||
return *new(miner.SectorPreCommitOnChainInfo), ErrNotSupported
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
return s.Internal.StateSectorPreCommitInfo(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *FullNodeStub) StateSectorPreCommitInfo(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) {
|
||||
return *new(miner.SectorPreCommitOnChainInfo), ErrNotSupported
|
||||
func (s *FullNodeStub) StateSectorPreCommitInfo(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *FullNodeStruct) StateVMCirculatingSupplyInternal(p0 context.Context, p1 types.TipSetKey) (CirculatingSupply, error) {
|
||||
@ -3927,25 +3939,25 @@ func (s *StorageMinerStub) ActorSectorSize(p0 context.Context, p1 address.Addres
|
||||
return *new(abi.SectorSize), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
||||
func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
||||
if s.Internal.CheckProvable == nil {
|
||||
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
||||
}
|
||||
return s.Internal.CheckProvable(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
||||
func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) {
|
||||
return *new(map[abi.SectorNumber]string), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) {
|
||||
func (s *StorageMinerStruct) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) {
|
||||
if s.Internal.ComputeDataCid == nil {
|
||||
return *new(abi.PieceInfo), ErrNotSupported
|
||||
}
|
||||
return s.Internal.ComputeDataCid(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) {
|
||||
func (s *StorageMinerStub) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) {
|
||||
return *new(abi.PieceInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -4587,25 +4599,25 @@ func (s *StorageMinerStub) ReturnMoveStorage(p0 context.Context, p1 storiface.Ca
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnProveReplicaUpdate1 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnProveReplicaUpdate1(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnProveReplicaUpdate2 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnProveReplicaUpdate2(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
@ -4631,58 +4643,58 @@ func (s *StorageMinerStub) ReturnReleaseUnsealed(p0 context.Context, p1 storifac
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnReplicaUpdate == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnReplicaUpdate(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnSealCommit1 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnSealCommit1(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnSealCommit2 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnSealCommit2(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnSealPreCommit1 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnSealPreCommit1(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStruct) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error {
|
||||
if s.Internal.ReturnSealPreCommit2 == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReturnSealPreCommit2(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error {
|
||||
func (s *StorageMinerStub) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
@ -4741,14 +4753,14 @@ func (s *StorageMinerStub) SectorAbortUpgrade(p0 context.Context, p1 abi.SectorN
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) {
|
||||
func (s *StorageMinerStruct) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) {
|
||||
if s.Internal.SectorAddPieceToAny == nil {
|
||||
return *new(SectorOffset), ErrNotSupported
|
||||
}
|
||||
return s.Internal.SectorAddPieceToAny(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) {
|
||||
func (s *StorageMinerStub) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) {
|
||||
return *new(SectorOffset), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -4972,14 +4984,14 @@ func (s *StorageMinerStub) SectorsSummary(p0 context.Context) (map[SectorState]i
|
||||
return *new(map[SectorState]int), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *StorageMinerStruct) SectorsUnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error {
|
||||
func (s *StorageMinerStruct) SectorsUnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error {
|
||||
if s.Internal.SectorsUnsealPiece == nil {
|
||||
return ErrNotSupported
|
||||
}
|
||||
return s.Internal.SectorsUnsealPiece(p0, p1, p2, p3, p4, p5)
|
||||
}
|
||||
|
||||
func (s *StorageMinerStub) SectorsUnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error {
|
||||
func (s *StorageMinerStub) SectorsUnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5258,25 +5270,25 @@ func (s *WalletStub) WalletSign(p0 context.Context, p1 address.Address, p2 []byt
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) AddPiece(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) AddPiece(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) {
|
||||
if s.Internal.AddPiece == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.AddPiece(p0, p1, p2, p3, p4)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) AddPiece(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) AddPiece(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) {
|
||||
if s.Internal.DataCid == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.DataCid(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5291,47 +5303,47 @@ func (s *WorkerStub) Enabled(p0 context.Context) (bool, error) {
|
||||
return false, ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) Fetch(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) Fetch(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) {
|
||||
if s.Internal.Fetch == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.Fetch(p0, p1, p2, p3, p4)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) Fetch(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) Fetch(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
if s.Internal.FinalizeReplicaUpdate == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.FinalizeReplicaUpdate(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
if s.Internal.FinalizeSector == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.FinalizeSector(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) GenerateSectorKeyFromData(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) GenerateSectorKeyFromData(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) {
|
||||
if s.Internal.GenerateSectorKeyFromData == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.GenerateSectorKeyFromData(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) GenerateSectorKeyFromData(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) GenerateSectorKeyFromData(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5368,14 +5380,14 @@ func (s *WorkerStub) Info(p0 context.Context) (storiface.WorkerInfo, error) {
|
||||
return *new(storiface.WorkerInfo), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) MoveStorage(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) MoveStorage(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) {
|
||||
if s.Internal.MoveStorage == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.MoveStorage(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) MoveStorage(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) MoveStorage(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5401,36 +5413,36 @@ func (s *WorkerStub) ProcessSession(p0 context.Context) (uuid.UUID, error) {
|
||||
return *new(uuid.UUID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) ProveReplicaUpdate1(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) ProveReplicaUpdate1(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) {
|
||||
if s.Internal.ProveReplicaUpdate1 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.ProveReplicaUpdate1(p0, p1, p2, p3, p4)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) ProveReplicaUpdate1(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) ProveReplicaUpdate1(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) ProveReplicaUpdate2(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) ProveReplicaUpdate2(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
if s.Internal.ProveReplicaUpdate2 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.ProveReplicaUpdate2(p0, p1, p2, p3, p4, p5)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) ProveReplicaUpdate2(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) ProveReplicaUpdate2(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) ReleaseUnsealed(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) ReleaseUnsealed(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
if s.Internal.ReleaseUnsealed == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReleaseUnsealed(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) ReleaseUnsealed(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) ReleaseUnsealed(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5445,58 +5457,58 @@ func (s *WorkerStub) Remove(p0 context.Context, p1 abi.SectorID) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) ReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) ReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
if s.Internal.ReplicaUpdate == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.ReplicaUpdate(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) ReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) ReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) SealCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) SealCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) {
|
||||
if s.Internal.SealCommit1 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.SealCommit1(p0, p1, p2, p3, p4, p5)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) SealCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) SealCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) SealCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) SealCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) {
|
||||
if s.Internal.SealCommit2 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.SealCommit2(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) SealCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) SealCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) SealPreCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) SealPreCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
if s.Internal.SealPreCommit1 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.SealPreCommit1(p0, p1, p2, p3)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) SealPreCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) SealPreCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) SealPreCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) SealPreCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) {
|
||||
if s.Internal.SealPreCommit2 == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.SealPreCommit2(p0, p1, p2)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) SealPreCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) SealPreCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
@ -5566,14 +5578,14 @@ func (s *WorkerStub) TaskTypes(p0 context.Context) (map[sealtasks.TaskType]struc
|
||||
return *new(map[sealtasks.TaskType]struct{}), ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *WorkerStruct) UnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStruct) UnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) {
|
||||
if s.Internal.UnsealPiece == nil {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
return s.Internal.UnsealPiece(p0, p1, p2, p3, p4, p5)
|
||||
}
|
||||
|
||||
func (s *WorkerStub) UnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) {
|
||||
func (s *WorkerStub) UnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) {
|
||||
return *new(storiface.CallID), ErrNotSupported
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@ -24,6 +25,18 @@ type WrapperV1Full struct {
|
||||
v1api.FullNode
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) {
|
||||
pi, err := w.FullNode.StateSectorPreCommitInfo(ctx, maddr, s, tsk)
|
||||
if err != nil {
|
||||
return miner.SectorPreCommitOnChainInfo{}, err
|
||||
}
|
||||
if pi == nil {
|
||||
return miner.SectorPreCommitOnChainInfo{}, xerrors.Errorf("precommit info does not exist")
|
||||
}
|
||||
|
||||
return *pi, nil
|
||||
}
|
||||
|
||||
func (w *WrapperV1Full) StateSearchMsg(ctx context.Context, msg cid.Cid) (*api.MsgLookup, error) {
|
||||
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, api.LookbackNoLimit, true)
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func VersionForType(nodeType NodeType) (Version, error) {
|
||||
// semver versions of the rpc api exposed
|
||||
var (
|
||||
FullAPIVersion0 = newVer(1, 5, 0)
|
||||
FullAPIVersion1 = newVer(2, 2, 0)
|
||||
FullAPIVersion1 = newVer(2, 3, 0)
|
||||
|
||||
MinerAPIVersion0 = newVer(1, 5, 0)
|
||||
WorkerAPIVersion0 = newVer(1, 6, 0)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -43,6 +43,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/lib/sigs"
|
||||
"github.com/filecoin-project/lotus/metrics"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var log = logging.Logger("fil-consensus")
|
||||
@ -57,7 +58,7 @@ type FilecoinEC struct {
|
||||
// the state manager handles making state queries
|
||||
sm *stmgr.StateManager
|
||||
|
||||
verifier ffiwrapper.Verifier
|
||||
verifier storiface.Verifier
|
||||
|
||||
genesis *types.TipSet
|
||||
}
|
||||
@ -66,7 +67,7 @@ type FilecoinEC struct {
|
||||
// the theoretical max height based on systime are quickly rejected
|
||||
const MaxHeightDrift = 5
|
||||
|
||||
func NewFilecoinExpectedConsensus(sm *stmgr.StateManager, beacon beacon.Schedule, verifier ffiwrapper.Verifier, genesis chain.Genesis) consensus.Consensus {
|
||||
func NewFilecoinExpectedConsensus(sm *stmgr.StateManager, beacon beacon.Schedule, verifier storiface.Verifier, genesis chain.Genesis) consensus.Consensus {
|
||||
if build.InsecurePoStValidation {
|
||||
log.Warn("*********************************************************************************************")
|
||||
log.Warn(" [INSECURE-POST-VALIDATION] Insecure test validation is enabled. If you see this outside of a test, it is a severe bug! ")
|
||||
|
@ -44,6 +44,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/journal"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
const msgsPerBlock = 20
|
||||
@ -592,7 +593,7 @@ type MiningCheckAPI interface {
|
||||
type mca struct {
|
||||
w *wallet.LocalWallet
|
||||
sm *stmgr.StateManager
|
||||
pv ffiwrapper.Verifier
|
||||
pv storiface.Verifier
|
||||
bcn beacon.Schedule
|
||||
}
|
||||
|
||||
@ -674,7 +675,7 @@ func ComputeVRF(ctx context.Context, sign SignFunc, worker address.Address, sigI
|
||||
|
||||
type genFakeVerifier struct{}
|
||||
|
||||
var _ ffiwrapper.Verifier = (*genFakeVerifier)(nil)
|
||||
var _ storiface.Verifier = (*genFakeVerifier)(nil)
|
||||
|
||||
func (m genFakeVerifier) VerifySeal(svi proof7.SealVerifyInfo) (bool, error) {
|
||||
return true, nil
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/rand"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func GetMinerWorkerRaw(ctx context.Context, sm *StateManager, st cid.Cid, maddr address.Address) (address.Address, error) {
|
||||
@ -117,7 +117,7 @@ func MinerSectorInfo(ctx context.Context, sm *StateManager, maddr address.Addres
|
||||
return mas.GetSector(sid)
|
||||
}
|
||||
|
||||
func GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwrapper.Verifier, sm *StateManager, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]builtin.ExtendedSectorInfo, error) {
|
||||
func GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv storiface.Verifier, sm *StateManager, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]builtin.ExtendedSectorInfo, error) {
|
||||
act, err := sm.LoadActorRaw(ctx, maddr, st)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to load miner actor: %w", err)
|
||||
@ -301,7 +301,7 @@ func ListMinerActors(ctx context.Context, sm *StateManager, ts *types.TipSet) ([
|
||||
return powState.ListAllMiners()
|
||||
}
|
||||
|
||||
func MinerGetBaseInfo(ctx context.Context, sm *StateManager, bcs beacon.Schedule, tsk types.TipSetKey, round abi.ChainEpoch, maddr address.Address, pv ffiwrapper.Verifier) (*api.MiningBaseInfo, error) {
|
||||
func MinerGetBaseInfo(ctx context.Context, sm *StateManager, bcs beacon.Schedule, tsk types.TipSetKey, round abi.ChainEpoch, maddr address.Address, pv storiface.Verifier) (*api.MiningBaseInfo, error) {
|
||||
ts, err := sm.ChainStore().LoadTipSet(ctx, tsk)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to load tipset for mining base: %w", err)
|
||||
|
@ -3,9 +3,12 @@ package types
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
typegen "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
)
|
||||
@ -95,6 +98,45 @@ func (k *TipSetKey) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k TipSetKey) MarshalCBOR(writer io.Writer) error {
|
||||
if err := typegen.WriteMajorTypeHeader(writer, typegen.MajByteString, uint64(len(k.Bytes()))); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := writer.Write(k.Bytes())
|
||||
return err
|
||||
}
|
||||
|
||||
func (k *TipSetKey) UnmarshalCBOR(reader io.Reader) error {
|
||||
cr := typegen.NewCborReader(reader)
|
||||
|
||||
maj, extra, err := cr.ReadHeader()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err == io.EOF {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
}()
|
||||
|
||||
if extra > typegen.ByteArrayMaxLen {
|
||||
return fmt.Errorf("t.Binary: byte array too large (%d)", extra)
|
||||
}
|
||||
if maj != typegen.MajByteString {
|
||||
return fmt.Errorf("expected byte array")
|
||||
}
|
||||
|
||||
b := make([]uint8, extra)
|
||||
|
||||
if _, err := io.ReadFull(cr, b); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*k, err = TipSetKeyFromBytes(b)
|
||||
return err
|
||||
}
|
||||
|
||||
func (k TipSetKey) IsEmpty() bool {
|
||||
return len(k.value) == 0
|
||||
}
|
||||
@ -124,3 +166,6 @@ func decodeKey(encoded []byte) ([]cid.Cid, error) {
|
||||
}
|
||||
return cids, nil
|
||||
}
|
||||
|
||||
var _ typegen.CBORMarshaler = &TipSetKey{}
|
||||
var _ typegen.CBORUnmarshaler = &TipSetKey{}
|
||||
|
@ -2,6 +2,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
@ -10,6 +11,8 @@ import (
|
||||
"github.com/multiformats/go-multihash"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
cborrpc "github.com/filecoin-project/go-cbor-util"
|
||||
)
|
||||
|
||||
func TestTipSetKey(t *testing.T) {
|
||||
@ -71,6 +74,13 @@ func TestTipSetKey(t *testing.T) {
|
||||
`{"/":"bafy2bzacedwviarjtjraqakob5pslltmuo5n3xev3nt5zylezofkbbv5jclyu"}`+
|
||||
`]`, k3)
|
||||
})
|
||||
|
||||
t.Run("CBOR", func(t *testing.T) {
|
||||
k3 := NewTipSetKey(c1, c2, c3)
|
||||
b, err := cborrpc.Dump(k3)
|
||||
require.NoError(t, err)
|
||||
fmt.Println(hex.EncodeToString(b))
|
||||
})
|
||||
}
|
||||
|
||||
func verifyJSON(t *testing.T, expected string, k TipSetKey) {
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/lib/sigs"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -38,7 +39,7 @@ func init() {
|
||||
|
||||
type SyscallBuilder func(ctx context.Context, rt *Runtime) runtime7.Syscalls
|
||||
|
||||
func Syscalls(verifier ffiwrapper.Verifier) SyscallBuilder {
|
||||
func Syscalls(verifier storiface.Verifier) SyscallBuilder {
|
||||
return func(ctx context.Context, rt *Runtime) runtime7.Syscalls {
|
||||
|
||||
return &syscallShim{
|
||||
@ -65,7 +66,7 @@ type syscallShim struct {
|
||||
actor address.Address
|
||||
cstate *state.StateTree
|
||||
cst cbor.IpldStore
|
||||
verifier ffiwrapper.Verifier
|
||||
verifier storiface.Verifier
|
||||
}
|
||||
|
||||
func (ss *syscallShim) ComputeUnsealedSectorCID(st abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) {
|
||||
|
@ -12,12 +12,12 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
type cachingVerifier struct {
|
||||
ds datastore.Datastore
|
||||
backend ffiwrapper.Verifier
|
||||
backend storiface.Verifier
|
||||
}
|
||||
|
||||
const bufsize = 128
|
||||
@ -107,4 +107,4 @@ func (cv cachingVerifier) VerifyReplicaUpdate(update prooftypes.ReplicaUpdateInf
|
||||
return cv.backend.VerifyReplicaUpdate(update)
|
||||
}
|
||||
|
||||
var _ ffiwrapper.Verifier = (*cachingVerifier)(nil)
|
||||
var _ storiface.Verifier = (*cachingVerifier)(nil)
|
||||
|
@ -44,6 +44,7 @@ import (
|
||||
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
type TipSetExec struct {
|
||||
@ -204,7 +205,7 @@ var importBenchCmd = &cli.Command{
|
||||
defer c.Close() //nolint:errcheck
|
||||
}
|
||||
|
||||
var verifier ffiwrapper.Verifier = ffiwrapper.ProofVerifier
|
||||
var verifier storiface.Verifier = ffiwrapper.ProofVerifier
|
||||
if cctx.IsSet("syscall-cache") {
|
||||
scds, err := badger.NewDatastore(cctx.String("syscall-cache"), &badger.DefaultOptions)
|
||||
if err != nil {
|
||||
|
@ -22,7 +22,6 @@ import (
|
||||
"github.com/filecoin-project/go-paramfetch"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -537,7 +536,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
|
||||
return nil, nil, fmt.Errorf("parallelism factor must cleanly divide numSectors")
|
||||
}
|
||||
for i := abi.SectorNumber(0); i < abi.SectorNumber(numSectors); i++ {
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: i,
|
||||
@ -569,7 +568,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
|
||||
start := worker * sectorsPerWorker
|
||||
end := start + sectorsPerWorker
|
||||
for i := abi.SectorNumber(start); i < abi.SectorNumber(end); i++ {
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: i,
|
||||
@ -643,7 +642,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
|
||||
}
|
||||
}
|
||||
|
||||
var proof storage.Proof
|
||||
var proof storiface.Proof
|
||||
if !skipc2 {
|
||||
proof, err = sb.SealCommit2(context.TODO(), sid, c1o)
|
||||
if err != nil {
|
||||
@ -780,7 +779,7 @@ var proveCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
ref := storage.SectorRef{
|
||||
ref := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: abi.SectorNumber(c2in.SectorNum),
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
"github.com/filecoin-project/go-paramfetch"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prf "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
@ -122,7 +121,7 @@ p: pvC0JBrEyUqtIIUvB2UUx/2a24c3Cvnu6AZ0D3IMBYAu...
|
||||
|
||||
type benchSectorProvider map[storiface.SectorFileType]string
|
||||
|
||||
func (b benchSectorProvider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
func (b benchSectorProvider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
out := storiface.SectorPaths{
|
||||
ID: id.ID,
|
||||
Unsealed: b[storiface.FTUnsealed],
|
||||
@ -178,7 +177,7 @@ var simpleAddPiece = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -251,7 +250,7 @@ var simplePreCommit1 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -329,7 +328,7 @@ var simplePreCommit2 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -395,7 +394,7 @@ var simpleCommit1 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -422,7 +421,7 @@ var simpleCommit1 = &cli.Command{
|
||||
Size: abi.PaddedPieceSize(sectorSize),
|
||||
PieceCID: commd,
|
||||
},
|
||||
}, storage.SectorCids{
|
||||
}, storiface.SectorCids{
|
||||
Unsealed: commd,
|
||||
Sealed: commr,
|
||||
})
|
||||
@ -507,7 +506,7 @@ var simpleCommit2 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
ref := storage.SectorRef{
|
||||
ref := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: abi.SectorNumber(c2in.SectorNum),
|
||||
@ -755,7 +754,7 @@ var simpleReplicaUpdate = &cli.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -823,7 +822,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -910,7 +909,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: 1,
|
||||
@ -940,7 +939,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
|
||||
return xerrors.Errorf("reading valilla proof file: %w", err)
|
||||
}
|
||||
|
||||
var vp storage.ReplicaVanillaProofs
|
||||
var vp storiface.ReplicaVanillaProofs
|
||||
if err := json.Unmarshal(vpb, &vp); err != nil {
|
||||
return xerrors.Errorf("unmarshalling vanilla proofs: %w", err)
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -477,7 +476,7 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
var tocheck []storage.SectorRef
|
||||
var tocheck []storiface.SectorRef
|
||||
for _, info := range sectorInfos {
|
||||
si := abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
@ -491,7 +490,7 @@ var provingCheckProvableCmd = &cli.Command{
|
||||
}
|
||||
|
||||
sectors[info.SectorNumber] = struct{}{}
|
||||
tocheck = append(tocheck, storage.SectorRef{
|
||||
tocheck = append(tocheck, storiface.SectorRef{
|
||||
ProofType: info.SealProof,
|
||||
ID: si,
|
||||
})
|
||||
|
@ -23,7 +23,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet/key"
|
||||
@ -65,7 +64,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect
|
||||
var sealedSectors []*genesis.PreSeal
|
||||
for i := 0; i < sectors; i++ {
|
||||
sid := abi.SectorID{Miner: abi.ActorID(mid), Number: next}
|
||||
ref := storage.SectorRef{ID: sid, ProofType: spt}
|
||||
ref := storiface.SectorRef{ID: sid, ProofType: spt}
|
||||
next++
|
||||
|
||||
var preseal *genesis.PreSeal
|
||||
@ -145,7 +144,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect
|
||||
return miner, &minerAddr.KeyInfo, nil
|
||||
}
|
||||
|
||||
func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.SectorSize, preimage []byte) (*genesis.PreSeal, error) {
|
||||
func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storiface.SectorRef, ssize abi.SectorSize, preimage []byte) (*genesis.PreSeal, error) {
|
||||
pi, err := sb.AddPiece(context.TODO(), sid, nil, abi.PaddedPieceSize(ssize).Unpadded(), rand.Reader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -184,7 +183,7 @@ func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storage.Se
|
||||
}, nil
|
||||
}
|
||||
|
||||
func presealSectorFake(sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.SectorSize) (*genesis.PreSeal, error) {
|
||||
func presealSectorFake(sbfs *basicfs.Provider, sid storiface.SectorRef, ssize abi.SectorSize) (*genesis.PreSeal, error) {
|
||||
paths, done, err := sbfs.AcquireSector(context.TODO(), sid, 0, storiface.FTSealed|storiface.FTCache, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("acquire unsealed sector: %w", err)
|
||||
@ -208,7 +207,7 @@ func presealSectorFake(sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.
|
||||
}, nil
|
||||
}
|
||||
|
||||
func cleanupUnsealed(sbfs *basicfs.Provider, ref storage.SectorRef) error {
|
||||
func cleanupUnsealed(sbfs *basicfs.Provider, ref storiface.SectorRef) error {
|
||||
paths, done, err := sbfs.AcquireSector(context.TODO(), ref, storiface.FTUnsealed, storiface.FTNone, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||
tutils "github.com/filecoin-project/specs-actors/v5/support/testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
// Ideally, we'd use extern/sealer/mock. Unfortunately, those mocks are a bit _too_ accurate
|
||||
@ -32,7 +32,7 @@ var log = logging.Logger("simulation-mock")
|
||||
// mockVerifier is a simple mock for verifying "fake" proofs.
|
||||
type mockVerifier struct{}
|
||||
|
||||
var Verifier ffiwrapper.Verifier = mockVerifier{}
|
||||
var Verifier storiface.Verifier = mockVerifier{}
|
||||
|
||||
func (mockVerifier) VerifySeal(proof prooftypes.SealVerifyInfo) (bool, error) {
|
||||
addr, err := address.NewIDAddress(uint64(proof.Miner))
|
||||
|
@ -233,7 +233,7 @@ Response:
|
||||
```json
|
||||
{
|
||||
"Version": "string value",
|
||||
"APIVersion": 131584,
|
||||
"APIVersion": 131840,
|
||||
"BlockDelay": 42
|
||||
}
|
||||
```
|
||||
|
@ -1460,7 +1460,7 @@ Perms: admin
|
||||
|
||||
Inputs: `null`
|
||||
|
||||
Response: `131584`
|
||||
Response: `131840`
|
||||
|
||||
## Add
|
||||
|
||||
|
@ -292,7 +292,7 @@ Response:
|
||||
```json
|
||||
{
|
||||
"Version": "string value",
|
||||
"APIVersion": 131584,
|
||||
"APIVersion": 131840,
|
||||
"BlockDelay": 42
|
||||
}
|
||||
```
|
||||
|
@ -170,6 +170,7 @@
|
||||
* [StateChangedActors](#StateChangedActors)
|
||||
* [StateCirculatingSupply](#StateCirculatingSupply)
|
||||
* [StateCompute](#StateCompute)
|
||||
* [StateComputeDataCID](#StateComputeDataCID)
|
||||
* [StateDealProviderCollateralBounds](#StateDealProviderCollateralBounds)
|
||||
* [StateDecodeParams](#StateDecodeParams)
|
||||
* [StateEncodeParams](#StateEncodeParams)
|
||||
@ -299,7 +300,7 @@ Response:
|
||||
```json
|
||||
{
|
||||
"Version": "string value",
|
||||
"APIVersion": 131584,
|
||||
"APIVersion": 131840,
|
||||
"BlockDelay": 42
|
||||
}
|
||||
```
|
||||
@ -5521,6 +5522,38 @@ Response:
|
||||
}
|
||||
```
|
||||
|
||||
### StateComputeDataCID
|
||||
StateComputeDataCID computes DataCID from a set of on-chain deals
|
||||
|
||||
|
||||
Perms: read
|
||||
|
||||
Inputs:
|
||||
```json
|
||||
[
|
||||
"f01234",
|
||||
8,
|
||||
[
|
||||
5432
|
||||
],
|
||||
[
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
},
|
||||
{
|
||||
"/": "bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve"
|
||||
}
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
|
||||
}
|
||||
```
|
||||
|
||||
### StateDealProviderCollateralBounds
|
||||
StateDealProviderCollateralBounds returns the min and max collateral a storage provider
|
||||
can issue. It takes the deal size and verified status as parameters.
|
||||
@ -6444,7 +6477,7 @@ Response:
|
||||
```
|
||||
|
||||
### StateMinerSectorAllocated
|
||||
StateMinerSectorAllocated checks if a sector is allocated
|
||||
StateMinerSectorAllocated checks if a sector number is marked as allocated.
|
||||
|
||||
|
||||
Perms: read
|
||||
@ -6957,7 +6990,12 @@ Response:
|
||||
```
|
||||
|
||||
### StateSectorPreCommitInfo
|
||||
StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector
|
||||
StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector.
|
||||
Returns nil and no error if the sector isn't precommitted.
|
||||
|
||||
Note that the sector number may be allocated while PreCommitInfo is nil. This means that either allocated sector
|
||||
numbers were compacted, and the sector number was marked as allocated in order to reduce size of the allocated
|
||||
sectors bitfield, or that the sector was precommitted, but the precommit has expired.
|
||||
|
||||
|
||||
Perms: read
|
||||
|
1
go.mod
1
go.mod
@ -56,7 +56,6 @@ require (
|
||||
github.com/filecoin-project/specs-actors/v6 v6.0.2
|
||||
github.com/filecoin-project/specs-actors/v7 v7.0.1
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.1
|
||||
github.com/filecoin-project/specs-storage v0.4.1
|
||||
github.com/filecoin-project/test-vectors/schema v0.0.5
|
||||
github.com/gbrlsnchs/jwt/v3 v3.0.1
|
||||
github.com/gdamore/tcell/v2 v2.2.0
|
||||
|
3
go.sum
3
go.sum
@ -370,7 +370,6 @@ github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go
|
||||
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||
github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||
github.com/filecoin-project/go-state-types v0.1.3/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||
github.com/filecoin-project/go-state-types v0.1.4/go.mod h1:xCA/WfKlC2zcn3fUmDv4IrzznwS98X5XW/irUP3Lhxg=
|
||||
github.com/filecoin-project/go-state-types v0.1.5/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
|
||||
@ -415,8 +414,6 @@ github.com/filecoin-project/specs-actors/v7 v7.0.1 h1:w72xCxijK7xs1qzmJiw+WYJaVt
|
||||
github.com/filecoin-project/specs-actors/v7 v7.0.1/go.mod h1:tPLEYXoXhcpyLh69Ccq91SOuLXsPWjHiY27CzawjUEk=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.1 h1:4u0tIRJeT5G7F05lwLRIsDnsrN+bJ5Ixj6h49Q7uE2Y=
|
||||
github.com/filecoin-project/specs-actors/v8 v8.0.1/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA=
|
||||
github.com/filecoin-project/specs-storage v0.4.1 h1:yvLEaLZj8f+uByhNC4mFOtCUyL2wQku+NGBp6hjTe9M=
|
||||
github.com/filecoin-project/specs-storage v0.4.1/go.mod h1:Z2eK6uMwAOSLjek6+sy0jNV2DSsMEENziMUz0GHRFBw=
|
||||
github.com/filecoin-project/storetheindex v0.4.0 h1:MPIDJYBknPbwBcVf+2/WEIK6LKxhZmfQGCrqKmvhFyU=
|
||||
github.com/filecoin-project/storetheindex v0.4.0/go.mod h1:LIwqpXoKeGxOGEjmxPfdYVPQYoZOSI3oXMUd9XTCpjc=
|
||||
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=
|
||||
|
@ -57,8 +57,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
sectorstorage "github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/mock"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -363,8 +363,8 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
// Are we mocking proofs?
|
||||
if n.options.mockProofs {
|
||||
opts = append(opts,
|
||||
node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
|
||||
node.Override(new(ffiwrapper.Prover), mock.MockProver),
|
||||
node.Override(new(storiface.Verifier), mock.MockVerifier),
|
||||
node.Override(new(storiface.Prover), mock.MockProver),
|
||||
)
|
||||
}
|
||||
|
||||
@ -643,8 +643,8 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
node.Override(new(sectorstorage.Unsealer), node.From(new(*mock.SectorMgr))),
|
||||
node.Override(new(sectorstorage.PieceProvider), node.From(new(*mock.SectorMgr))),
|
||||
|
||||
node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
|
||||
node.Override(new(ffiwrapper.Prover), mock.MockProver),
|
||||
node.Override(new(storiface.Verifier), mock.MockVerifier),
|
||||
node.Override(new(storiface.Prover), mock.MockProver),
|
||||
node.Unset(new(*sectorstorage.Manager)),
|
||||
)
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -21,6 +20,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/node/impl"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/mock"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func TestWindowedPost(t *testing.T) {
|
||||
@ -105,7 +105,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
|
||||
// Drop the partition
|
||||
err = secs.ForEach(func(sid uint64) error {
|
||||
return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(storage.SectorRef{
|
||||
return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: abi.SectorNumber(sid),
|
||||
@ -115,7 +115,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
var s storage.SectorRef
|
||||
var s storiface.SectorRef
|
||||
|
||||
// Drop 1 sectors from deadline 3 partition 0
|
||||
{
|
||||
@ -137,7 +137,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
|
||||
require.NoError(t, err)
|
||||
t.Log("the sectors", all)
|
||||
|
||||
s = storage.SectorRef{
|
||||
s = storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: abi.SectorNumber(sn),
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
storage2 "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -206,7 +205,7 @@ func TestWindowPostWorker(t *testing.T) {
|
||||
|
||||
t.Logf("Drop sector %d; dl %d part %d", sid, di.Index+1, 0)
|
||||
|
||||
err = miner.BaseAPI.(*impl.StorageMinerAPI).IStorageMgr.Remove(ctx, storage2.SectorRef{
|
||||
err = miner.BaseAPI.(*impl.StorageMinerAPI).IStorageMgr.Remove(ctx, storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: abi.SectorNumber(sid),
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
specstorage "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
@ -55,7 +54,7 @@ func (sa *sectorAccessor) UnsealSectorAt(ctx context.Context, sectorID abi.Secto
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ref := specstorage.SectorRef{
|
||||
ref := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: sectorID,
|
||||
@ -90,7 +89,7 @@ func (sa *sectorAccessor) IsUnsealed(ctx context.Context, sectorID abi.SectorNum
|
||||
return false, err
|
||||
}
|
||||
|
||||
ref := specstorage.SectorRef{
|
||||
ref := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: abi.ActorID(mid),
|
||||
Number: sectorID,
|
||||
|
@ -28,7 +28,7 @@ type eventsCalledAPI interface {
|
||||
}
|
||||
|
||||
type dealInfoAPI interface {
|
||||
GetCurrentDealInfo(ctx context.Context, tok pipeline.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.CurrentDealInfo, error)
|
||||
GetCurrentDealInfo(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.CurrentDealInfo, error)
|
||||
}
|
||||
|
||||
type diffPreCommitsAPI interface {
|
||||
@ -41,9 +41,9 @@ type SectorCommittedManager struct {
|
||||
dpc diffPreCommitsAPI
|
||||
}
|
||||
|
||||
func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI pipeline.CurrentDealInfoTskAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager {
|
||||
func NewSectorCommittedManager(ev eventsCalledAPI, tskAPI pipeline.CurrentDealInfoAPI, dpcAPI diffPreCommitsAPI) *SectorCommittedManager {
|
||||
dim := &pipeline.CurrentDealInfoManager{
|
||||
CDAPI: &pipeline.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI},
|
||||
CDAPI: tskAPI,
|
||||
}
|
||||
return newSectorCommittedManager(ev, dim, dpcAPI)
|
||||
}
|
||||
@ -87,12 +87,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
// when the client node was down after the deal was published, and when
|
||||
// the precommit containing it landed on chain)
|
||||
|
||||
publishTs, err := types.TipSetKeyFromBytes(dealInfo.PublishMsgTipSet)
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
|
||||
diff, err := mgr.dpc.diffPreCommits(ctx, provider, publishTs, ts.Key())
|
||||
diff, err := mgr.dpc.diffPreCommits(ctx, provider, dealInfo.PublishMsgTipSet, ts.Key())
|
||||
if err != nil {
|
||||
return false, false, err
|
||||
}
|
||||
@ -142,7 +137,7 @@ func (mgr *SectorCommittedManager) OnDealSectorPreCommitted(ctx context.Context,
|
||||
|
||||
// When there is a reorg, the deal ID may change, so get the
|
||||
// current deal ID from the publish message CID
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key().Bytes(), &proposal, publishCid)
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key(), &proposal, publishCid)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -250,7 +245,7 @@ func (mgr *SectorCommittedManager) OnDealSectorCommitted(ctx context.Context, pr
|
||||
}
|
||||
|
||||
// Get the deal info
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key().Bytes(), &proposal, publishCid)
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key(), &proposal, publishCid)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
||||
}
|
||||
@ -384,7 +379,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) (pipeline.CurrentDealInfo, bool, error) {
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key().Bytes(), proposal, publishCid)
|
||||
res, err := mgr.dealInfo.GetCurrentDealInfo(ctx, ts.Key(), proposal, publishCid)
|
||||
if err != nil {
|
||||
// TODO: This may be fine for some errors
|
||||
return res, false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
||||
|
@ -159,7 +159,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
|
||||
currentDealInfo: pipeline.CurrentDealInfo{
|
||||
DealID: dealID,
|
||||
MarketDeal: slashedDeal,
|
||||
PublishMsgTipSet: nil,
|
||||
PublishMsgTipSet: types.EmptyTSK,
|
||||
},
|
||||
expectedCBCallCount: 0,
|
||||
expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch),
|
||||
@ -574,7 +574,7 @@ type mockDealInfoAPI struct {
|
||||
Err2 error
|
||||
}
|
||||
|
||||
func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tok pipeline.TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.CurrentDealInfo, error) {
|
||||
func (m *mockDealInfoAPI) GetCurrentDealInfo(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (pipeline.CurrentDealInfo, error) {
|
||||
m.count++
|
||||
if m.count == 2 {
|
||||
return m.CurrentDealInfo2, m.Err2
|
||||
|
@ -327,7 +327,7 @@ func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCi
|
||||
return nil, xerrors.Errorf("WaitForPublishDeals failed to get chain head: %w", err)
|
||||
}
|
||||
|
||||
res, err := n.scMgr.dealInfo.GetCurrentDealInfo(ctx, head.Key().Bytes(), &proposal, publishCid)
|
||||
res, err := n.scMgr.dealInfo.GetCurrentDealInfo(ctx, head.Key(), &proposal, publishCid)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("WaitForPublishDeals getting deal info errored: %w", err)
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/paychmgr"
|
||||
"github.com/filecoin-project/lotus/paychmgr/settler"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
// Chain node provides access to the Filecoin blockchain, by setting up a full
|
||||
@ -62,8 +63,8 @@ var ChainNode = Options(
|
||||
Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap),
|
||||
|
||||
// Consensus: crypto dependencies
|
||||
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
||||
Override(new(ffiwrapper.Prover), ffiwrapper.ProofProver),
|
||||
Override(new(storiface.Verifier), ffiwrapper.ProofVerifier),
|
||||
Override(new(storiface.Prover), ffiwrapper.ProofProver),
|
||||
|
||||
// Consensus: LegacyVM
|
||||
Override(new(vm.SyscallBuilder), vm.Syscalls),
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/storedask"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
provider "github.com/filecoin-project/index-provider"
|
||||
storage2 "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -102,9 +101,9 @@ func ConfigStorageMiner(c interface{}) Option {
|
||||
If(!cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
|
||||
|
||||
// Sector storage: Proofs
|
||||
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier),
|
||||
Override(new(ffiwrapper.Prover), ffiwrapper.ProofProver),
|
||||
Override(new(storage2.Prover), From(new(sectorstorage.SectorManager))),
|
||||
Override(new(storiface.Verifier), ffiwrapper.ProofVerifier),
|
||||
Override(new(storiface.Prover), ffiwrapper.ProofProver),
|
||||
Override(new(storiface.ProverPoSt), From(new(sectorstorage.SectorManager))),
|
||||
|
||||
// Sealing (todo should be under EnableSealing, but storagefsm is currently bundled with storage.Miner)
|
||||
Override(new(sealing.SectorIDCounter), modules.SectorIDCounter),
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"go.uber.org/fx"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -21,9 +22,12 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -41,7 +45,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/vm"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
type StateModuleAPI interface {
|
||||
@ -89,7 +93,7 @@ type StateAPI struct {
|
||||
|
||||
StateModuleAPI
|
||||
|
||||
ProofVerifier ffiwrapper.Verifier
|
||||
ProofVerifier storiface.Verifier
|
||||
StateManager *stmgr.StateManager
|
||||
Chain *store.ChainStore
|
||||
Beacon beacon.Schedule
|
||||
@ -756,6 +760,69 @@ func (m *StateModule) StateMarketStorageDeal(ctx context.Context, dealId abi.Dea
|
||||
return stmgr.GetStorageDeal(ctx, m.StateManager, dealId, ts)
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error) {
|
||||
nv, err := a.StateNetworkVersion(ctx, tsk)
|
||||
if err != nil {
|
||||
return cid.Cid{}, err
|
||||
}
|
||||
|
||||
var ccparams []byte
|
||||
if nv < network.Version13 {
|
||||
ccparams, err = actors.SerializeParams(&market2.ComputeDataCommitmentParams{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
})
|
||||
} else {
|
||||
ccparams, err = actors.SerializeParams(&market5.ComputeDataCommitmentParams{
|
||||
Inputs: []*market5.SectorDataSpec{
|
||||
{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("computing params for ComputeDataCommitment: %w", err)
|
||||
}
|
||||
|
||||
ccmt := &types.Message{
|
||||
To: market.Address,
|
||||
From: maddr,
|
||||
Value: types.NewInt(0),
|
||||
Method: market.Methods.ComputeDataCommitment,
|
||||
Params: ccparams,
|
||||
}
|
||||
r, err := a.StateCall(ctx, ccmt, tsk)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("calling ComputeDataCommitment: %w", err)
|
||||
}
|
||||
if r.MsgRct.ExitCode != 0 {
|
||||
return cid.Undef, xerrors.Errorf("receipt for ComputeDataCommitment had exit code %d", r.MsgRct.ExitCode)
|
||||
}
|
||||
|
||||
if nv < network.Version13 {
|
||||
var c cbg.CborCid
|
||||
if err := c.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
}
|
||||
|
||||
return cid.Cid(c), nil
|
||||
}
|
||||
|
||||
var cr market5.ComputeDataCommitmentReturn
|
||||
if err := cr.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
}
|
||||
|
||||
if len(cr.CommDs) != 1 {
|
||||
return cid.Undef, xerrors.Errorf("CommD output must have 1 entry")
|
||||
}
|
||||
|
||||
return cid.Cid(cr.CommDs[0]), nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateChangedActors(ctx context.Context, old cid.Cid, new cid.Cid) (map[string]types.Actor, error) {
|
||||
store := a.Chain.ActorStore(ctx)
|
||||
|
||||
@ -813,20 +880,18 @@ func (a *StateAPI) StateMinerSectorCount(ctx context.Context, addr address.Addre
|
||||
return api.MinerSectors{Live: liveCount, Active: activeCount, Faulty: faultyCount}, nil
|
||||
}
|
||||
|
||||
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
|
||||
if err != nil {
|
||||
return minertypes.SectorPreCommitOnChainInfo{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||
}
|
||||
|
||||
pci, err := stmgr.PreCommitInfo(ctx, a.StateManager, maddr, n, ts)
|
||||
if err != nil {
|
||||
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||
} else if pci == nil {
|
||||
return minertypes.SectorPreCommitOnChainInfo{}, xerrors.Errorf("precommit info is not exists")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return *pci, err
|
||||
return pci, err
|
||||
}
|
||||
|
||||
func (m *StateModule) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) {
|
||||
|
@ -34,7 +34,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
sto "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||
@ -222,7 +221,7 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb
|
||||
return sInfo, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r sto.Data, d api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
so, err := sm.Miner.SectorAddPieceToAny(ctx, size, r, d)
|
||||
if err != nil {
|
||||
// jsonrpc doesn't support returning values with errors, make sure we never do that
|
||||
@ -232,7 +231,7 @@ func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.Unp
|
||||
return so, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector sto.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error {
|
||||
func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error {
|
||||
return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, offset, size, randomness, commd)
|
||||
}
|
||||
|
||||
@ -425,7 +424,7 @@ func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64,
|
||||
return sm.WdPoSt.ComputePoSt(ctx, dlIdx, ts)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData sto.Data) (abi.PieceInfo, error) {
|
||||
func (sm *StorageMinerAPI) ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) {
|
||||
return sm.StorageMgr.DataCid(ctx, pieceSize, pieceData)
|
||||
}
|
||||
|
||||
@ -1224,7 +1223,7 @@ func (sm *StorageMinerAPI) CreateBackup(ctx context.Context, fpath string) error
|
||||
return backup(ctx, sm.DS, fpath)
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []sto.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) {
|
||||
func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) {
|
||||
var rg storiface.RGetter
|
||||
if expensive {
|
||||
rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {
|
||||
|
@ -70,7 +70,7 @@ import (
|
||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
"github.com/filecoin-project/lotus/storage/wdpost"
|
||||
)
|
||||
|
||||
@ -211,8 +211,8 @@ type StorageMinerParams struct {
|
||||
MetadataDS dtypes.MetadataDS
|
||||
Sealer sealer.SectorManager
|
||||
SectorIDCounter sealing.SectorIDCounter
|
||||
Verifier ffiwrapper.Verifier
|
||||
Prover ffiwrapper.Prover
|
||||
Verifier storiface.Verifier
|
||||
Prover storiface.Prover
|
||||
GetSealingConfigFn dtypes.GetSealingConfigFunc
|
||||
Journal journal.Journal
|
||||
AddrSel *ctladdr.AddressSelector
|
||||
|
@ -1,29 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/events"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
)
|
||||
|
||||
var _ sealing.Events = new(EventsAdapter)
|
||||
|
||||
type EventsAdapter struct {
|
||||
delegate *events.Events
|
||||
}
|
||||
|
||||
func NewEventsAdapter(api *events.Events) EventsAdapter {
|
||||
return EventsAdapter{delegate: api}
|
||||
}
|
||||
|
||||
func (e EventsAdapter) ChainAt(hnd sealing.HeightHandler, rev sealing.RevertHandler, confidence int, h abi.ChainEpoch) error {
|
||||
return e.delegate.ChainAt(context.TODO(), func(ctx context.Context, ts *types.TipSet, curH abi.ChainEpoch) error {
|
||||
return hnd(ctx, ts.Key().Bytes(), curH)
|
||||
}, func(ctx context.Context, ts *types.TipSet) error {
|
||||
return rev(ctx, ts.Key().Bytes())
|
||||
}, confidence, h)
|
||||
}
|
@ -1,432 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
)
|
||||
|
||||
var _ pipeline.SealingAPI = new(SealingAPIAdapter)
|
||||
|
||||
type SealingAPIAdapter struct {
|
||||
delegate fullNodeFilteredAPI
|
||||
}
|
||||
|
||||
func NewSealingAPIAdapter(api fullNodeFilteredAPI) SealingAPIAdapter {
|
||||
return SealingAPIAdapter{delegate: api}
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerSectorSize(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (abi.SectorSize, error) {
|
||||
// TODO: update storage-fsm to just StateMinerInfo
|
||||
mi, err := s.StateMinerInfo(ctx, maddr, tok)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return mi.SectorSize, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerPreCommitDepositForPower(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok pipeline.TipSetToken) (big.Int, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerPreCommitDepositForPower(ctx, a, pci, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerInitialPledgeCollateral(ctx context.Context, a address.Address, pci minertypes.SectorPreCommitInfo, tok pipeline.TipSetToken) (big.Int, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerInitialPledgeCollateral(ctx, a, pci, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerInfo(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (api.MinerInfo, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return api.MinerInfo{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
// TODO: update storage-fsm to just StateMinerInfo
|
||||
return s.delegate.StateMinerInfo(ctx, maddr, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (big.Int, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerAvailableBalance(ctx, maddr, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (address.Address, error) {
|
||||
// TODO: update storage-fsm to just StateMinerInfo
|
||||
mi, err := s.StateMinerInfo(ctx, maddr, tok)
|
||||
if err != nil {
|
||||
return address.Undef, err
|
||||
}
|
||||
return mi.Worker, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerDeadlines(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) ([]api.Deadline, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerDeadlines(ctx, maddr, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerSectorAllocated(ctx context.Context, maddr address.Address, sid abi.SectorNumber, tok pipeline.TipSetToken) (bool, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerSectorAllocated(ctx, maddr, sid, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (bitfield.BitField, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
act, err := s.delegate.StateGetActor(ctx, maddr, tsk)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, xerrors.Errorf("getting miner actor: temp error: %+v", err)
|
||||
}
|
||||
|
||||
stor := store.ActorStore(ctx, blockstore.NewAPIBlockstore(s.delegate))
|
||||
|
||||
state, err := miner.Load(stor, act)
|
||||
if err != nil {
|
||||
return bitfield.BitField{}, xerrors.Errorf("loading miner state: %+v", err)
|
||||
}
|
||||
|
||||
return miner.AllPartSectors(state, miner.Partition.ActiveSectors)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateWaitMsg(ctx context.Context, mcid cid.Cid) (pipeline.MsgLookup, error) {
|
||||
wmsg, err := s.delegate.StateWaitMsg(ctx, mcid, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return pipeline.MsgLookup{}, err
|
||||
}
|
||||
|
||||
return pipeline.MsgLookup{
|
||||
Receipt: pipeline.MessageReceipt{
|
||||
ExitCode: wmsg.Receipt.ExitCode,
|
||||
Return: wmsg.Receipt.Return,
|
||||
GasUsed: wmsg.Receipt.GasUsed,
|
||||
},
|
||||
TipSetTok: wmsg.TipSet.Bytes(),
|
||||
Height: wmsg.Height,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateSearchMsg(ctx context.Context, c cid.Cid) (*pipeline.MsgLookup, error) {
|
||||
wmsg, err := s.delegate.StateSearchMsg(ctx, types.EmptyTSK, c, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if wmsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &pipeline.MsgLookup{
|
||||
Receipt: pipeline.MessageReceipt{
|
||||
ExitCode: wmsg.Receipt.ExitCode,
|
||||
Return: wmsg.Receipt.Return,
|
||||
GasUsed: wmsg.Receipt.GasUsed,
|
||||
},
|
||||
TipSetTok: wmsg.TipSet.Bytes(),
|
||||
Height: wmsg.Height,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok pipeline.TipSetToken) (cid.Cid, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
nv, err := s.delegate.StateNetworkVersion(ctx, tsk)
|
||||
if err != nil {
|
||||
return cid.Cid{}, err
|
||||
}
|
||||
|
||||
var ccparams []byte
|
||||
if nv < network.Version13 {
|
||||
ccparams, err = actors.SerializeParams(&market2.ComputeDataCommitmentParams{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
})
|
||||
} else {
|
||||
ccparams, err = actors.SerializeParams(&market5.ComputeDataCommitmentParams{
|
||||
Inputs: []*market5.SectorDataSpec{
|
||||
{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("computing params for ComputeDataCommitment: %w", err)
|
||||
}
|
||||
|
||||
ccmt := &types.Message{
|
||||
To: market.Address,
|
||||
From: maddr,
|
||||
Value: types.NewInt(0),
|
||||
Method: market.Methods.ComputeDataCommitment,
|
||||
Params: ccparams,
|
||||
}
|
||||
r, err := s.delegate.StateCall(ctx, ccmt, tsk)
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("calling ComputeDataCommitment: %w", err)
|
||||
}
|
||||
if r.MsgRct.ExitCode != 0 {
|
||||
return cid.Undef, xerrors.Errorf("receipt for ComputeDataCommitment had exit code %d", r.MsgRct.ExitCode)
|
||||
}
|
||||
|
||||
if nv < network.Version13 {
|
||||
var c cbg.CborCid
|
||||
if err := c.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
}
|
||||
|
||||
return cid.Cid(c), nil
|
||||
}
|
||||
|
||||
var cr market5.ComputeDataCommitmentReturn
|
||||
if err := cr.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
}
|
||||
|
||||
if len(cr.CommDs) != 1 {
|
||||
return cid.Undef, xerrors.Errorf("CommD output must have 1 entry")
|
||||
}
|
||||
|
||||
return cid.Cid(cr.CommDs[0]), nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok pipeline.TipSetToken) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
act, err := s.delegate.StateGetActor(ctx, maddr, tsk)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("handleSealFailed(%d): temp error: %+v", sectorNumber, err)
|
||||
}
|
||||
|
||||
stor := store.ActorStore(ctx, blockstore.NewAPIBlockstore(s.delegate))
|
||||
|
||||
state, err := miner.Load(stor, act)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("handleSealFailed(%d): temp error: loading miner state: %+v", sectorNumber, err)
|
||||
}
|
||||
|
||||
pci, err := state.GetPrecommittedSector(sectorNumber)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if pci == nil {
|
||||
set, err := state.IsAllocated(sectorNumber)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("checking if sector is allocated: %w", err)
|
||||
}
|
||||
if set {
|
||||
return nil, pipeline.ErrSectorAllocated
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return pci, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok pipeline.TipSetToken) (*miner.SectorOnChainInfo, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateSectorGetInfo(ctx, maddr, sectorNumber, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok pipeline.TipSetToken) (*pipeline.SectorLocation, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
l, err := s.delegate.StateSectorPartition(ctx, maddr, sectorNumber, tsk)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if l != nil {
|
||||
return &pipeline.SectorLocation{
|
||||
Deadline: l.Deadline,
|
||||
Partition: l.Partition,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, nil // not found
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerPartitions(ctx context.Context, maddr address.Address, dlIdx uint64, tok pipeline.TipSetToken) ([]api.Partition, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerPartitions(ctx, maddr, dlIdx, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateLookupID(ctx context.Context, addr address.Address, tok pipeline.TipSetToken) (address.Address, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return address.Undef, err
|
||||
}
|
||||
|
||||
return s.delegate.StateLookupID(ctx, addr, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok pipeline.TipSetToken) (*api.MarketDeal, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.delegate.StateMarketStorageDeal(ctx, dealID, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMarketStorageDealProposal(ctx context.Context, dealID abi.DealID, tok pipeline.TipSetToken) (market.DealProposal, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return market.DealProposal{}, err
|
||||
}
|
||||
|
||||
deal, err := s.delegate.StateMarketStorageDeal(ctx, dealID, tsk)
|
||||
if err != nil {
|
||||
return market.DealProposal{}, err
|
||||
}
|
||||
|
||||
return deal.Proposal, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateNetworkVersion(ctx context.Context, tok pipeline.TipSetToken) (network.Version, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return network.VersionMax, err
|
||||
}
|
||||
|
||||
return s.delegate.StateNetworkVersion(ctx, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateMinerProvingDeadline(ctx context.Context, maddr address.Address, tok pipeline.TipSetToken) (*dline.Info, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.delegate.StateMinerProvingDeadline(ctx, maddr, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) {
|
||||
msg := types.Message{
|
||||
To: to,
|
||||
From: from,
|
||||
Value: value,
|
||||
Method: method,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
smsg, err := s.delegate.MpoolPushMessage(ctx, &msg, &api.MessageSendSpec{MaxFee: maxFee})
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
return smsg.Cid(), nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) ChainHead(ctx context.Context) (pipeline.TipSetToken, abi.ChainEpoch, error) {
|
||||
head, err := s.delegate.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
return head.Key().Bytes(), head.Height(), nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) ChainBaseFee(ctx context.Context, tok pipeline.TipSetToken) (abi.TokenAmount, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return big.Zero(), err
|
||||
}
|
||||
|
||||
ts, err := s.delegate.ChainGetTipSet(ctx, tsk)
|
||||
if err != nil {
|
||||
return big.Zero(), err
|
||||
}
|
||||
|
||||
return ts.Blocks()[0].ParentBaseFee, nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error) {
|
||||
return s.delegate.ChainGetMessage(ctx, mc)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok pipeline.TipSetToken) (abi.Randomness, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
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 pipeline.TipSetToken) (abi.Randomness, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.delegate.StateGetRandomnessFromTickets(ctx, personalization, randEpoch, entropy, tsk)
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) ChainReadObj(ctx context.Context, ocid cid.Cid) ([]byte, error) {
|
||||
return s.delegate.ChainReadObj(ctx, ocid)
|
||||
}
|
@ -18,7 +18,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/v1api"
|
||||
@ -34,7 +33,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var log = logging.Logger("storageminer")
|
||||
@ -53,8 +52,8 @@ type Miner struct {
|
||||
sealer sealer.SectorManager
|
||||
ds datastore.Batching
|
||||
sc pipeline.SectorIDCounter
|
||||
verif ffiwrapper.Verifier
|
||||
prover ffiwrapper.Prover
|
||||
verif storiface.Verifier
|
||||
prover storiface.Prover
|
||||
addrSel *ctladdr.AddressSelector
|
||||
|
||||
maddr address.Address
|
||||
@ -82,7 +81,7 @@ type fullNodeFilteredAPI interface {
|
||||
// Call a read only method on actors (no interaction with the chain required)
|
||||
StateCall(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error)
|
||||
StateMinerSectors(context.Context, address.Address, *bitfield.BitField, types.TipSetKey) ([]*miner.SectorOnChainInfo, error)
|
||||
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error)
|
||||
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*lminer.SectorLocation, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||
@ -102,6 +101,7 @@ type fullNodeFilteredAPI interface {
|
||||
StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
|
||||
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
|
||||
StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error)
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
@ -135,8 +135,8 @@ func NewMiner(api fullNodeFilteredAPI,
|
||||
ds datastore.Batching,
|
||||
sealer sealer.SectorManager,
|
||||
sc pipeline.SectorIDCounter,
|
||||
verif ffiwrapper.Verifier,
|
||||
prover ffiwrapper.Prover,
|
||||
verif storiface.Verifier,
|
||||
prover storiface.Prover,
|
||||
gsd dtypes.GetSealingConfigFunc,
|
||||
feeCfg config.MinerFeeConfig,
|
||||
journal journal.Journal,
|
||||
@ -176,19 +176,12 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to subscribe to events: %w", err)
|
||||
}
|
||||
evtsAdapter := NewEventsAdapter(evts)
|
||||
|
||||
// Create a shim to glue the API required by the sealing component
|
||||
// with the API that Lotus is capable of providing.
|
||||
// The shim translates between "tipset tokens" and tipset keys, and
|
||||
// provides extra methods.
|
||||
adaptedAPI := NewSealingAPIAdapter(m.api)
|
||||
|
||||
// Instantiate a precommit policy.
|
||||
cfg := pipeline.GetSealingConfigFunc(m.getSealConfig)
|
||||
provingBuffer := md.WPoStProvingPeriod * 2
|
||||
|
||||
pcp := pipeline.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer)
|
||||
pcp := pipeline.NewBasicPreCommitPolicy(m.api, cfg, provingBuffer)
|
||||
|
||||
// address selector.
|
||||
as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
|
||||
@ -196,7 +189,7 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Instantiate the sealing FSM.
|
||||
m.sealing = pipeline.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 = pipeline.New(ctx, m.api, m.feeCfg, evts, m.maddr, m.ds, m.sealer, m.sc, m.verif, m.prover, &pcp, cfg, m.handleSealingNotifications, as)
|
||||
|
||||
// Run the sealing FSM.
|
||||
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function
|
||||
@ -246,13 +239,13 @@ func (m *Miner) runPreflightChecks(ctx context.Context) error {
|
||||
}
|
||||
|
||||
type StorageWpp struct {
|
||||
prover storage.Prover
|
||||
verifier ffiwrapper.Verifier
|
||||
prover storiface.ProverPoSt
|
||||
verifier storiface.Verifier
|
||||
miner abi.ActorID
|
||||
winnRpt abi.RegisteredPoStProof
|
||||
}
|
||||
|
||||
func NewWinningPoStProver(api v1api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
||||
func NewWinningPoStProver(api v1api.FullNode, prover storiface.ProverPoSt, verifier storiface.Verifier, miner dtypes.MinerID) (*StorageWpp, error) {
|
||||
ma, err := address.NewIDAddress(uint64(miner))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -9,11 +9,11 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
"github.com/filecoin-project/lotus/storage/sectorblocks"
|
||||
)
|
||||
|
||||
@ -31,7 +31,7 @@ func (m *Miner) ListSectors() ([]pipeline.SectorInfo, error) {
|
||||
return m.sealing.ListSectors()
|
||||
}
|
||||
|
||||
func (m *Miner) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
|
||||
func (m *Miner) PledgeSector(ctx context.Context) (storiface.SectorRef, error) {
|
||||
return m.sealing.PledgeSector(ctx)
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ func (m *Miner) SectorAbortUpgrade(sectorNum abi.SectorNumber) error {
|
||||
return m.sealing.AbortUpgrade(sectorNum)
|
||||
}
|
||||
|
||||
func (m *Miner) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storage.Data, d api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
func (m *Miner) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
return m.sealing.SectorAddPieceToAny(ctx, size, r, d)
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/partialfile"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -105,7 +104,7 @@ func (handler *FetchHandler) remoteGetSector(w http.ResponseWriter, r *http.Requ
|
||||
|
||||
// The caller has a lock on this sector already, no need to get one here
|
||||
// passing 0 spt because we don't allocate anything
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: id,
|
||||
ProofType: 0,
|
||||
}
|
||||
@ -238,7 +237,7 @@ func (handler *FetchHandler) remoteGetAllocated(w http.ResponseWriter, r *http.R
|
||||
// The caller has a lock on this sector already, no need to get one here
|
||||
|
||||
// passing 0 spt because we don't allocate anything
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: id,
|
||||
ProofType: 0,
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/paths/mocks"
|
||||
@ -26,7 +25,7 @@ func TestRemoteGetAllocated(t *testing.T) {
|
||||
|
||||
emptyPartialFile := &partialfile.PartialFile{}
|
||||
pfPath := "path"
|
||||
expectedSectorRef := storage.SectorRef{
|
||||
expectedSectorRef := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 123,
|
||||
Number: 123,
|
||||
@ -255,7 +254,7 @@ func TestRemoteGetSector(t *testing.T) {
|
||||
|
||||
validSectorName := fmt.Sprintf("s-t0%d-%d", 123, 123)
|
||||
validSectorFileType := storiface.FTUnsealed.String()
|
||||
expectedSectorRef := storage.SectorRef{
|
||||
expectedSectorRef := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 123,
|
||||
Number: 123,
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/partialfile"
|
||||
@ -34,7 +33,7 @@ type PartialFileHandler interface {
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/store.go -package=mocks . Store
|
||||
|
||||
type Store interface {
|
||||
AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (paths storiface.SectorPaths, stores storiface.SectorPaths, err error)
|
||||
AcquireSector(ctx context.Context, s storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (paths storiface.SectorPaths, stores storiface.SectorPaths, err error)
|
||||
Remove(ctx context.Context, s abi.SectorID, types storiface.SectorFileType, force bool, keepIn []storiface.ID) error
|
||||
|
||||
// like remove, but doesn't remove the primary sector copy, nor the last
|
||||
@ -42,11 +41,11 @@ type Store interface {
|
||||
RemoveCopies(ctx context.Context, s abi.SectorID, types storiface.SectorFileType) error
|
||||
|
||||
// move sectors into storage
|
||||
MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error
|
||||
MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error
|
||||
|
||||
FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error)
|
||||
|
||||
Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error)
|
||||
Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error)
|
||||
|
||||
GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error)
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import (
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -369,7 +368,7 @@ func (st *Local) reportStorage(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) {
|
||||
func (st *Local) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) {
|
||||
ssize, err := sid.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -430,7 +429,7 @@ func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storifac
|
||||
return done, nil
|
||||
}
|
||||
|
||||
func (st *Local) AcquireSector(ctx context.Context, sid storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
func (st *Local) AcquireSector(ctx context.Context, sid storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
if existing|allocate != existing^allocate {
|
||||
return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector")
|
||||
}
|
||||
@ -645,7 +644,7 @@ func (st *Local) removeSector(ctx context.Context, sid abi.SectorID, typ storifa
|
||||
return nil
|
||||
}
|
||||
|
||||
func (st *Local) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error {
|
||||
func (st *Local) MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error {
|
||||
dest, destIds, err := st.AcquireSector(ctx, s, storiface.FTNone, types, storiface.PathStorage, storiface.AcquireMove)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("acquire dest storage: %w", err)
|
||||
@ -717,7 +716,7 @@ func (st *Local) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er
|
||||
}
|
||||
|
||||
func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error) {
|
||||
sr := storage.SectorRef{
|
||||
sr := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: minerID,
|
||||
Number: si.SectorNumber,
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
storage "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
fsutil "github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
storiface "github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -41,7 +40,7 @@ func (m *MockStore) EXPECT() *MockStoreMockRecorder {
|
||||
}
|
||||
|
||||
// AcquireSector mocks base method.
|
||||
func (m *MockStore) AcquireSector(arg0 context.Context, arg1 storage.SectorRef, arg2, arg3 storiface.SectorFileType, arg4 storiface.PathType, arg5 storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
func (m *MockStore) AcquireSector(arg0 context.Context, arg1 storiface.SectorRef, arg2, arg3 storiface.SectorFileType, arg4 storiface.PathType, arg5 storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "AcquireSector", arg0, arg1, arg2, arg3, arg4, arg5)
|
||||
ret0, _ := ret[0].(storiface.SectorPaths)
|
||||
@ -87,7 +86,7 @@ func (mr *MockStoreMockRecorder) GenerateSingleVanillaProof(arg0, arg1, arg2, ar
|
||||
}
|
||||
|
||||
// MoveStorage mocks base method.
|
||||
func (m *MockStore) MoveStorage(arg0 context.Context, arg1 storage.SectorRef, arg2 storiface.SectorFileType) error {
|
||||
func (m *MockStore) MoveStorage(arg0 context.Context, arg1 storiface.SectorRef, arg2 storiface.SectorFileType) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "MoveStorage", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(error)
|
||||
@ -129,7 +128,7 @@ func (mr *MockStoreMockRecorder) RemoveCopies(arg0, arg1, arg2 interface{}) *gom
|
||||
}
|
||||
|
||||
// Reserve mocks base method.
|
||||
func (m *MockStore) Reserve(arg0 context.Context, arg1 storage.SectorRef, arg2 storiface.SectorFileType, arg3 storiface.SectorPaths, arg4 map[storiface.SectorFileType]int) (func(), error) {
|
||||
func (m *MockStore) Reserve(arg0 context.Context, arg1 storiface.SectorRef, arg2 storiface.SectorFileType, arg3 storiface.SectorPaths, arg4 map[storiface.SectorFileType]int) (func(), error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Reserve", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(func())
|
||||
|
@ -21,7 +21,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -90,7 +89,7 @@ func NewRemote(local Store, index SectorIndex, auth http.Header, fetchLimit int,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Remote) AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
func (r *Remote) AcquireSector(ctx context.Context, s storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) {
|
||||
if existing|allocate != existing^allocate {
|
||||
return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector")
|
||||
}
|
||||
@ -354,7 +353,7 @@ func (r *Remote) checkAllocated(ctx context.Context, url string, spt abi.Registe
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Remote) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error {
|
||||
func (r *Remote) MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error {
|
||||
// Make sure we have the data local
|
||||
_, _, err := r.AcquireSector(ctx, s, types, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
|
||||
if err != nil {
|
||||
@ -529,7 +528,7 @@ func (r *Remote) readRemote(ctx context.Context, url string, offset, size abi.Pa
|
||||
// CheckIsUnsealed checks if we have an unsealed piece at the given offset in an already unsealed sector file for the given piece
|
||||
// either locally or on any of the workers.
|
||||
// Returns true if we have the unsealed piece, false otherwise.
|
||||
func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (bool, error) {
|
||||
func (r *Remote) CheckIsUnsealed(ctx context.Context, s storiface.SectorRef, offset, size abi.PaddedPieceSize) (bool, error) {
|
||||
ft := storiface.FTUnsealed
|
||||
|
||||
paths, _, err := r.local.AcquireSector(ctx, s, ft, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
|
||||
@ -616,7 +615,7 @@ func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offse
|
||||
// 1. no worker(local worker included) has an unsealed file for the given sector OR
|
||||
// 2. no worker(local worker included) has the unsealed piece in their unsealed sector file.
|
||||
// Will return a nil reader and a nil error in such a case.
|
||||
func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), error) {
|
||||
func (r *Remote) Reader(ctx context.Context, s storiface.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), error) {
|
||||
ft := storiface.FTUnsealed
|
||||
|
||||
// check if we have the unsealed sector file locally
|
||||
@ -762,7 +761,7 @@ func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size a
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (r *Remote) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) {
|
||||
func (r *Remote) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) {
|
||||
log.Warnf("reserve called on remote store, sectorID: %v", sid.ID)
|
||||
return func() {
|
||||
|
||||
|
@ -21,7 +21,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
@ -117,7 +116,7 @@ func TestMoveShared(t *testing.T) {
|
||||
|
||||
// add a sealed replica file to the sealing (non-shared) path
|
||||
|
||||
s1ref := storage.SectorRef{
|
||||
s1ref := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 12,
|
||||
Number: 1,
|
||||
@ -162,7 +161,7 @@ func TestReader(t *testing.T) {
|
||||
|
||||
ft := storiface.FTUnsealed
|
||||
|
||||
sectorRef := storage.SectorRef{
|
||||
sectorRef := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 123,
|
||||
Number: 123,
|
||||
@ -519,7 +518,7 @@ func TestCheckIsUnsealed(t *testing.T) {
|
||||
ft := storiface.FTUnsealed
|
||||
emptyPartialFile := &partialfile.PartialFile{}
|
||||
|
||||
sectorRef := storage.SectorRef{
|
||||
sectorRef := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 123,
|
||||
Number: 123,
|
||||
@ -789,7 +788,7 @@ func TestCheckIsUnsealed(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func mockSectorAcquire(l *mocks.MockStore, sectorRef storage.SectorRef, pfPath string, err error) {
|
||||
func mockSectorAcquire(l *mocks.MockStore, sectorRef storiface.SectorRef, pfPath string, err error) {
|
||||
l.EXPECT().AcquireSector(gomock.Any(), sectorRef, storiface.FTUnsealed,
|
||||
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
|
||||
Unsealed: pfPath,
|
||||
|
@ -312,7 +312,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// t.PreCommit1Out (storage.PreCommit1Out) (slice)
|
||||
// t.PreCommit1Out (storiface.PreCommit1Out) (slice)
|
||||
if len("PreCommit1Out") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long")
|
||||
}
|
||||
@ -458,7 +458,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// t.PreCommitTipSet (sealing.TipSetToken) (slice)
|
||||
// t.PreCommitTipSet (types.TipSetKey) (struct)
|
||||
if len("PreCommitTipSet") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long")
|
||||
}
|
||||
@ -470,15 +470,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(t.PreCommitTipSet) > cbg.ByteArrayMaxLen {
|
||||
return xerrors.Errorf("Byte array in field t.PreCommitTipSet was too long")
|
||||
}
|
||||
|
||||
if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.PreCommitTipSet))); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := cw.Write(t.PreCommitTipSet[:]); err != nil {
|
||||
if err := t.PreCommitTipSet.MarshalCBOR(cw); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -667,7 +659,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
|
||||
}
|
||||
}
|
||||
|
||||
// t.ReplicaUpdateProof (storage.ReplicaUpdateProof) (slice)
|
||||
// t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice)
|
||||
if len("ReplicaUpdateProof") > cbg.MaxLength {
|
||||
return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long")
|
||||
}
|
||||
@ -1046,7 +1038,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) {
|
||||
|
||||
t.TicketEpoch = abi.ChainEpoch(extraI)
|
||||
}
|
||||
// t.PreCommit1Out (storage.PreCommit1Out) (slice)
|
||||
// t.PreCommit1Out (storiface.PreCommit1Out) (slice)
|
||||
case "PreCommit1Out":
|
||||
|
||||
maj, extra, err = cr.ReadHeader()
|
||||
@ -1189,27 +1181,15 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) {
|
||||
}
|
||||
|
||||
}
|
||||
// t.PreCommitTipSet (sealing.TipSetToken) (slice)
|
||||
// t.PreCommitTipSet (types.TipSetKey) (struct)
|
||||
case "PreCommitTipSet":
|
||||
|
||||
maj, extra, err = cr.ReadHeader()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
{
|
||||
|
||||
if extra > cbg.ByteArrayMaxLen {
|
||||
return fmt.Errorf("t.PreCommitTipSet: byte array too large (%d)", extra)
|
||||
}
|
||||
if maj != cbg.MajByteString {
|
||||
return fmt.Errorf("expected byte array")
|
||||
}
|
||||
if err := t.PreCommitTipSet.UnmarshalCBOR(cr); err != nil {
|
||||
return xerrors.Errorf("unmarshaling t.PreCommitTipSet: %w", err)
|
||||
}
|
||||
|
||||
if extra > 0 {
|
||||
t.PreCommitTipSet = make([]uint8, extra)
|
||||
}
|
||||
|
||||
if _, err := io.ReadFull(cr, t.PreCommitTipSet[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
// t.PreCommit2Fails (uint64) (uint64)
|
||||
case "PreCommit2Fails":
|
||||
@ -1406,7 +1386,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) {
|
||||
}
|
||||
|
||||
}
|
||||
// t.ReplicaUpdateProof (storage.ReplicaUpdateProof) (slice)
|
||||
// t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice)
|
||||
case "ReplicaUpdateProof":
|
||||
|
||||
maj, extra, err = cr.ReadHeader()
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
// TODO: For now we handle this by halting state execution, when we get jsonrpc reconnecting
|
||||
@ -39,7 +40,7 @@ type ErrBadRU struct{ error }
|
||||
type ErrBadPR struct{ error }
|
||||
|
||||
func checkPieces(ctx context.Context, maddr address.Address, si SectorInfo, api SealingAPI, mustHaveDeals bool) error {
|
||||
tok, height, err := api.ChainHead(ctx)
|
||||
ts, err := api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return &ErrApi{xerrors.Errorf("getting chain head: %w", err)}
|
||||
}
|
||||
@ -59,25 +60,25 @@ func checkPieces(ctx context.Context, maddr address.Address, si SectorInfo, api
|
||||
|
||||
dealCount++
|
||||
|
||||
proposal, err := api.StateMarketStorageDealProposal(ctx, p.DealInfo.DealID, tok)
|
||||
deal, err := api.StateMarketStorageDeal(ctx, p.DealInfo.DealID, ts.Key())
|
||||
if err != nil {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("getting deal %d for piece %d: %w", p.DealInfo.DealID, i, err)}
|
||||
}
|
||||
|
||||
if proposal.Provider != maddr {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with wrong provider: %s != %s", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, proposal.Provider, maddr)}
|
||||
if deal.Proposal.Provider != maddr {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with wrong provider: %s != %s", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, deal.Proposal.Provider, maddr)}
|
||||
}
|
||||
|
||||
if proposal.PieceCID != p.Piece.PieceCID {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with wrong PieceCID: %s != %s", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, p.Piece.PieceCID, proposal.PieceCID)}
|
||||
if deal.Proposal.PieceCID != p.Piece.PieceCID {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with wrong PieceCID: %s != %s", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, p.Piece.PieceCID, deal.Proposal.PieceCID)}
|
||||
}
|
||||
|
||||
if p.Piece.Size != proposal.PieceSize {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with different size: %d != %d", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, p.Piece.Size, proposal.PieceSize)}
|
||||
if p.Piece.Size != deal.Proposal.PieceSize {
|
||||
return &ErrInvalidDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers deal %d with different size: %d != %d", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, p.Piece.Size, deal.Proposal.PieceSize)}
|
||||
}
|
||||
|
||||
if height >= proposal.StartEpoch {
|
||||
return &ErrExpiredDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, proposal.StartEpoch, height)}
|
||||
if ts.Height() >= deal.Proposal.StartEpoch {
|
||||
return &ErrExpiredDeals{xerrors.Errorf("piece %d (of %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(si.Pieces), si.SectorNumber, p.DealInfo.DealID, deal.Proposal.StartEpoch, ts.Height())}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,12 +91,12 @@ func checkPieces(ctx context.Context, maddr address.Address, si SectorInfo, api
|
||||
|
||||
// checkPrecommit checks that data commitment generated in the sealing process
|
||||
// matches pieces, and that the seal ticket isn't expired
|
||||
func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, tok TipSetToken, height abi.ChainEpoch, api SealingAPI) (err error) {
|
||||
func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, tsk types.TipSetKey, height abi.ChainEpoch, api SealingAPI) (err error) {
|
||||
if err := checkPieces(ctx, maddr, si, api, false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
commD, err := api.StateComputeDataCommitment(ctx, maddr, si.SectorType, si.dealIDs(), tok)
|
||||
commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
|
||||
if err != nil {
|
||||
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
|
||||
}
|
||||
@ -104,12 +105,8 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
|
||||
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
|
||||
}
|
||||
|
||||
pci, err := api.StateSectorPreCommitInfo(ctx, maddr, si.SectorNumber, tok)
|
||||
pci, err := api.StateSectorPreCommitInfo(ctx, maddr, si.SectorNumber, tsk)
|
||||
if err != nil {
|
||||
if err == ErrSectorAllocated {
|
||||
//committed P2 message but commit C2 message too late, pci should be null in this case
|
||||
return &ErrSectorNumberAllocated{err}
|
||||
}
|
||||
return &ErrApi{xerrors.Errorf("getting precommit info: %w", err)}
|
||||
}
|
||||
|
||||
@ -121,6 +118,15 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
|
||||
return &ErrPrecommitOnChain{xerrors.Errorf("precommit already on chain")}
|
||||
}
|
||||
|
||||
alloc, err := api.StateMinerSectorAllocated(ctx, maddr, si.SectorNumber, tsk)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("checking if sector is allocated: %w", err)
|
||||
}
|
||||
if alloc {
|
||||
//committed P2 message but commit C2 message too late, pci should be null in this case
|
||||
return &ErrSectorNumberAllocated{xerrors.Errorf("sector %d is allocated, but PreCommit info wasn't found on chain", si.SectorNumber)}
|
||||
}
|
||||
|
||||
//never commit P2 message before, check ticket expiration
|
||||
ticketEarliest := height - policy.MaxPreCommitRandomnessLookback
|
||||
|
||||
@ -130,27 +136,32 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte, tok TipSetToken) (err error) {
|
||||
func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte, tsk types.TipSetKey) (err error) {
|
||||
if si.SeedEpoch == 0 {
|
||||
return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")}
|
||||
}
|
||||
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tok)
|
||||
if err == ErrSectorAllocated {
|
||||
// not much more we can check here, basically try to wait for commit,
|
||||
// and hope that this will work
|
||||
|
||||
if si.CommitMessage != nil {
|
||||
return &ErrCommitWaitFailed{err}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tsk)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
|
||||
if pci == nil {
|
||||
alloc, err := m.Api.StateMinerSectorAllocated(ctx, m.maddr, si.SectorNumber, tsk)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("checking if sector is allocated: %w", err)
|
||||
}
|
||||
if alloc {
|
||||
// not much more we can check here, basically try to wait for commit,
|
||||
// and hope that this will work
|
||||
|
||||
if si.CommitMessage != nil {
|
||||
return &ErrCommitWaitFailed{err}
|
||||
}
|
||||
|
||||
return xerrors.Errorf("sector %d is allocated, but PreCommit info wasn't found on chain", si.SectorNumber)
|
||||
}
|
||||
|
||||
return &ErrNoPrecommit{xerrors.Errorf("precommit info not found on-chain")}
|
||||
}
|
||||
|
||||
@ -163,7 +174,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
|
||||
return err
|
||||
}
|
||||
|
||||
seed, err := m.Api.StateGetRandomnessFromBeacon(ctx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, si.SeedEpoch, buf.Bytes(), tok)
|
||||
seed, err := m.Api.StateGetRandomnessFromBeacon(ctx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, si.SeedEpoch, buf.Bytes(), tsk)
|
||||
if err != nil {
|
||||
return &ErrApi{xerrors.Errorf("failed to get randomness for computing seal proof: %w", err)}
|
||||
}
|
||||
@ -200,7 +211,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
|
||||
}
|
||||
|
||||
// check that sector info is good after running a replica update
|
||||
func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInfo, tok TipSetToken, api SealingAPI) error {
|
||||
func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInfo, tsk types.TipSetKey, api SealingAPI) error {
|
||||
|
||||
if err := checkPieces(ctx, maddr, si, api, true); err != nil {
|
||||
return err
|
||||
@ -209,7 +220,7 @@ func checkReplicaUpdate(ctx context.Context, maddr address.Address, si SectorInf
|
||||
return xerrors.Errorf("replica update on sector not marked for update")
|
||||
}
|
||||
|
||||
commD, err := api.StateComputeDataCommitment(ctx, maddr, si.SectorType, si.dealIDs(), tok)
|
||||
commD, err := api.StateComputeDataCID(ctx, maddr, si.SectorType, si.dealIDs(), tsk)
|
||||
if err != nil {
|
||||
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var aggFeeNum = big.NewInt(110)
|
||||
@ -35,15 +35,14 @@ var aggFeeDen = big.NewInt(100)
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_commit_batcher.go -package=mocks . CommitBatcherApi
|
||||
|
||||
type CommitBatcherApi interface {
|
||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
|
||||
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error)
|
||||
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error)
|
||||
ChainBaseFee(context.Context, TipSetToken) (abi.TokenAmount, error)
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||
ChainHead(ctx context.Context) (*types.TipSet, error)
|
||||
|
||||
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error)
|
||||
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error)
|
||||
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
|
||||
StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
|
||||
}
|
||||
|
||||
type AggregateInput struct {
|
||||
@ -59,7 +58,7 @@ type CommitBatcher struct {
|
||||
addrSel AddrSel
|
||||
feeCfg config.MinerFeeConfig
|
||||
getConfig GetSealingConfigFunc
|
||||
prover ffiwrapper.Prover
|
||||
prover storiface.Prover
|
||||
|
||||
cutoffs map[abi.SectorNumber]time.Time
|
||||
todo map[abi.SectorNumber]AggregateInput
|
||||
@ -70,7 +69,7 @@ type CommitBatcher struct {
|
||||
lk sync.Mutex
|
||||
}
|
||||
|
||||
func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBatcherApi, addrSel AddrSel, feeCfg config.MinerFeeConfig, getConfig GetSealingConfigFunc, prov ffiwrapper.Prover) *CommitBatcher {
|
||||
func NewCommitBatcher(mctx context.Context, maddr address.Address, api CommitBatcherApi, addrSel AddrSel, feeCfg config.MinerFeeConfig, getConfig GetSealingConfigFunc, prov storiface.Prover) *CommitBatcher {
|
||||
b := &CommitBatcher{
|
||||
api: api,
|
||||
maddr: maddr,
|
||||
@ -204,14 +203,14 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
|
||||
|
||||
var res []sealiface.CommitBatchRes
|
||||
|
||||
tok, h, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
blackedOut := func() bool {
|
||||
const nv16BlackoutWindow = abi.ChainEpoch(20) // a magik number
|
||||
if h <= build.UpgradeSkyrHeight && build.UpgradeSkyrHeight-h < nv16BlackoutWindow {
|
||||
if ts.Height() <= build.UpgradeSkyrHeight && build.UpgradeSkyrHeight-ts.Height() < nv16BlackoutWindow {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -220,13 +219,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
|
||||
individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut()
|
||||
|
||||
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) {
|
||||
|
||||
bf, err := b.api.ChainBaseFee(b.mctx, tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get base fee: %w", err)
|
||||
}
|
||||
|
||||
if bf.LessThan(cfg.AggregateAboveBaseFee) {
|
||||
if ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.AggregateAboveBaseFee) {
|
||||
individual = true
|
||||
}
|
||||
}
|
||||
@ -265,7 +258,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBatchRes, error) {
|
||||
tok, _, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -292,7 +285,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
|
||||
|
||||
res.Sectors = append(res.Sectors, id)
|
||||
|
||||
sc, err := b.getSectorCollateral(id, tok)
|
||||
sc, err := b.getSectorCollateral(id, ts.Key())
|
||||
if err != nil {
|
||||
res.FailedSectors[id] = err.Error()
|
||||
continue
|
||||
@ -321,7 +314,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting miner id: %w", err)
|
||||
}
|
||||
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, tok)
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("getting network version: %s", err)
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting network version: %s", err)
|
||||
@ -347,19 +340,14 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
|
||||
return []sealiface.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, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err)
|
||||
}
|
||||
|
||||
maxFee := b.feeCfg.MaxCommitBatchGasFee.FeeForSectors(len(infos))
|
||||
|
||||
bf, err := b.api.ChainBaseFee(b.mctx, tok)
|
||||
if err != nil {
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get base fee: %w", err)
|
||||
}
|
||||
|
||||
aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), bf)
|
||||
aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), ts.MinTicketBlock().ParentBaseFee)
|
||||
if err != nil {
|
||||
log.Errorf("getting aggregate commit network fee: %s", err)
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate commit network fee: %s", err)
|
||||
@ -380,7 +368,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
|
||||
return []sealiface.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 := sendMsg(b.mctx, b.api, from, b.maddr, builtin.MethodsMiner.ProveCommitAggregate, needFunds, maxFee, enc.Bytes())
|
||||
if err != nil {
|
||||
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err)
|
||||
}
|
||||
@ -393,7 +381,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.CommitBatchRes, error) {
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get miner info: %w", err)
|
||||
}
|
||||
@ -401,7 +389,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
|
||||
avail := types.TotalFilecoinInt
|
||||
|
||||
if cfg.CollateralFromMinerBalance && !cfg.DisableCollateralFallback {
|
||||
avail, err = b.api.StateMinerAvailableBalance(b.mctx, b.maddr, nil)
|
||||
avail, err = b.api.StateMinerAvailableBalance(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting available miner balance: %w", err)
|
||||
}
|
||||
@ -412,7 +400,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
|
||||
}
|
||||
}
|
||||
|
||||
tok, _, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -425,7 +413,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
|
||||
FailedSectors: map[abi.SectorNumber]string{},
|
||||
}
|
||||
|
||||
mcid, err := b.processSingle(cfg, mi, &avail, sn, info, tok)
|
||||
mcid, err := b.processSingle(cfg, mi, &avail, sn, info, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("process single error: %+v", err) // todo: return to user
|
||||
r.FailedSectors[sn] = err.Error()
|
||||
@ -439,7 +427,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tok TipSetToken) (cid.Cid, error) {
|
||||
func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tsk types.TipSetKey) (cid.Cid, error) {
|
||||
enc := new(bytes.Buffer)
|
||||
params := &miner.ProveCommitSectorParams{
|
||||
SectorNumber: sn,
|
||||
@ -450,7 +438,7 @@ func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, av
|
||||
return cid.Undef, xerrors.Errorf("marshaling commit params: %w", err)
|
||||
}
|
||||
|
||||
collateral, err := b.getSectorCollateral(sn, tok)
|
||||
collateral, err := b.getSectorCollateral(sn, tsk)
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
@ -475,7 +463,7 @@ func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, av
|
||||
return cid.Undef, xerrors.Errorf("no good address to send commit message from: %w", err)
|
||||
}
|
||||
|
||||
mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, big.Int(b.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(b.mctx, b.api, from, b.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, big.Int(b.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("pushing message to mpool: %w", err)
|
||||
}
|
||||
@ -569,18 +557,18 @@ func (b *CommitBatcher) Stop(ctx context.Context) error {
|
||||
|
||||
// TODO: If this returned epochs, it would make testing much easier
|
||||
func (b *CommitBatcher) getCommitCutoff(si SectorInfo) (time.Time, error) {
|
||||
tok, curEpoch, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
return time.Now(), xerrors.Errorf("getting chain head: %s", err)
|
||||
}
|
||||
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, tok)
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("getting network version: %s", err)
|
||||
return time.Now(), xerrors.Errorf("getting network version: %s", err)
|
||||
}
|
||||
|
||||
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, si.SectorNumber, tok)
|
||||
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, si.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("getting precommit info: %s", err)
|
||||
return time.Now(), err
|
||||
@ -609,15 +597,15 @@ func (b *CommitBatcher) getCommitCutoff(si SectorInfo) (time.Time, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if cutoffEpoch <= curEpoch {
|
||||
if cutoffEpoch <= ts.Height() {
|
||||
return time.Now(), nil
|
||||
}
|
||||
|
||||
return time.Now().Add(time.Duration(cutoffEpoch-curEpoch) * time.Duration(build.BlockDelaySecs) * time.Second), nil
|
||||
return time.Now().Add(time.Duration(cutoffEpoch-ts.Height()) * time.Duration(build.BlockDelaySecs) * time.Second), nil
|
||||
}
|
||||
|
||||
func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tok TipSetToken) (abi.TokenAmount, error) {
|
||||
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tok)
|
||||
func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tsk types.TipSetKey) (abi.TokenAmount, error) {
|
||||
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tsk)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
@ -625,7 +613,7 @@ func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tok TipSetToken
|
||||
return big.Zero(), xerrors.Errorf("precommit info not found on chain")
|
||||
}
|
||||
|
||||
collateral, err := b.api.StateMinerInitialPledgeCollateral(b.mctx, b.maddr, pci.Info, tok)
|
||||
collateral, err := b.api.StateMinerInitialPledgeCollateral(b.mctx, b.maddr, pci.Info, tsk)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("getting initial pledge collateral: %w", err)
|
||||
}
|
||||
|
@ -10,12 +10,14 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
||||
@ -25,7 +27,7 @@ import (
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/mocks"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func TestCommitBatcher(t *testing.T) {
|
||||
@ -94,7 +96,7 @@ func TestCommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
addSector := func(sn abi.SectorNumber) action {
|
||||
addSector := func(sn abi.SectorNumber, aboveBalancer bool) action {
|
||||
return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *pipeline.CommitBatcher) promise {
|
||||
var pcres sealiface.CommitBatchRes
|
||||
var pcerr error
|
||||
@ -105,7 +107,12 @@ func TestCommitBatcher(t *testing.T) {
|
||||
SectorNumber: sn,
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
basefee := types.PicoFil
|
||||
if aboveBalancer {
|
||||
basefee = types.NanoFil
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil)
|
||||
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version13, nil)
|
||||
s.EXPECT().StateSectorPreCommitInfo(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&minertypes.SectorPreCommitOnChainInfo{
|
||||
PreCommitDeposit: big.Zero(),
|
||||
@ -129,10 +136,10 @@ func TestCommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
addSectors := func(sectors []abi.SectorNumber) action {
|
||||
addSectors := func(sectors []abi.SectorNumber, aboveBalancer bool) action {
|
||||
as := make([]action, len(sectors))
|
||||
for i, sector := range sectors {
|
||||
as[i] = addSector(sector)
|
||||
as[i] = addSector(sector, aboveBalancer)
|
||||
}
|
||||
return actions(as...)
|
||||
}
|
||||
@ -166,17 +173,17 @@ func TestCommitBatcher(t *testing.T) {
|
||||
basefee = types.NanoFil
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
if batch {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil)
|
||||
/*if batch {
|
||||
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(basefee, nil)
|
||||
}
|
||||
}*/
|
||||
|
||||
if !aboveBalancer {
|
||||
batch = false
|
||||
ti = len(expect)
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil)
|
||||
|
||||
pciC := len(expect)
|
||||
if failOnePCI {
|
||||
@ -193,14 +200,14 @@ func TestCommitBatcher(t *testing.T) {
|
||||
|
||||
if batch {
|
||||
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version13, nil)
|
||||
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(basefee, nil)
|
||||
//s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(basefee, nil)
|
||||
}
|
||||
|
||||
s.EXPECT().SendMsg(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.([]byte)
|
||||
s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.(*types.Message)
|
||||
if batch {
|
||||
var params miner5.ProveCommitAggregateParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b)))
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params)))
|
||||
for _, number := range expect {
|
||||
set, err := params.SectorNumbers.IsSet(uint64(number))
|
||||
require.NoError(t, err)
|
||||
@ -208,10 +215,10 @@ func TestCommitBatcher(t *testing.T) {
|
||||
}
|
||||
} else {
|
||||
var params miner5.ProveCommitSectorParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b)))
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params)))
|
||||
}
|
||||
return true
|
||||
})).Times(ti)
|
||||
}), gomock.Any()).Return(dummySmsg, nil).Times(ti)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -276,21 +283,21 @@ func TestCommitBatcher(t *testing.T) {
|
||||
}{
|
||||
"addSingle-aboveBalancer": {
|
||||
actions: []action{
|
||||
addSector(0),
|
||||
addSector(0, true),
|
||||
waitPending(1),
|
||||
flush([]abi.SectorNumber{0}, true, false),
|
||||
},
|
||||
},
|
||||
"addTwo-aboveBalancer": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(2)),
|
||||
addSectors(getSectors(2), true),
|
||||
waitPending(2),
|
||||
flush(getSectors(2), true, false),
|
||||
},
|
||||
},
|
||||
"addAte-aboveBalancer": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(8)),
|
||||
addSectors(getSectors(8), true),
|
||||
waitPending(8),
|
||||
flush(getSectors(8), true, false),
|
||||
},
|
||||
@ -298,26 +305,26 @@ func TestCommitBatcher(t *testing.T) {
|
||||
"addMax-aboveBalancer": {
|
||||
actions: []action{
|
||||
expectSend(getSectors(maxBatch), true, false),
|
||||
addSectors(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch), true),
|
||||
},
|
||||
},
|
||||
"addSingle-belowBalancer": {
|
||||
actions: []action{
|
||||
addSector(0),
|
||||
addSector(0, false),
|
||||
waitPending(1),
|
||||
flush([]abi.SectorNumber{0}, false, false),
|
||||
},
|
||||
},
|
||||
"addTwo-belowBalancer": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(2)),
|
||||
addSectors(getSectors(2), false),
|
||||
waitPending(2),
|
||||
flush(getSectors(2), false, false),
|
||||
},
|
||||
},
|
||||
"addAte-belowBalancer": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(8)),
|
||||
addSectors(getSectors(8), false),
|
||||
waitPending(8),
|
||||
flush(getSectors(8), false, false),
|
||||
},
|
||||
@ -325,20 +332,20 @@ func TestCommitBatcher(t *testing.T) {
|
||||
"addMax-belowBalancer": {
|
||||
actions: []action{
|
||||
expectSend(getSectors(maxBatch), false, false),
|
||||
addSectors(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch), false),
|
||||
},
|
||||
},
|
||||
|
||||
"addAte-aboveBalancer-failOne": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(8)),
|
||||
addSectors(getSectors(8), true),
|
||||
waitPending(8),
|
||||
flush(getSectors(8), true, true),
|
||||
},
|
||||
},
|
||||
"addAte-belowBalancer-failOne": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(8)),
|
||||
addSectors(getSectors(8), false),
|
||||
waitPending(8),
|
||||
flush(getSectors(8), false, true),
|
||||
},
|
||||
@ -384,4 +391,50 @@ func (f fakeProver) AggregateSealProofs(aggregateInfo prooftypes.AggregateSealVe
|
||||
return []byte("Trust me, I'm a proof"), nil
|
||||
}
|
||||
|
||||
var _ ffiwrapper.Prover = &fakeProver{}
|
||||
var _ storiface.Prover = &fakeProver{}
|
||||
|
||||
var dummyAddr = func() address.Address {
|
||||
a, _ := address.NewFromString("t00")
|
||||
return a
|
||||
}()
|
||||
|
||||
func makeBFTs(t *testing.T, basefee abi.TokenAmount, h abi.ChainEpoch) *types.TipSet {
|
||||
dummyCid, _ := cid.Parse("bafkqaaa")
|
||||
|
||||
var ts, err = types.NewTipSet([]*types.BlockHeader{
|
||||
{
|
||||
Height: h,
|
||||
Miner: dummyAddr,
|
||||
|
||||
Parents: []cid.Cid{},
|
||||
|
||||
Ticket: &types.Ticket{VRFProof: []byte{byte(h % 2)}},
|
||||
|
||||
ParentStateRoot: dummyCid,
|
||||
Messages: dummyCid,
|
||||
ParentMessageReceipts: dummyCid,
|
||||
|
||||
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
|
||||
BLSAggregate: &crypto.Signature{Type: crypto.SigTypeBLS},
|
||||
|
||||
ParentBaseFee: basefee,
|
||||
},
|
||||
})
|
||||
if t != nil {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
return ts
|
||||
}
|
||||
|
||||
func makeTs(t *testing.T, h abi.ChainEpoch) *types.TipSet {
|
||||
return makeBFTs(t, big.NewInt(0), h)
|
||||
}
|
||||
|
||||
var dummySmsg = &types.SignedMessage{
|
||||
Message: types.Message{
|
||||
From: dummyAddr,
|
||||
To: dummyAddr,
|
||||
},
|
||||
Signature: crypto.Signature{Type: crypto.SigTypeBLS},
|
||||
}
|
||||
|
@ -21,16 +21,16 @@ import (
|
||||
|
||||
type CurrentDealInfoAPI interface {
|
||||
ChainGetMessage(context.Context, cid.Cid) (*types.Message, error)
|
||||
StateLookupID(context.Context, address.Address, TipSetToken) (address.Address, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (*api.MarketDeal, error)
|
||||
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error)
|
||||
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
||||
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||
StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
|
||||
}
|
||||
|
||||
type CurrentDealInfo struct {
|
||||
DealID abi.DealID
|
||||
MarketDeal *api.MarketDeal
|
||||
PublishMsgTipSet TipSetToken
|
||||
PublishMsgTipSet types.TipSetKey
|
||||
}
|
||||
|
||||
type CurrentDealInfoManager struct {
|
||||
@ -40,19 +40,19 @@ type CurrentDealInfoManager struct {
|
||||
// GetCurrentDealInfo gets the current deal state and deal ID.
|
||||
// Note that the deal ID is assigned when the deal is published, so it may
|
||||
// have changed if there was a reorg after the deal was published.
|
||||
func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tok TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error) {
|
||||
func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (CurrentDealInfo, error) {
|
||||
// Lookup the deal ID by comparing the deal proposal to the proposals in
|
||||
// the publish deals message, and indexing into the message return value
|
||||
dealID, pubMsgTok, err := mgr.dealIDFromPublishDealsMsg(ctx, tok, proposal, publishCid)
|
||||
dealID, pubMsgTok, err := mgr.dealIDFromPublishDealsMsg(ctx, tsk, proposal, publishCid)
|
||||
if err != nil {
|
||||
return CurrentDealInfo{}, err
|
||||
}
|
||||
|
||||
// Lookup the deal state by deal ID
|
||||
marketDeal, err := mgr.CDAPI.StateMarketStorageDeal(ctx, dealID, tok)
|
||||
marketDeal, err := mgr.CDAPI.StateMarketStorageDeal(ctx, dealID, tsk)
|
||||
if err == nil && proposal != nil {
|
||||
// Make sure the retrieved deal proposal matches the target proposal
|
||||
equal, err := mgr.CheckDealEquality(ctx, tok, *proposal, marketDeal.Proposal)
|
||||
equal, err := mgr.CheckDealEquality(ctx, tsk, *proposal, marketDeal.Proposal)
|
||||
if err != nil {
|
||||
return CurrentDealInfo{}, err
|
||||
}
|
||||
@ -65,36 +65,36 @@ func (mgr *CurrentDealInfoManager) GetCurrentDealInfo(ctx context.Context, tok T
|
||||
|
||||
// dealIDFromPublishDealsMsg looks up the publish deals message by cid, and finds the deal ID
|
||||
// by looking at the message return value
|
||||
func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context, tok TipSetToken, proposal *market.DealProposal, publishCid cid.Cid) (abi.DealID, TipSetToken, error) {
|
||||
func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context, tsk types.TipSetKey, proposal *market.DealProposal, publishCid cid.Cid) (abi.DealID, types.TipSetKey, error) {
|
||||
dealID := abi.DealID(0)
|
||||
|
||||
// Get the return value of the publish deals message
|
||||
lookup, err := mgr.CDAPI.StateSearchMsg(ctx, publishCid)
|
||||
lookup, err := mgr.CDAPI.StateSearchMsg(ctx, tsk, publishCid, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("looking for publish deal message %s: search msg failed: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: search msg failed: %w", publishCid, err)
|
||||
}
|
||||
|
||||
if lookup == nil {
|
||||
return dealID, nil, xerrors.Errorf("looking for publish deal message %s: not found", publishCid)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: not found", publishCid)
|
||||
}
|
||||
|
||||
if lookup.Receipt.ExitCode != exitcode.Ok {
|
||||
return dealID, nil, xerrors.Errorf("looking for publish deal message %s: non-ok exit code: %s", publishCid, lookup.Receipt.ExitCode)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: non-ok exit code: %s", publishCid, lookup.Receipt.ExitCode)
|
||||
}
|
||||
|
||||
nv, err := mgr.CDAPI.StateNetworkVersion(ctx, lookup.TipSetTok)
|
||||
nv, err := mgr.CDAPI.StateNetworkVersion(ctx, lookup.TipSet)
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("getting network version: %w", err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("getting network version: %w", err)
|
||||
}
|
||||
|
||||
retval, err := market.DecodePublishStorageDealsReturn(lookup.Receipt.Return, nv)
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("looking for publish deal message %s: decoding message return: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: decoding message return: %w", publishCid, err)
|
||||
}
|
||||
|
||||
dealIDs, err := retval.DealIDs()
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("looking for publish deal message %s: getting dealIDs: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("looking for publish deal message %s: getting dealIDs: %w", publishCid, err)
|
||||
}
|
||||
|
||||
// TODO: Can we delete this? We're well past the point when we first introduced the proposals into sealing deal info
|
||||
@ -104,7 +104,7 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
|
||||
// in the message.
|
||||
if proposal == nil {
|
||||
if len(dealIDs) > 1 {
|
||||
return dealID, nil, xerrors.Errorf(
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf(
|
||||
"getting deal ID from publish deal message %s: "+
|
||||
"no deal proposal supplied but message return value has more than one deal (%d deals)",
|
||||
publishCid, len(dealIDs))
|
||||
@ -113,27 +113,27 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
|
||||
// There is a single deal in this publish message and no deal proposal
|
||||
// was supplied, so we have nothing to compare against. Just assume
|
||||
// the deal ID is correct and that it was valid
|
||||
return dealIDs[0], lookup.TipSetTok, nil
|
||||
return dealIDs[0], lookup.TipSet, nil
|
||||
}
|
||||
|
||||
// Get the parameters to the publish deals message
|
||||
pubmsg, err := mgr.CDAPI.ChainGetMessage(ctx, publishCid)
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("getting publish deal message %s: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("getting publish deal message %s: %w", publishCid, err)
|
||||
}
|
||||
|
||||
var pubDealsParams market8.PublishStorageDealsParams
|
||||
if err := pubDealsParams.UnmarshalCBOR(bytes.NewReader(pubmsg.Params)); err != nil {
|
||||
return dealID, nil, xerrors.Errorf("unmarshalling publish deal message params for message %s: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("unmarshalling publish deal message params for message %s: %w", publishCid, err)
|
||||
}
|
||||
|
||||
// Scan through the deal proposals in the message parameters to find the
|
||||
// index of the target deal proposal
|
||||
dealIdx := -1
|
||||
for i, paramDeal := range pubDealsParams.Deals {
|
||||
eq, err := mgr.CheckDealEquality(ctx, tok, *proposal, paramDeal.Proposal)
|
||||
eq, err := mgr.CheckDealEquality(ctx, tsk, *proposal, paramDeal.Proposal)
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("comparing publish deal message %s proposal to deal proposal: %w", publishCid, err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("comparing publish deal message %s proposal to deal proposal: %w", publishCid, err)
|
||||
}
|
||||
if eq {
|
||||
dealIdx = i
|
||||
@ -143,38 +143,38 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
|
||||
fmt.Printf("found dealIdx %d\n", dealIdx)
|
||||
|
||||
if dealIdx == -1 {
|
||||
return dealID, nil, xerrors.Errorf("could not find deal in publish deals message %s", publishCid)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("could not find deal in publish deals message %s", publishCid)
|
||||
}
|
||||
|
||||
if dealIdx >= len(pubDealsParams.Deals) {
|
||||
return dealID, nil, xerrors.Errorf(
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf(
|
||||
"deal index %d out of bounds of deal proposals (len %d) in publish deals message %s",
|
||||
dealIdx, len(dealIDs), publishCid)
|
||||
}
|
||||
|
||||
valid, outIdx, err := retval.IsDealValid(uint64(dealIdx))
|
||||
if err != nil {
|
||||
return dealID, nil, xerrors.Errorf("determining deal validity: %w", err)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("determining deal validity: %w", err)
|
||||
}
|
||||
|
||||
if !valid {
|
||||
return dealID, nil, xerrors.New("deal was invalid at publication")
|
||||
return dealID, types.EmptyTSK, xerrors.New("deal was invalid at publication")
|
||||
}
|
||||
|
||||
// final check against for invalid return value output
|
||||
// should not be reachable from onchain output, only pathological test cases
|
||||
if outIdx >= len(dealIDs) {
|
||||
return dealID, nil, xerrors.Errorf("invalid publish storage deals ret marking %d as valid while only returning %d valid deals in publish deal message %s", outIdx, len(dealIDs), publishCid)
|
||||
return dealID, types.EmptyTSK, xerrors.Errorf("invalid publish storage deals ret marking %d as valid while only returning %d valid deals in publish deal message %s", outIdx, len(dealIDs), publishCid)
|
||||
}
|
||||
return dealIDs[outIdx], lookup.TipSetTok, nil
|
||||
return dealIDs[outIdx], lookup.TipSet, nil
|
||||
}
|
||||
|
||||
func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tok TipSetToken, p1, p2 market.DealProposal) (bool, error) {
|
||||
p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tok)
|
||||
func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tsk types.TipSetKey, p1, p2 market.DealProposal) (bool, error) {
|
||||
p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tsk)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tok)
|
||||
p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tsk)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -190,65 +190,3 @@ func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tok Ti
|
||||
p1.Provider == p2.Provider &&
|
||||
p1ClientID == p2ClientID, nil
|
||||
}
|
||||
|
||||
type CurrentDealInfoTskAPI interface {
|
||||
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
||||
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, error)
|
||||
}
|
||||
|
||||
type CurrentDealInfoAPIAdapter struct {
|
||||
CurrentDealInfoTskAPI
|
||||
}
|
||||
|
||||
func (c *CurrentDealInfoAPIAdapter) StateLookupID(ctx context.Context, a address.Address, tok TipSetToken) (address.Address, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return address.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return c.CurrentDealInfoTskAPI.StateLookupID(ctx, a, tsk)
|
||||
}
|
||||
|
||||
func (c *CurrentDealInfoAPIAdapter) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok TipSetToken) (*api.MarketDeal, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return c.CurrentDealInfoTskAPI.StateMarketStorageDeal(ctx, dealID, tsk)
|
||||
}
|
||||
|
||||
func (c *CurrentDealInfoAPIAdapter) StateSearchMsg(ctx context.Context, k cid.Cid) (*MsgLookup, error) {
|
||||
wmsg, err := c.CurrentDealInfoTskAPI.StateSearchMsg(ctx, types.EmptyTSK, k, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if wmsg == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
ExitCode: wmsg.Receipt.ExitCode,
|
||||
Return: wmsg.Receipt.Return,
|
||||
GasUsed: wmsg.Receipt.GasUsed,
|
||||
},
|
||||
TipSetTok: wmsg.TipSet.Bytes(),
|
||||
Height: wmsg.Height,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *CurrentDealInfoAPIAdapter) StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return network.VersionMax, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
return c.CurrentDealInfoTskAPI.StateNetworkVersion(ctx, tsk)
|
||||
}
|
||||
|
||||
var _ CurrentDealInfoAPI = (*CurrentDealInfoAPIAdapter)(nil)
|
||||
|
@ -101,7 +101,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
type testCaseData struct {
|
||||
searchMessageLookup *MsgLookup
|
||||
searchMessageLookup *api.MsgLookup
|
||||
searchMessageErr error
|
||||
marketDeals map[abi.DealID]*api.MarketDeal
|
||||
publishCid cid.Cid
|
||||
@ -114,8 +114,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
testCases := map[string]testCaseData{
|
||||
"deal lookup succeeds": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{successDealID}),
|
||||
},
|
||||
@ -129,8 +129,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"deal lookup succeeds two return values": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}),
|
||||
},
|
||||
@ -145,8 +145,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"deal lookup fails proposal mis-match": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID}),
|
||||
},
|
||||
@ -160,8 +160,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"deal lookup handles invalid actor output with mismatched count of deals and return values": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID}),
|
||||
},
|
||||
@ -177,8 +177,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
|
||||
"deal lookup fails when deal was not valid and index exceeds output array": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturn(t, []abi.DealID{earlierDealID}, []uint64{0}),
|
||||
},
|
||||
@ -195,8 +195,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
|
||||
"deal lookup succeeds when theres a separate deal failure": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturn(t, []abi.DealID{anotherDealID, successDealID}, []uint64{0, 2}),
|
||||
},
|
||||
@ -214,8 +214,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
|
||||
"deal lookup succeeds, target proposal nil, single deal in message": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{successDealID}),
|
||||
},
|
||||
@ -229,8 +229,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"deal lookup fails, multiple deals in return value but target proposal nil": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}),
|
||||
},
|
||||
@ -258,8 +258,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"return code not ok": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.ErrIllegalState,
|
||||
},
|
||||
},
|
||||
@ -269,8 +269,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
},
|
||||
"unable to unmarshal params": {
|
||||
publishCid: dummyCid,
|
||||
searchMessageLookup: &MsgLookup{
|
||||
Receipt: MessageReceipt{
|
||||
searchMessageLookup: &api.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: []byte("applesauce"),
|
||||
},
|
||||
@ -298,7 +298,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
|
||||
}
|
||||
dealInfoMgr := CurrentDealInfoManager{mockApi}
|
||||
|
||||
res, err := dealInfoMgr.GetCurrentDealInfo(ctx, ts.Key().Bytes(), data.targetProposal, data.publishCid)
|
||||
res, err := dealInfoMgr.GetCurrentDealInfo(ctx, ts.Key(), data.targetProposal, data.publishCid)
|
||||
require.Equal(t, data.expectedDealID, res.DealID)
|
||||
require.Equal(t, data.expectedMarketDeal, res.MarketDeal)
|
||||
if data.expectedError == nil {
|
||||
@ -319,7 +319,7 @@ type marketDealKey struct {
|
||||
}
|
||||
|
||||
type CurrentDealInfoMockAPI struct {
|
||||
SearchMessageLookup *MsgLookup
|
||||
SearchMessageLookup *api.MsgLookup
|
||||
SearchMessageErr error
|
||||
|
||||
MarketDeals map[marketDealKey]*api.MarketDeal
|
||||
@ -359,15 +359,11 @@ func (mapi *CurrentDealInfoMockAPI) ChainGetMessage(ctx context.Context, c cid.C
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (mapi *CurrentDealInfoMockAPI) StateLookupID(ctx context.Context, addr address.Address, token TipSetToken) (address.Address, error) {
|
||||
func (mapi *CurrentDealInfoMockAPI) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok TipSetToken) (*api.MarketDeal, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error) {
|
||||
deal, ok := mapi.MarketDeals[marketDealKey{dealID, tsk}]
|
||||
if !ok {
|
||||
return nil, errNotFound
|
||||
@ -375,7 +371,7 @@ func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context,
|
||||
return deal, nil
|
||||
}
|
||||
|
||||
func (mapi *CurrentDealInfoMockAPI) StateSearchMsg(ctx context.Context, c cid.Cid) (*MsgLookup, error) {
|
||||
func (mapi *CurrentDealInfoMockAPI) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error) {
|
||||
if mapi.SearchMessageLookup == nil {
|
||||
return mapi.SearchMessageLookup, mapi.SearchMessageErr
|
||||
}
|
||||
@ -383,7 +379,7 @@ func (mapi *CurrentDealInfoMockAPI) StateSearchMsg(ctx context.Context, c cid.Ci
|
||||
return mapi.SearchMessageLookup, mapi.SearchMessageErr
|
||||
}
|
||||
|
||||
func (mapi *CurrentDealInfoMockAPI) StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) {
|
||||
func (mapi *CurrentDealInfoMockAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
|
||||
return mapi.Version, nil
|
||||
}
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
package sealing
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
)
|
||||
|
||||
// `curH`-`ts.Height` = `confidence`
|
||||
type HeightHandler func(ctx context.Context, tok TipSetToken, curH abi.ChainEpoch) error
|
||||
type RevertHandler func(ctx context.Context, tok TipSetToken) error
|
||||
|
||||
type Events interface {
|
||||
ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h abi.ChainEpoch) error
|
||||
}
|
@ -9,7 +9,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
type mutator interface {
|
||||
@ -133,7 +135,7 @@ type SectorOldTicket struct{}
|
||||
func (evt SectorOldTicket) apply(*SectorInfo) {}
|
||||
|
||||
type SectorPreCommit1 struct {
|
||||
PreCommit1Out storage.PreCommit1Out
|
||||
PreCommit1Out storiface.PreCommit1Out
|
||||
}
|
||||
|
||||
func (evt SectorPreCommit1) apply(state *SectorInfo) {
|
||||
@ -166,7 +168,7 @@ func (evt SectorPreCommitBatchSent) apply(state *SectorInfo) {
|
||||
}
|
||||
|
||||
type SectorPreCommitLanded struct {
|
||||
TipSet TipSetToken
|
||||
TipSet types.TipSetKey
|
||||
}
|
||||
|
||||
func (evt SectorPreCommitLanded) apply(si *SectorInfo) {
|
||||
@ -314,7 +316,7 @@ func (evt SectorStartCCUpdate) apply(state *SectorInfo) {
|
||||
}
|
||||
|
||||
type SectorReplicaUpdate struct {
|
||||
Out storage.ReplicaUpdateOut
|
||||
Out storiface.ReplicaUpdateOut
|
||||
}
|
||||
|
||||
func (evt SectorReplicaUpdate) apply(state *SectorInfo) {
|
||||
@ -323,7 +325,7 @@ func (evt SectorReplicaUpdate) apply(state *SectorInfo) {
|
||||
}
|
||||
|
||||
type SectorProveReplicaUpdate struct {
|
||||
Proof storage.ReplicaUpdateProof
|
||||
Proof storiface.ReplicaUpdateProof
|
||||
}
|
||||
|
||||
func (evt SectorProveReplicaUpdate) apply(state *SectorInfo) {
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
|
||||
func (m *Sealing) PledgeSector(ctx context.Context) (storiface.SectorRef, error) {
|
||||
m.startupWait.Wait()
|
||||
|
||||
m.inputLk.Lock()
|
||||
@ -16,23 +16,23 @@ func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
|
||||
|
||||
cfg, err := m.getConfig()
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, xerrors.Errorf("getting config: %w", err)
|
||||
return storiface.SectorRef{}, xerrors.Errorf("getting config: %w", err)
|
||||
}
|
||||
|
||||
if cfg.MaxSealingSectors > 0 {
|
||||
if m.stats.curSealing() >= cfg.MaxSealingSectors {
|
||||
return storage.SectorRef{}, xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors)
|
||||
return storiface.SectorRef{}, xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors)
|
||||
}
|
||||
}
|
||||
|
||||
spt, err := m.currentSealProof(ctx)
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, xerrors.Errorf("getting seal proof type: %w", err)
|
||||
return storiface.SectorRef{}, xerrors.Errorf("getting seal proof type: %w", err)
|
||||
}
|
||||
|
||||
sid, err := m.createSector(ctx, cfg, spt)
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, err
|
||||
return storiface.SectorRef{}, err
|
||||
}
|
||||
|
||||
log.Infof("Creating CC sector %d", sid)
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -23,6 +22,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error {
|
||||
@ -124,7 +124,7 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo,
|
||||
sealTime := time.Unix(sector.CreationTime, 0).Add(cfg.WaitDealsDelay)
|
||||
|
||||
// check deal age, start sealing when the deal closest to starting is within slack time
|
||||
_, current, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
blockTime := time.Second * time.Duration(build.BlockDelaySecs)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("API error getting head: %w", err)
|
||||
@ -134,7 +134,7 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo,
|
||||
continue
|
||||
}
|
||||
dealSafeSealEpoch := piece.DealInfo.DealProposal.StartEpoch - cfg.StartEpochSealingBuffer
|
||||
dealSafeSealTime := time.Now().Add(time.Duration(dealSafeSealEpoch-current) * blockTime)
|
||||
dealSafeSealTime := time.Now().Add(time.Duration(dealSafeSealEpoch-ts.Height()) * blockTime)
|
||||
if dealSafeSealTime.Before(sealTime) {
|
||||
sealTime = dealSafeSealTime
|
||||
}
|
||||
@ -274,7 +274,7 @@ func (m *Sealing) handleAddPieceFailed(ctx statemachine.Context, sector SectorIn
|
||||
return ctx.Send(SectorRetryWaitDeals{})
|
||||
}
|
||||
|
||||
func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, data storage.Data, deal api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, data storiface.Data, deal api.PieceDealInfo) (api.SectorOffset, error) {
|
||||
log.Infof("Adding piece for deal %d (publish msg: %s)", deal.DealID, deal.PublishCid)
|
||||
if (padreader.PaddedSize(uint64(size))) != size {
|
||||
return api.SectorOffset{}, xerrors.Errorf("cannot allocate unpadded piece")
|
||||
@ -303,14 +303,14 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
|
||||
return api.SectorOffset{}, xerrors.Errorf("getting config: %w", err)
|
||||
}
|
||||
|
||||
_, head, err := m.Api.ChainHead(ctx)
|
||||
ts, err := m.Api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return api.SectorOffset{}, xerrors.Errorf("couldnt get chain head: %w", err)
|
||||
}
|
||||
if head+cfg.StartEpochSealingBuffer > deal.DealProposal.StartEpoch {
|
||||
if ts.Height()+cfg.StartEpochSealingBuffer > deal.DealProposal.StartEpoch {
|
||||
return api.SectorOffset{}, xerrors.Errorf(
|
||||
"cannot add piece for deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d",
|
||||
deal.DealProposal.PieceCID, head, deal.DealProposal.StartEpoch)
|
||||
deal.DealProposal.PieceCID, ts.Height(), deal.DealProposal.StartEpoch)
|
||||
}
|
||||
|
||||
m.inputLk.Lock()
|
||||
@ -341,7 +341,7 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
|
||||
}
|
||||
|
||||
// called with m.inputLk; transfers the lock to another goroutine!
|
||||
func (m *Sealing) addPendingPiece(ctx context.Context, size abi.UnpaddedPieceSize, data storage.Data, deal api.PieceDealInfo, sp abi.RegisteredSealProof) *pendingPiece {
|
||||
func (m *Sealing) addPendingPiece(ctx context.Context, size abi.UnpaddedPieceSize, data storiface.Data, deal api.PieceDealInfo, sp abi.RegisteredSealProof) *pendingPiece {
|
||||
doneCh := make(chan struct{})
|
||||
pp := &pendingPiece{
|
||||
doneCh: doneCh,
|
||||
@ -399,7 +399,7 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e
|
||||
if e, ok := memo[sn]; ok {
|
||||
return e.e, e.p, nil
|
||||
}
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx, m.maddr, sn, TipSetToken{})
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx, m.maddr, sn, types.TipSetKey{})
|
||||
if err != nil {
|
||||
return 0, big.Zero(), err
|
||||
}
|
||||
@ -544,14 +544,14 @@ func (m *Sealing) calcTargetExpiration(ctx context.Context, ssize abi.SectorSize
|
||||
}
|
||||
}
|
||||
|
||||
_, curEpoch, err := m.Api.ChainHead(ctx)
|
||||
ts, err := m.Api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return 0, 0, xerrors.Errorf("getting current epoch: %w", err)
|
||||
}
|
||||
|
||||
minDur, maxDur := policy.DealDurationBounds(0)
|
||||
|
||||
return curEpoch + minDur, curEpoch + maxDur, nil
|
||||
return ts.Height() + minDur, ts.Height() + maxDur, nil
|
||||
}
|
||||
|
||||
func (m *Sealing) maybeUpgradeSector(ctx context.Context, sp abi.RegisteredSealProof, ef expFn) (bool, error) {
|
||||
@ -580,7 +580,7 @@ func (m *Sealing) maybeUpgradeSector(ctx context.Context, sp abi.RegisteredSealP
|
||||
}
|
||||
|
||||
slowChecks := func(sid abi.SectorNumber) bool {
|
||||
active, err := m.sectorActive(ctx, TipSetToken{}, sid)
|
||||
active, err := m.sectorActive(ctx, types.TipSetKey{}, sid)
|
||||
if err != nil {
|
||||
log.Errorw("checking sector active", "error", err)
|
||||
return false
|
||||
|
@ -12,18 +12,16 @@ import (
|
||||
cid "github.com/ipfs/go-cid"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
bitfield "github.com/filecoin-project/go-bitfield"
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
market "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||
miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
crypto "github.com/filecoin-project/go-state-types/crypto"
|
||||
dline "github.com/filecoin-project/go-state-types/dline"
|
||||
network "github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
api "github.com/filecoin-project/lotus/api"
|
||||
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
types "github.com/filecoin-project/lotus/chain/types"
|
||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
)
|
||||
|
||||
// MockSealingAPI is a mock of SealingAPI interface.
|
||||
@ -49,21 +47,6 @@ func (m *MockSealingAPI) EXPECT() *MockSealingAPIMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ChainBaseFee mocks base method.
|
||||
func (m *MockSealingAPI) ChainBaseFee(arg0 context.Context, arg1 sealing.TipSetToken) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainBaseFee indicates an expected call of ChainBaseFee.
|
||||
func (mr *MockSealingAPIMockRecorder) ChainBaseFee(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainBaseFee", reflect.TypeOf((*MockSealingAPI)(nil).ChainBaseFee), arg0, arg1)
|
||||
}
|
||||
|
||||
// ChainGetMessage mocks base method.
|
||||
func (m *MockSealingAPI) ChainGetMessage(arg0 context.Context, arg1 cid.Cid) (*types.Message, error) {
|
||||
m.ctrl.T.Helper()
|
||||
@ -80,13 +63,12 @@ func (mr *MockSealingAPIMockRecorder) ChainGetMessage(arg0, arg1 interface{}) *g
|
||||
}
|
||||
|
||||
// ChainHead mocks base method.
|
||||
func (m *MockSealingAPI) ChainHead(arg0 context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) {
|
||||
func (m *MockSealingAPI) ChainHead(arg0 context.Context) (*types.TipSet, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainHead", arg0)
|
||||
ret0, _ := ret[0].(sealing.TipSetToken)
|
||||
ret1, _ := ret[1].(abi.ChainEpoch)
|
||||
ret2, _ := ret[2].(error)
|
||||
return ret0, ret1, ret2
|
||||
ret0, _ := ret[0].(*types.TipSet)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainHead indicates an expected call of ChainHead.
|
||||
@ -110,38 +92,38 @@ func (mr *MockSealingAPIMockRecorder) ChainReadObj(arg0, arg1 interface{}) *gomo
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainReadObj", reflect.TypeOf((*MockSealingAPI)(nil).ChainReadObj), arg0, arg1)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m *MockSealingAPI) SendMsg(arg0 context.Context, arg1, arg2 address.Address, arg3 abi.MethodNum, arg4, arg5 big.Int, arg6 []byte) (cid.Cid, error) {
|
||||
// MpoolPushMessage mocks base method.
|
||||
func (m *MockSealingAPI) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendMsg", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret := m.ctrl.Call(m, "MpoolPushMessage", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*types.SignedMessage)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// MpoolPushMessage indicates an expected call of MpoolPushMessage.
|
||||
func (mr *MockSealingAPIMockRecorder) MpoolPushMessage(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolPushMessage", reflect.TypeOf((*MockSealingAPI)(nil).MpoolPushMessage), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateComputeDataCID mocks base method.
|
||||
func (m *MockSealingAPI) StateComputeDataCID(arg0 context.Context, arg1 address.Address, arg2 abi.RegisteredSealProof, arg3 []abi.DealID, arg4 types.TipSetKey) (cid.Cid, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateComputeDataCID", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockSealingAPIMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||
// StateComputeDataCID indicates an expected call of StateComputeDataCID.
|
||||
func (mr *MockSealingAPIMockRecorder) StateComputeDataCID(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockSealingAPI)(nil).SendMsg), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateComputeDataCommitment", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateComputeDataCommitment indicates an expected call of StateComputeDataCommitment.
|
||||
func (mr *MockSealingAPIMockRecorder) StateComputeDataCommitment(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateComputeDataCommitment", reflect.TypeOf((*MockSealingAPI)(nil).StateComputeDataCommitment), arg0, arg1, arg2, arg3, arg4)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateComputeDataCID", reflect.TypeOf((*MockSealingAPI)(nil).StateComputeDataCID), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// 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 types.TipSetKey) (abi.Randomness, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(abi.Randomness)
|
||||
@ -156,7 +138,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromBeacon(arg0, arg1, a
|
||||
}
|
||||
|
||||
// StateGetRandomnessFromTickets mocks base method.
|
||||
func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing.TipSetToken) (abi.Randomness, error) {
|
||||
func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 types.TipSetKey) (abi.Randomness, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(abi.Randomness)
|
||||
@ -171,7 +153,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromTickets(arg0, arg1,
|
||||
}
|
||||
|
||||
// StateLookupID mocks base method.
|
||||
func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (address.Address, error) {
|
||||
func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (address.Address, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(address.Address)
|
||||
@ -186,7 +168,7 @@ func (mr *MockSealingAPIMockRecorder) StateLookupID(arg0, arg1, arg2 interface{}
|
||||
}
|
||||
|
||||
// StateMarketStorageDeal mocks base method.
|
||||
func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 sealing.TipSetToken) (*api.MarketDeal, error) {
|
||||
func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 types.TipSetKey) (*api.MarketDeal, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*api.MarketDeal)
|
||||
@ -200,38 +182,8 @@ func (mr *MockSealingAPIMockRecorder) StateMarketStorageDeal(arg0, arg1, arg2 in
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMarketStorageDeal", reflect.TypeOf((*MockSealingAPI)(nil).StateMarketStorageDeal), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMarketStorageDealProposal mocks base method.
|
||||
func (m *MockSealingAPI) StateMarketStorageDealProposal(arg0 context.Context, arg1 abi.DealID, arg2 sealing.TipSetToken) (market.DealProposal, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMarketStorageDealProposal", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(market.DealProposal)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateMarketStorageDealProposal indicates an expected call of StateMarketStorageDealProposal.
|
||||
func (mr *MockSealingAPIMockRecorder) StateMarketStorageDealProposal(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMarketStorageDealProposal", reflect.TypeOf((*MockSealingAPI)(nil).StateMarketStorageDealProposal), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMinerActiveSectors mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerActiveSectors(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (bitfield.BitField, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerActiveSectors", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(bitfield.BitField)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateMinerActiveSectors indicates an expected call of StateMinerActiveSectors.
|
||||
func (mr *MockSealingAPIMockRecorder) StateMinerActiveSectors(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerActiveSectors", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerActiveSectors), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// 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 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -245,8 +197,23 @@ func (mr *MockSealingAPIMockRecorder) StateMinerAvailableBalance(arg0, arg1, arg
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerAvailableBalance", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerAvailableBalance), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMinerDeadlines mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerDeadlines(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) ([]api.Deadline, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerDeadlines", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].([]api.Deadline)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateMinerDeadlines indicates an expected call of StateMinerDeadlines.
|
||||
func (mr *MockSealingAPIMockRecorder) StateMinerDeadlines(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerDeadlines", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerDeadlines), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// 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 types.TipSetKey) (api.MinerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(api.MinerInfo)
|
||||
@ -261,7 +228,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{
|
||||
}
|
||||
|
||||
// StateMinerInitialPledgeCollateral mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) {
|
||||
func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -276,7 +243,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInitialPledgeCollateral(arg0, ar
|
||||
}
|
||||
|
||||
// StateMinerPartitions mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 sealing.TipSetToken) ([]api.Partition, error) {
|
||||
func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 types.TipSetKey) ([]api.Partition, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].([]api.Partition)
|
||||
@ -291,7 +258,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPartitions(arg0, arg1, arg2, arg
|
||||
}
|
||||
|
||||
// StateMinerPreCommitDepositForPower mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) {
|
||||
func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -306,7 +273,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPreCommitDepositForPower(arg0, a
|
||||
}
|
||||
|
||||
// StateMinerProvingDeadline mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (*dline.Info, error) {
|
||||
func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*dline.Info, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*dline.Info)
|
||||
@ -321,7 +288,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerProvingDeadline(arg0, arg1, arg2
|
||||
}
|
||||
|
||||
// StateMinerSectorAllocated mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (bool, error) {
|
||||
func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (bool, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(bool)
|
||||
@ -335,38 +302,8 @@ func (mr *MockSealingAPIMockRecorder) StateMinerSectorAllocated(arg0, arg1, arg2
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerSectorAllocated", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerSectorAllocated), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// StateMinerSectorSize mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerSectorSize(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (abi.SectorSize, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerSectorSize", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(abi.SectorSize)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateMinerSectorSize indicates an expected call of StateMinerSectorSize.
|
||||
func (mr *MockSealingAPIMockRecorder) StateMinerSectorSize(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerSectorSize", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerSectorSize), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMinerWorkerAddress mocks base method.
|
||||
func (m *MockSealingAPI) StateMinerWorkerAddress(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (address.Address, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerWorkerAddress", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(address.Address)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateMinerWorkerAddress indicates an expected call of StateMinerWorkerAddress.
|
||||
func (mr *MockSealingAPIMockRecorder) StateMinerWorkerAddress(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateMinerWorkerAddress", reflect.TypeOf((*MockSealingAPI)(nil).StateMinerWorkerAddress), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// 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 types.TipSetKey) (network.Version, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
|
||||
ret0, _ := ret[0].(network.Version)
|
||||
@ -381,22 +318,22 @@ func (mr *MockSealingAPIMockRecorder) StateNetworkVersion(arg0, arg1 interface{}
|
||||
}
|
||||
|
||||
// StateSearchMsg mocks base method.
|
||||
func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 cid.Cid) (*sealing.MsgLookup, error) {
|
||||
func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 types.TipSetKey, arg2 cid.Cid, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1)
|
||||
ret0, _ := ret[0].(*sealing.MsgLookup)
|
||||
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateSearchMsg indicates an expected call of StateSearchMsg.
|
||||
func (mr *MockSealingAPIMockRecorder) StateSearchMsg(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockSealingAPIMockRecorder) StateSearchMsg(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSearchMsg", reflect.TypeOf((*MockSealingAPI)(nil).StateSearchMsg), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateSearchMsg", reflect.TypeOf((*MockSealingAPI)(nil).StateSearchMsg), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
||||
// 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 types.TipSetKey) (*miner.SectorOnChainInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*miner.SectorOnChainInfo)
|
||||
@ -411,10 +348,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3
|
||||
}
|
||||
|
||||
// StateSectorPartition mocks base method.
|
||||
func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*sealing.SectorLocation, error) {
|
||||
func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorLocation, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*sealing.SectorLocation)
|
||||
ret0, _ := ret[0].(*miner0.SectorLocation)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
@ -426,7 +363,7 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg
|
||||
}
|
||||
|
||||
// StateSectorPreCommitInfo mocks base method.
|
||||
func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
|
||||
@ -441,16 +378,16 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPreCommitInfo(arg0, arg1, arg2,
|
||||
}
|
||||
|
||||
// StateWaitMsg mocks base method.
|
||||
func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid) (sealing.MsgLookup, error) {
|
||||
func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1)
|
||||
ret0, _ := ret[0].(sealing.MsgLookup)
|
||||
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1, arg2, arg3, arg4)
|
||||
ret0, _ := ret[0].(*api.MsgLookup)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// StateWaitMsg indicates an expected call of StateWaitMsg.
|
||||
func (mr *MockSealingAPIMockRecorder) StateWaitMsg(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockSealingAPIMockRecorder) StateWaitMsg(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateWaitMsg", reflect.TypeOf((*MockSealingAPI)(nil).StateWaitMsg), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateWaitMsg", reflect.TypeOf((*MockSealingAPI)(nil).StateWaitMsg), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
@ -18,7 +17,7 @@ import (
|
||||
network "github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
api "github.com/filecoin-project/lotus/api"
|
||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
types "github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
// MockCommitBatcherApi is a mock of CommitBatcherApi interface.
|
||||
@ -44,29 +43,13 @@ func (m *MockCommitBatcherApi) EXPECT() *MockCommitBatcherApiMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ChainBaseFee mocks base method.
|
||||
func (m *MockCommitBatcherApi) ChainBaseFee(arg0 context.Context, arg1 sealing.TipSetToken) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainBaseFee indicates an expected call of ChainBaseFee.
|
||||
func (mr *MockCommitBatcherApiMockRecorder) ChainBaseFee(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainBaseFee", reflect.TypeOf((*MockCommitBatcherApi)(nil).ChainBaseFee), arg0, arg1)
|
||||
}
|
||||
|
||||
// ChainHead mocks base method.
|
||||
func (m *MockCommitBatcherApi) ChainHead(arg0 context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) {
|
||||
func (m *MockCommitBatcherApi) ChainHead(arg0 context.Context) (*types.TipSet, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainHead", arg0)
|
||||
ret0, _ := ret[0].(sealing.TipSetToken)
|
||||
ret1, _ := ret[1].(abi.ChainEpoch)
|
||||
ret2, _ := ret[2].(error)
|
||||
return ret0, ret1, ret2
|
||||
ret0, _ := ret[0].(*types.TipSet)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainHead indicates an expected call of ChainHead.
|
||||
@ -75,23 +58,23 @@ func (mr *MockCommitBatcherApiMockRecorder) ChainHead(arg0 interface{}) *gomock.
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainHead", reflect.TypeOf((*MockCommitBatcherApi)(nil).ChainHead), arg0)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m *MockCommitBatcherApi) SendMsg(arg0 context.Context, arg1, arg2 address.Address, arg3 abi.MethodNum, arg4, arg5 big.Int, arg6 []byte) (cid.Cid, error) {
|
||||
// MpoolPushMessage mocks base method.
|
||||
func (m *MockCommitBatcherApi) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendMsg", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret := m.ctrl.Call(m, "MpoolPushMessage", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*types.SignedMessage)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockCommitBatcherApiMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||
// MpoolPushMessage indicates an expected call of MpoolPushMessage.
|
||||
func (mr *MockCommitBatcherApiMockRecorder) MpoolPushMessage(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockCommitBatcherApi)(nil).SendMsg), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolPushMessage", reflect.TypeOf((*MockCommitBatcherApi)(nil).MpoolPushMessage), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMinerAvailableBalance mocks base method.
|
||||
func (m *MockCommitBatcherApi) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (big.Int, error) {
|
||||
func (m *MockCommitBatcherApi) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -106,7 +89,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerAvailableBalance(arg0, arg
|
||||
}
|
||||
|
||||
// StateMinerInfo mocks base method.
|
||||
func (m *MockCommitBatcherApi) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (api.MinerInfo, error) {
|
||||
func (m *MockCommitBatcherApi) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (api.MinerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(api.MinerInfo)
|
||||
@ -121,7 +104,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerInfo(arg0, arg1, arg2 inte
|
||||
}
|
||||
|
||||
// StateMinerInitialPledgeCollateral mocks base method.
|
||||
func (m *MockCommitBatcherApi) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) {
|
||||
func (m *MockCommitBatcherApi) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -136,7 +119,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerInitialPledgeCollateral(ar
|
||||
}
|
||||
|
||||
// StateNetworkVersion mocks base method.
|
||||
func (m *MockCommitBatcherApi) StateNetworkVersion(arg0 context.Context, arg1 sealing.TipSetToken) (network.Version, error) {
|
||||
func (m *MockCommitBatcherApi) StateNetworkVersion(arg0 context.Context, arg1 types.TipSetKey) (network.Version, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
|
||||
ret0, _ := ret[0].(network.Version)
|
||||
@ -151,7 +134,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateNetworkVersion(arg0, arg1 inter
|
||||
}
|
||||
|
||||
// StateSectorPreCommitInfo mocks base method.
|
||||
func (m *MockCommitBatcherApi) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
func (m *MockCommitBatcherApi) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
|
||||
|
@ -9,15 +9,13 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
|
||||
address "github.com/filecoin-project/go-address"
|
||||
abi "github.com/filecoin-project/go-state-types/abi"
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
network "github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
api "github.com/filecoin-project/lotus/api"
|
||||
sealing "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
types "github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
// MockPreCommitBatcherApi is a mock of PreCommitBatcherApi interface.
|
||||
@ -43,29 +41,13 @@ func (m *MockPreCommitBatcherApi) EXPECT() *MockPreCommitBatcherApiMockRecorder
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// ChainBaseFee mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) ChainBaseFee(arg0 context.Context, arg1 sealing.TipSetToken) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainBaseFee", arg0, arg1)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainBaseFee indicates an expected call of ChainBaseFee.
|
||||
func (mr *MockPreCommitBatcherApiMockRecorder) ChainBaseFee(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainBaseFee", reflect.TypeOf((*MockPreCommitBatcherApi)(nil).ChainBaseFee), arg0, arg1)
|
||||
}
|
||||
|
||||
// ChainHead mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) ChainHead(arg0 context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) {
|
||||
func (m *MockPreCommitBatcherApi) ChainHead(arg0 context.Context) (*types.TipSet, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ChainHead", arg0)
|
||||
ret0, _ := ret[0].(sealing.TipSetToken)
|
||||
ret1, _ := ret[1].(abi.ChainEpoch)
|
||||
ret2, _ := ret[2].(error)
|
||||
return ret0, ret1, ret2
|
||||
ret0, _ := ret[0].(*types.TipSet)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ChainHead indicates an expected call of ChainHead.
|
||||
@ -74,23 +56,23 @@ func (mr *MockPreCommitBatcherApiMockRecorder) ChainHead(arg0 interface{}) *gomo
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainHead", reflect.TypeOf((*MockPreCommitBatcherApi)(nil).ChainHead), arg0)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) SendMsg(arg0 context.Context, arg1, arg2 address.Address, arg3 abi.MethodNum, arg4, arg5 big.Int, arg6 []byte) (cid.Cid, error) {
|
||||
// MpoolPushMessage mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendMsg", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
ret0, _ := ret[0].(cid.Cid)
|
||||
ret := m.ctrl.Call(m, "MpoolPushMessage", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(*types.SignedMessage)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockPreCommitBatcherApiMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
|
||||
// MpoolPushMessage indicates an expected call of MpoolPushMessage.
|
||||
func (mr *MockPreCommitBatcherApiMockRecorder) MpoolPushMessage(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockPreCommitBatcherApi)(nil).SendMsg), arg0, arg1, arg2, arg3, arg4, arg5, arg6)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MpoolPushMessage", reflect.TypeOf((*MockPreCommitBatcherApi)(nil).MpoolPushMessage), arg0, arg1, arg2)
|
||||
}
|
||||
|
||||
// StateMinerAvailableBalance mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (big.Int, error) {
|
||||
func (m *MockPreCommitBatcherApi) StateMinerAvailableBalance(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (big.Int, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(big.Int)
|
||||
@ -105,7 +87,7 @@ func (mr *MockPreCommitBatcherApiMockRecorder) StateMinerAvailableBalance(arg0,
|
||||
}
|
||||
|
||||
// StateMinerInfo mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (api.MinerInfo, error) {
|
||||
func (m *MockPreCommitBatcherApi) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (api.MinerInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
||||
ret0, _ := ret[0].(api.MinerInfo)
|
||||
@ -120,7 +102,7 @@ func (mr *MockPreCommitBatcherApiMockRecorder) StateMinerInfo(arg0, arg1, arg2 i
|
||||
}
|
||||
|
||||
// StateNetworkVersion mocks base method.
|
||||
func (m *MockPreCommitBatcherApi) StateNetworkVersion(arg0 context.Context, arg1 sealing.TipSetToken) (network.Version, error) {
|
||||
func (m *MockPreCommitBatcherApi) StateNetworkVersion(arg0 context.Context, arg1 types.TipSetKey) (network.Version, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
|
||||
ret0, _ := ret[0].(network.Version)
|
||||
|
@ -28,12 +28,11 @@ import (
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_precommit_batcher.go -package=mocks . PreCommitBatcherApi
|
||||
|
||||
type PreCommitBatcherApi interface {
|
||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
|
||||
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error)
|
||||
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error)
|
||||
ChainBaseFee(context.Context, TipSetToken) (abi.TokenAmount, error)
|
||||
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
|
||||
ChainHead(ctx context.Context) (*types.TipSet, error)
|
||||
StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
|
||||
}
|
||||
|
||||
type preCommitEntry struct {
|
||||
@ -188,31 +187,26 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
tok, _, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bf, err := b.api.ChainBaseFee(b.mctx, tok)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get base fee: %w", err)
|
||||
}
|
||||
|
||||
// TODO: Drop this once nv14 has come and gone
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, tok)
|
||||
nv, err := b.api.StateNetworkVersion(b.mctx, ts.Key())
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get network version: %w", err)
|
||||
}
|
||||
|
||||
individual := false
|
||||
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && bf.LessThan(cfg.BatchPreCommitAboveBaseFee) && nv >= network.Version14 {
|
||||
if !cfg.BatchPreCommitAboveBaseFee.Equals(big.Zero()) && ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.BatchPreCommitAboveBaseFee) && nv >= network.Version14 {
|
||||
individual = true
|
||||
}
|
||||
|
||||
// todo support multiple batches
|
||||
var res []sealiface.PreCommitBatchRes
|
||||
if !individual {
|
||||
res, err = b.processBatch(cfg, tok, bf, nv)
|
||||
res, err = b.processBatch(cfg, ts.Key(), ts.MinTicketBlock().ParentBaseFee, nv)
|
||||
} else {
|
||||
res, err = b.processIndividually(cfg)
|
||||
}
|
||||
@ -240,7 +234,7 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
|
||||
}
|
||||
|
||||
func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.PreCommitBatchRes, error) {
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get miner info: %w", err)
|
||||
}
|
||||
@ -248,7 +242,7 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac
|
||||
avail := types.TotalFilecoinInt
|
||||
|
||||
if cfg.CollateralFromMinerBalance && !cfg.DisableCollateralFallback {
|
||||
avail, err = b.api.StateMinerAvailableBalance(b.mctx, b.maddr, nil)
|
||||
avail, err = b.api.StateMinerAvailableBalance(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting available miner balance: %w", err)
|
||||
}
|
||||
@ -307,7 +301,7 @@ func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo,
|
||||
return cid.Undef, xerrors.Errorf("no good address to send precommit message from: %w", err)
|
||||
}
|
||||
|
||||
mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.PreCommitSector, deposit, big.Int(b.feeCfg.MaxPreCommitGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(b.mctx, b.api, from, b.maddr, builtin.MethodsMiner.PreCommitSector, deposit, big.Int(b.feeCfg.MaxPreCommitGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("pushing message to mpool: %w", err)
|
||||
}
|
||||
@ -315,7 +309,7 @@ func (b *PreCommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo,
|
||||
return mcid, nil
|
||||
}
|
||||
|
||||
func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, bf abi.TokenAmount, nv network.Version) ([]sealiface.PreCommitBatchRes, error) {
|
||||
func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tsk types.TipSetKey, bf abi.TokenAmount, nv network.Version) ([]sealiface.PreCommitBatchRes, error) {
|
||||
params := miner.PreCommitSectorBatchParams{}
|
||||
deposit := big.Zero()
|
||||
var res sealiface.PreCommitBatchRes
|
||||
@ -336,7 +330,7 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b
|
||||
return []sealiface.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, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err)
|
||||
}
|
||||
@ -364,7 +358,7 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b
|
||||
return []sealiface.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 := sendMsg(b.mctx, b.api, from, b.maddr, builtin.MethodsMiner.PreCommitSectorBatch, needFunds, maxFee, enc.Bytes())
|
||||
if err != nil {
|
||||
return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err)
|
||||
}
|
||||
@ -378,13 +372,13 @@ func (b *PreCommitBatcher) processBatch(cfg sealiface.Config, tok TipSetToken, b
|
||||
|
||||
// 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) {
|
||||
_, curEpoch, err := b.api.ChainHead(b.mctx)
|
||||
ts, err := b.api.ChainHead(b.mctx)
|
||||
if err != nil {
|
||||
log.Errorf("getting chain head: %s", err)
|
||||
return sealiface.PreCommitBatchRes{}, err
|
||||
}
|
||||
|
||||
cutoff, err := getPreCommitCutoff(curEpoch, s)
|
||||
cutoff, err := getPreCommitCutoff(ts.Height(), s)
|
||||
if err != nil {
|
||||
return sealiface.PreCommitBatchRes{}, xerrors.Errorf("failed to calculate cutoff: %w", err)
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
addSector := func(sn abi.SectorNumber) action {
|
||||
addSector := func(sn abi.SectorNumber, aboveBalancer bool) action {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise {
|
||||
var pcres sealiface.PreCommitBatchRes
|
||||
var pcerr error
|
||||
@ -109,7 +109,12 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
SectorNumber: sn,
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
basefee := big.NewInt(9999)
|
||||
if aboveBalancer {
|
||||
basefee = big.NewInt(10001)
|
||||
}
|
||||
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil)
|
||||
|
||||
go func() {
|
||||
defer done.Unlock()
|
||||
@ -130,10 +135,10 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
addSectors := func(sectors []abi.SectorNumber) action {
|
||||
addSectors := func(sectors []abi.SectorNumber, aboveBalancer bool) action {
|
||||
as := make([]action, len(sectors))
|
||||
for i, sector := range sectors {
|
||||
as[i] = addSector(sector)
|
||||
as[i] = addSector(sector, aboveBalancer)
|
||||
}
|
||||
return actions(as...)
|
||||
}
|
||||
@ -153,20 +158,19 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
expectSend := func(expect []abi.SectorNumber) action {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(10001), nil)
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(10001), 1), nil)
|
||||
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil)
|
||||
|
||||
s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil)
|
||||
s.EXPECT().SendMsg(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.([]byte)
|
||||
s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.(*types.Message)
|
||||
var params miner6.PreCommitSectorBatchParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b)))
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params)))
|
||||
for s, number := range expect {
|
||||
require.Equal(t, number, params.Sectors[s].SectorNumber)
|
||||
}
|
||||
return true
|
||||
}))
|
||||
}), gomock.Any()).Return(dummySmsg, nil)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -174,20 +178,19 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
expectSendsSingle := func(expect []abi.SectorNumber) action {
|
||||
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise {
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil)
|
||||
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(9999), nil)
|
||||
s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(9999), 1), nil)
|
||||
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil)
|
||||
|
||||
s.EXPECT().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil)
|
||||
for _, number := range expect {
|
||||
numClone := number
|
||||
s.EXPECT().SendMsg(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.([]byte)
|
||||
s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
|
||||
b := i.(*types.Message)
|
||||
var params miner6.PreCommitSectorParams
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b)))
|
||||
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params)))
|
||||
require.Equal(t, numClone, params.SectorNumber)
|
||||
return true
|
||||
}))
|
||||
}), gomock.Any()).Return(dummySmsg, nil)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -223,14 +226,14 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
}{
|
||||
"addSingle": {
|
||||
actions: []action{
|
||||
addSector(0),
|
||||
addSector(0, false),
|
||||
waitPending(1),
|
||||
flush([]abi.SectorNumber{0}),
|
||||
},
|
||||
},
|
||||
"addTwo": {
|
||||
actions: []action{
|
||||
addSectors(getSectors(2)),
|
||||
addSectors(getSectors(2), false),
|
||||
waitPending(2),
|
||||
flush(getSectors(2)),
|
||||
},
|
||||
@ -238,13 +241,13 @@ func TestPrecommitBatcher(t *testing.T) {
|
||||
"addMax": {
|
||||
actions: []action{
|
||||
expectSend(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch), true),
|
||||
},
|
||||
},
|
||||
"addMax-belowBaseFee": {
|
||||
actions: []action{
|
||||
expectSendsSingle(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch)),
|
||||
addSectors(getSectors(maxBatch), false),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
type PreCommitPolicy interface {
|
||||
@ -18,8 +19,8 @@ type PreCommitPolicy interface {
|
||||
}
|
||||
|
||||
type Chain interface {
|
||||
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error)
|
||||
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
|
||||
ChainHead(context.Context) (*types.TipSet, error)
|
||||
StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
|
||||
}
|
||||
|
||||
// BasicPreCommitPolicy satisfies PreCommitPolicy. It has two modes:
|
||||
@ -58,7 +59,7 @@ func NewBasicPreCommitPolicy(api Chain, cfgGetter GetSealingConfigFunc, provingB
|
||||
// Expiration produces the pre-commit sector expiration epoch for an encoded
|
||||
// replica containing the provided enumeration of pieces and deals.
|
||||
func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi.ChainEpoch, error) {
|
||||
_, epoch, err := p.api.ChainHead(ctx)
|
||||
ts, err := p.api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -70,8 +71,8 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
|
||||
continue
|
||||
}
|
||||
|
||||
if p.DealInfo.DealSchedule.EndEpoch < epoch {
|
||||
log.Warnf("piece schedule %+v ended before current epoch %d", p, epoch)
|
||||
if p.DealInfo.DealSchedule.EndEpoch < ts.Height() {
|
||||
log.Warnf("piece schedule %+v ended before current epoch %d", p, ts.Height())
|
||||
continue
|
||||
}
|
||||
|
||||
@ -88,13 +89,13 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
|
||||
return 0, err
|
||||
}
|
||||
|
||||
tmp := epoch + expirationDuration
|
||||
tmp := ts.Height() + expirationDuration
|
||||
end = &tmp
|
||||
}
|
||||
|
||||
// Ensure there is at least one day for the PC message to land without falling below min sector lifetime
|
||||
// TODO: The "one day" should probably be a config, though it doesn't matter too much
|
||||
minExp := epoch + policy.GetMinSectorExpiration() + miner.WPoStProvingPeriod
|
||||
minExp := ts.Height() + policy.GetMinSectorExpiration() + miner.WPoStProvingPeriod
|
||||
if *end < minExp {
|
||||
end = &minExp
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
)
|
||||
@ -41,12 +42,12 @@ func fakeConfigGetter(stub *fakeConfigStub) pipeline.GetSealingConfigFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fakeChain) StateNetworkVersion(ctx context.Context, tok pipeline.TipSetToken) (network.Version, error) {
|
||||
func (f *fakeChain) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
|
||||
return build.NewestNetworkVersion, nil
|
||||
}
|
||||
|
||||
func (f *fakeChain) ChainHead(ctx context.Context) (pipeline.TipSetToken, abi.ChainEpoch, error) {
|
||||
return []byte{1, 2, 3}, f.h, nil
|
||||
func (f *fakeChain) ChainHead(ctx context.Context) (*types.TipSet, error) {
|
||||
return makeTs(nil, f.h), nil
|
||||
}
|
||||
|
||||
func fakePieceCid(t *testing.T) cid.Cid {
|
||||
|
@ -2,7 +2,6 @@ package sealing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -13,7 +12,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
@ -21,16 +19,15 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/events"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
const SectorStorePrefix = "/sectors"
|
||||
@ -39,44 +36,32 @@ var ErrTooManySectorsSealing = xerrors.New("too many sectors sealing")
|
||||
|
||||
var log = logging.Logger("sectors")
|
||||
|
||||
type SectorLocation struct {
|
||||
Deadline uint64
|
||||
Partition uint64
|
||||
}
|
||||
|
||||
var ErrSectorAllocated = errors.New("sectorNumber is allocated, but PreCommit info wasn't found on chain")
|
||||
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/api.go -package=mocks . SealingAPI
|
||||
|
||||
type SealingAPI interface {
|
||||
StateWaitMsg(context.Context, cid.Cid) (MsgLookup, error)
|
||||
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error)
|
||||
StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok TipSetToken) (cid.Cid, error)
|
||||
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
|
||||
|
||||
// Can return ErrSectorAllocated in case precommit info wasn't found, but the sector number is marked as allocated
|
||||
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorOnChainInfo, error)
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*SectorLocation, error)
|
||||
StateLookupID(context.Context, address.Address, TipSetToken) (address.Address, error)
|
||||
StateMinerSectorSize(context.Context, address.Address, TipSetToken) (abi.SectorSize, error)
|
||||
StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok TipSetToken) (address.Address, error)
|
||||
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error)
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error)
|
||||
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error)
|
||||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, TipSetToken) (bool, error)
|
||||
StateMinerActiveSectors(context.Context, address.Address, TipSetToken) (bitfield.BitField, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (*api.MarketDeal, error)
|
||||
StateMarketStorageDealProposal(context.Context, abi.DealID, TipSetToken) (market.DealProposal, error)
|
||||
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
|
||||
StateMinerProvingDeadline(context.Context, address.Address, TipSetToken) (*dline.Info, error)
|
||||
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tok TipSetToken) ([]api.Partition, error)
|
||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
|
||||
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error)
|
||||
ChainBaseFee(context.Context, TipSetToken) (abi.TokenAmount, error)
|
||||
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
|
||||
StateComputeDataCID(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tsk types.TipSetKey) (cid.Cid, error)
|
||||
StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
|
||||
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
|
||||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
|
||||
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
|
||||
StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
|
||||
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
|
||||
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error)
|
||||
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
ChainHead(ctx context.Context) (*types.TipSet, error)
|
||||
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
||||
StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok TipSetToken) (abi.Randomness, error)
|
||||
StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tok TipSetToken) (abi.Randomness, error)
|
||||
StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error)
|
||||
StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error)
|
||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||
}
|
||||
|
||||
@ -84,6 +69,10 @@ type SectorStateNotifee func(before, after SectorInfo)
|
||||
|
||||
type AddrSel func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error)
|
||||
|
||||
type Events interface {
|
||||
ChainAt(ctx context.Context, hnd events.HeightHandler, rev events.RevertHandler, confidence int, h abi.ChainEpoch) error
|
||||
}
|
||||
|
||||
type Sealing struct {
|
||||
Api SealingAPI
|
||||
DealInfo *CurrentDealInfoManager
|
||||
@ -98,7 +87,7 @@ type Sealing struct {
|
||||
sealer sealer.SectorManager
|
||||
sectors *statemachine.StateGroup
|
||||
sc SectorIDCounter
|
||||
verif ffiwrapper.Verifier
|
||||
verif storiface.Verifier
|
||||
pcp PreCommitPolicy
|
||||
|
||||
inputLk sync.Mutex
|
||||
@ -154,13 +143,13 @@ type pendingPiece struct {
|
||||
size abi.UnpaddedPieceSize
|
||||
deal api.PieceDealInfo
|
||||
|
||||
data storage.Data
|
||||
data storiface.Data
|
||||
|
||||
assigned bool // assigned to a sector?
|
||||
accepted func(abi.SectorNumber, abi.UnpaddedPieceSize, error)
|
||||
}
|
||||
|
||||
func New(mctx context.Context, api SealingAPI, fc config.MinerFeeConfig, events Events, maddr address.Address, ds datastore.Batching, sealer sealer.SectorManager, sc SectorIDCounter, verif ffiwrapper.Verifier, prov ffiwrapper.Prover, pcp PreCommitPolicy, gc GetSealingConfigFunc, notifee SectorStateNotifee, as AddrSel) *Sealing {
|
||||
func New(mctx context.Context, api SealingAPI, fc config.MinerFeeConfig, events Events, maddr address.Address, ds datastore.Batching, sealer sealer.SectorManager, sc SectorIDCounter, verif storiface.Verifier, prov storiface.Prover, pcp PreCommitPolicy, gc GetSealingConfigFunc, notifee SectorStateNotifee, as AddrSel) *Sealing {
|
||||
s := &Sealing{
|
||||
Api: api,
|
||||
DealInfo: &CurrentDealInfoManager{api},
|
||||
@ -259,12 +248,12 @@ func (m *Sealing) CommitPending(ctx context.Context) ([]abi.SectorID, error) {
|
||||
}
|
||||
|
||||
func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof, error) {
|
||||
mi, err := m.Api.StateMinerInfo(ctx, m.maddr, nil)
|
||||
mi, err := m.Api.StateMinerInfo(ctx, m.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
ver, err := m.Api.StateNetworkVersion(ctx, nil)
|
||||
ver, err := m.Api.StateNetworkVersion(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -272,8 +261,8 @@ func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof
|
||||
return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType)
|
||||
}
|
||||
|
||||
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storage.SectorRef {
|
||||
return storage.SectorRef{
|
||||
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storiface.SectorRef {
|
||||
return storiface.SectorRef{
|
||||
ID: m.minerSectorID(num),
|
||||
ProofType: spt,
|
||||
}
|
||||
|
@ -14,7 +14,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
const minRetryTime = 1 * time.Minute
|
||||
@ -36,13 +38,13 @@ func failedCooldown(ctx statemachine.Context, sector SectorInfo) error {
|
||||
}
|
||||
|
||||
func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitOnChainInfo, bool) {
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
info, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
info, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err)
|
||||
return nil, false
|
||||
@ -72,14 +74,14 @@ func (m *Sealing) handleSealPrecommit2Failed(ctx statemachine.Context, sector Se
|
||||
}
|
||||
|
||||
func (m *Sealing) handlePreCommitFailed(ctx statemachine.Context, sector SectorInfo) error {
|
||||
tok, height, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommitFailed: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if sector.PreCommitMessage != nil {
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), *sector.PreCommitMessage)
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), ts.Key(), *sector.PreCommitMessage, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
// API error
|
||||
if err := failedCooldown(ctx, sector); err != nil {
|
||||
@ -106,7 +108,7 @@ func (m *Sealing) handlePreCommitFailed(ctx statemachine.Context, sector SectorI
|
||||
}
|
||||
}
|
||||
|
||||
if err := checkPrecommit(ctx.Context(), m.Address(), sector, tok, height, m.Api); err != nil {
|
||||
if err := checkPrecommit(ctx.Context(), m.Address(), sector, ts.Key(), ts.Height(), m.Api); err != nil {
|
||||
switch err.(type) {
|
||||
case *ErrApi:
|
||||
log.Errorf("handlePreCommitFailed: api error, not proceeding: %+v", err)
|
||||
@ -139,7 +141,7 @@ func (m *Sealing) handlePreCommitFailed(ctx statemachine.Context, sector SectorI
|
||||
if pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil {
|
||||
if sector.PreCommitMessage == nil {
|
||||
log.Warnf("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorNumber)
|
||||
return ctx.Send(SectorPreCommitLanded{TipSet: tok})
|
||||
return ctx.Send(SectorPreCommitLanded{TipSet: ts.Key()})
|
||||
}
|
||||
|
||||
if pci.Info.SealedCID != *sector.CommR {
|
||||
@ -188,7 +190,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
|
||||
}
|
||||
|
||||
if sector.ReplicaUpdateMessage != nil {
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), *sector.ReplicaUpdateMessage)
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), types.EmptyTSK, *sector.ReplicaUpdateMessage, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
// API error
|
||||
return ctx.Send(SectorRetrySubmitReplicaUpdateWait{})
|
||||
@ -208,13 +210,13 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
|
||||
}
|
||||
}
|
||||
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, tok, m.Api); err != nil {
|
||||
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, ts.Key(), m.Api); err != nil {
|
||||
switch err.(type) {
|
||||
case *ErrApi:
|
||||
log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err)
|
||||
@ -237,7 +239,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
|
||||
}
|
||||
|
||||
// Abort upgrade for sectors that went faulty since being marked for upgrade
|
||||
active, err := m.sectorActive(ctx.Context(), tok, sector.SectorNumber)
|
||||
active, err := m.sectorActive(ctx.Context(), ts.Key(), sector.SectorNumber)
|
||||
if err != nil {
|
||||
log.Errorf("sector active check: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -261,14 +263,14 @@ func (m *Sealing) handleReleaseSectorKeyFailed(ctx statemachine.Context, sector
|
||||
}
|
||||
|
||||
func (m *Sealing) handleCommitFailed(ctx statemachine.Context, sector SectorInfo) error {
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if sector.CommitMessage != nil {
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), *sector.CommitMessage)
|
||||
mw, err := m.Api.StateSearchMsg(ctx.Context(), ts.Key(), *sector.CommitMessage, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
// API error
|
||||
if err := failedCooldown(ctx, sector); err != nil {
|
||||
@ -295,7 +297,7 @@ func (m *Sealing) handleCommitFailed(ctx statemachine.Context, sector SectorInfo
|
||||
}
|
||||
}
|
||||
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, tok); err != nil {
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, ts.Key()); err != nil {
|
||||
switch err.(type) {
|
||||
case *ErrApi:
|
||||
log.Errorf("handleCommitFailed: api error, not proceeding: %+v", err)
|
||||
@ -365,7 +367,7 @@ func (m *Sealing) handleTerminateFailed(ctx statemachine.Context, sector SectorI
|
||||
// ignoring error as it's most likely an API error - `pci` will be nil, and we'll go back to
|
||||
// the Terminating state after cooldown. If the API is still failing, well get back to here
|
||||
// with the error in SectorInfo log.
|
||||
pci, _ := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)
|
||||
pci, _ := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, types.EmptyTSK)
|
||||
if pci != nil {
|
||||
return nil // pause the fsm, needs manual user action
|
||||
}
|
||||
@ -379,7 +381,7 @@ func (m *Sealing) handleTerminateFailed(ctx statemachine.Context, sector SectorI
|
||||
|
||||
func (m *Sealing) handleDealsExpired(ctx statemachine.Context, sector SectorInfo) error {
|
||||
// First make vary sure the sector isn't committed
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting sector info: %w", err)
|
||||
}
|
||||
@ -435,7 +437,7 @@ func (m *Sealing) handleRecoverDealIDsOrFailWith(ctx statemachine.Context, secto
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -457,7 +459,7 @@ func (m *Sealing) handleRecoverDealIDsOrFailWith(ctx statemachine.Context, secto
|
||||
mdp := *p.DealInfo.DealProposal
|
||||
dp = &mdp
|
||||
}
|
||||
res, err := m.DealInfo.GetCurrentDealInfo(ctx.Context(), tok, dp, *p.DealInfo.PublishCid)
|
||||
res, err := m.DealInfo.GetCurrentDealInfo(ctx.Context(), ts.Key(), dp, *p.DealInfo.PublishCid)
|
||||
if err != nil {
|
||||
failed[i] = xerrors.Errorf("getting current deal info for piece %d: %w", i, err)
|
||||
continue
|
||||
@ -508,7 +510,7 @@ func (m *Sealing) handleSnapDealsRecoverDealIDs(ctx statemachine.Context, sector
|
||||
}
|
||||
|
||||
func recoveryPiecesToFix(ctx context.Context, api SealingAPI, sector SectorInfo, maddr address.Address) ([]int, int, error) {
|
||||
tok, height, err := api.ChainHead(ctx)
|
||||
ts, err := api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return nil, 0, xerrors.Errorf("getting chain head: %w", err)
|
||||
}
|
||||
@ -528,35 +530,35 @@ func recoveryPiecesToFix(ctx context.Context, api SealingAPI, sector SectorInfo,
|
||||
continue
|
||||
}
|
||||
|
||||
proposal, err := api.StateMarketStorageDealProposal(ctx, p.DealInfo.DealID, tok)
|
||||
deal, err := api.StateMarketStorageDeal(ctx, p.DealInfo.DealID, ts.Key())
|
||||
if err != nil {
|
||||
log.Warnf("getting deal %d for piece %d: %+v", p.DealInfo.DealID, i, err)
|
||||
toFix = append(toFix, i)
|
||||
continue
|
||||
}
|
||||
|
||||
if proposal.Provider != maddr {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with wrong provider: %s != %s", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, proposal.Provider, maddr)
|
||||
if deal.Proposal.Provider != maddr {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with wrong provider: %s != %s", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, deal.Proposal.Provider, maddr)
|
||||
toFix = append(toFix, i)
|
||||
continue
|
||||
}
|
||||
|
||||
if proposal.PieceCID != p.Piece.PieceCID {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with wrong PieceCID: %s != %s", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, p.Piece.PieceCID, proposal.PieceCID)
|
||||
if deal.Proposal.PieceCID != p.Piece.PieceCID {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with wrong PieceCID: %s != %s", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, p.Piece.PieceCID, deal.Proposal.PieceCID)
|
||||
toFix = append(toFix, i)
|
||||
continue
|
||||
}
|
||||
|
||||
if p.Piece.Size != proposal.PieceSize {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with different size: %d != %d", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, p.Piece.Size, proposal.PieceSize)
|
||||
if p.Piece.Size != deal.Proposal.PieceSize {
|
||||
log.Warnf("piece %d (of %d) of sector %d refers deal %d with different size: %d != %d", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, p.Piece.Size, deal.Proposal.PieceSize)
|
||||
toFix = append(toFix, i)
|
||||
continue
|
||||
}
|
||||
|
||||
if height >= proposal.StartEpoch {
|
||||
if ts.Height() >= deal.Proposal.StartEpoch {
|
||||
// TODO: check if we are in an early enough state (before precommit), try to remove the offending pieces
|
||||
// (tricky as we have to 'defragment' the sector while doing that, and update piece references for retrieval)
|
||||
return nil, 0, xerrors.Errorf("can't fix sector deals: piece %d (of %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, proposal.StartEpoch, height)
|
||||
return nil, 0, xerrors.Errorf("can't fix sector deals: piece %d (of %d) of sector %d refers expired deal %d - should start at %d, head %d", i, len(sector.Pieces), sector.SectorNumber, p.DealInfo.DealID, deal.Proposal.StartEpoch, ts.Height())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
api2 "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
pipeline "github.com/filecoin-project/lotus/storage/pipeline"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/mocks"
|
||||
)
|
||||
@ -49,14 +50,14 @@ func TestStateRecoverDealIDs(t *testing.T) {
|
||||
}
|
||||
|
||||
//stm: @CHAIN_STATE_MARKET_STORAGE_DEAL_001, @CHAIN_STATE_NETWORK_VERSION_001
|
||||
api.EXPECT().StateMarketStorageDealProposal(ctx, dealId, nil).Return(dealProposal, nil)
|
||||
api.EXPECT().StateMarketStorageDeal(ctx, dealId, nil).Return(&api2.MarketDeal{Proposal: dealProposal}, nil)
|
||||
|
||||
pc := idCid("publishCID")
|
||||
|
||||
// expect GetCurrentDealInfo
|
||||
{
|
||||
api.EXPECT().StateSearchMsg(ctx, pc).Return(&pipeline.MsgLookup{
|
||||
Receipt: pipeline.MessageReceipt{
|
||||
api.EXPECT().StateSearchMsg(ctx, gomock.Any(), pc, gomock.Any(), gomock.Any()).Return(&api2.MsgLookup{
|
||||
Receipt: types.MessageReceipt{
|
||||
ExitCode: exitcode.Ok,
|
||||
Return: cborRet(&market0.PublishStorageDealsReturn{
|
||||
IDs: []abi.DealID{dealId},
|
||||
|
@ -8,8 +8,10 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) error {
|
||||
@ -24,7 +26,7 @@ func (m *Sealing) handleFaultReported(ctx statemachine.Context, sector SectorInf
|
||||
return xerrors.Errorf("entered fault reported state without a FaultReportMsg cid")
|
||||
}
|
||||
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.FaultReportMsg)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.FaultReportMsg, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to wait for fault declaration: %w", err)
|
||||
}
|
||||
@ -46,7 +48,7 @@ func (m *Sealing) handleTerminating(ctx statemachine.Context, sector SectorInfo)
|
||||
// * Check for correct termination
|
||||
// * wait for expiration (+winning lookback?)
|
||||
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting sector info: %w", err)})
|
||||
}
|
||||
@ -54,7 +56,7 @@ func (m *Sealing) handleTerminating(ctx statemachine.Context, sector SectorInfo)
|
||||
if si == nil {
|
||||
// either already terminated or not committed yet
|
||||
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, nil)
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("checking precommit presence: %w", err)})
|
||||
}
|
||||
@ -82,7 +84,7 @@ func (m *Sealing) handleTerminateWait(ctx statemachine.Context, sector SectorInf
|
||||
return xerrors.New("entered TerminateWait with nil TerminateMessage")
|
||||
}
|
||||
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.TerminateMessage)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.TerminateMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("waiting for terminate message to land on chain: %w", err)})
|
||||
}
|
||||
@ -96,21 +98,21 @@ func (m *Sealing) handleTerminateWait(ctx statemachine.Context, sector SectorInf
|
||||
|
||||
func (m *Sealing) handleTerminateFinality(ctx statemachine.Context, sector SectorInfo) error {
|
||||
for {
|
||||
tok, epoch, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting chain head: %w", err)})
|
||||
}
|
||||
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting network version: %w", err)})
|
||||
}
|
||||
|
||||
if epoch >= sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv) {
|
||||
if ts.Height() >= sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv) {
|
||||
return ctx.Send(SectorRemove{})
|
||||
}
|
||||
|
||||
toWait := time.Duration(epoch-sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv)) * time.Duration(build.BlockDelaySecs) * time.Second
|
||||
toWait := time.Duration(ts.Height()-sector.TerminatedAt+policy.GetWinningPoStSectorSetLookback(nv)) * time.Duration(build.BlockDelaySecs) * time.Second
|
||||
select {
|
||||
case <-time.After(toWait):
|
||||
continue
|
||||
|
@ -15,7 +15,9 @@ import (
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
func (m *Sealing) handleReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
||||
@ -39,12 +41,12 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector Sect
|
||||
return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber)
|
||||
}
|
||||
// Abort upgrade for sectors that went faulty since being marked for upgrade
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
active, err := m.sectorActive(ctx.Context(), tok, sector.SectorNumber)
|
||||
active, err := m.sectorActive(ctx.Context(), ts.Key(), sector.SectorNumber)
|
||||
if err != nil {
|
||||
log.Errorf("sector active check: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -75,17 +77,17 @@ func (m *Sealing) handleProveReplicaUpdate(ctx statemachine.Context, sector Sect
|
||||
|
||||
func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error {
|
||||
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, tok, m.Api); err != nil {
|
||||
if err := checkReplicaUpdate(ctx.Context(), m.maddr, sector, ts.Key(), m.Api); err != nil {
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
}
|
||||
|
||||
sl, err := m.Api.StateSectorPartition(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
sl, err := m.Api.StateSectorPartition(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -119,7 +121,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
||||
return xerrors.Errorf("getting config: %w", err)
|
||||
}
|
||||
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -142,7 +144,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
||||
//ReplaceSectorNumber: 0,
|
||||
}
|
||||
|
||||
collateral, err := m.Api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, virtualPCI, tok)
|
||||
collateral, err := m.Api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, virtualPCI, ts.Key())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting initial pledge collateral: %w", err)
|
||||
}
|
||||
@ -160,7 +162,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
||||
|
||||
goodFunds := big.Add(collateral, big.Int(m.feeCfg.MaxCommitGasFee))
|
||||
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tok)
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -171,7 +173,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
|
||||
log.Errorf("no good address to send replica update message from: %+v", err)
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
}
|
||||
mcid, err := m.Api.SendMsg(ctx.Context(), from, m.maddr, builtin.MethodsMiner.ProveReplicaUpdates, collateral, big.Int(m.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(ctx.Context(), m.Api, from, m.maddr, builtin.MethodsMiner.ProveReplicaUpdates, collateral, big.Int(m.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitReplicaUpdate: error sending message: %+v", err)
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
@ -186,7 +188,7 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
}
|
||||
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
log.Errorf("handleReplicaUpdateWait: failed to wait for message: %+v", err)
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
@ -203,7 +205,7 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto
|
||||
default:
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
}
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, mw.TipSetTok)
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, mw.TipSet)
|
||||
if err != nil {
|
||||
log.Errorf("api err failed to get sector info: %+v", err)
|
||||
return ctx.Send(SectorSubmitReplicaUpdateFailed{})
|
||||
@ -234,17 +236,17 @@ func (m *Sealing) handleFinalizeReplicaUpdate(ctx statemachine.Context, sector S
|
||||
|
||||
func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector SectorInfo) error {
|
||||
try := func() error {
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.ReplicaUpdateMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -253,9 +255,9 @@ func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector Sector
|
||||
|
||||
targetHeight := mw.Height + lb + InteractivePoRepConfidence
|
||||
|
||||
return m.events.ChainAt(func(context.Context, TipSetToken, abi.ChainEpoch) error {
|
||||
return m.events.ChainAt(context.Background(), func(context.Context, *types.TipSet, abi.ChainEpoch) error {
|
||||
return ctx.Send(SectorUpdateActive{})
|
||||
}, func(ctx context.Context, ts TipSetToken) error {
|
||||
}, func(ctx context.Context, ts *types.TipSet) error {
|
||||
log.Warn("revert in handleUpdateActivating")
|
||||
return nil
|
||||
}, InteractivePoRepConfidence, targetHeight)
|
||||
|
@ -17,12 +17,14 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/go-statemachine"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var DealSectorPriority = 1024
|
||||
@ -82,7 +84,7 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
|
||||
return ctx.Send(SectorPacked{FillerPieces: fillerPieces})
|
||||
}
|
||||
|
||||
func (m *Sealing) padSector(ctx context.Context, sectorID storage.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]abi.PieceInfo, error) {
|
||||
func (m *Sealing) padSector(ctx context.Context, sectorID storiface.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]abi.PieceInfo, error) {
|
||||
if len(sizes) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
@ -118,7 +120,7 @@ func checkProveCommitExpired(preCommitEpoch, msd abi.ChainEpoch, currEpoch abi.C
|
||||
}
|
||||
|
||||
func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.SealRandomness, abi.ChainEpoch, bool, error) {
|
||||
tok, epoch, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("getTicket: api error, not proceeding: %+v", err)
|
||||
return nil, 0, false, nil
|
||||
@ -126,19 +128,19 @@ func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.Se
|
||||
|
||||
// the reason why the StateMinerSectorAllocated function is placed here, if it is outside,
|
||||
// if the MarshalCBOR function and StateSectorPreCommitInfo function return err, it will be executed
|
||||
allocated, aerr := m.Api.StateMinerSectorAllocated(ctx.Context(), m.maddr, sector.SectorNumber, nil)
|
||||
allocated, aerr := m.Api.StateMinerSectorAllocated(ctx.Context(), m.maddr, sector.SectorNumber, types.EmptyTSK)
|
||||
if aerr != nil {
|
||||
log.Errorf("getTicket: api error, checking if sector is allocated: %+v", aerr)
|
||||
return nil, 0, false, nil
|
||||
}
|
||||
|
||||
ticketEpoch := epoch - policy.SealRandomnessLookback
|
||||
ticketEpoch := ts.Height() - policy.SealRandomnessLookback
|
||||
buf := new(bytes.Buffer)
|
||||
if err := m.maddr.MarshalCBOR(buf); err != nil {
|
||||
return nil, 0, allocated, err
|
||||
}
|
||||
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
return nil, 0, allocated, xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
@ -146,7 +148,7 @@ func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.Se
|
||||
if pci != nil {
|
||||
ticketEpoch = pci.Info.SealRandEpoch
|
||||
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
return nil, 0, allocated, xerrors.Errorf("getTicket: StateNetworkVersion: api error, not proceeding: %+v", err)
|
||||
}
|
||||
@ -160,7 +162,7 @@ func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.Se
|
||||
return nil, 0, allocated, xerrors.Errorf("getTicket: max prove commit duration policy error, not proceeding: %w", err)
|
||||
}
|
||||
|
||||
if checkProveCommitExpired(pci.PreCommitEpoch, msd, epoch) {
|
||||
if checkProveCommitExpired(pci.PreCommitEpoch, msd, ts.Height()) {
|
||||
return nil, 0, allocated, xerrors.Errorf("ticket expired for precommitted sector")
|
||||
}
|
||||
}
|
||||
@ -169,7 +171,7 @@ func (m *Sealing) getTicket(ctx statemachine.Context, sector SectorInfo) (abi.Se
|
||||
return nil, 0, allocated, xerrors.Errorf("sector %s precommitted but expired", sector.SectorNumber)
|
||||
}
|
||||
|
||||
rand, err := m.Api.StateGetRandomnessFromTickets(ctx.Context(), crypto.DomainSeparationTag_SealRandomness, ticketEpoch, buf.Bytes(), tok)
|
||||
rand, err := m.Api.StateGetRandomnessFromTickets(ctx.Context(), crypto.DomainSeparationTag_SealRandomness, ticketEpoch, buf.Bytes(), ts.Key())
|
||||
if err != nil {
|
||||
return nil, 0, allocated, err
|
||||
}
|
||||
@ -215,14 +217,14 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
|
||||
}
|
||||
}
|
||||
|
||||
tok, height, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommit1: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if checkTicketExpired(sector.TicketEpoch, height) {
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
if checkTicketExpired(sector.TicketEpoch, ts.Height()) {
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommit1: StateSectorPreCommitInfo: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -232,7 +234,7 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
|
||||
return ctx.Send(SectorOldTicket{}) // go get new ticket
|
||||
}
|
||||
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommit1: StateNetworkVersion: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -250,7 +252,7 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
|
||||
}
|
||||
|
||||
// if height > PreCommitEpoch + msd, there is no need to recalculate
|
||||
if checkProveCommitExpired(pci.PreCommitEpoch, msd, height) {
|
||||
if checkProveCommitExpired(pci.PreCommitEpoch, msd, ts.Height()) {
|
||||
return ctx.Send(SectorOldTicket{}) // will be removed
|
||||
}
|
||||
}
|
||||
@ -281,57 +283,57 @@ func (m *Sealing) handlePreCommit2(ctx statemachine.Context, sector SectorInfo)
|
||||
})
|
||||
}
|
||||
|
||||
func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitInfo, big.Int, TipSetToken, error) {
|
||||
tok, height, err := m.Api.ChainHead(ctx.Context())
|
||||
func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitInfo, big.Int, types.TipSetKey, error) {
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
|
||||
return nil, big.Zero(), nil, nil
|
||||
return nil, big.Zero(), types.EmptyTSK, nil
|
||||
}
|
||||
|
||||
if err := checkPrecommit(ctx.Context(), m.Address(), sector, tok, height, m.Api); err != nil {
|
||||
if err := checkPrecommit(ctx.Context(), m.Address(), sector, ts.Key(), ts.Height(), m.Api); err != nil {
|
||||
switch err := err.(type) {
|
||||
case *ErrApi:
|
||||
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
|
||||
return nil, big.Zero(), nil, nil
|
||||
return nil, big.Zero(), types.EmptyTSK, nil
|
||||
case *ErrBadCommD: // TODO: Should this just back to packing? (not really needed since handlePreCommit1 will do that too)
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("bad CommD error: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("bad CommD error: %w", err)})
|
||||
case *ErrExpiredTicket:
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("ticket expired: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("ticket expired: %w", err)})
|
||||
case *ErrBadTicket:
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("bad ticket: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("bad ticket: %w", err)})
|
||||
case *ErrInvalidDeals:
|
||||
log.Warnf("invalid deals in sector %d: %v", sector.SectorNumber, err)
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorInvalidDealIDs{Return: RetPreCommitting})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorInvalidDealIDs{Return: RetPreCommitting})
|
||||
case *ErrExpiredDeals:
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorDealsExpired{xerrors.Errorf("sector deals expired: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorDealsExpired{xerrors.Errorf("sector deals expired: %w", err)})
|
||||
case *ErrPrecommitOnChain:
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorPreCommitLanded{TipSet: tok}) // we re-did precommit
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorPreCommitLanded{TipSet: ts.Key()}) // we re-did precommit
|
||||
case *ErrSectorNumberAllocated:
|
||||
log.Errorf("handlePreCommitFailed: sector number already allocated, not proceeding: %+v", err)
|
||||
// TODO: check if the sector is committed (not sure how we'd end up here)
|
||||
return nil, big.Zero(), nil, nil
|
||||
return nil, big.Zero(), types.EmptyTSK, nil
|
||||
default:
|
||||
return nil, big.Zero(), nil, xerrors.Errorf("checkPrecommit sanity check error: %w", err)
|
||||
return nil, big.Zero(), types.EmptyTSK, xerrors.Errorf("checkPrecommit sanity check error: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
expiration, err := m.pcp.Expiration(ctx.Context(), sector.Pieces...)
|
||||
if err != nil {
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)})
|
||||
}
|
||||
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
|
||||
if err != nil {
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get network version: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get network version: %w", err)})
|
||||
}
|
||||
|
||||
av, err := actors.VersionForNetwork(nv)
|
||||
if err != nil {
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get actors version: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get actors version: %w", err)})
|
||||
}
|
||||
msd, err := policy.GetMaxProveCommitDuration(av, sector.SectorType)
|
||||
if err != nil {
|
||||
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get max prove commit duration: %w", err)})
|
||||
return nil, big.Zero(), types.EmptyTSK, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get max prove commit duration: %w", err)})
|
||||
}
|
||||
|
||||
if minExpiration := sector.TicketEpoch + policy.MaxPreCommitRandomnessLookback + msd + miner.MinSectorExpiration; expiration < minExpiration {
|
||||
@ -339,7 +341,7 @@ func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (
|
||||
}
|
||||
|
||||
// Assume: both precommit msg & commit msg land on chain as early as possible
|
||||
maxExpiration := height + policy.GetPreCommitChallengeDelay() + policy.GetMaxSectorExpirationExtension()
|
||||
maxExpiration := ts.Height() + policy.GetPreCommitChallengeDelay() + policy.GetMaxSectorExpirationExtension()
|
||||
if expiration > maxExpiration {
|
||||
expiration = maxExpiration
|
||||
}
|
||||
@ -354,12 +356,12 @@ func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (
|
||||
DealIDs: sector.dealIDs(),
|
||||
}
|
||||
|
||||
collateral, err := m.Api.StateMinerPreCommitDepositForPower(ctx.Context(), m.maddr, *params, tok)
|
||||
collateral, err := m.Api.StateMinerPreCommitDepositForPower(ctx.Context(), m.maddr, *params, ts.Key())
|
||||
if err != nil {
|
||||
return nil, big.Zero(), nil, xerrors.Errorf("getting initial pledge collateral: %w", err)
|
||||
return nil, big.Zero(), types.EmptyTSK, xerrors.Errorf("getting initial pledge collateral: %w", err)
|
||||
}
|
||||
|
||||
return params, collateral, tok, nil
|
||||
return params, collateral, ts.Key(), nil
|
||||
}
|
||||
|
||||
func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInfo) error {
|
||||
@ -369,7 +371,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
||||
}
|
||||
|
||||
if cfg.BatchPreCommits {
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), nil)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting network version: %w", err)
|
||||
}
|
||||
@ -379,7 +381,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
||||
}
|
||||
}
|
||||
|
||||
params, pcd, tok, err := m.preCommitParams(ctx, sector)
|
||||
params, pcd, tsk, err := m.preCommitParams(ctx, sector)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)})
|
||||
}
|
||||
@ -397,7 +399,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("could not serialize pre-commit sector parameters: %w", err)})
|
||||
}
|
||||
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tok)
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tsk)
|
||||
if err != nil {
|
||||
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -411,7 +413,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
||||
}
|
||||
|
||||
log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit)
|
||||
mcid, err := m.Api.SendMsg(ctx.Context(), from, m.maddr, builtin.MethodsMiner.PreCommitSector, deposit, big.Int(m.feeCfg.MaxPreCommitGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(ctx.Context(), m.Api, from, m.maddr, builtin.MethodsMiner.PreCommitSector, deposit, big.Int(m.feeCfg.MaxPreCommitGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
|
||||
}
|
||||
@ -455,7 +457,7 @@ func (m *Sealing) handlePreCommitWait(ctx statemachine.Context, sector SectorInf
|
||||
|
||||
// would be ideal to just use the events.Called handler, but it wouldn't be able to handle individual message timeouts
|
||||
log.Info("Sector precommitted: ", sector.SectorNumber)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.PreCommitMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorChainPreCommitFailed{err})
|
||||
}
|
||||
@ -476,17 +478,17 @@ func (m *Sealing) handlePreCommitWait(ctx statemachine.Context, sector SectorInf
|
||||
|
||||
log.Info("precommit message landed on chain: ", sector.SectorNumber)
|
||||
|
||||
return ctx.Send(SectorPreCommitLanded{TipSet: mw.TipSetTok})
|
||||
return ctx.Send(SectorPreCommitLanded{TipSet: mw.TipSet})
|
||||
}
|
||||
|
||||
func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) error {
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleWaitSeed: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
@ -496,10 +498,10 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
|
||||
|
||||
randHeight := pci.PreCommitEpoch + policy.GetPreCommitChallengeDelay()
|
||||
|
||||
err = m.events.ChainAt(func(ectx context.Context, _ TipSetToken, curH abi.ChainEpoch) error {
|
||||
err = m.events.ChainAt(context.Background(), func(ectx context.Context, _ *types.TipSet, curH abi.ChainEpoch) error {
|
||||
// in case of null blocks the randomness can land after the tipset we
|
||||
// get from the events API
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
@ -509,9 +511,9 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
|
||||
if err := m.maddr.MarshalCBOR(buf); err != nil {
|
||||
return err
|
||||
}
|
||||
rand, err := m.Api.StateGetRandomnessFromBeacon(ectx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, randHeight, buf.Bytes(), tok)
|
||||
rand, err := m.Api.StateGetRandomnessFromBeacon(ectx, crypto.DomainSeparationTag_InteractiveSealChallengeSeed, randHeight, buf.Bytes(), ts.Key())
|
||||
if err != nil {
|
||||
err = xerrors.Errorf("failed to get randomness for computing seal proof (ch %d; rh %d; tsk %x): %w", curH, randHeight, tok, err)
|
||||
err = xerrors.Errorf("failed to get randomness for computing seal proof (ch %d; rh %d; tsk %x): %w", curH, randHeight, ts.Key(), err)
|
||||
|
||||
_ = ctx.Send(SectorChainPreCommitFailed{error: err})
|
||||
return err
|
||||
@ -520,7 +522,7 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
|
||||
_ = ctx.Send(SectorSeedReady{SeedValue: abi.InteractiveSealRandomness(rand), SeedEpoch: randHeight})
|
||||
|
||||
return nil
|
||||
}, func(ctx context.Context, ts TipSetToken) error {
|
||||
}, func(ctx context.Context, ts *types.TipSet) error {
|
||||
log.Warn("revert in interactive commit sector step")
|
||||
// TODO: need to cancel running process and restart...
|
||||
return nil
|
||||
@ -536,7 +538,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
||||
if sector.CommitMessage != nil {
|
||||
log.Warnf("sector %d entered committing state with a commit message cid", sector.SectorNumber)
|
||||
|
||||
ml, err := m.Api.StateSearchMsg(ctx.Context(), *sector.CommitMessage)
|
||||
ml, err := m.Api.StateSearchMsg(ctx.Context(), types.EmptyTSK, *sector.CommitMessage, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
log.Warnf("sector %d searching existing commit message %s: %+v", sector.SectorNumber, *sector.CommitMessage, err)
|
||||
}
|
||||
@ -560,7 +562,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")})
|
||||
}
|
||||
|
||||
cids := storage.SectorCids{
|
||||
cids := storiface.SectorCids{
|
||||
Unsealed: *sector.CommD,
|
||||
Sealed: *sector.CommR,
|
||||
}
|
||||
@ -575,13 +577,13 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
||||
}
|
||||
|
||||
{
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.checkCommit(ctx.Context(), sector, proof, tok); err != nil {
|
||||
if err := m.checkCommit(ctx.Context(), sector, proof, ts.Key()); err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("commit check error: %w", err)})
|
||||
}
|
||||
}
|
||||
@ -604,7 +606,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
}
|
||||
|
||||
if cfg.AggregateCommits {
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), nil)
|
||||
nv, err := m.Api.StateNetworkVersion(ctx.Context(), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting network version: %w", err)
|
||||
}
|
||||
@ -614,13 +616,13 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
}
|
||||
}
|
||||
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, tok); err != nil {
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, ts.Key()); err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("commit check error: %w", err)})
|
||||
}
|
||||
|
||||
@ -634,13 +636,13 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("could not serialize commit sector parameters: %w", err)})
|
||||
}
|
||||
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, tok)
|
||||
mi, err := m.Api.StateMinerInfo(ctx.Context(), m.maddr, ts.Key())
|
||||
if err != nil {
|
||||
log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, tok)
|
||||
pci, err := m.Api.StateSectorPreCommitInfo(ctx.Context(), m.maddr, sector.SectorNumber, ts.Key())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting precommit info: %w", err)
|
||||
}
|
||||
@ -648,7 +650,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
return ctx.Send(SectorCommitFailed{error: xerrors.Errorf("precommit info not found on chain")})
|
||||
}
|
||||
|
||||
collateral, err := m.Api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, pci.Info, tok)
|
||||
collateral, err := m.Api.StateMinerInitialPledgeCollateral(ctx.Context(), m.maddr, pci.Info, ts.Key())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting initial pledge collateral: %w", err)
|
||||
}
|
||||
@ -671,7 +673,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
}
|
||||
|
||||
// TODO: check seed / ticket / deals are up to date
|
||||
mcid, err := m.Api.SendMsg(ctx.Context(), from, m.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, big.Int(m.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(ctx.Context(), m.Api, from, m.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, big.Int(m.feeCfg.MaxCommitGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
|
||||
}
|
||||
@ -699,13 +701,13 @@ func (m *Sealing) handleSubmitCommitAggregate(ctx statemachine.Context, sector S
|
||||
})
|
||||
|
||||
if err != nil || res.Error != "" {
|
||||
tok, _, err := m.Api.ChainHead(ctx.Context())
|
||||
ts, err := m.Api.ChainHead(ctx.Context())
|
||||
if err != nil {
|
||||
log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, tok); err != nil {
|
||||
if err := m.checkCommit(ctx.Context(), sector, sector.Proof, ts.Key()); err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("commit check error: %w", err)})
|
||||
}
|
||||
|
||||
@ -729,7 +731,7 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo)
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("entered commit wait with no commit cid")})
|
||||
}
|
||||
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.CommitMessage)
|
||||
mw, err := m.Api.StateWaitMsg(ctx.Context(), *sector.CommitMessage, build.MessageConfidence, api.LookbackNoLimit, true)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("failed to wait for porep inclusion: %w", err)})
|
||||
}
|
||||
@ -746,7 +748,7 @@ func (m *Sealing) handleCommitWait(ctx statemachine.Context, sector SectorInfo)
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("submitting sector proof failed (exit=%d, msg=%s) (t:%x; s:%x(%d); p:%x)", mw.Receipt.ExitCode, sector.CommitMessage, sector.TicketValue, sector.SeedValue, sector.SeedEpoch, sector.Proof)})
|
||||
}
|
||||
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, mw.TipSetTok)
|
||||
si, err := m.Api.StateSectorGetInfo(ctx.Context(), m.maddr, sector.SectorNumber, mw.TipSet)
|
||||
if err != nil {
|
||||
return ctx.Send(SectorCommitFailed{xerrors.Errorf("proof validation failed, calling StateSectorGetInfo: %w", err)})
|
||||
}
|
||||
|
@ -19,15 +19,17 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
)
|
||||
|
||||
type TerminateBatcherApi interface {
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*SectorLocation, error)
|
||||
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
|
||||
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error)
|
||||
StateMinerProvingDeadline(context.Context, address.Address, TipSetToken) (*dline.Info, error)
|
||||
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tok TipSetToken) ([]api.Partition, error)
|
||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
|
||||
StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
|
||||
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
|
||||
}
|
||||
|
||||
type TerminateBatcher struct {
|
||||
@ -38,7 +40,7 @@ type TerminateBatcher struct {
|
||||
feeCfg config.MinerFeeConfig
|
||||
getConfig GetSealingConfigFunc
|
||||
|
||||
todo map[SectorLocation]*bitfield.BitField // MinerSectorLocation -> BitField
|
||||
todo map[lminer.SectorLocation]*bitfield.BitField // MinerSectorLocation -> BitField
|
||||
|
||||
waiting map[abi.SectorNumber][]chan cid.Cid
|
||||
|
||||
@ -56,7 +58,7 @@ func NewTerminationBatcher(mctx context.Context, maddr address.Address, api Term
|
||||
feeCfg: feeCfg,
|
||||
getConfig: getConfig,
|
||||
|
||||
todo: map[SectorLocation]*bitfield.BitField{},
|
||||
todo: map[lminer.SectorLocation]*bitfield.BitField{},
|
||||
waiting: map[abi.SectorNumber][]chan cid.Cid{},
|
||||
|
||||
notify: make(chan struct{}, 1),
|
||||
@ -107,7 +109,7 @@ func (b *TerminateBatcher) run() {
|
||||
}
|
||||
|
||||
func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
||||
dl, err := b.api.StateMinerProvingDeadline(b.mctx, b.maddr, nil)
|
||||
dl, err := b.api.StateMinerProvingDeadline(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("getting proving deadline info failed: %w", err)
|
||||
}
|
||||
@ -147,7 +149,7 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
ps, err := b.api.StateMinerPartitions(b.mctx, b.maddr, loc.Deadline, nil)
|
||||
ps, err := b.api.StateMinerPartitions(b.mctx, b.maddr, loc.Deadline, types.EmptyTSK)
|
||||
if err != nil {
|
||||
log.Warnw("TerminateBatcher: getting miner partitions", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
|
||||
continue
|
||||
@ -210,7 +212,7 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
||||
return nil, xerrors.Errorf("couldn't serialize TerminateSectors params: %w", err)
|
||||
}
|
||||
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, nil)
|
||||
mi, err := b.api.StateMinerInfo(b.mctx, b.maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("couldn't get miner info: %w", err)
|
||||
}
|
||||
@ -220,14 +222,14 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
|
||||
return nil, xerrors.Errorf("no good address found: %w", err)
|
||||
}
|
||||
|
||||
mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, builtin.MethodsMiner.TerminateSectors, big.Zero(), big.Int(b.feeCfg.MaxTerminateGasFee), enc.Bytes())
|
||||
mcid, err := sendMsg(b.mctx, b.api, from, b.maddr, builtin.MethodsMiner.TerminateSectors, big.Zero(), big.Int(b.feeCfg.MaxTerminateGasFee), enc.Bytes())
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("sending message failed: %w", err)
|
||||
}
|
||||
log.Infow("Sent TerminateSectors message", "cid", mcid, "from", from, "terminations", len(params.Terminations))
|
||||
|
||||
for _, t := range params.Terminations {
|
||||
delete(b.todo, SectorLocation{
|
||||
delete(b.todo, lminer.SectorLocation{
|
||||
Deadline: t.Deadline,
|
||||
Partition: t.Partition,
|
||||
})
|
||||
@ -256,7 +258,7 @@ func (b *TerminateBatcher) AddTermination(ctx context.Context, s abi.SectorID) (
|
||||
return cid.Undef, false, err
|
||||
}
|
||||
|
||||
loc, err := b.api.StateSectorPartition(ctx, maddr, s.Number, nil)
|
||||
loc, err := b.api.StateSectorPartition(ctx, maddr, s.Number, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return cid.Undef, false, xerrors.Errorf("getting sector location: %w", err)
|
||||
}
|
||||
@ -266,7 +268,7 @@ func (b *TerminateBatcher) AddTermination(ctx context.Context, s abi.SectorID) (
|
||||
|
||||
{
|
||||
// check if maybe already terminated
|
||||
parts, err := b.api.StateMinerPartitions(ctx, maddr, loc.Deadline, nil)
|
||||
parts, err := b.api.StateMinerPartitions(ctx, maddr, loc.Deadline, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return cid.Cid{}, false, xerrors.Errorf("getting partitions: %w", err)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package sealing
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
@ -9,12 +8,12 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||
"github.com/filecoin-project/go-state-types/exitcode"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/statemachine.go -package=mocks . Context
|
||||
@ -69,7 +68,7 @@ type SectorInfo struct {
|
||||
// PreCommit1
|
||||
TicketValue abi.SealRandomness
|
||||
TicketEpoch abi.ChainEpoch
|
||||
PreCommit1Out storage.PreCommit1Out
|
||||
PreCommit1Out storiface.PreCommit1Out
|
||||
|
||||
// PreCommit2
|
||||
CommD *cid.Cid
|
||||
@ -79,7 +78,7 @@ type SectorInfo struct {
|
||||
PreCommitInfo *miner.SectorPreCommitInfo
|
||||
PreCommitDeposit big.Int
|
||||
PreCommitMessage *cid.Cid
|
||||
PreCommitTipSet TipSetToken
|
||||
PreCommitTipSet types.TipSetKey
|
||||
|
||||
PreCommit2Fails uint64
|
||||
|
||||
@ -96,7 +95,7 @@ type SectorInfo struct {
|
||||
CCPieces []Piece
|
||||
UpdateSealed *cid.Cid
|
||||
UpdateUnsealed *cid.Cid
|
||||
ReplicaUpdateProof storage.ReplicaUpdateProof
|
||||
ReplicaUpdateProof storiface.ReplicaUpdateProof
|
||||
ReplicaUpdateMessage *cid.Cid
|
||||
|
||||
// Faults
|
||||
@ -165,8 +164,8 @@ func (t *SectorInfo) sealingCtx(ctx context.Context) context.Context {
|
||||
|
||||
// Returns list of offset/length tuples of sector data ranges which clients
|
||||
// requested to keep unsealed
|
||||
func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storage.Range {
|
||||
var out []storage.Range
|
||||
func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storiface.Range {
|
||||
var out []storiface.Range
|
||||
|
||||
var at abi.UnpaddedPieceSize
|
||||
for _, piece := range pieces {
|
||||
@ -183,7 +182,7 @@ func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool)
|
||||
continue
|
||||
}
|
||||
|
||||
out = append(out, storage.Range{
|
||||
out = append(out, storiface.Range{
|
||||
Offset: at - psize,
|
||||
Size: psize,
|
||||
})
|
||||
@ -196,22 +195,4 @@ type SectorIDCounter interface {
|
||||
Next() (abi.SectorNumber, error)
|
||||
}
|
||||
|
||||
type TipSetToken []byte
|
||||
|
||||
type MsgLookup struct {
|
||||
Receipt MessageReceipt
|
||||
TipSetTok TipSetToken
|
||||
Height abi.ChainEpoch
|
||||
}
|
||||
|
||||
type MessageReceipt struct {
|
||||
ExitCode exitcode.ExitCode
|
||||
Return []byte
|
||||
GasUsed int64
|
||||
}
|
||||
|
||||
type GetSealingConfigFunc func() (sealiface.Config, error)
|
||||
|
||||
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
|
||||
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) error {
|
||||
@ -23,16 +25,16 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
|
||||
return xerrors.Errorf("not a committed-capacity sector, has deals")
|
||||
}
|
||||
|
||||
tok, head, err := m.Api.ChainHead(ctx)
|
||||
ts, err := m.Api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("couldnt get chain head: %w", err)
|
||||
}
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx, m.maddr, id, tok)
|
||||
onChainInfo, err := m.Api.StateSectorGetInfo(ctx, m.maddr, id, ts.Key())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to read sector on chain info: %w", err)
|
||||
}
|
||||
|
||||
active, err := m.sectorActive(ctx, tok, id)
|
||||
active, err := m.sectorActive(ctx, ts.Key(), id)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to check if sector is active")
|
||||
}
|
||||
@ -40,7 +42,7 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
|
||||
return xerrors.Errorf("cannot mark inactive sector for upgrade")
|
||||
}
|
||||
|
||||
if onChainInfo.Expiration-head < market7.DealMinDuration {
|
||||
if onChainInfo.Expiration-ts.Height() < market7.DealMinDuration {
|
||||
return xerrors.Errorf("pointless to upgrade sector %d, expiration %d is less than a min deal duration away from current epoch."+
|
||||
"Upgrade expiration before marking for upgrade", id, onChainInfo.Expiration)
|
||||
}
|
||||
@ -48,11 +50,28 @@ func (m *Sealing) MarkForSnapUpgrade(ctx context.Context, id abi.SectorNumber) e
|
||||
return m.sectors.Send(uint64(id), SectorMarkForUpdate{})
|
||||
}
|
||||
|
||||
func (m *Sealing) sectorActive(ctx context.Context, tok TipSetToken, sector abi.SectorNumber) (bool, error) {
|
||||
active, err := m.Api.StateMinerActiveSectors(ctx, m.maddr, tok)
|
||||
func (m *Sealing) sectorActive(ctx context.Context, tsk types.TipSetKey, sector abi.SectorNumber) (bool, error) {
|
||||
dls, err := m.Api.StateMinerDeadlines(ctx, m.maddr, tsk)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("failed to check active sectors: %w", err)
|
||||
return false, xerrors.Errorf("getting proving deadlines: %w", err)
|
||||
}
|
||||
|
||||
return active.IsSet(uint64(sector))
|
||||
for dl := range dls {
|
||||
parts, err := m.Api.StateMinerPartitions(ctx, m.maddr, uint64(dl), tsk)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("getting partitions for deadline %d: %w", dl, err)
|
||||
}
|
||||
|
||||
for p, part := range parts {
|
||||
set, err := part.ActiveSectors.IsSet(uint64(sector))
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("checking if sector %d is in deadline %d partition %d: %w", sector, dl, p, err)
|
||||
}
|
||||
if set {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
@ -4,12 +4,15 @@ import (
|
||||
"context"
|
||||
"math/bits"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/sealiface"
|
||||
)
|
||||
|
||||
@ -64,14 +67,14 @@ func (m *Sealing) GetSectorInfo(sid abi.SectorNumber) (SectorInfo, error) {
|
||||
}
|
||||
|
||||
func collateralSendAmount(ctx context.Context, api interface {
|
||||
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error)
|
||||
StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
|
||||
}, maddr address.Address, cfg sealiface.Config, collateral abi.TokenAmount) (abi.TokenAmount, error) {
|
||||
if cfg.CollateralFromMinerBalance {
|
||||
if cfg.DisableCollateralFallback {
|
||||
return big.Zero(), nil
|
||||
}
|
||||
|
||||
avail, err := api.StateMinerAvailableBalance(ctx, maddr, nil)
|
||||
avail, err := api.StateMinerAvailableBalance(ctx, maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("getting available miner balance: %w", err)
|
||||
}
|
||||
@ -89,3 +92,22 @@ func collateralSendAmount(ctx context.Context, api interface {
|
||||
|
||||
return collateral, nil
|
||||
}
|
||||
|
||||
func sendMsg(ctx context.Context, sa interface {
|
||||
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
}, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) {
|
||||
msg := types.Message{
|
||||
To: to,
|
||||
From: from,
|
||||
Value: value,
|
||||
Method: method,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
smsg, err := sa.MpoolPushMessage(ctx, &msg, &api.MessageSendSpec{MaxFee: maxFee})
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
return smsg.Cid(), nil
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
@ -20,11 +19,11 @@ var PostCheckTimeout = 160 * time.Second
|
||||
|
||||
// FaultTracker TODO: Track things more actively
|
||||
type FaultTracker interface {
|
||||
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error)
|
||||
CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error)
|
||||
}
|
||||
|
||||
// CheckProvable returns unprovable sectors
|
||||
func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) {
|
||||
func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -61,7 +60,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
|
||||
go func(sector storage.SectorRef) {
|
||||
go func(sector storiface.SectorRef) {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
<-throttle
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
@ -24,7 +23,7 @@ type Provider struct {
|
||||
waitSector map[sectorFile]chan struct{}
|
||||
}
|
||||
|
||||
func (b *Provider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
func (b *Provider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
if err := os.Mkdir(filepath.Join(b.Root, storiface.FTUnsealed.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||
return storiface.SectorPaths{}, nil, err
|
||||
}
|
||||
|
@ -6,11 +6,13 @@ package ffiwrapper
|
||||
import (
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var ProofProver = proofProver{}
|
||||
|
||||
var _ Prover = ProofProver
|
||||
var _ storiface.Prover = ProofProver
|
||||
|
||||
type proofProver struct{}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import (
|
||||
commcid "github.com/filecoin-project/go-fil-commcid"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/lib/nullreader"
|
||||
nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
|
||||
@ -35,7 +34,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
var _ Storage = &Sealer{}
|
||||
var _ storiface.Storage = &Sealer{}
|
||||
|
||||
func New(sectors SectorProvider) (*Sealer, error) {
|
||||
sb := &Sealer{
|
||||
@ -47,13 +46,13 @@ func New(sectors SectorProvider) (*Sealer, error) {
|
||||
return sb, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) NewSector(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (sb *Sealer) NewSector(ctx context.Context, sector storiface.SectorRef) error {
|
||||
// TODO: Allocate the sector here instead of in addpiece
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) {
|
||||
func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) {
|
||||
pieceData = io.LimitReader(io.MultiReader(
|
||||
pieceData,
|
||||
nullreader.Reader{},
|
||||
@ -173,7 +172,7 @@ func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) AddPiece(ctx context.Context, sector storage.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, pieceSize abi.UnpaddedPieceSize, file storage.Data) (abi.PieceInfo, error) {
|
||||
func (sb *Sealer) AddPiece(ctx context.Context, sector storiface.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, pieceSize abi.UnpaddedPieceSize, file storiface.Data) (abi.PieceInfo, error) {
|
||||
// TODO: allow tuning those:
|
||||
chunk := abi.PaddedPieceSize(4 << 20)
|
||||
parallel := runtime.NumCPU()
|
||||
@ -377,7 +376,7 @@ func (sb *Sealer) pieceCid(spt abi.RegisteredSealProof, in []byte) (cid.Cid, err
|
||||
return pieceCID, werr()
|
||||
}
|
||||
|
||||
func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storage.SectorRef, commD cid.Cid, unsealedPath string, randomness abi.SealRandomness) (bool, error) {
|
||||
func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storiface.SectorRef, commD cid.Cid, unsealedPath string, randomness abi.SealRandomness) (bool, error) {
|
||||
replicaPath, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage)
|
||||
if xerrors.Is(err, storiface.ErrSectorNotFound) {
|
||||
return false, nil
|
||||
@ -400,7 +399,7 @@ func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storage.Se
|
||||
return true, ffi.SectorUpdate.DecodeFrom(updateProof, unsealedPath, replicaPath.Update, sealedPaths.Sealed, sealedPaths.Cache, commD)
|
||||
}
|
||||
|
||||
func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector storage.SectorRef, randomness abi.SealRandomness) (storiface.SectorPaths, func(), error) {
|
||||
func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector storiface.SectorRef, randomness abi.SealRandomness) (storiface.SectorPaths, func(), error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage)
|
||||
if err == nil {
|
||||
return paths, done, err
|
||||
@ -429,7 +428,7 @@ func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector stora
|
||||
return sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage)
|
||||
}
|
||||
|
||||
func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error {
|
||||
func (sb *Sealer) UnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error {
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -605,7 +604,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, off
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
path, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTNone, storiface.PathStorage)
|
||||
if err != nil {
|
||||
return false, xerrors.Errorf("acquire unsealed sector path: %w", err)
|
||||
@ -661,7 +660,7 @@ func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storag
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) error {
|
||||
func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) error {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache, storiface.FTSealed, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("acquiring sector paths: %w", err)
|
||||
@ -706,7 +705,7 @@ func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storage.Sector
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) {
|
||||
func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTSealed|storiface.FTCache, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("acquiring sector paths: %w", err)
|
||||
@ -777,26 +776,26 @@ func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storage.SectorRef,
|
||||
|
||||
var PC2CheckRounds = 3
|
||||
|
||||
func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.PreCommit1Out) (storage.SectorCids, error) {
|
||||
func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.PreCommit1Out) (storiface.SectorCids, error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("acquiring sector paths: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("acquiring sector paths: %w", err)
|
||||
}
|
||||
defer done()
|
||||
|
||||
sealedCID, unsealedCID, err := ffi.SealPreCommitPhase2(phase1Out, paths.Cache, paths.Sealed)
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("presealing sector %d (%s): %w", sector.ID.Number, paths.Unsealed, err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("presealing sector %d (%s): %w", sector.ID.Number, paths.Unsealed, err)
|
||||
}
|
||||
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("get ssize: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("get ssize: %w", err)
|
||||
}
|
||||
|
||||
p1odec := map[string]interface{}{}
|
||||
if err := json.Unmarshal(phase1Out, &p1odec); err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("unmarshaling pc1 output: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("unmarshaling pc1 output: %w", err)
|
||||
}
|
||||
|
||||
var ticket abi.SealRandomness
|
||||
@ -805,7 +804,7 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
|
||||
if found {
|
||||
ticket, err = base64.StdEncoding.DecodeString(ti.(string))
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("decoding ticket: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("decoding ticket: %w", err)
|
||||
}
|
||||
|
||||
for i := 0; i < PC2CheckRounds; i++ {
|
||||
@ -828,18 +827,18 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
|
||||
log.Warn("checking PreCommit failed: ", err)
|
||||
log.Warnf("num:%d tkt:%v seed:%v sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sd[:], sealedCID, unsealedCID)
|
||||
|
||||
return storage.SectorCids{}, xerrors.Errorf("checking PreCommit failed: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("checking PreCommit failed: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return storage.SectorCids{
|
||||
return storiface.SectorCids{
|
||||
Unsealed: unsealedCID,
|
||||
Sealed: sealedCID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storage.Commit1Out, error) {
|
||||
func (sb *Sealer) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.Commit1Out, error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("acquire sector paths: %w", err)
|
||||
@ -866,12 +865,12 @@ func (sb *Sealer) SealCommit1(ctx context.Context, sector storage.SectorRef, tic
|
||||
return output, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) SealCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.Commit1Out) (storage.Proof, error) {
|
||||
func (sb *Sealer) SealCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.Commit1Out) (storiface.Proof, error) {
|
||||
return ffi.SealCommitPhase2(phase1Out, sector.ID.Number, sector.ID.Miner)
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) {
|
||||
empty := storage.ReplicaUpdateOut{}
|
||||
func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) {
|
||||
empty := storiface.ReplicaUpdateOut{}
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return empty, xerrors.Errorf("failed to acquire sector paths: %w", err)
|
||||
@ -917,10 +916,10 @@ func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
if err != nil {
|
||||
return empty, xerrors.Errorf("failed to update replica %d with new deal data: %w", sector.ID.Number, err)
|
||||
}
|
||||
return storage.ReplicaUpdateOut{NewSealed: sealed, NewUnsealed: unsealed}, nil
|
||||
return storiface.ReplicaUpdateOut{NewSealed: sealed, NewUnsealed: unsealed}, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) {
|
||||
func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathSealing)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to acquire sector paths: %w", err)
|
||||
@ -936,12 +935,12 @@ func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector
|
||||
return vanillaProofs, nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) {
|
||||
func (sb *Sealer) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) {
|
||||
updateProofType := abi.SealProofInfos[sector.ProofType].UpdateProof
|
||||
return ffi.SectorUpdate.GenerateUpdateProofWithVanilla(updateProofType, sectorKey, newSealed, newUnsealed, vanillaProofs)
|
||||
}
|
||||
|
||||
func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error {
|
||||
func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error {
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTSealed, storiface.PathSealing)
|
||||
defer done()
|
||||
if err != nil {
|
||||
@ -968,11 +967,11 @@ func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storage.
|
||||
return ffi.SectorUpdate.RemoveData(updateProofType, paths.Sealed, paths.Cache, paths.Update, paths.UpdateCache, paths.Unsealed, commD)
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReleaseSealed(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (sb *Sealer) ReleaseSealed(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return xerrors.Errorf("not supported at this layer")
|
||||
}
|
||||
|
||||
func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (sb *Sealer) freeUnsealed(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1040,7 +1039,7 @@ func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, ke
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (sb *Sealer) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1059,7 +1058,7 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef,
|
||||
return ffi.ClearCache(uint64(ssize), paths.Cache)
|
||||
}
|
||||
|
||||
func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1096,7 +1095,7 @@ func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error {
|
||||
func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error {
|
||||
// This call is meant to mark storage as 'freeable'. Given that unsealing is
|
||||
// very expensive, we don't remove data as soon as we can - instead we only
|
||||
// do that when we don't have free space for data that really needs it
|
||||
@ -1106,15 +1105,15 @@ func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef,
|
||||
return xerrors.Errorf("not supported at this layer")
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (sb *Sealer) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return xerrors.Errorf("not supported at this layer")
|
||||
}
|
||||
|
||||
func (sb *Sealer) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (sb *Sealer) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return xerrors.Errorf("not supported at this layer")
|
||||
}
|
||||
|
||||
func (sb *Sealer) Remove(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (sb *Sealer) Remove(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return xerrors.Errorf("not supported at this layer") // happens in localworker
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import (
|
||||
"github.com/filecoin-project/go-paramfetch"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
|
||||
@ -44,8 +43,8 @@ var sectorSize, _ = sealProofType.SectorSize()
|
||||
var sealRand = abi.SealRandomness{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2}
|
||||
|
||||
type seal struct {
|
||||
ref storage.SectorRef
|
||||
cids storage.SectorCids
|
||||
ref storiface.SectorRef
|
||||
cids storiface.SectorCids
|
||||
pi abi.PieceInfo
|
||||
ticket abi.SealRandomness
|
||||
}
|
||||
@ -57,7 +56,7 @@ func data(sn abi.SectorNumber, dlen abi.UnpaddedPieceSize) io.Reader {
|
||||
)
|
||||
}
|
||||
|
||||
func (s *seal) precommit(t *testing.T, sb *Sealer, id storage.SectorRef, done func()) {
|
||||
func (s *seal) precommit(t *testing.T, sb *Sealer, id storiface.SectorRef, done func()) {
|
||||
defer done()
|
||||
dlen := abi.PaddedPieceSize(sectorSize).Unpadded()
|
||||
|
||||
@ -86,7 +85,7 @@ func (s *seal) precommit(t *testing.T, sb *Sealer, id storage.SectorRef, done fu
|
||||
|
||||
var seed = abi.InteractiveSealRandomness{0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9}
|
||||
|
||||
func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof {
|
||||
func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storiface.Proof {
|
||||
defer done()
|
||||
|
||||
pc1, err := sb.SealCommit1(context.TODO(), s.ref, s.ticket, seed, []abi.PieceInfo{s.pi}, s.cids)
|
||||
@ -122,7 +121,7 @@ func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof {
|
||||
return proof
|
||||
}
|
||||
|
||||
func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storage.SectorRef, done func()) {
|
||||
func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storiface.SectorRef, done func()) {
|
||||
defer done()
|
||||
|
||||
var b bytes.Buffer
|
||||
@ -225,7 +224,7 @@ func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) {
|
||||
}
|
||||
}
|
||||
|
||||
func corrupt(t *testing.T, sealer *Sealer, id storage.SectorRef) {
|
||||
func corrupt(t *testing.T, sealer *Sealer, id storiface.SectorRef) {
|
||||
paths, done, err := sealer.sectors.AcquireSector(context.Background(), id, storiface.FTSealed, 0, storiface.PathStorage)
|
||||
require.NoError(t, err)
|
||||
defer done()
|
||||
@ -306,7 +305,7 @@ func TestSealAndVerify(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 1},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
@ -379,7 +378,7 @@ func TestSealPoStNoCommit(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 1},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
@ -441,15 +440,15 @@ func TestSealAndVerify3(t *testing.T) {
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
si1 := storage.SectorRef{
|
||||
si1 := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 1},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
si2 := storage.SectorRef{
|
||||
si2 := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 2},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
si3 := storage.SectorRef{
|
||||
si3 := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 3},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
@ -529,7 +528,7 @@ func TestSealAndVerifyAggregate(t *testing.T) {
|
||||
|
||||
toAggregate := make([][]byte, numAgg)
|
||||
for i := 0; i < numAgg; i++ {
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: abi.SectorNumber(i + 1)},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
@ -763,7 +762,7 @@ func TestAddPiece512M(t *testing.T) {
|
||||
|
||||
r := rand.New(rand.NewSource(0x7e5))
|
||||
|
||||
c, err := sb.AddPiece(context.TODO(), storage.SectorRef{
|
||||
c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: miner,
|
||||
Number: 0,
|
||||
@ -806,7 +805,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
|
||||
b.Cleanup(cleanup)
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
c, err := sb.AddPiece(context.TODO(), storage.SectorRef{
|
||||
c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: miner,
|
||||
Number: abi.SectorNumber(i),
|
||||
@ -849,7 +848,7 @@ func TestAddPiece512MPadded(t *testing.T) {
|
||||
|
||||
r := rand.New(rand.NewSource(0x7e5))
|
||||
|
||||
c, err := sb.AddPiece(context.TODO(), storage.SectorRef{
|
||||
c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: miner,
|
||||
Number: 0,
|
||||
@ -917,7 +916,7 @@ func TestMulticoreSDR(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
si := storage.SectorRef{
|
||||
si := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: miner, Number: 1},
|
||||
ProofType: sealProofType,
|
||||
}
|
||||
|
@ -2,57 +2,15 @@ package ffiwrapper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper/basicfs"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
type Validator interface {
|
||||
CanCommit(sector storiface.SectorPaths) (bool, error)
|
||||
CanProve(sector storiface.SectorPaths) (bool, error)
|
||||
}
|
||||
|
||||
type StorageSealer interface {
|
||||
storage.Sealer
|
||||
storage.Storage
|
||||
}
|
||||
|
||||
type Storage interface {
|
||||
storage.Prover
|
||||
StorageSealer
|
||||
|
||||
UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error
|
||||
ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
|
||||
}
|
||||
|
||||
type Verifier interface {
|
||||
VerifySeal(proof.SealVerifyInfo) (bool, error)
|
||||
VerifyAggregateSeals(aggregate proof.AggregateSealVerifyProofAndInfos) (bool, error)
|
||||
VerifyReplicaUpdate(update proof.ReplicaUpdateInfo) (bool, error)
|
||||
VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error)
|
||||
VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error)
|
||||
|
||||
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
|
||||
}
|
||||
|
||||
// Prover contains cheap proving-related methods
|
||||
type Prover interface {
|
||||
// TODO: move GenerateWinningPoStSectorChallenge from the Verifier interface to here
|
||||
|
||||
AggregateSealProofs(aggregateInfo proof.AggregateSealVerifyProofAndInfos, proofs [][]byte) ([]byte, error)
|
||||
}
|
||||
|
||||
type SectorProvider interface {
|
||||
// * returns storiface.ErrSectorNotFound if a requested existing sector doesn't exist
|
||||
// * returns an error when allocate is set, and existing isn't, and the sector exists
|
||||
AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error)
|
||||
AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error)
|
||||
}
|
||||
|
||||
var _ SectorProvider = &basicfs.Provider{}
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
@ -76,7 +75,7 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
|
||||
continue
|
||||
}
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: mid, Number: s.SectorNumber},
|
||||
ProofType: s.SealProof,
|
||||
}
|
||||
@ -129,7 +128,7 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
|
||||
return ffi.NewSortedPrivateSectorInfo(out...), skipped, done, nil
|
||||
}
|
||||
|
||||
var _ Verifier = ProofVerifier
|
||||
var _ storiface.Verifier = ProofVerifier
|
||||
|
||||
type proofVerifier struct{}
|
||||
|
||||
|
@ -17,7 +17,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
@ -46,8 +45,8 @@ type Worker interface {
|
||||
}
|
||||
|
||||
type SectorManager interface {
|
||||
ffiwrapper.StorageSealer
|
||||
storage.Prover
|
||||
storiface.Sealer
|
||||
storiface.ProverPoSt
|
||||
storiface.WorkerReturn
|
||||
FaultTracker
|
||||
}
|
||||
@ -65,7 +64,7 @@ type Manager struct {
|
||||
windowPoStSched *poStScheduler
|
||||
winningPoStSched *poStScheduler
|
||||
|
||||
localProver storage.Prover
|
||||
localProver storiface.ProverPoSt
|
||||
|
||||
workLk sync.Mutex
|
||||
work *statestore.StateStore
|
||||
@ -81,7 +80,7 @@ type Manager struct {
|
||||
waitRes map[WorkID]chan struct{}
|
||||
}
|
||||
|
||||
var _ storage.Prover = &Manager{}
|
||||
var _ storiface.ProverPoSt = &Manager{}
|
||||
|
||||
type result struct {
|
||||
r interface{}
|
||||
@ -267,7 +266,7 @@ func schedNop(context.Context, Worker) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) schedFetch(sector storage.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) func(context.Context, Worker) error {
|
||||
func (m *Manager) schedFetch(sector storiface.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) func(context.Context, Worker) error {
|
||||
return func(ctx context.Context, worker Worker) error {
|
||||
_, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, ft, ptype, am))
|
||||
return err
|
||||
@ -278,7 +277,7 @@ func (m *Manager) schedFetch(sector storage.SectorRef, ft storiface.SectorFileTy
|
||||
// It will schedule the Unsealing task on a worker that either already has the sealed sector files or has space in
|
||||
// one of it's sealing scratch spaces to store them after fetching them from another worker.
|
||||
// If the chosen worker already has the Unsealed sector file, we will NOT Unseal the sealed sector file again.
|
||||
func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed *cid.Cid) error {
|
||||
func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed *cid.Cid) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -335,19 +334,19 @@ func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorR
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) NewSector(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (m *Manager) NewSector(ctx context.Context, sector storiface.SectorRef) error {
|
||||
log.Warnf("stub NewSector")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) {
|
||||
func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
selector := newTaskSelector()
|
||||
|
||||
var out abi.PieceInfo
|
||||
err := m.sched.Schedule(ctx, storage.NoSectorRef, sealtasks.TTDataCid, selector, schedNop, func(ctx context.Context, w Worker) error {
|
||||
err := m.sched.Schedule(ctx, storiface.NoSectorRef, sealtasks.TTDataCid, selector, schedNop, func(ctx context.Context, w Worker) error {
|
||||
p, err := m.waitSimpleCall(ctx)(w.DataCid(ctx, pieceSize, pieceData))
|
||||
if err != nil {
|
||||
return err
|
||||
@ -361,7 +360,7 @@ func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize,
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (m *Manager) AddPiece(ctx context.Context, sector storage.SectorRef, existingPieces []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
||||
func (m *Manager) AddPiece(ctx context.Context, sector storiface.SectorRef, existingPieces []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -392,7 +391,7 @@ func (m *Manager) AddPiece(ctx context.Context, sector storage.SectorRef, existi
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) {
|
||||
func (m *Manager) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -410,7 +409,7 @@ func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef,
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.PreCommit1Out)
|
||||
out = p.(storiface.PreCommit1Out)
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,13 +442,13 @@ func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef,
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.PreCommit1Out) (out storage.SectorCids, err error) {
|
||||
func (m *Manager) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.PreCommit1Out) (out storiface.SectorCids, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTPreCommit2, sector, phase1Out)
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("getWork: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("getWork: %w", err)
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
@ -461,7 +460,7 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.SectorCids)
|
||||
out = p.(storiface.SectorCids)
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,7 +470,7 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
|
||||
}
|
||||
|
||||
if err := m.index.StorageLock(ctx, sector.ID, storiface.FTSealed, storiface.FTCache); err != nil {
|
||||
return storage.SectorCids{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
return storiface.SectorCids{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
|
||||
selector := newExistingSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, true)
|
||||
@ -486,19 +485,19 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return storage.SectorCids{}, err
|
||||
return storiface.SectorCids{}, err
|
||||
}
|
||||
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (out storage.Commit1Out, err error) {
|
||||
func (m *Manager) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (out storiface.Commit1Out, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit1, sector, ticket, seed, pieces, cids)
|
||||
if err != nil {
|
||||
return storage.Commit1Out{}, xerrors.Errorf("getWork: %w", err)
|
||||
return storiface.Commit1Out{}, xerrors.Errorf("getWork: %w", err)
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
@ -510,7 +509,7 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.Commit1Out)
|
||||
out = p.(storiface.Commit1Out)
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,7 +519,7 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic
|
||||
}
|
||||
|
||||
if err := m.index.StorageLock(ctx, sector.ID, storiface.FTSealed, storiface.FTCache); err != nil {
|
||||
return storage.Commit1Out{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
return storiface.Commit1Out{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
|
||||
// NOTE: We set allowFetch to false in so that we always execute on a worker
|
||||
@ -544,10 +543,10 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.Commit1Out) (out storage.Proof, err error) {
|
||||
func (m *Manager) SealCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.Commit1Out) (out storiface.Proof, err error) {
|
||||
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit2, sector, phase1Out)
|
||||
if err != nil {
|
||||
return storage.Proof{}, xerrors.Errorf("getWork: %w", err)
|
||||
return storiface.Proof{}, xerrors.Errorf("getWork: %w", err)
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
@ -559,7 +558,7 @@ func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, pha
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.Proof)
|
||||
out = p.(storiface.Proof)
|
||||
}
|
||||
}
|
||||
|
||||
@ -587,7 +586,7 @@ func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, pha
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (m *Manager) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -664,7 +663,7 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -750,7 +749,7 @@ func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error {
|
||||
func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error {
|
||||
ssize, err := sector.ProofType.SectorSize()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -770,7 +769,7 @@ func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef,
|
||||
return m.storage.Remove(ctx, sector.ID, storiface.FTUnsealed, true, nil)
|
||||
}
|
||||
|
||||
func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -781,7 +780,7 @@ func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef
|
||||
return m.storage.Remove(ctx, sector.ID, storiface.FTSealed, true, nil)
|
||||
}
|
||||
|
||||
func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -798,7 +797,7 @@ func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storage.Sect
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error {
|
||||
func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error {
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
@ -848,7 +847,7 @@ func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storage.
|
||||
return waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) Remove(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (m *Manager) Remove(ctx context.Context, sector storiface.SectorRef) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -877,13 +876,13 @@ func (m *Manager) Remove(ctx context.Context, sector storage.SectorRef) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (out storage.ReplicaUpdateOut, err error) {
|
||||
func (m *Manager) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (out storiface.ReplicaUpdateOut, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
log.Debugf("manager is doing replica update")
|
||||
wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTReplicaUpdate, sector, pieces)
|
||||
if err != nil {
|
||||
return storage.ReplicaUpdateOut{}, xerrors.Errorf("getWork: %w", err)
|
||||
return storiface.ReplicaUpdateOut{}, xerrors.Errorf("getWork: %w", err)
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
@ -895,7 +894,7 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.ReplicaUpdateOut)
|
||||
out = p.(storiface.ReplicaUpdateOut)
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,7 +904,7 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
}
|
||||
|
||||
if err := m.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache); err != nil {
|
||||
return storage.ReplicaUpdateOut{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
return storiface.ReplicaUpdateOut{}, xerrors.Errorf("acquiring sector lock: %w", err)
|
||||
}
|
||||
|
||||
selector := newAllocSelector(m.index, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
|
||||
@ -920,12 +919,12 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return storage.ReplicaUpdateOut{}, xerrors.Errorf("Schedule: %w", err)
|
||||
return storiface.ReplicaUpdateOut{}, xerrors.Errorf("Schedule: %w", err)
|
||||
}
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (out storage.ReplicaVanillaProofs, err error) {
|
||||
func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (out storiface.ReplicaVanillaProofs, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -943,7 +942,7 @@ func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.ReplicaVanillaProofs)
|
||||
out = p.(storiface.ReplicaVanillaProofs)
|
||||
}
|
||||
}
|
||||
|
||||
@ -978,7 +977,7 @@ func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector
|
||||
return out, waitErr
|
||||
}
|
||||
|
||||
func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (out storage.ReplicaUpdateProof, err error) {
|
||||
func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (out storiface.ReplicaUpdateProof, err error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
@ -996,7 +995,7 @@ func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storage.Sector
|
||||
return
|
||||
}
|
||||
if p != nil {
|
||||
out = p.(storage.ReplicaUpdateProof)
|
||||
out = p.(storiface.ReplicaUpdateProof)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1032,19 +1031,19 @@ func (m *Manager) ReturnAddPiece(ctx context.Context, callID storiface.CallID, p
|
||||
return m.returnResult(ctx, callID, pi, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, p1o, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, sealed, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, out, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, proof, err)
|
||||
}
|
||||
|
||||
@ -1056,15 +1055,15 @@ func (m *Manager) ReturnReleaseUnsealed(ctx context.Context, callID storiface.Ca
|
||||
return m.returnResult(ctx, callID, nil, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, out, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storage.ReplicaVanillaProofs, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storiface.ReplicaVanillaProofs, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, out, err)
|
||||
}
|
||||
|
||||
func (m *Manager) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storage.ReplicaUpdateProof, err *storiface.CallError) error {
|
||||
func (m *Manager) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storiface.ReplicaUpdateProof, err *storiface.CallError) error {
|
||||
return m.returnResult(ctx, callID, proof, err)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
@ -157,7 +156,7 @@ func TestSimple(t *testing.T) {
|
||||
}, lstor, m))
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
@ -233,7 +232,7 @@ func TestSnapDeals(t *testing.T) {
|
||||
log.Warn("Continuing test with 2k sectors")
|
||||
}
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: proofType,
|
||||
}
|
||||
@ -311,7 +310,7 @@ func TestSnapDeals(t *testing.T) {
|
||||
fmt.Printf("Decode duration (%s): %s\n", ss.ShortString(), time.Since(startDecode))
|
||||
|
||||
// Remove just the first piece and decode for retrieval
|
||||
require.NoError(t, m.FinalizeSector(ctx, sid, []storage.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}}))
|
||||
require.NoError(t, m.FinalizeSector(ctx, sid, []storiface.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}}))
|
||||
require.NoError(t, m.SectorsUnsealPiece(ctx, sid, 0, p1.Size.Unpadded(), ticket, &out.NewUnsealed))
|
||||
|
||||
fmt.Printf("GSK\n")
|
||||
@ -364,12 +363,12 @@ func TestSnarkPackV2(t *testing.T) {
|
||||
|
||||
mid := abi.ActorID(1000)
|
||||
|
||||
sid1 := storage.SectorRef{
|
||||
sid1 := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: mid, Number: 1},
|
||||
ProofType: proofType,
|
||||
}
|
||||
|
||||
sid2 := storage.SectorRef{
|
||||
sid2 := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: mid, Number: 2},
|
||||
ProofType: proofType,
|
||||
}
|
||||
@ -487,7 +486,7 @@ func TestRedoPC1(t *testing.T) {
|
||||
err := m.AddWorker(ctx, tw)
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
@ -542,7 +541,7 @@ func TestRestartManager(t *testing.T) {
|
||||
err := m.AddWorker(ctx, tw)
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
@ -636,7 +635,7 @@ func TestRestartWorker(t *testing.T) {
|
||||
wds := datastore.NewMapDatastore()
|
||||
|
||||
arch := make(chan chan apres)
|
||||
w := newLocalWorker(func() (ffiwrapper.Storage, error) {
|
||||
w := newLocalWorker(func() (storiface.Storage, error) {
|
||||
return &testExec{apch: arch}, nil
|
||||
}, WorkerConfig{
|
||||
TaskTypes: localTasks,
|
||||
@ -645,7 +644,7 @@ func TestRestartWorker(t *testing.T) {
|
||||
err := m.AddWorker(ctx, w)
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
@ -673,7 +672,7 @@ func TestRestartWorker(t *testing.T) {
|
||||
}
|
||||
|
||||
// restart the worker
|
||||
w = newLocalWorker(func() (ffiwrapper.Storage, error) {
|
||||
w = newLocalWorker(func() (storiface.Storage, error) {
|
||||
return &testExec{apch: arch}, nil
|
||||
}, WorkerConfig{
|
||||
TaskTypes: localTasks,
|
||||
@ -709,7 +708,7 @@ func TestReenableWorker(t *testing.T) {
|
||||
wds := datastore.NewMapDatastore()
|
||||
|
||||
arch := make(chan chan apres)
|
||||
w := newLocalWorker(func() (ffiwrapper.Storage, error) {
|
||||
w := newLocalWorker(func() (storiface.Storage, error) {
|
||||
return &testExec{apch: arch}, nil
|
||||
}, WorkerConfig{
|
||||
TaskTypes: localTasks,
|
||||
@ -782,7 +781,7 @@ func TestResUse(t *testing.T) {
|
||||
wds := datastore.NewMapDatastore()
|
||||
|
||||
arch := make(chan chan apres)
|
||||
w := newLocalWorker(func() (ffiwrapper.Storage, error) {
|
||||
w := newLocalWorker(func() (storiface.Storage, error) {
|
||||
return &testExec{apch: arch}, nil
|
||||
}, WorkerConfig{
|
||||
TaskTypes: localTasks,
|
||||
@ -793,7 +792,7 @@ func TestResUse(t *testing.T) {
|
||||
err := m.AddWorker(ctx, w)
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
@ -840,7 +839,7 @@ func TestResOverride(t *testing.T) {
|
||||
wds := datastore.NewMapDatastore()
|
||||
|
||||
arch := make(chan chan apres)
|
||||
w := newLocalWorker(func() (ffiwrapper.Storage, error) {
|
||||
w := newLocalWorker(func() (storiface.Storage, error) {
|
||||
return &testExec{apch: arch}, nil
|
||||
}, WorkerConfig{
|
||||
TaskTypes: localTasks,
|
||||
@ -855,7 +854,7 @@ func TestResOverride(t *testing.T) {
|
||||
err := m.AddWorker(ctx, w)
|
||||
require.NoError(t, err)
|
||||
|
||||
sid := storage.SectorRef{
|
||||
sid := storiface.SectorRef{
|
||||
ID: abi.SectorID{Miner: 1000, Number: 1},
|
||||
ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1,
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import (
|
||||
commcid "github.com/filecoin-project/go-fil-commcid"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -72,11 +71,11 @@ type sectorState struct {
|
||||
lk sync.Mutex
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) NewSector(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (mgr *SectorMgr) NewSector(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error {
|
||||
func (mgr *SectorMgr) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error {
|
||||
panic("SectorMgr: unsealing piece: implement me")
|
||||
}
|
||||
|
||||
@ -84,7 +83,7 @@ func (mgr *SectorMgr) DataCid(ctx context.Context, size abi.UnpaddedPieceSize, r
|
||||
panic("todo")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID storage.SectorRef, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
||||
func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID storiface.SectorRef, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
||||
log.Warn("Add piece: ", sectorID, size, sectorID.ProofType)
|
||||
|
||||
var b bytes.Buffer
|
||||
@ -128,11 +127,11 @@ func (mgr *SectorMgr) AcquireSectorNumber() (abi.SectorNumber, error) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
func (mgr *SectorMgr) IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ForceState(sid storage.SectorRef, st int) error {
|
||||
func (mgr *SectorMgr) ForceState(sid storiface.SectorRef, st int) error {
|
||||
mgr.lk.Lock()
|
||||
ss, ok := mgr.sectors[sid.ID]
|
||||
mgr.lk.Unlock()
|
||||
@ -145,7 +144,7 @@ func (mgr *SectorMgr) ForceState(sid storage.SectorRef, st int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) {
|
||||
func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) {
|
||||
mgr.lk.Lock()
|
||||
ss, ok := mgr.sectors[sid.ID]
|
||||
mgr.lk.Unlock()
|
||||
@ -205,7 +204,7 @@ func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storage.SectorRef,
|
||||
return cc, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storage.SectorRef, phase1Out storage.PreCommit1Out) (cids storage.SectorCids, err error) {
|
||||
func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storiface.SectorRef, phase1Out storiface.PreCommit1Out) (cids storiface.SectorCids, err error) {
|
||||
db := []byte(string(phase1Out))
|
||||
db[0] ^= 'd'
|
||||
|
||||
@ -218,13 +217,13 @@ func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storage.SectorRef,
|
||||
|
||||
commR, _ := commcid.ReplicaCommitmentV1ToCID(commr)
|
||||
|
||||
return storage.SectorCids{
|
||||
return storiface.SectorCids{
|
||||
Unsealed: d,
|
||||
Sealed: commR,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (output storage.Commit1Out, err error) {
|
||||
func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (output storiface.Commit1Out, err error) {
|
||||
mgr.lk.Lock()
|
||||
ss, ok := mgr.sectors[sid.ID]
|
||||
mgr.lk.Unlock()
|
||||
@ -252,7 +251,7 @@ func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storage.SectorRef, ti
|
||||
return out[:], nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storage.SectorRef, phase1Out storage.Commit1Out) (proof storage.Proof, err error) {
|
||||
func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storiface.SectorRef, phase1Out storiface.Commit1Out) (proof storiface.Proof, err error) {
|
||||
plen, err := sid.ProofType.ProofSize()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -266,31 +265,31 @@ func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storage.SectorRef, ph
|
||||
return out[:], nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReplicaUpdate(ctx context.Context, sid storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) {
|
||||
out := storage.ReplicaUpdateOut{}
|
||||
func (mgr *SectorMgr) ReplicaUpdate(ctx context.Context, sid storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) {
|
||||
out := storiface.ReplicaUpdateOut{}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) {
|
||||
func (mgr *SectorMgr) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) {
|
||||
out := make([][]byte, 0)
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) {
|
||||
func (mgr *SectorMgr) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) {
|
||||
return make([]byte, 0), nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error {
|
||||
func (mgr *SectorMgr) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReleaseSealed(ctx context.Context, sid storage.SectorRef) error {
|
||||
func (mgr *SectorMgr) ReleaseSealed(ctx context.Context, sid storiface.SectorRef) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Test Instrumentation Methods
|
||||
|
||||
func (mgr *SectorMgr) MarkFailed(sid storage.SectorRef, failed bool) error {
|
||||
func (mgr *SectorMgr) MarkFailed(sid storiface.SectorRef, failed bool) error {
|
||||
mgr.lk.Lock()
|
||||
defer mgr.lk.Unlock()
|
||||
ss, ok := mgr.sectors[sid.ID]
|
||||
@ -310,7 +309,7 @@ func (mgr *SectorMgr) Fail() {
|
||||
return
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) MarkCorrupted(sid storage.SectorRef, corrupted bool) error {
|
||||
func (mgr *SectorMgr) MarkCorrupted(sid storiface.SectorRef, corrupted bool) error {
|
||||
mgr.lk.Lock()
|
||||
defer mgr.lk.Unlock()
|
||||
ss, ok := mgr.sectors[sid.ID]
|
||||
@ -437,7 +436,7 @@ func (mgr *SectorMgr) GenerateWindowPoStWithVanilla(ctx context.Context, proofTy
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) {
|
||||
func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) {
|
||||
off := storiface.UnpaddedByteIndex(0)
|
||||
var piece cid.Cid
|
||||
for _, c := range mgr.sectors[sector.ID].pieces {
|
||||
@ -463,21 +462,21 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storage.SectorRef, o
|
||||
}, false, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof) (storage.SectorRef, []abi.PieceInfo, error) {
|
||||
func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof) (storiface.SectorRef, []abi.PieceInfo, error) {
|
||||
psize, err := spt.SectorSize()
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, nil, err
|
||||
return storiface.SectorRef{}, nil, err
|
||||
}
|
||||
usize := abi.PaddedPieceSize(psize).Unpadded()
|
||||
sid, err := mgr.AcquireSectorNumber()
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, nil, err
|
||||
return storiface.SectorRef{}, nil, err
|
||||
}
|
||||
|
||||
buf := make([]byte, usize)
|
||||
_, _ = rand.Read(buf) // nolint:gosec
|
||||
|
||||
id := storage.SectorRef{
|
||||
id := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: mid,
|
||||
Number: sid,
|
||||
@ -487,33 +486,33 @@ func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof
|
||||
|
||||
pi, err := mgr.AddPiece(context.TODO(), id, nil, usize, bytes.NewReader(buf))
|
||||
if err != nil {
|
||||
return storage.SectorRef{}, nil, err
|
||||
return storiface.SectorRef{}, nil, err
|
||||
}
|
||||
|
||||
return id, []abi.PieceInfo{pi}, nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) FinalizeSector(context.Context, storage.SectorRef, []storage.Range) error {
|
||||
func (mgr *SectorMgr) FinalizeSector(context.Context, storiface.SectorRef, []storiface.Range) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) FinalizeReplicaUpdate(context.Context, storage.SectorRef, []storage.Range) error {
|
||||
func (mgr *SectorMgr) FinalizeReplicaUpdate(context.Context, storiface.SectorRef, []storiface.Range) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error {
|
||||
func (mgr *SectorMgr) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (mgr *SectorMgr) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (mgr *SectorMgr) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) Remove(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (mgr *SectorMgr) Remove(ctx context.Context, sector storiface.SectorRef) error {
|
||||
mgr.lk.Lock()
|
||||
defer mgr.lk.Unlock()
|
||||
|
||||
@ -525,7 +524,7 @@ func (mgr *SectorMgr) Remove(ctx context.Context, sector storage.SectorRef) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, ids []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) {
|
||||
func (mgr *SectorMgr) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, ids []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) {
|
||||
bad := map[abi.SectorID]string{}
|
||||
|
||||
for _, sid := range ids {
|
||||
@ -549,19 +548,19 @@ func (mgr *SectorMgr) ReturnAddPiece(ctx context.Context, callID storiface.CallI
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
@ -589,15 +588,15 @@ func (mgr *SectorMgr) ReturnFetch(ctx context.Context, callID storiface.CallID,
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storage.ReplicaVanillaProofs, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storiface.ReplicaVanillaProofs, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
func (mgr *SectorMgr) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateProof, err *storiface.CallError) error {
|
||||
func (mgr *SectorMgr) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateProof, err *storiface.CallError) error {
|
||||
panic("not supported")
|
||||
}
|
||||
|
||||
@ -735,6 +734,6 @@ var MockVerifier = mockVerifProver{
|
||||
|
||||
var MockProver = MockVerifier
|
||||
|
||||
var _ storage.Sealer = &SectorMgr{}
|
||||
var _ ffiwrapper.Verifier = MockVerifier
|
||||
var _ ffiwrapper.Prover = MockProver
|
||||
var _ storiface.Sealer = &SectorMgr{}
|
||||
var _ storiface.Verifier = MockVerifier
|
||||
var _ storiface.Prover = MockProver
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/dagstore/mount"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fr32"
|
||||
@ -19,7 +18,7 @@ import (
|
||||
|
||||
type Unsealer interface {
|
||||
// SectorsUnsealPiece will Unseal a Sealed sector file for the given sector.
|
||||
SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error
|
||||
SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error
|
||||
}
|
||||
|
||||
type PieceProvider interface {
|
||||
@ -28,8 +27,8 @@ type PieceProvider interface {
|
||||
// default in most cases, but this might matter with future PoRep)
|
||||
// startOffset is added to the pieceOffset to get the starting reader offset.
|
||||
// The number of bytes that can be read is pieceSize-startOffset
|
||||
ReadPiece(ctx context.Context, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, pieceSize abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error)
|
||||
IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
|
||||
ReadPiece(ctx context.Context, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, pieceSize abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error)
|
||||
IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
|
||||
}
|
||||
|
||||
var _ PieceProvider = &pieceProvider{}
|
||||
@ -50,7 +49,7 @@ func NewPieceProvider(storage *paths.Remote, index paths.SectorIndex, uns Unseal
|
||||
|
||||
// IsUnsealed checks if we have the unsealed piece at the given offset in an already
|
||||
// existing unsealed file either locally or on any of the workers.
|
||||
func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
if err := offset.Valid(); err != nil {
|
||||
return false, xerrors.Errorf("offset is not valid: %w", err)
|
||||
}
|
||||
@ -72,7 +71,7 @@ func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storage.SectorRef
|
||||
// It will NOT try to schedule an Unseal of a sealed sector file for the read.
|
||||
//
|
||||
// Returns a nil reader if the piece does NOT exist in any unsealed file or there is no unsealed file for the given sector on any of the workers.
|
||||
func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, pc cid.Cid, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (mount.Reader, error) {
|
||||
func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, pc cid.Cid, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (mount.Reader, error) {
|
||||
// acquire a lock purely for reading unsealed sectors
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
if err := p.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed, storiface.FTNone); err != nil {
|
||||
@ -156,7 +155,7 @@ var _ io.Closer = funcCloser(nil)
|
||||
// If we do NOT have an existing unsealed file containing the given piece thus causing us to schedule an Unseal,
|
||||
// the returned boolean parameter will be set to true.
|
||||
// If we have an existing unsealed file containing the given piece, the returned boolean will be set to false.
|
||||
func (p *pieceProvider) ReadPiece(ctx context.Context, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) {
|
||||
func (p *pieceProvider) ReadPiece(ctx context.Context, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) {
|
||||
if err := pieceOffset.Valid(); err != nil {
|
||||
return nil, false, xerrors.Errorf("pieceOffset is not valid: %w", err)
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-statestore"
|
||||
specstorage "github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
|
||||
@ -182,7 +181,7 @@ type pieceProviderTestHarness struct {
|
||||
ctx context.Context
|
||||
index *paths.Index
|
||||
pp PieceProvider
|
||||
sector specstorage.SectorRef
|
||||
sector storiface.SectorRef
|
||||
mgr *Manager
|
||||
ticket abi.SealRandomness
|
||||
commD cid.Cid
|
||||
@ -232,7 +231,7 @@ func newPieceProviderTestHarness(t *testing.T, mgrConfig Config, sectorProofType
|
||||
|
||||
pp := NewPieceProvider(remoteStore, index, mgr)
|
||||
|
||||
sector := specstorage.SectorRef{
|
||||
sector := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 100,
|
||||
Number: 10,
|
||||
@ -318,13 +317,13 @@ func (p *pieceProviderTestHarness) addPiece(t *testing.T, pieceData []byte) abi.
|
||||
return pieceInfo
|
||||
}
|
||||
|
||||
func (p *pieceProviderTestHarness) preCommit1(t *testing.T) specstorage.PreCommit1Out {
|
||||
func (p *pieceProviderTestHarness) preCommit1(t *testing.T) storiface.PreCommit1Out {
|
||||
preCommit1, err := p.mgr.SealPreCommit1(p.ctx, p.sector, p.ticket, p.addedPieces)
|
||||
require.NoError(t, err)
|
||||
return preCommit1
|
||||
}
|
||||
|
||||
func (p *pieceProviderTestHarness) preCommit2(t *testing.T, pc1 specstorage.PreCommit1Out) {
|
||||
func (p *pieceProviderTestHarness) preCommit2(t *testing.T, pc1 storiface.PreCommit1Out) {
|
||||
sectorCids, err := p.mgr.SealPreCommit2(p.ctx, p.sector, pc1)
|
||||
require.NoError(t, err)
|
||||
commD := sectorCids.Unsealed
|
||||
@ -351,7 +350,7 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa
|
||||
require.Equal(t, expectedBytes, readData)
|
||||
}
|
||||
|
||||
func (p *pieceProviderTestHarness) finalizeSector(t *testing.T, keepUnseal []specstorage.Range) {
|
||||
func (p *pieceProviderTestHarness) finalizeSector(t *testing.T, keepUnseal []storiface.Range) {
|
||||
require.NoError(t, p.mgr.FinalizeSector(p.ctx, p.sector, keepUnseal))
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,6 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
@ -16,7 +14,7 @@ type readonlyProvider struct {
|
||||
stor *paths.Local
|
||||
}
|
||||
|
||||
func (l *readonlyProvider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
func (l *readonlyProvider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) {
|
||||
if allocate != storiface.FTNone {
|
||||
return storiface.SectorPaths{}, nil, xerrors.New("read-only storage")
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -119,7 +118,7 @@ type workerDisableReq struct {
|
||||
}
|
||||
|
||||
type WorkerRequest struct {
|
||||
Sector storage.SectorRef
|
||||
Sector storiface.SectorRef
|
||||
TaskType sealtasks.TaskType
|
||||
Priority int // larger values more important
|
||||
Sel WorkerSelector
|
||||
@ -176,7 +175,7 @@ func newScheduler(assigner string) (*Scheduler, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (sh *Scheduler) Schedule(ctx context.Context, sector storage.SectorRef, taskType sealtasks.TaskType, sel WorkerSelector, prepare WorkerAction, work WorkerAction) error {
|
||||
func (sh *Scheduler) Schedule(ctx context.Context, sector storiface.SectorRef, taskType sealtasks.TaskType, sel WorkerSelector, prepare WorkerAction, work WorkerAction) error {
|
||||
ret := make(chan workerResponse)
|
||||
|
||||
select {
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
prooftypes "github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
|
||||
@ -68,79 +67,79 @@ type schedTestWorker struct {
|
||||
ignoreResources bool
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) Remove(ctx context.Context, sector storage.SectorRef) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) Remove(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) NewSector(ctx context.Context, sector storage.SectorRef) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) NewSector(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, peices []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, peices []abi.PieceInfo) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) Fetch(ctx context.Context, id storage.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) Fetch(ctx context.Context, id storiface.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) UnsealPiece(ctx context.Context, id storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) UnsealPiece(ctx context.Context, id storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (storiface.CallID, error) {
|
||||
func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (storiface.CallID, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
@ -276,7 +275,7 @@ func TestSched(t *testing.T) {
|
||||
go func() {
|
||||
defer rm.wg.Done()
|
||||
|
||||
sectorRef := storage.SectorRef{
|
||||
sectorRef := storiface.SectorRef{
|
||||
ID: abi.SectorID{
|
||||
Miner: 8,
|
||||
Number: sid,
|
||||
@ -666,7 +665,7 @@ func TestWindowCompact(t *testing.T) {
|
||||
for _, task := range windowTasks {
|
||||
window.Todo = append(window.Todo, &WorkerRequest{
|
||||
TaskType: task,
|
||||
Sector: storage.SectorRef{ProofType: spt},
|
||||
Sector: storiface.SectorRef{ProofType: spt},
|
||||
})
|
||||
window.Allocated.Add(task.SealTask(spt), wh.Info.Resources, storiface.ResourceTable[task][spt])
|
||||
}
|
||||
|
31
storage/sealer/storiface/paths.go
Normal file
31
storage/sealer/storiface/paths.go
Normal file
@ -0,0 +1,31 @@
|
||||
package storiface
|
||||
|
||||
import "github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
type PathType string
|
||||
|
||||
const (
|
||||
PathStorage PathType = "storage"
|
||||
PathSealing PathType = "sealing"
|
||||
)
|
||||
|
||||
type AcquireMode string
|
||||
|
||||
const (
|
||||
AcquireMove AcquireMode = "move"
|
||||
AcquireCopy AcquireMode = "copy"
|
||||
)
|
||||
|
||||
type Refs struct {
|
||||
RefCount [FileTypes]uint
|
||||
}
|
||||
|
||||
type SectorLock struct {
|
||||
Sector abi.SectorID
|
||||
Write [FileTypes]uint
|
||||
Read [FileTypes]uint
|
||||
}
|
||||
|
||||
type SectorLocks struct {
|
||||
Locks []SectorLock
|
||||
}
|
@ -1,31 +1,121 @@
|
||||
package storiface
|
||||
|
||||
import "github.com/filecoin-project/go-state-types/abi"
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
type PathType string
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
const (
|
||||
PathStorage PathType = "storage"
|
||||
PathSealing PathType = "sealing"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
)
|
||||
|
||||
type AcquireMode string
|
||||
type Data = io.Reader
|
||||
|
||||
const (
|
||||
AcquireMove AcquireMode = "move"
|
||||
AcquireCopy AcquireMode = "copy"
|
||||
)
|
||||
|
||||
type Refs struct {
|
||||
RefCount [FileTypes]uint
|
||||
type SectorRef struct {
|
||||
ID abi.SectorID
|
||||
ProofType abi.RegisteredSealProof
|
||||
}
|
||||
|
||||
type SectorLock struct {
|
||||
Sector abi.SectorID
|
||||
Write [FileTypes]uint
|
||||
Read [FileTypes]uint
|
||||
var NoSectorRef = SectorRef{}
|
||||
|
||||
type ProverPoSt interface {
|
||||
GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error)
|
||||
GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error)
|
||||
|
||||
GenerateWinningPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte) ([]proof.PoStProof, error)
|
||||
GenerateWindowPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte, partitionIdx int) (proof.PoStProof, error)
|
||||
}
|
||||
|
||||
type SectorLocks struct {
|
||||
Locks []SectorLock
|
||||
type PreCommit1Out []byte
|
||||
|
||||
type Commit1Out []byte
|
||||
|
||||
type Proof []byte
|
||||
|
||||
type SectorCids struct {
|
||||
Unsealed cid.Cid
|
||||
Sealed cid.Cid
|
||||
}
|
||||
|
||||
type Range struct {
|
||||
Offset abi.UnpaddedPieceSize
|
||||
Size abi.UnpaddedPieceSize
|
||||
}
|
||||
|
||||
type ReplicaUpdateProof []byte
|
||||
type ReplicaVanillaProofs [][]byte
|
||||
|
||||
type ReplicaUpdateOut struct {
|
||||
NewSealed cid.Cid
|
||||
NewUnsealed cid.Cid
|
||||
}
|
||||
|
||||
type Sealer interface {
|
||||
NewSector(ctx context.Context, sector SectorRef) error
|
||||
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error)
|
||||
AddPiece(ctx context.Context, sector SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error)
|
||||
|
||||
SealPreCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (PreCommit1Out, error)
|
||||
SealPreCommit2(ctx context.Context, sector SectorRef, pc1o PreCommit1Out) (SectorCids, error)
|
||||
|
||||
SealCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (Commit1Out, error)
|
||||
SealCommit2(ctx context.Context, sector SectorRef, c1o Commit1Out) (Proof, error)
|
||||
|
||||
FinalizeSector(ctx context.Context, sector SectorRef, keepUnsealed []Range) error
|
||||
|
||||
// ReleaseUnsealed marks parts of the unsealed sector file as safe to drop
|
||||
// (called by the fsm on restart, allows storage to keep no persistent
|
||||
// state about unsealed fast-retrieval copies)
|
||||
ReleaseUnsealed(ctx context.Context, sector SectorRef, safeToFree []Range) error
|
||||
ReleaseSectorKey(ctx context.Context, sector SectorRef) error
|
||||
ReleaseReplicaUpgrade(ctx context.Context, sector SectorRef) error
|
||||
|
||||
// Removes all data associated with the specified sector
|
||||
Remove(ctx context.Context, sector SectorRef) error
|
||||
|
||||
// Generate snap deals replica update
|
||||
ReplicaUpdate(ctx context.Context, sector SectorRef, pieces []abi.PieceInfo) (ReplicaUpdateOut, error)
|
||||
|
||||
// Prove that snap deals replica was done correctly
|
||||
ProveReplicaUpdate1(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (ReplicaVanillaProofs, error)
|
||||
ProveReplicaUpdate2(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs ReplicaVanillaProofs) (ReplicaUpdateProof, error)
|
||||
|
||||
// GenerateSectorKeyFromData computes sector key given unsealed data and updated replica
|
||||
GenerateSectorKeyFromData(ctx context.Context, sector SectorRef, unsealed cid.Cid) error
|
||||
|
||||
FinalizeReplicaUpdate(ctx context.Context, sector SectorRef, keepUnsealed []Range) error
|
||||
}
|
||||
|
||||
type Unsealer interface {
|
||||
UnsealPiece(ctx context.Context, sector SectorRef, offset UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error
|
||||
ReadPiece(ctx context.Context, writer io.Writer, sector SectorRef, offset UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
|
||||
}
|
||||
|
||||
type Storage interface {
|
||||
ProverPoSt
|
||||
Sealer
|
||||
Unsealer
|
||||
}
|
||||
|
||||
type Validator interface {
|
||||
CanCommit(sector SectorPaths) (bool, error)
|
||||
CanProve(sector SectorPaths) (bool, error)
|
||||
}
|
||||
|
||||
type Verifier interface {
|
||||
VerifySeal(proof.SealVerifyInfo) (bool, error)
|
||||
VerifyAggregateSeals(aggregate proof.AggregateSealVerifyProofAndInfos) (bool, error)
|
||||
VerifyReplicaUpdate(update proof.ReplicaUpdateInfo) (bool, error)
|
||||
VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error)
|
||||
VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error)
|
||||
|
||||
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
|
||||
}
|
||||
|
||||
// Prover contains cheap proving-related methods
|
||||
type Prover interface {
|
||||
// TODO: move GenerateWinningPoStSectorChallenge from the Verifier interface to here
|
||||
|
||||
AggregateSealProofs(aggregateInfo proof.AggregateSealVerifyProofAndInfos, proofs [][]byte) ([]byte, error)
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
|
||||
)
|
||||
@ -119,22 +118,22 @@ var UndefCall CallID
|
||||
|
||||
type WorkerCalls interface {
|
||||
// async
|
||||
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (CallID, error)
|
||||
AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (CallID, error)
|
||||
SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (CallID, error)
|
||||
SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (CallID, error)
|
||||
SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (CallID, error)
|
||||
SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (CallID, error)
|
||||
FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (CallID, error)
|
||||
FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (CallID, error)
|
||||
ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (CallID, error)
|
||||
ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (CallID, error)
|
||||
ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (CallID, error)
|
||||
ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (CallID, error)
|
||||
GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (CallID, error)
|
||||
MoveStorage(ctx context.Context, sector storage.SectorRef, types SectorFileType) (CallID, error)
|
||||
UnsealPiece(context.Context, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error)
|
||||
Fetch(context.Context, storage.SectorRef, SectorFileType, PathType, AcquireMode) (CallID, error)
|
||||
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData Data) (CallID, error)
|
||||
AddPiece(ctx context.Context, sector SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (CallID, error)
|
||||
SealPreCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (CallID, error)
|
||||
SealPreCommit2(ctx context.Context, sector SectorRef, pc1o PreCommit1Out) (CallID, error)
|
||||
SealCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (CallID, error)
|
||||
SealCommit2(ctx context.Context, sector SectorRef, c1o Commit1Out) (CallID, error)
|
||||
FinalizeSector(ctx context.Context, sector SectorRef, keepUnsealed []Range) (CallID, error)
|
||||
FinalizeReplicaUpdate(ctx context.Context, sector SectorRef, keepUnsealed []Range) (CallID, error)
|
||||
ReleaseUnsealed(ctx context.Context, sector SectorRef, safeToFree []Range) (CallID, error)
|
||||
ReplicaUpdate(ctx context.Context, sector SectorRef, pieces []abi.PieceInfo) (CallID, error)
|
||||
ProveReplicaUpdate1(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (CallID, error)
|
||||
ProveReplicaUpdate2(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs ReplicaVanillaProofs) (CallID, error)
|
||||
GenerateSectorKeyFromData(ctx context.Context, sector SectorRef, commD cid.Cid) (CallID, error)
|
||||
MoveStorage(ctx context.Context, sector SectorRef, types SectorFileType) (CallID, error)
|
||||
UnsealPiece(context.Context, SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error)
|
||||
Fetch(context.Context, SectorRef, SectorFileType, PathType, AcquireMode) (CallID, error)
|
||||
|
||||
// sync
|
||||
GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error)
|
||||
@ -202,15 +201,15 @@ func Err(code ErrorCode, sub error) *CallError {
|
||||
type WorkerReturn interface {
|
||||
ReturnDataCid(ctx context.Context, callID CallID, pi abi.PieceInfo, err *CallError) error
|
||||
ReturnAddPiece(ctx context.Context, callID CallID, pi abi.PieceInfo, err *CallError) error
|
||||
ReturnSealPreCommit1(ctx context.Context, callID CallID, p1o storage.PreCommit1Out, err *CallError) error
|
||||
ReturnSealPreCommit2(ctx context.Context, callID CallID, sealed storage.SectorCids, err *CallError) error
|
||||
ReturnSealCommit1(ctx context.Context, callID CallID, out storage.Commit1Out, err *CallError) error
|
||||
ReturnSealCommit2(ctx context.Context, callID CallID, proof storage.Proof, err *CallError) error
|
||||
ReturnSealPreCommit1(ctx context.Context, callID CallID, p1o PreCommit1Out, err *CallError) error
|
||||
ReturnSealPreCommit2(ctx context.Context, callID CallID, sealed SectorCids, err *CallError) error
|
||||
ReturnSealCommit1(ctx context.Context, callID CallID, out Commit1Out, err *CallError) error
|
||||
ReturnSealCommit2(ctx context.Context, callID CallID, proof Proof, err *CallError) error
|
||||
ReturnFinalizeSector(ctx context.Context, callID CallID, err *CallError) error
|
||||
ReturnReleaseUnsealed(ctx context.Context, callID CallID, err *CallError) error
|
||||
ReturnReplicaUpdate(ctx context.Context, callID CallID, out storage.ReplicaUpdateOut, err *CallError) error
|
||||
ReturnProveReplicaUpdate1(ctx context.Context, callID CallID, proofs storage.ReplicaVanillaProofs, err *CallError) error
|
||||
ReturnProveReplicaUpdate2(ctx context.Context, callID CallID, proof storage.ReplicaUpdateProof, err *CallError) error
|
||||
ReturnReplicaUpdate(ctx context.Context, callID CallID, out ReplicaUpdateOut, err *CallError) error
|
||||
ReturnProveReplicaUpdate1(ctx context.Context, callID CallID, proofs ReplicaVanillaProofs, err *CallError) error
|
||||
ReturnProveReplicaUpdate2(ctx context.Context, callID CallID, proof ReplicaUpdateProof, err *CallError) error
|
||||
ReturnGenerateSectorKeyFromData(ctx context.Context, callID CallID, err *CallError) error
|
||||
ReturnFinalizeReplicaUpdate(ctx context.Context, callID CallID, err *CallError) error
|
||||
ReturnMoveStorage(ctx context.Context, callID CallID, err *CallError) error
|
||||
|
@ -8,9 +8,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
)
|
||||
|
||||
@ -23,7 +21,7 @@ type testExec struct {
|
||||
apch chan chan apres
|
||||
}
|
||||
|
||||
func (t *testExec) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) {
|
||||
func (t *testExec) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
@ -43,83 +41,83 @@ func (t *testExec) GenerateWindowPoStWithVanilla(ctx context.Context, proofType
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storage.PreCommit1Out, error) {
|
||||
func (t *testExec) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.PreCommit1Out, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storage.SectorCids, error) {
|
||||
func (t *testExec) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.SectorCids, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storage.Commit1Out, error) {
|
||||
func (t *testExec) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.Commit1Out, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storage.Proof, error) {
|
||||
func (t *testExec) SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.Proof, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (t *testExec) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error {
|
||||
func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReleaseSealed(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (t *testExec) ReleaseSealed(ctx context.Context, sector storiface.SectorRef) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (t *testExec) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (t *testExec) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) Remove(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (t *testExec) Remove(ctx context.Context, sector storiface.SectorRef) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) {
|
||||
func (t *testExec) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) {
|
||||
func (t *testExec) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) {
|
||||
func (t *testExec) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error {
|
||||
func (t *testExec) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error {
|
||||
func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) NewSector(ctx context.Context, sector storage.SectorRef) error {
|
||||
func (t *testExec) NewSector(ctx context.Context, sector storiface.SectorRef) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) {
|
||||
func (t *testExec) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) {
|
||||
resp := make(chan apres)
|
||||
t.apch <- resp
|
||||
ar := <-resp
|
||||
return ar.pi, ar.err
|
||||
}
|
||||
|
||||
func (t *testExec) UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error {
|
||||
func (t *testExec) UnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *testExec) ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
func (t *testExec) ReadPiece(ctx context.Context, writer io.Writer, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
var _ ffiwrapper.Storage = &testExec{}
|
||||
var _ storiface.Storage = &testExec{}
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-storage/storage"
|
||||
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/mock"
|
||||
@ -49,7 +48,7 @@ func newTestWorker(wcfg WorkerConfig, lstor *paths.Local, ret storiface.WorkerRe
|
||||
}
|
||||
}
|
||||
|
||||
func (t *testWorker) asyncCall(sector storage.SectorRef, work func(ci storiface.CallID)) (storiface.CallID, error) {
|
||||
func (t *testWorker) asyncCall(sector storiface.SectorRef, work func(ci storiface.CallID)) (storiface.CallID, error) {
|
||||
ci := storiface.CallID{
|
||||
Sector: sector.ID,
|
||||
ID: uuid.New(),
|
||||
@ -60,7 +59,7 @@ func (t *testWorker) asyncCall(sector storage.SectorRef, work func(ci storiface.
|
||||
return ci, nil
|
||||
}
|
||||
|
||||
func (t *testWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) {
|
||||
func (t *testWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
p, err := t.mockSeal.AddPiece(ctx, sector, pieceSizes, newPieceSize, pieceData)
|
||||
if err := t.ret.ReturnAddPiece(ctx, ci, p, toCallError(err)); err != nil {
|
||||
@ -69,7 +68,7 @@ func (t *testWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pie
|
||||
})
|
||||
}
|
||||
|
||||
func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
out, err := t.mockSeal.ReplicaUpdate(ctx, sector, pieces)
|
||||
if err := t.ret.ReturnReplicaUpdate(ctx, ci, out, toCallError(err)); err != nil {
|
||||
@ -78,7 +77,7 @@ func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef
|
||||
})
|
||||
}
|
||||
|
||||
func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) {
|
||||
func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
vanillaProofs, err := t.mockSeal.ProveReplicaUpdate1(ctx, sector, sectorKey, newSealed, newUnsealed)
|
||||
if err := t.ret.ReturnProveReplicaUpdate1(ctx, ci, vanillaProofs, toCallError(err)); err != nil {
|
||||
@ -87,7 +86,7 @@ func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.Sec
|
||||
})
|
||||
}
|
||||
|
||||
func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
proof, err := t.mockSeal.ProveReplicaUpdate2(ctx, sector, sectorKey, newSealed, newUnsealed, vanillaProofs)
|
||||
if err := t.ret.ReturnProveReplicaUpdate2(ctx, ci, proof, toCallError(err)); err != nil {
|
||||
@ -96,7 +95,7 @@ func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.Sec
|
||||
})
|
||||
}
|
||||
|
||||
func (t *testWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
func (t *testWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
t.pc1s++
|
||||
|
||||
@ -114,7 +113,7 @@ func (t *testWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRe
|
||||
})
|
||||
}
|
||||
|
||||
func (t *testWorker) Fetch(ctx context.Context, sector storage.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) {
|
||||
func (t *testWorker) Fetch(ctx context.Context, sector storiface.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) {
|
||||
return t.asyncCall(sector, func(ci storiface.CallID) {
|
||||
if err := t.ret.ReturnFetch(ctx, ci, nil); err != nil {
|
||||
log.Error(err)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user