Merge branch 'filecoin-project:master' into master

This commit is contained in:
kaola526 2022-06-21 17:20:56 +08:00 committed by GitHub
commit ace17753f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
121 changed files with 1811 additions and 2043 deletions

View File

@ -133,6 +133,18 @@ install-worker:
install-app: install-app:
install -C ./$(APP) /usr/local/bin/$(APP) install -C ./$(APP) /usr/local/bin/$(APP)
uninstall: uninstall-daemon uninstall-miner uninstall-worker
.PHONY: uninstall
uninstall-daemon:
rm -f /usr/local/bin/lotus
uninstall-miner:
rm -f /usr/local/bin/lotus-miner
uninstall-worker:
rm -f /usr/local/bin/lotus-worker
# TOOLS # TOOLS
lotus-seed: $(BUILD_DEPS) lotus-seed: $(BUILD_DEPS)

View File

@ -457,10 +457,15 @@ type FullNode interface {
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (types.BigInt, error) //perm:read 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 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 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 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 returns the PreCommit info for the specified miner's sector.
StateSectorPreCommitInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) //perm:read // 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 // 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 // NOTE: returned info.Expiration may not be accurate in some cases, use StateSectorExpiration to get accurate
// expiration epoch // expiration epoch
@ -517,6 +522,8 @@ type FullNode interface {
StateMarketDeals(context.Context, types.TipSetKey) (map[string]*MarketDeal, error) //perm:read StateMarketDeals(context.Context, types.TipSetKey) (map[string]*MarketDeal, error) //perm:read
// StateMarketStorageDeal returns information about the indicated deal // StateMarketStorageDeal returns information about the indicated deal
StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*MarketDeal, error) //perm:read 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 retrieves the ID address of the given address
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read 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 // StateAccountKey returns the public key address of the given ID address for secp and bls accounts

View File

@ -18,7 +18,6 @@ import (
"github.com/filecoin-project/go-state-types/builtin/v8/market" "github.com/filecoin-project/go-state-types/builtin/v8/market"
"github.com/filecoin-project/go-state-types/builtin/v8/miner" "github.com/filecoin-project/go-state-types/builtin/v8/miner"
abinetwork "github.com/filecoin-project/go-state-types/network" 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/actors/builtin"
"github.com/filecoin-project/lotus/chain/types" "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 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 // Temp api for testing
PledgeSector(context.Context) (abi.SectorID, error) //perm:write 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, // 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 // either a new sector will be created, or this call will block until more
// sectors can be created. // 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 // List all staged sectors
SectorsList(context.Context) ([]abi.SectorNumber, error) //perm:read SectorsList(context.Context) ([]abi.SectorNumber, error) //perm:read
@ -126,14 +125,14 @@ type StorageMiner interface {
//storiface.WorkerReturn //storiface.WorkerReturn
ReturnDataCid(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, 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 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 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 storage.SectorCids, 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 storage.Commit1Out, 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 storage.Proof, 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 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 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 storage.ReplicaVanillaProofs, 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 storage.ReplicaUpdateProof, 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 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 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 ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true
@ -272,7 +271,7 @@ type StorageMiner interface {
// the path specified when calling CreateBackup is within the base path // the path specified when calling CreateBackup is within the base path
CreateBackup(ctx context.Context, fpath string) error //perm:admin 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 ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read
} }

View File

@ -8,7 +8,6 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/proof" "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/sealtasks"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
@ -34,22 +33,22 @@ type Worker interface {
Info(context.Context) (storiface.WorkerInfo, error) //perm:admin Info(context.Context) (storiface.WorkerInfo, error) //perm:admin
// storiface.WorkerCalls // storiface.WorkerCalls
DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (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 storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.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 storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (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 storage.SectorRef, pc1o storage.PreCommit1Out) (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 storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (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 storage.SectorRef, c1o storage.Commit1Out) (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 storage.SectorRef, keepUnsealed []storage.Range) (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 storage.SectorRef, keepUnsealed []storage.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 storage.SectorRef, pieces []abi.PieceInfo) (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 storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (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 storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (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 storage.SectorRef, commD cid.Cid) (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 storage.SectorRef, safeToFree []storage.Range) (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 storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin MoveStorage(ctx context.Context, sector storiface.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 UnsealPiece(context.Context, storiface.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 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 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 GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin

View File

@ -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) 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. // StateDealProviderCollateralBounds mocks base method.
func (m *MockFullNode) StateDealProviderCollateralBounds(arg0 context.Context, arg1 abi.PaddedPieceSize, arg2 bool, arg3 types.TipSetKey) (api.DealCollateralBounds, error) { func (m *MockFullNode) StateDealProviderCollateralBounds(arg0 context.Context, arg1 abi.PaddedPieceSize, arg2 bool, arg3 types.TipSetKey) (api.DealCollateralBounds, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
@ -2934,10 +2949,10 @@ func (mr *MockFullNodeMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg3
} }
// StateSectorPreCommitInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(miner.SectorPreCommitOnChainInfo) ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }

View File

@ -30,7 +30,6 @@ import (
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network" abinetwork "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/specs-storage/storage"
apitypes "github.com/filecoin-project/lotus/api/types" apitypes "github.com/filecoin-project/lotus/api/types"
"github.com/filecoin-project/lotus/chain/actors/builtin" "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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` 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"` SectorsUpdate func(p0 context.Context, p1 abi.SectorNumber, p2 SectorState) error `perm:"admin"`
@ -912,19 +913,19 @@ type WalletStub struct {
type WorkerStruct struct { type WorkerStruct struct {
Internal 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"` 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"` 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"` 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"` Paths func(p0 context.Context) ([]storiface.StoragePath, error) `perm:"admin"`
ProcessSession func(p0 context.Context) (uuid.UUID, 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"` 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"` 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"` 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"` 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 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) { func (s *FullNodeStruct) StateDealProviderCollateralBounds(p0 context.Context, p1 abi.PaddedPieceSize, p2 bool, p3 types.TipSetKey) (DealCollateralBounds, error) {
if s.Internal.StateDealProviderCollateralBounds == nil { if s.Internal.StateDealProviderCollateralBounds == nil {
return *new(DealCollateralBounds), ErrNotSupported return *new(DealCollateralBounds), ErrNotSupported
@ -2882,15 +2894,15 @@ func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Addre
return nil, ErrNotSupported 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 { if s.Internal.StateSectorPreCommitInfo == nil {
return *new(miner.SectorPreCommitOnChainInfo), ErrNotSupported return nil, ErrNotSupported
} }
return s.Internal.StateSectorPreCommitInfo(p0, p1, p2, p3) 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) { func (s *FullNodeStub) StateSectorPreCommitInfo(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
return *new(miner.SectorPreCommitOnChainInfo), ErrNotSupported return nil, ErrNotSupported
} }
func (s *FullNodeStruct) StateVMCirculatingSupplyInternal(p0 context.Context, p1 types.TipSetKey) (CirculatingSupply, error) { 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 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 { if s.Internal.CheckProvable == nil {
return *new(map[abi.SectorNumber]string), ErrNotSupported return *new(map[abi.SectorNumber]string), ErrNotSupported
} }
return s.Internal.CheckProvable(p0, p1, p2, p3) 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 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 { if s.Internal.ComputeDataCid == nil {
return *new(abi.PieceInfo), ErrNotSupported return *new(abi.PieceInfo), ErrNotSupported
} }
return s.Internal.ComputeDataCid(p0, p1, p2) 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 return *new(abi.PieceInfo), ErrNotSupported
} }
@ -4587,25 +4599,25 @@ func (s *StorageMinerStub) ReturnMoveStorage(p0 context.Context, p1 storiface.Ca
return ErrNotSupported 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 { if s.Internal.ReturnProveReplicaUpdate1 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnProveReplicaUpdate1(p0, p1, p2, p3) 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 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 { if s.Internal.ReturnProveReplicaUpdate2 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnProveReplicaUpdate2(p0, p1, p2, p3) 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 return ErrNotSupported
} }
@ -4631,58 +4643,58 @@ func (s *StorageMinerStub) ReturnReleaseUnsealed(p0 context.Context, p1 storifac
return ErrNotSupported 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 { if s.Internal.ReturnReplicaUpdate == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnReplicaUpdate(p0, p1, p2, p3) 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 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 { if s.Internal.ReturnSealCommit1 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnSealCommit1(p0, p1, p2, p3) 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 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 { if s.Internal.ReturnSealCommit2 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnSealCommit2(p0, p1, p2, p3) 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 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 { if s.Internal.ReturnSealPreCommit1 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnSealPreCommit1(p0, p1, p2, p3) 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 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 { if s.Internal.ReturnSealPreCommit2 == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.ReturnSealPreCommit2(p0, p1, p2, p3) 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 return ErrNotSupported
} }
@ -4741,14 +4753,14 @@ func (s *StorageMinerStub) SectorAbortUpgrade(p0 context.Context, p1 abi.SectorN
return ErrNotSupported 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 { if s.Internal.SectorAddPieceToAny == nil {
return *new(SectorOffset), ErrNotSupported return *new(SectorOffset), ErrNotSupported
} }
return s.Internal.SectorAddPieceToAny(p0, p1, p2, p3) 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 return *new(SectorOffset), ErrNotSupported
} }
@ -4972,14 +4984,14 @@ func (s *StorageMinerStub) SectorsSummary(p0 context.Context) (map[SectorState]i
return *new(map[SectorState]int), ErrNotSupported 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 { if s.Internal.SectorsUnsealPiece == nil {
return ErrNotSupported return ErrNotSupported
} }
return s.Internal.SectorsUnsealPiece(p0, p1, p2, p3, p4, p5) 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 return ErrNotSupported
} }
@ -5258,25 +5270,25 @@ func (s *WalletStub) WalletSign(p0 context.Context, p1 address.Address, p2 []byt
return nil, ErrNotSupported 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 { if s.Internal.AddPiece == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.AddPiece(p0, p1, p2, p3, p4) 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 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 { if s.Internal.DataCid == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.DataCid(p0, p1, p2) 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 return *new(storiface.CallID), ErrNotSupported
} }
@ -5291,47 +5303,47 @@ func (s *WorkerStub) Enabled(p0 context.Context) (bool, error) {
return false, ErrNotSupported 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 { if s.Internal.Fetch == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.Fetch(p0, p1, p2, p3, p4) 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 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 { if s.Internal.FinalizeReplicaUpdate == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.FinalizeReplicaUpdate(p0, p1, p2) 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 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 { if s.Internal.FinalizeSector == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.FinalizeSector(p0, p1, p2) 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 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 { if s.Internal.GenerateSectorKeyFromData == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.GenerateSectorKeyFromData(p0, p1, p2) 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 return *new(storiface.CallID), ErrNotSupported
} }
@ -5368,14 +5380,14 @@ func (s *WorkerStub) Info(p0 context.Context) (storiface.WorkerInfo, error) {
return *new(storiface.WorkerInfo), ErrNotSupported 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 { if s.Internal.MoveStorage == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.MoveStorage(p0, p1, p2) 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 return *new(storiface.CallID), ErrNotSupported
} }
@ -5401,36 +5413,36 @@ func (s *WorkerStub) ProcessSession(p0 context.Context) (uuid.UUID, error) {
return *new(uuid.UUID), ErrNotSupported 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 { if s.Internal.ProveReplicaUpdate1 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.ProveReplicaUpdate1(p0, p1, p2, p3, p4) 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 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 { if s.Internal.ProveReplicaUpdate2 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.ProveReplicaUpdate2(p0, p1, p2, p3, p4, p5) 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 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 { if s.Internal.ReleaseUnsealed == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.ReleaseUnsealed(p0, p1, p2) 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 return *new(storiface.CallID), ErrNotSupported
} }
@ -5445,58 +5457,58 @@ func (s *WorkerStub) Remove(p0 context.Context, p1 abi.SectorID) error {
return ErrNotSupported 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 { if s.Internal.ReplicaUpdate == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.ReplicaUpdate(p0, p1, p2) 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 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 { if s.Internal.SealCommit1 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.SealCommit1(p0, p1, p2, p3, p4, p5) 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 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 { if s.Internal.SealCommit2 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.SealCommit2(p0, p1, p2) 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 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 { if s.Internal.SealPreCommit1 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.SealPreCommit1(p0, p1, p2, p3) 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 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 { if s.Internal.SealPreCommit2 == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.SealPreCommit2(p0, p1, p2) 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 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 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 { if s.Internal.UnsealPiece == nil {
return *new(storiface.CallID), ErrNotSupported return *new(storiface.CallID), ErrNotSupported
} }
return s.Internal.UnsealPiece(p0, p1, p2, p3, p4, p5) 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 return *new(storiface.CallID), ErrNotSupported
} }

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "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/go-state-types/crypto"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -24,6 +25,18 @@ type WrapperV1Full struct {
v1api.FullNode 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) { func (w *WrapperV1Full) StateSearchMsg(ctx context.Context, msg cid.Cid) (*api.MsgLookup, error) {
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, api.LookbackNoLimit, true) return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, api.LookbackNoLimit, true)
} }

View File

@ -55,7 +55,7 @@ func VersionForType(nodeType NodeType) (Version, error) {
// semver versions of the rpc api exposed // semver versions of the rpc api exposed
var ( var (
FullAPIVersion0 = newVer(1, 5, 0) FullAPIVersion0 = newVer(1, 5, 0)
FullAPIVersion1 = newVer(2, 2, 0) FullAPIVersion1 = newVer(2, 3, 0)
MinerAPIVersion0 = newVer(1, 5, 0) MinerAPIVersion0 = newVer(1, 5, 0)
WorkerAPIVersion0 = newVer(1, 6, 0) WorkerAPIVersion0 = newVer(1, 6, 0)

Binary file not shown.

View File

@ -1,2 +1,2 @@
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWFHDtFx7CVTy4xoCDutVo1cScvSnQjDeaM8UzwVS1qwkh /dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWSUZhAY3eyoPUboJ1ZWe4dNPFWTr1EPoDjbTDSAN15uhY
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWKt8cwpkiumkT8x32c3YFxsPRwhV5J8hCYPn9mhUmcAXt /dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWDfvNrSRVGWAGbn3sm9C8z98W2x25qCZjaXGHXmGiH24e

View File

@ -9,120 +9,120 @@ import (
var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMetadata{{ var EmbeddedBuiltinActorsMetadata []*BuiltinActorsMetadata = []*BuiltinActorsMetadata{{
Network: "butterflynet", Network: "butterflynet",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzacedktlamzlgecxpnsnods5iyh5uspbg2ukqrrn6h6c2h5iozmtb2d6"), ManifestCid: MustParseCid("bafy2bzaced6uuyvoidi5gmqk6wsx7hlchpjfvzrkqlbnto2p5tvzcnaf6gmey"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebbdtqcmjtyqzheoycfn3kitaqivhywxjcvrl5dyor4qh4rh23zfu"), "account": MustParseCid("bafk2bzaceckohebftaeh3umtazldwcm2yjfsv74tf7qbxledmhm5uiqoslhgy"),
"cron": MustParseCid("bafk2bzacedy7j3r4wfjxm4vhlc7xdxkuuihbmcvq6kldtm65ioll2du6jwgnq"), "cron": MustParseCid("bafk2bzacebjgaky46lkkwh7dk6vxxcoktem3wvd64pamjlmjiuw4dpw6ip4gs"),
"init": MustParseCid("bafk2bzaceauk2zhkie7btkmjmcuv2z5f53lv3adqlq4ozp7dln64lkath6iia"), "init": MustParseCid("bafk2bzacebjzrzjtrq7fops45chsb5xwr2ljmsbpn6rdhaeofhgazqfnnnvia"),
"multisig": MustParseCid("bafk2bzacedaxdz26xg44m5chunjjpjayzjhyfofnzaotmbuay7p4sso6n4vz4"), "multisig": MustParseCid("bafk2bzacecumdo2d2vpmkd66vqdkj32zu6m54ddpaqiqcchybq7fljygips6e"),
"paymentchannel": MustParseCid("bafk2bzacebklebmukj53bkeu2zaeawv2aolzd7qepchpybimfewii43ti3np6"), "paymentchannel": MustParseCid("bafk2bzacecmsfeq364zbysebk4xkpmtcxe4bv4lrlfdzidqoudnsdihph4d6u"),
"reward": MustParseCid("bafk2bzaceanwnmfpzgyrp6upiutqaumkugzjncrq3grettmq7wgg3rejfcmoi"), "reward": MustParseCid("bafk2bzacecegz7l24oflfaljv2leyt5hm43xtnpiud6onb5cj7rxii64skro4"),
"storagemarket": MustParseCid("bafk2bzacecqpkkhltbzju4oe4kszp7pgffopifbcy5i4xuxsexsoyp7psvgyu"), "storagemarket": MustParseCid("bafk2bzacedhbgxtzn7njswwj6nddtwvikiawg6v6nfd5j2m4kzwpmzx3hs6za"),
"storageminer": MustParseCid("bafk2bzacebewpe2ufauqsey7p7wuxihi6eqmszf4nyjwcq2rcw2ld53k7muke"), "storageminer": MustParseCid("bafk2bzacedesl6liweoc2tbd2tu7srt4gl47s4mkpxuutyhsp5xdgfon7dhde"),
"storagepower": MustParseCid("bafk2bzacec5rymvcahknqtm677udm6webygsgarzfm75udpac4zqzs6n4bmpu"), "storagepower": MustParseCid("bafk2bzaceaanma6h3fgx6i7z44rq43ztpgsm5p5kv7o67tgx37w2deg22747u"),
"system": MustParseCid("bafk2bzacec5mttzs3bddj6c2fbfxyzkeqgy5fcn3cihflq3jju37uzoatarsm"), "system": MustParseCid("bafk2bzaceb7hdtxcgmjyad73fmwqsitaj45tdnf33w4ppr6yviwrng42vrfqk"),
"verifiedregistry": MustParseCid("bafk2bzacecbhego5vgecly7rw2igkjggzplpv4vnclpyti4x42gaejokm6vmc"), "verifiedregistry": MustParseCid("bafk2bzacebevs25cjj2swznkyyauodmwpvcwkgqldbw2x5sd7dwjg7vvntnzu"),
}, },
}, { }, {
Network: "calibrationnet", Network: "calibrationnet",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzaced4z2234ptuufryfekgfstbd54nehguvssd6ehigybhhksxsycuno"), ManifestCid: MustParseCid("bafy2bzacedrdn6z3z7xz7lx4wll3tlgktirhllzqxb766dxpaqp3ukxsjfsba"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzaceciadbjjhts53lmrojgnujoyvux4fx6444w6f5y33olfokkvkrbuu"), "account": MustParseCid("bafk2bzacecruossn66xqbeutqx5r4k2kjzgd43frmwd4qkw6haez44ubvvpxo"),
"cron": MustParseCid("bafk2bzaceahzwi3rmu4rpnz4ql6tclg4f4sbo5piyweut7ccfp6bwocsw24ze"), "cron": MustParseCid("bafk2bzaceaxlezmclw5ugldhhtfgvn7yztux45scqik3ez4yhwiqhg5ssib44"),
"init": MustParseCid("bafk2bzacebcmo3hxum3stwg7rvinvf44eusk5mwdsjvbezwzce7et6lpheaji"), "init": MustParseCid("bafk2bzaceadyfilb22bcvzvnpzbg2lyg6npmperyq6es2brvzjdh5rmywc4ry"),
"multisig": MustParseCid("bafk2bzaceb3frglrinpyou6oha3jcjnwhmbfqdbaqzi3l6ifcf2r2t4pi4vns"), "multisig": MustParseCid("bafk2bzacec66wmb4kohuzvuxsulhcgiwju7sqkldwfpmmgw7dbbwgm5l2574q"),
"paymentchannel": MustParseCid("bafk2bzacedarudx3zeudotuhltmr5qlbgsjelzx2ze3653p3v6cpgx7ejlcl6"), "paymentchannel": MustParseCid("bafk2bzaceblot4pemhfgwb3lceellwrpgxaqkpselzbpqu32maffpopdunlha"),
"reward": MustParseCid("bafk2bzacedn5jwjjtmr7nfhgrw4pcrt4rdwh72bhqwrs6onb2dxk5xlrywqrk"), "reward": MustParseCid("bafk2bzaceayah37uvj7brl5no4gmvmqbmtndh5raywuts7h6tqbgbq2ge7dhu"),
"storagemarket": MustParseCid("bafk2bzacebvyzgssvcnttuw4fexk3r6szdnk5f2ykoe3aetscae33rxuyjfy2"), "storagemarket": MustParseCid("bafk2bzacebotg5coqnglzsdrqxtkqk2eq4krxt6zvds3i3vb2yejgxhexl2n6"),
"storageminer": MustParseCid("bafk2bzacedcupmzfcwi6ohkklttbsrwvbux3ptpdb4a7g34jmf6cm2ge7qlkk"), "storageminer": MustParseCid("bafk2bzacea6rabflc7kpwr6y4lzcqsnuahr4zblyq3rhzrrsfceeiw2lufrb4"),
"storagepower": MustParseCid("bafk2bzacecyn75cwowuhmn6nfi2covidf5ihr7veyx7bd4lezkkvh2nbjzjry"), "storagepower": MustParseCid("bafk2bzacecpwr4mynn55bg5hrlns3osvg7sty3rca6zlai3vl52vbbjk7ulfa"),
"system": MustParseCid("bafk2bzaceclsb6xnx62hilb6kk5qydzha5xubxkrpy7kqqyr4kq2bhadg5jbe"), "system": MustParseCid("bafk2bzaceaqrkllksxv2jsfgjvmuewx5vbzrammw5mdscod6gkdr3ijih2q64"),
"verifiedregistry": MustParseCid("bafk2bzacedfjp6a5m2nhsmzae2i4grfaw4urzpiur22w6h55csptvr5cauttm"), "verifiedregistry": MustParseCid("bafk2bzaceaihibfu625lbtzdp3tcftscshrmbgghgrc7kzqhxn4455pycpdkm"),
}, },
}, { }, {
Network: "caterpillarnet", Network: "caterpillarnet",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzacecooicf3mbtuqjmdfdtbw35ivp2xyjktlxwfebwvulaahamrqw3k4"), ManifestCid: MustParseCid("bafy2bzacebitcr6geekzzkiggl35gi7f32zph46ufgz5lxkd7pqccqgzvpqyc"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacebbr5xcsjhc4heykayi4nqyit2bnl4xv6degmhrlbcrkuah7xcsam"), "account": MustParseCid("bafk2bzaceaqeughlonz5okhkep3busavpt6qlaxy3x4lx2go3wsf4oval42go"),
"cron": MustParseCid("bafk2bzacedrsf2aplg4wgjzwzzyxyhdsxlpp2ydxgnvfvq5a4ym6xvcdhh222"), "cron": MustParseCid("bafk2bzacedixwc4mo3k2akjstogi3hsu6yzibe6uzs3hke2m74j7umpe7ydwk"),
"init": MustParseCid("bafk2bzacedpwzwvfyypfo2b2pg2k2vrru6x2haa6ozlb2lf22pnacw7r76c5c"), "init": MustParseCid("bafk2bzacedrygc7pawj6rgfy5uawgfkykias2phw7lgjfj7yyxtfpk3wsyj7c"),
"multisig": MustParseCid("bafk2bzacea4iz3rmpft4v3uy2dxymoez6hfnlql3v5x4g3pk3rmgfjis34pzi"), "multisig": MustParseCid("bafk2bzacececbmijm2t4uemwgrspnnslpgnksozvshrwgf3ozh6zncz7aqr4c"),
"paymentchannel": MustParseCid("bafk2bzacedx4behmy7x2a4xn5oh6pgl7vubc3by5zaakio3bbkmop3ju4ncbm"), "paymentchannel": MustParseCid("bafk2bzacedv3lmu3ut7nrl5zpxl22je2qiognakt3m4eibux4x74nwibdegeu"),
"reward": MustParseCid("bafk2bzaceazq62qx7bjot3jfmrawg5mgmjsrblzp3x6yug7uf22glhwjou7uq"), "reward": MustParseCid("bafk2bzacebaxil4vhggtxaz57s4rdxsmjgiegexoyyol77gdtkaxmzuuk2fts"),
"storagemarket": MustParseCid("bafk2bzaceaevfwztizbgtg6ybshcfaenyoverce22hhhwuv6y5gogf52tqx4g"), "storagemarket": MustParseCid("bafk2bzacecsr53mwcmsdqvg6o45j6skvs56rszpk6qitgctebqmjhntatkhie"),
"storageminer": MustParseCid("bafk2bzacebjyrh6vs5vjrh5wxrrgtdbfzaib6vc2ubmr3pgv66mbebhkd3m4k"), "storageminer": MustParseCid("bafk2bzacecamuvyexrh27koduxutjtmiats7knwgduujhpx2ppbcidnyrsj22"),
"storagepower": MustParseCid("bafk2bzacedblxcejkcuuxbtmyiq5klkq5zcokor2fm2aeaq7wfou4eln637yc"), "storagepower": MustParseCid("bafk2bzaceadhmwub5wksxgcakprhahrnm6rhmcle2unlc5lqcnnkplxcy3tby"),
"system": MustParseCid("bafk2bzaceamrktidazdlpsjm7quo7lynurnknqtfhd3cam3p3b2ec2ua5zlk4"), "system": MustParseCid("bafk2bzacebnierpf3g52brlzcs3of4stltmrfw3nhgy3y67e2lndohpuckv72"),
"verifiedregistry": MustParseCid("bafk2bzacecyadbss4wve276yr4yc2adhow56apq3rglmb2fusgorpxpkmavz6"), "verifiedregistry": MustParseCid("bafk2bzaceckqvl6647so55jgmnoa7jchs3ifbgncdb3qx6e33l2smcnthrkgi"),
}, },
}, { }, {
Network: "devnet", Network: "devnet",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzaceb6v3llydxlcaofdhubn24gkwuooymar56iun5ceidvvm5zm2q42a"), ManifestCid: MustParseCid("bafy2bzaceajvuce5g5f3lxosfupsizwtlppix6xcwrjphv5rto3rf63j5cdfy"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacedeoab5nfo3obkkedm6sbjefdxhdfh7vpdxoqx6vba25ur2irnkpy"), "account": MustParseCid("bafk2bzacedt3rrna27knzqv45rntnzblcpbdyb7abwprqqc3m3sclhhs5rcbm"),
"cron": MustParseCid("bafk2bzacedbz5ox2ua6b2tee2armmwmq32ge6xnyu2n2vbbmxo5r5p73aiwfw"), "cron": MustParseCid("bafk2bzaceacwupgz6ywehqvepuyo5zmmk5zckeep2unnrh2v4m55zzfmuybnm"),
"init": MustParseCid("bafk2bzaceaf7zqjo5hjyozvzudllvoub6ejcqs7vpquie7wdp6fkt27swqpqu"), "init": MustParseCid("bafk2bzacedetk52vj6vfpqw3wfd5shnkfigokmyhrfojhtvz43336m43thham"),
"multisig": MustParseCid("bafk2bzacebkm2rputkjqhqy3djtut7xoq6nvbnqken3oaelmv4oxljxzhvuzg"), "multisig": MustParseCid("bafk2bzacebtypmb6dqnhowzttf643kbgtdhf6iclasc4ffxkkq5atriqc42g6"),
"paymentchannel": MustParseCid("bafk2bzaceawo3dveeocpgkstqirdjob7xlrmy4qy2lcgq5gpnyxvest2g6joa"), "paymentchannel": MustParseCid("bafk2bzacedvd4cfhfz7duxkudnu2cxbqkmanodgvpf623jmtz75njif5d5d3a"),
"reward": MustParseCid("bafk2bzaceainy5y3xu6ryjh3hfh7p2ab5n7uh26mprzwnajgsmu7eajxlaxe6"), "reward": MustParseCid("bafk2bzaceaegqj6sg3dkfb6pcduktclnaqg7lwxfvbmnb75dbwdft7p7ovwh4"),
"storagemarket": MustParseCid("bafk2bzacecg45uhzcfrgi6iblseykqk5e7zi4snzy55hceqbanmq4p4zj3y4o"), "storagemarket": MustParseCid("bafk2bzacecfzobcdmc3hxivo7e4w66xlvz2ekbx2g24yzom5b2wxfmt775nus"),
"storageminer": MustParseCid("bafk2bzacebqjo3ziocbaikgvysc2zdyxe3iqn3vsi5v7lipgcvswxbss5zcrw"), "storageminer": MustParseCid("bafk2bzacebjmefvh4a3qee4e5pnjdhtpwz3hcvysofuclfxl4v7r3wmjggoja"),
"storagepower": MustParseCid("bafk2bzaceax24kwja27fheihx4hh6wwgiouffz4np2u3ghbpm372oait6zdh2"), "storagepower": MustParseCid("bafk2bzacebxp6iwxv4ofpij2yf4etg42w6spbwt44f7cioyvo6u6rt76mkrvi"),
"system": MustParseCid("bafk2bzacecfiu6omvipao6qvngnoisjuoq3im4a2czojbkqzyru37puiy4iz6"), "system": MustParseCid("bafk2bzacec3t66vrvb6ltgjvtga7xmtvy4x2xvfgq262v44gs7nsalbklamzc"),
"verifiedregistry": MustParseCid("bafk2bzaceacw5575umfg2kon6yzacthrvppky3leugsjc5vmixbfp3ob5evw4"), "verifiedregistry": MustParseCid("bafk2bzaceantjiul66lkpcq6jpujmo3gy2nft44w2tud44wzznrodqm5imegk"),
}, },
}, { }, {
Network: "mainnet", Network: "mainnet",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzacebkful67ipjqhpp4gwqhotjebrruowmpnhs55aljykmdwp2eee6am"), ManifestCid: MustParseCid("bafy2bzaceclwsaafb4h7nofp64v7ctxq5cs75545mylvw3hwaxdign6xk5kka"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzaceab5hj4qbccnlbcq2dlzurghekipwl6hvm7wmfoxj2nhnmqhjqete"), "account": MustParseCid("bafk2bzaceb2bkfdnv2ohescckcywwtrmhtbn53aenbo2x5ybrvtnjfspkud4g"),
"cron": MustParseCid("bafk2bzacecs34u2mrisxcqanpu3lgv2pyxvwosopn6cdcxg7pcxefr47mkzda"), "cron": MustParseCid("bafk2bzaceaxoogtk2e4onrx32eykhqy43l3hzcrkz6okhdujjohrfuy6z4ygk"),
"init": MustParseCid("bafk2bzacec24c457opefiv7zo4wqi3f5w6k4ptfbkyhtmbwilzkindmfby5g2"), "init": MustParseCid("bafk2bzacecxkeddlvo5azclqbasrlymu3a2k3y6jsbaeov4lix5pwzdra5bek"),
"multisig": MustParseCid("bafk2bzacec7jef7mpiiv7wjnp6ncgkwufpbmqz5z6c2vfd2no4tqgf77qgifi"), "multisig": MustParseCid("bafk2bzacebqhfu4doyffwknjsw7vjldpkccf253i6sncx6ty7ofm2q3d2ttys"),
"paymentchannel": MustParseCid("bafk2bzacedqx4wnzlhvalcrxjlxwer2n54woz7ggearqxuk7lx3gasg6dx52s"), "paymentchannel": MustParseCid("bafk2bzacebk5kb6ofhksspgv3wp6uwbcrn7x37ego54bgakywseg7bgw4ffdq"),
"reward": MustParseCid("bafk2bzacedu4fgsp72huqi7tbsyguoia7g3oyuwh74omkx44a65pwrm3rjth2"), "reward": MustParseCid("bafk2bzaced2lusdnjdfn7o6fb5cqzdccllqgb5i6ofqlfdknvpuaz7wkkq324"),
"storagemarket": MustParseCid("bafk2bzacedylxxikx3rzl3dfswlisafr42qmn2mid3acajjzadwyheofi4ngw"), "storagemarket": MustParseCid("bafk2bzacedcpb2vsb6xzz32jzgxc5hh4bmhjggjjitizusr5eucfrziizt7tk"),
"storageminer": MustParseCid("bafk2bzacecpxjo5xfofk363mjem6tdnmuhobqhlhitnf4etevuxzbeoincl3k"), "storageminer": MustParseCid("bafk2bzacecbnz4cxd3j46taxsfzq3jkzai5sef3zwnxzft77unterfkcukk6w"),
"storagepower": MustParseCid("bafk2bzacecm37s2363hn2hbscuqf2ensbqq3nsfnwbplstpggbpijdblins2m"), "storagepower": MustParseCid("bafk2bzaceaz7dharmmwjghgobsnefiyciz6ogj6uzdoomlyid6h3ye4nzpurs"),
"system": MustParseCid("bafk2bzacedhasoz5w7hthbxbeifmg7mrlgpwhmqcif2d63uopna4xzk37uafy"), "system": MustParseCid("bafk2bzaceckspyzcsqyrigwziyubzj7nv3bfiu2p7mwfltyhmzxg34lwj4dfm"),
"verifiedregistry": MustParseCid("bafk2bzacecvwi3ndugiyfi2hlpo6kixhlvhsnuy64m33gfrr5bhxfjorpzef6"), "verifiedregistry": MustParseCid("bafk2bzacecztqq7o5po5hbbtgi3uc7znxkmjl4qqeyhuy42svo3p3zc6cev2c"),
}, },
}, { }, {
Network: "testing", Network: "testing",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzacedajylykoksplon3gzx27wli5bs72lzd5nih5c375ytqa4rjxnesa"), ManifestCid: MustParseCid("bafy2bzacea33t2faxpcqd47layvl7j6e2rzctc4of4m7nwx5wjagvulwasjzs"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea2lrlc3dpgfay3v3h4hfhm36il3eeegdbstvwuawf2dm6z4hkzsy"), "account": MustParseCid("bafk2bzacearozlorchwfq4gkgkdtmvd43lcjblnge6j3putfetavneycdum4i"),
"cron": MustParseCid("bafk2bzaceao6lmovdtxyiyhtlvx6hqsm2oal2vrlnabgtmozqsl2pet2gpef6"), "cron": MustParseCid("bafk2bzacean2fewjae57hwyomnf7ktyiahuenyxhzrpkhsrlwsecyv2lk2hto"),
"init": MustParseCid("bafk2bzacebbhy4izopnuj5moauauvlxw4oeozvylnejxollmwdfcmbnnkj77s"), "init": MustParseCid("bafk2bzacecioxkb2gqaze7lnaq7xj2aibiqgapl4jq2qyccjbvuzanzzkwqnc"),
"multisig": MustParseCid("bafk2bzacecblegf5dogxfb7edzsdttollesh2qup7bxrqjem5sdssiuoiqxja"), "multisig": MustParseCid("bafk2bzacecyeqb2ilsuoxfphqpfxrtwaz7vfbrq3kq67j5uof6sbrw675zbry"),
"paymentchannel": MustParseCid("bafk2bzaceaxvwc4qiwss3juhrdsy4pb4bitl7ahllxnup4k55q37eori6ttho"), "paymentchannel": MustParseCid("bafk2bzacedsi4nwln57uqf2vhjma3qfsmavjhyjwk6bch2nl3zbwmwln3cgk6"),
"reward": MustParseCid("bafk2bzacedd7lgezplkws6zpokyyjcmwzwof7ruxr3frpguhxkglqg52i3lf4"), "reward": MustParseCid("bafk2bzacec3no7avpydxxkqzc7druqiljmfs6antcmdbhjtyytlzfrj3nemlm"),
"storagemarket": MustParseCid("bafk2bzaceauec7dpcnjrgsmy2rektiraq7lfvr4t4azyukjuluxmufglca7wc"), "storagemarket": MustParseCid("bafk2bzacedqlm6c4yhtcw3f3fkhx4bc3cfckyvkk6tfsdnzita47poq4jfv5i"),
"storageminer": MustParseCid("bafk2bzacebrhhpno62lv6g7i5ccuvj57kdozbubqvq6mtjbrt2slihxddl3s4"), "storageminer": MustParseCid("bafk2bzacedcxbj6ntcnmupkmxwr42pvfrurqjykbs4mzndmvjgjg63ka2wupo"),
"storagepower": MustParseCid("bafk2bzacecoh3c7fm7wdvhij46fzetwwkxks4ftu5jgovhitoxts2xild3v3u"), "storagepower": MustParseCid("bafk2bzacebg663joio3mq5utzm2k3je6piwmqlyindcklbhnsukku6u26mrus"),
"system": MustParseCid("bafk2bzacea4zg4zf77wne3rewpb5m4adl5bc2dogiph7j3q4rhrbpknwvq7qc"), "system": MustParseCid("bafk2bzaceaxy3h63qnazdiny57sh2yaq3c3azyt6zgpefpom3hs2lyfsmw3ui"),
"verifiedregistry": MustParseCid("bafk2bzaceakcp7ur3wsnxi4cfh7huybjg5otlazmztrhzikxwxvrjv4uljcoq"), "verifiedregistry": MustParseCid("bafk2bzacebeauqrzfv4cr644udm2fnltuz6cddoyzo2n7cvpa6l3ktnofu7w2"),
}, },
}, { }, {
Network: "testing-fake-proofs", Network: "testing-fake-proofs",
Version: 8, Version: 8,
ManifestCid: MustParseCid("bafy2bzaced3kmznycbhfjkcdzymlywevk5jamtujr6eadgun6vrebmi5np22m"), ManifestCid: MustParseCid("bafy2bzacedsjtsrqey2n54hm7eblf25ygmvv6e73uvqsdiklavtmqmxilcdjc"),
Actors: map[string]cid.Cid{ Actors: map[string]cid.Cid{
"account": MustParseCid("bafk2bzacea2lrlc3dpgfay3v3h4hfhm36il3eeegdbstvwuawf2dm6z4hkzsy"), "account": MustParseCid("bafk2bzacearozlorchwfq4gkgkdtmvd43lcjblnge6j3putfetavneycdum4i"),
"cron": MustParseCid("bafk2bzaceao6lmovdtxyiyhtlvx6hqsm2oal2vrlnabgtmozqsl2pet2gpef6"), "cron": MustParseCid("bafk2bzacean2fewjae57hwyomnf7ktyiahuenyxhzrpkhsrlwsecyv2lk2hto"),
"init": MustParseCid("bafk2bzaceaqllna5m7kwvsahn6ijnhv4fkkyjthxrb2bwdacufvpbi3a6qygo"), "init": MustParseCid("bafk2bzacebwfsgvfuuogwodiq53m23ggae5saavabeqouttmo6s52pdmzmg36"),
"multisig": MustParseCid("bafk2bzaceduvgbzhawh5gi23lsd7be2sefnldqhbe4clsh4bqvafyo4sk5g3y"), "multisig": MustParseCid("bafk2bzacecyeqb2ilsuoxfphqpfxrtwaz7vfbrq3kq67j5uof6sbrw675zbry"),
"paymentchannel": MustParseCid("bafk2bzacedaxkwccobed76fsmyevttptfw74pumb637himbwnce4jtaxtxazs"), "paymentchannel": MustParseCid("bafk2bzacedsi4nwln57uqf2vhjma3qfsmavjhyjwk6bch2nl3zbwmwln3cgk6"),
"reward": MustParseCid("bafk2bzacedd7lgezplkws6zpokyyjcmwzwof7ruxr3frpguhxkglqg52i3lf4"), "reward": MustParseCid("bafk2bzacec3no7avpydxxkqzc7druqiljmfs6antcmdbhjtyytlzfrj3nemlm"),
"storagemarket": MustParseCid("bafk2bzacea3zogutvlgo7vea3widjsjz6z23mgftvlhcrnuwuptuh2cgv75ww"), "storagemarket": MustParseCid("bafk2bzaceckvmh2knnsuzx2jqcmjnmckccoffznr3uah25p7ndphva6qwhfuc"),
"storageminer": MustParseCid("bafk2bzacec2bz7ts7lzvty2qzovj3r3hutwgs3j7yo3ep7v67gsytft7spexa"), "storageminer": MustParseCid("bafk2bzacedngg6mggpxoeyineuiwp26doj7h46yxp6fk6rftfo6suwsd23fku"),
"storagepower": MustParseCid("bafk2bzaceaiip5k5yendslu7ldy7rnmtabzlez6sbgdcvqfjivxr2gvxb7cy4"), "storagepower": MustParseCid("bafk2bzacectbtyzafwpjtsfbsi75wky6i6ufoggrch6nc66bxcskmxie4ho34"),
"system": MustParseCid("bafk2bzacea4zg4zf77wne3rewpb5m4adl5bc2dogiph7j3q4rhrbpknwvq7qc"), "system": MustParseCid("bafk2bzaceaxy3h63qnazdiny57sh2yaq3c3azyt6zgpefpom3hs2lyfsmw3ui"),
"verifiedregistry": MustParseCid("bafk2bzaceakcp7ur3wsnxi4cfh7huybjg5otlazmztrhzikxwxvrjv4uljcoq"), "verifiedregistry": MustParseCid("bafk2bzacebeauqrzfv4cr644udm2fnltuz6cddoyzo2n7cvpa6l3ktnofu7w2"),
}, },
}} }}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -37,7 +37,7 @@ func BuildTypeString() string {
} }
// BuildVersion is the local build version // BuildVersion is the local build version
const BuildVersion = "1.17.0-dev" const BuildVersion = "1.17.1-dev"
func UserVersion() string { func UserVersion() string {
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" { if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {

View File

@ -43,6 +43,7 @@ import (
"github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/lib/sigs"
"github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
var log = logging.Logger("fil-consensus") var log = logging.Logger("fil-consensus")
@ -57,7 +58,7 @@ type FilecoinEC struct {
// the state manager handles making state queries // the state manager handles making state queries
sm *stmgr.StateManager sm *stmgr.StateManager
verifier ffiwrapper.Verifier verifier storiface.Verifier
genesis *types.TipSet genesis *types.TipSet
} }
@ -66,7 +67,7 @@ type FilecoinEC struct {
// the theoretical max height based on systime are quickly rejected // the theoretical max height based on systime are quickly rejected
const MaxHeightDrift = 5 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 { if build.InsecurePoStValidation {
log.Warn("*********************************************************************************************") 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! ") log.Warn(" [INSECURE-POST-VALIDATION] Insecure test validation is enabled. If you see this outside of a test, it is a severe bug! ")

View File

@ -44,6 +44,7 @@ import (
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
const msgsPerBlock = 20 const msgsPerBlock = 20
@ -592,7 +593,7 @@ type MiningCheckAPI interface {
type mca struct { type mca struct {
w *wallet.LocalWallet w *wallet.LocalWallet
sm *stmgr.StateManager sm *stmgr.StateManager
pv ffiwrapper.Verifier pv storiface.Verifier
bcn beacon.Schedule bcn beacon.Schedule
} }
@ -674,7 +675,7 @@ func ComputeVRF(ctx context.Context, sign SignFunc, worker address.Address, sigI
type genFakeVerifier struct{} type genFakeVerifier struct{}
var _ ffiwrapper.Verifier = (*genFakeVerifier)(nil) var _ storiface.Verifier = (*genFakeVerifier)(nil)
func (m genFakeVerifier) VerifySeal(svi proof7.SealVerifyInfo) (bool, error) { func (m genFakeVerifier) VerifySeal(svi proof7.SealVerifyInfo) (bool, error) {
return true, nil return true, nil

View File

@ -26,7 +26,7 @@ import (
"github.com/filecoin-project/lotus/chain/rand" "github.com/filecoin-project/lotus/chain/rand"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/vm" "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) { 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) 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) act, err := sm.LoadActorRaw(ctx, maddr, st)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to load miner actor: %w", err) 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() 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) ts, err := sm.ChainStore().LoadTipSet(ctx, tsk)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to load tipset for mining base: %w", err) return nil, xerrors.Errorf("failed to load tipset for mining base: %w", err)

View File

@ -3,9 +3,12 @@ package types
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"io"
"strings" "strings"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
typegen "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
) )
@ -95,6 +98,45 @@ func (k *TipSetKey) UnmarshalJSON(b []byte) error {
return nil 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 { func (k TipSetKey) IsEmpty() bool {
return len(k.value) == 0 return len(k.value) == 0
} }
@ -124,3 +166,6 @@ func decodeKey(encoded []byte) ([]cid.Cid, error) {
} }
return cids, nil return cids, nil
} }
var _ typegen.CBORMarshaler = &TipSetKey{}
var _ typegen.CBORUnmarshaler = &TipSetKey{}

View File

@ -2,6 +2,7 @@
package types package types
import ( import (
"encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"testing" "testing"
@ -10,6 +11,8 @@ import (
"github.com/multiformats/go-multihash" "github.com/multiformats/go-multihash"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
cborrpc "github.com/filecoin-project/go-cbor-util"
) )
func TestTipSetKey(t *testing.T) { func TestTipSetKey(t *testing.T) {
@ -71,6 +74,13 @@ func TestTipSetKey(t *testing.T) {
`{"/":"bafy2bzacedwviarjtjraqakob5pslltmuo5n3xev3nt5zylezofkbbv5jclyu"}`+ `{"/":"bafy2bzacedwviarjtjraqakob5pslltmuo5n3xev3nt5zylezofkbbv5jclyu"}`+
`]`, k3) `]`, 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) { func verifyJSON(t *testing.T, expected string, k TipSetKey) {

View File

@ -28,6 +28,7 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/lib/sigs"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
func init() { func init() {
@ -38,7 +39,7 @@ func init() {
type SyscallBuilder func(ctx context.Context, rt *Runtime) runtime7.Syscalls 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 func(ctx context.Context, rt *Runtime) runtime7.Syscalls {
return &syscallShim{ return &syscallShim{
@ -65,7 +66,7 @@ type syscallShim struct {
actor address.Address actor address.Address
cstate *state.StateTree cstate *state.StateTree
cst cbor.IpldStore cst cbor.IpldStore
verifier ffiwrapper.Verifier verifier storiface.Verifier
} }
func (ss *syscallShim) ComputeUnsealedSectorCID(st abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) { func (ss *syscallShim) ComputeUnsealedSectorCID(st abi.RegisteredSealProof, pieces []abi.PieceInfo) (cid.Cid, error) {

View File

@ -21,7 +21,7 @@ type Interface interface {
Flush(ctx context.Context) (cid.Cid, error) Flush(ctx context.Context) (cid.Cid, error)
} }
var experimentalUseFvm = os.Getenv("LOTUS_USE_FVM_TO_SYNC_MAINNET_V15") == "1" var useFvmForMainnetV15 = os.Getenv("LOTUS_USE_FVM_TO_SYNC_MAINNET_V15") == "1"
func NewVM(ctx context.Context, opts *VMOpts) (Interface, error) { func NewVM(ctx context.Context, opts *VMOpts) (Interface, error) {
if opts.NetworkVersion >= network.Version16 { if opts.NetworkVersion >= network.Version16 {
@ -29,7 +29,7 @@ func NewVM(ctx context.Context, opts *VMOpts) (Interface, error) {
} }
// Remove after v16 upgrade, this is only to support testing and validation of the FVM // Remove after v16 upgrade, this is only to support testing and validation of the FVM
if experimentalUseFvm && opts.NetworkVersion >= network.Version15 { if useFvmForMainnetV15 && opts.NetworkVersion >= network.Version15 {
return NewFVM(ctx, opts) return NewFVM(ctx, opts)
} }

View File

@ -557,6 +557,10 @@ func interactiveDeal(cctx *cli.Context) error {
a = def a = def
} }
if _, err := api.StateGetActor(ctx, a, types.EmptyTSK); err != nil {
return xerrors.Errorf("address not initialized on chain: %w", err)
}
fromBal, err := api.WalletBalance(ctx, a) fromBal, err := api.WalletBalance(ctx, a)
if err != nil { if err != nil {
return xerrors.Errorf("checking from address balance: %w", err) return xerrors.Errorf("checking from address balance: %w", err)

View File

@ -12,12 +12,12 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
type cachingVerifier struct { type cachingVerifier struct {
ds datastore.Datastore ds datastore.Datastore
backend ffiwrapper.Verifier backend storiface.Verifier
} }
const bufsize = 128 const bufsize = 128
@ -107,4 +107,4 @@ func (cv cachingVerifier) VerifyReplicaUpdate(update prooftypes.ReplicaUpdateInf
return cv.backend.VerifyReplicaUpdate(update) return cv.backend.VerifyReplicaUpdate(update)
} }
var _ ffiwrapper.Verifier = (*cachingVerifier)(nil) var _ storiface.Verifier = (*cachingVerifier)(nil)

View File

@ -44,6 +44,7 @@ import (
_ "github.com/filecoin-project/lotus/lib/sigs/secp" _ "github.com/filecoin-project/lotus/lib/sigs/secp"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
type TipSetExec struct { type TipSetExec struct {
@ -204,7 +205,7 @@ var importBenchCmd = &cli.Command{
defer c.Close() //nolint:errcheck defer c.Close() //nolint:errcheck
} }
var verifier ffiwrapper.Verifier = ffiwrapper.ProofVerifier var verifier storiface.Verifier = ffiwrapper.ProofVerifier
if cctx.IsSet("syscall-cache") { if cctx.IsSet("syscall-cache") {
scds, err := badger.NewDatastore(cctx.String("syscall-cache"), &badger.DefaultOptions) scds, err := badger.NewDatastore(cctx.String("syscall-cache"), &badger.DefaultOptions)
if err != nil { if err != nil {

View File

@ -22,7 +22,6 @@ import (
"github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/specs-storage/storage"
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "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") return nil, nil, fmt.Errorf("parallelism factor must cleanly divide numSectors")
} }
for i := abi.SectorNumber(0); i < abi.SectorNumber(numSectors); i++ { for i := abi.SectorNumber(0); i < abi.SectorNumber(numSectors); i++ {
sid := storage.SectorRef{ sid := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: i, Number: i,
@ -569,7 +568,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
start := worker * sectorsPerWorker start := worker * sectorsPerWorker
end := start + sectorsPerWorker end := start + sectorsPerWorker
for i := abi.SectorNumber(start); i < abi.SectorNumber(end); i++ { for i := abi.SectorNumber(start); i < abi.SectorNumber(end); i++ {
sid := storage.SectorRef{ sid := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: i, 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 { if !skipc2 {
proof, err = sb.SealCommit2(context.TODO(), sid, c1o) proof, err = sb.SealCommit2(context.TODO(), sid, c1o)
if err != nil { if err != nil {
@ -780,7 +779,7 @@ var proveCmd = &cli.Command{
return err return err
} }
ref := storage.SectorRef{ ref := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum), Number: abi.SectorNumber(c2in.SectorNum),

View File

@ -20,7 +20,6 @@ import (
"github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
prf "github.com/filecoin-project/specs-actors/actors/runtime/proof" prf "github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
@ -122,7 +121,7 @@ p: pvC0JBrEyUqtIIUvB2UUx/2a24c3Cvnu6AZ0D3IMBYAu...
type benchSectorProvider map[storiface.SectorFileType]string 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{ out := storiface.SectorPaths{
ID: id.ID, ID: id.ID,
Unsealed: b[storiface.FTUnsealed], Unsealed: b[storiface.FTUnsealed],
@ -178,7 +177,7 @@ var simpleAddPiece = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -251,7 +250,7 @@ var simplePreCommit1 = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -329,7 +328,7 @@ var simplePreCommit2 = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -395,7 +394,7 @@ var simpleCommit1 = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -422,7 +421,7 @@ var simpleCommit1 = &cli.Command{
Size: abi.PaddedPieceSize(sectorSize), Size: abi.PaddedPieceSize(sectorSize),
PieceCID: commd, PieceCID: commd,
}, },
}, storage.SectorCids{ }, storiface.SectorCids{
Unsealed: commd, Unsealed: commd,
Sealed: commr, Sealed: commr,
}) })
@ -507,7 +506,7 @@ var simpleCommit2 = &cli.Command{
return err return err
} }
ref := storage.SectorRef{ ref := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(c2in.SectorNum), Number: abi.SectorNumber(c2in.SectorNum),
@ -755,7 +754,7 @@ var simpleReplicaUpdate = &cli.Command{
if err != nil { if err != nil {
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -823,7 +822,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -910,7 +909,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
return err return err
} }
sr := storage.SectorRef{ sr := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: mid, Miner: mid,
Number: 1, Number: 1,
@ -940,7 +939,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{
return xerrors.Errorf("reading valilla proof file: %w", err) 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 { if err := json.Unmarshal(vpb, &vp); err != nil {
return xerrors.Errorf("unmarshalling vanilla proofs: %w", err) return xerrors.Errorf("unmarshalling vanilla proofs: %w", err)
} }

View File

@ -14,7 +14,6 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "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/blockstore"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -477,7 +476,7 @@ var provingCheckProvableCmd = &cli.Command{
return err return err
} }
var tocheck []storage.SectorRef var tocheck []storiface.SectorRef
for _, info := range sectorInfos { for _, info := range sectorInfos {
si := abi.SectorID{ si := abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
@ -491,7 +490,7 @@ var provingCheckProvableCmd = &cli.Command{
} }
sectors[info.SectorNumber] = struct{}{} sectors[info.SectorNumber] = struct{}{}
tocheck = append(tocheck, storage.SectorRef{ tocheck = append(tocheck, storiface.SectorRef{
ProofType: info.SealProof, ProofType: info.SealProof,
ID: si, ID: si,
}) })

View File

@ -23,7 +23,6 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market" 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/types"
"github.com/filecoin-project/lotus/chain/wallet/key" "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 var sealedSectors []*genesis.PreSeal
for i := 0; i < sectors; i++ { for i := 0; i < sectors; i++ {
sid := abi.SectorID{Miner: abi.ActorID(mid), Number: next} sid := abi.SectorID{Miner: abi.ActorID(mid), Number: next}
ref := storage.SectorRef{ID: sid, ProofType: spt} ref := storiface.SectorRef{ID: sid, ProofType: spt}
next++ next++
var preseal *genesis.PreSeal var preseal *genesis.PreSeal
@ -145,7 +144,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect
return miner, &minerAddr.KeyInfo, nil 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) pi, err := sb.AddPiece(context.TODO(), sid, nil, abi.PaddedPieceSize(ssize).Unpadded(), rand.Reader)
if err != nil { if err != nil {
return nil, err return nil, err
@ -184,7 +183,7 @@ func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storage.Se
}, nil }, 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) paths, done, err := sbfs.AcquireSector(context.TODO(), sid, 0, storiface.FTSealed|storiface.FTCache, storiface.PathSealing)
if err != nil { if err != nil {
return nil, xerrors.Errorf("acquire unsealed sector: %w", err) return nil, xerrors.Errorf("acquire unsealed sector: %w", err)
@ -208,7 +207,7 @@ func presealSectorFake(sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.
}, nil }, 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) paths, done, err := sbfs.AcquireSector(context.TODO(), ref, storiface.FTUnsealed, storiface.FTNone, storiface.PathSealing)
if err != nil { if err != nil {
return err return err

View File

@ -15,7 +15,7 @@ import (
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
tutils "github.com/filecoin-project/specs-actors/v5/support/testing" 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 // 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. // mockVerifier is a simple mock for verifying "fake" proofs.
type mockVerifier struct{} type mockVerifier struct{}
var Verifier ffiwrapper.Verifier = mockVerifier{} var Verifier storiface.Verifier = mockVerifier{}
func (mockVerifier) VerifySeal(proof prooftypes.SealVerifyInfo) (bool, error) { func (mockVerifier) VerifySeal(proof prooftypes.SealVerifyInfo) (bool, error) {
addr, err := address.NewIDAddress(uint64(proof.Miner)) addr, err := address.NewIDAddress(uint64(proof.Miner))

View File

@ -233,7 +233,7 @@ Response:
```json ```json
{ {
"Version": "string value", "Version": "string value",
"APIVersion": 131584, "APIVersion": 131840,
"BlockDelay": 42 "BlockDelay": 42
} }
``` ```

View File

@ -1460,7 +1460,7 @@ Perms: admin
Inputs: `null` Inputs: `null`
Response: `131584` Response: `131840`
## Add ## Add

View File

@ -292,7 +292,7 @@ Response:
```json ```json
{ {
"Version": "string value", "Version": "string value",
"APIVersion": 131584, "APIVersion": 131840,
"BlockDelay": 42 "BlockDelay": 42
} }
``` ```

View File

@ -170,6 +170,7 @@
* [StateChangedActors](#StateChangedActors) * [StateChangedActors](#StateChangedActors)
* [StateCirculatingSupply](#StateCirculatingSupply) * [StateCirculatingSupply](#StateCirculatingSupply)
* [StateCompute](#StateCompute) * [StateCompute](#StateCompute)
* [StateComputeDataCID](#StateComputeDataCID)
* [StateDealProviderCollateralBounds](#StateDealProviderCollateralBounds) * [StateDealProviderCollateralBounds](#StateDealProviderCollateralBounds)
* [StateDecodeParams](#StateDecodeParams) * [StateDecodeParams](#StateDecodeParams)
* [StateEncodeParams](#StateEncodeParams) * [StateEncodeParams](#StateEncodeParams)
@ -299,7 +300,7 @@ Response:
```json ```json
{ {
"Version": "string value", "Version": "string value",
"APIVersion": 131584, "APIVersion": 131840,
"BlockDelay": 42 "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
StateDealProviderCollateralBounds returns the min and max collateral a storage provider StateDealProviderCollateralBounds returns the min and max collateral a storage provider
can issue. It takes the deal size and verified status as parameters. can issue. It takes the deal size and verified status as parameters.
@ -6444,7 +6477,7 @@ Response:
``` ```
### StateMinerSectorAllocated ### StateMinerSectorAllocated
StateMinerSectorAllocated checks if a sector is allocated StateMinerSectorAllocated checks if a sector number is marked as allocated.
Perms: read Perms: read
@ -6957,7 +6990,12 @@ Response:
``` ```
### StateSectorPreCommitInfo ### 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 Perms: read

View File

@ -7,7 +7,7 @@ USAGE:
lotus-miner [global options] command [command options] [arguments...] lotus-miner [global options] command [command options] [arguments...]
VERSION: VERSION:
1.17.0-dev 1.17.1-dev
COMMANDS: COMMANDS:
init Initialize a lotus miner repo init Initialize a lotus miner repo

View File

@ -7,7 +7,7 @@ USAGE:
lotus-worker [global options] command [command options] [arguments...] lotus-worker [global options] command [command options] [arguments...]
VERSION: VERSION:
1.17.0-dev 1.17.1-dev
COMMANDS: COMMANDS:
run Start lotus worker run Start lotus worker

View File

@ -7,7 +7,7 @@ USAGE:
lotus [global options] command [command options] [arguments...] lotus [global options] command [command options] [arguments...]
VERSION: VERSION:
1.17.0-dev 1.17.1-dev
COMMANDS: COMMANDS:
daemon Start a lotus daemon process daemon Start a lotus daemon process

View File

@ -2,13 +2,9 @@
# Lotus X.Y.Z Release # Lotus X.Y.Z Release
We're happy to announce Lotus X.Y.Z...
## 🗺 Must-dos for the release ## What will be in the release
## 🌟 Nice-to-haves for the release
<List of items with PRs and/or Issues to be considered for this release>
## 🚢 Estimated shipping date ## 🚢 Estimated shipping date
@ -16,7 +12,7 @@ We're happy to announce Lotus X.Y.Z...
## 🔦 Highlights ## 🔦 Highlights
< top highlights for this release notes > < See Changelog>
## ✅ Release Checklist ## ✅ Release Checklist
@ -25,7 +21,7 @@ We're happy to announce Lotus X.Y.Z...
First steps: First steps:
- [ ] Fork a new branch (`release/vX.Y.Z`) from `master` and make any further release related changes to this branch. If any "non-trivial" changes get added to the release, uncheck all the checkboxes and return to this stage. - [ ] Fork a new branch (`release/vX.Y.Z`) from `master` and make any further release related changes to this branch. If any "non-trivial" changes get added to the release, uncheck all the checkboxes and return to this stage.
- [ ] Bump the version in `version.go` in the `master` branch to `vX.(Y+1).0-dev`. - [ ] Bump the version in `version.go` in the `master` branch to `vX.Y.(Z+1)-dev` (bump from feature release) or `vX.(Y+1).0-dev` (bump from mandatory release)
Prepping an RC: Prepping an RC:
@ -63,29 +59,22 @@ Testing an RC:
- [ ] (optional) let a sector go faulty, and see it be recovered - [ ] (optional) let a sector go faulty, and see it be recovered
- [ ] **Stage 2 - Community Testing** - [ ] **Stage 2 - Community Testing**
- [ ] Inform beta lotus users (@lotus-early-testers in Filecoin Slack #fil-lotus) - [ ] Test with [SPX](https://github.com/filecoin-project/lotus/discussions/7461) fellows
- [ ] Work on documentations for new features, configuration changes and so on.
- [ ] **Stage 3 - Community Prod Testing** - [ ] **Stage 3 - Community Prod Testing**
- [ ] Documentation - [ ] Update the [CHANGELOG.md](https://github.com/filecoin-project/lotus/blob/master/CHANGELOG.md) to the state that can be used as release note.
- [ ] Ensure that [CHANGELOG.md](https://github.com/filecoin-project/lotus/blob/master/CHANGELOG.md) is up to date - [ ] Invite the wider community through (link to the release issue)
- [ ] Check if any [config](https://docs.filecoin.io/get-started/lotus/configuration-and-advanced-usage/#configuration) updates are needed
- [ ] Invite the wider community through (link to the release issue):
- [ ] Check `Create a discussion for this release` when tagging for the major/close-to-final rcs(new features, hot-fixes) release
- [ ] Link the disucssion in #fil-lotus on Filecoin slack
- [ ] **Stage 4 - Release** - [ ] **Stage 4 - Release**
- [ ] Final preparation - [ ] Final preparation
- [ ] Verify that version string in [`version.go`](https://github.com/ipfs/go-ipfs/tree/master/version.go) has been updated. - [ ] Verify that version string in [`version.go`](https://github.com/ipfs/go-ipfs/tree/master/version.go) has been updated.
- [ ] Ensure that [CHANGELOG.md](https://github.com/filecoin-project/lotus/blob/master/CHANGELOG.md) is up to date - [ ] Prep the changelog using `scripts/mkreleaselog`, and add it to `CHANGELOG.md`. Ensure that [CHANGELOG.md](https://github.com/filecoin-project/lotus/blob/master/CHANGELOG.md) is up to date
- [ ] Prep the changelog using `scripts/mkreleaselog`, and add it to `CHANGELOG.md`
- [ ] Merge `release-vX.Y.Z` into the `releases` branch. - [ ] Merge `release-vX.Y.Z` into the `releases` branch.
- [ ] Tag this merge commit (on the `releases` branch) with `vX.Y.Z` - [ ] Tag this merge commit (on the `releases` branch) with `vX.Y.Z`
- [ ] Cut the release [here](https://github.com/filecoin-project/lotus/releases/new?prerelease=true&target=releases). - [ ] Cut the release [here](https://github.com/filecoin-project/lotus/releases/new?prerelease=true&target=releases).
- [ ] Final announcements - [ ] Check `Create a discussion for this release`
- [ ] Update network.filecoin.io for mainnet, calib and nerpa.
- [ ] repost in #fil-lotus-announcement in filecoin slack
- [ ] Inform node providers (Protofire, Digital Ocean..)
- [ ] **Post-Release** - [ ] **Post-Release**
- [ ] Merge the `releases` branch back into `master`, ignoring the changes to `version.go` (keep the `-dev` version from master). Do NOT delete the `releases` branch when doing so! - [ ] Merge the `releases` branch back into `master`, ignoring the changes to `version.go` (keep the `-dev` version from master). Do NOT delete the `releases` branch when doing so!
@ -98,4 +87,4 @@ See the final release notes!
## ⁉️ Do you have questions? ## ⁉️ Do you have questions?
Leave a comment [here](<link to release discussion>) if you have any questions. Leave a comment in this ticket!

9
go.mod
View File

@ -37,16 +37,16 @@ require (
github.com/filecoin-project/go-data-transfer v1.15.1 github.com/filecoin-project/go-data-transfer v1.15.1
github.com/filecoin-project/go-fil-commcid v0.1.0 github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
github.com/filecoin-project/go-fil-markets v1.20.1-v16-1 github.com/filecoin-project/go-fil-markets v1.21.0
github.com/filecoin-project/go-jsonrpc v0.1.5 github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-legs v0.3.10 github.com/filecoin-project/go-legs v0.3.10
github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-padreader v0.0.1
github.com/filecoin-project/go-paramfetch v0.0.4 github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.1.9 github.com/filecoin-project/go-state-types v0.1.10
github.com/filecoin-project/go-statemachine v1.0.2 github.com/filecoin-project/go-statemachine v1.0.2
github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-statestore v0.2.0
github.com/filecoin-project/go-storedcounter v0.1.0 github.com/filecoin-project/go-storedcounter v0.1.0
github.com/filecoin-project/index-provider v0.5.0 github.com/filecoin-project/index-provider v0.6.1
github.com/filecoin-project/pubsub v1.0.0 github.com/filecoin-project/pubsub v1.0.0
github.com/filecoin-project/specs-actors v0.9.15 github.com/filecoin-project/specs-actors v0.9.15
github.com/filecoin-project/specs-actors/v2 v2.3.6 github.com/filecoin-project/specs-actors/v2 v2.3.6
@ -56,7 +56,6 @@ require (
github.com/filecoin-project/specs-actors/v6 v6.0.2 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/v7 v7.0.1
github.com/filecoin-project/specs-actors/v8 v8.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/filecoin-project/test-vectors/schema v0.0.5
github.com/gbrlsnchs/jwt/v3 v3.0.1 github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/gdamore/tcell/v2 v2.2.0 github.com/gdamore/tcell/v2 v2.2.0
@ -203,7 +202,7 @@ require (
github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect github.com/filecoin-project/go-hamt-ipld v0.1.5 // indirect
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 // indirect
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 // indirect github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 // indirect
github.com/filecoin-project/storetheindex v0.3.5 // indirect github.com/filecoin-project/storetheindex v0.4.0 // indirect
github.com/flynn/noise v1.0.0 // indirect github.com/flynn/noise v1.0.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect

30
go.sum
View File

@ -306,6 +306,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/filecoin-project/dagstore v0.5.2 h1:Nd6oXdnolbbVhpMpkYT5PJHOjQp4OBSntHpMV5pxj3c= github.com/filecoin-project/dagstore v0.5.2 h1:Nd6oXdnolbbVhpMpkYT5PJHOjQp4OBSntHpMV5pxj3c=
github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0= github.com/filecoin-project/dagstore v0.5.2/go.mod h1:mdqKzYrRBHf1pRMthYfMv3n37oOw0Tkx7+TxPt240M0=
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8= github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
@ -344,8 +345,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo= github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8= github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
github.com/filecoin-project/go-fil-markets v1.20.1-v16-1 h1:/eZXwVg2Z7qPwTBUAinA7m6w6rLYBeSvE61XW8MTV5M= github.com/filecoin-project/go-fil-markets v1.21.0 h1:xn9eTzKRW9T6bTfGUNJU037e+rQTeIk9hLSd0grtJko=
github.com/filecoin-project/go-fil-markets v1.20.1-v16-1/go.mod h1:QHJZVEbQ7TydJ6hjK87q4MxOmRfDNbQkuSkdjxtqBWo= github.com/filecoin-project/go-fil-markets v1.21.0/go.mod h1:MjGQ3tiKdaB+hFAEHD9xuElSYTIDciawVXX5ekzOzfA=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24= github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM= github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
@ -353,10 +354,9 @@ github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+
github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI= github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI= github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI=
github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g= github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g=
github.com/filecoin-project/go-indexer-core v0.2.8/go.mod h1:IagNfTdFuX4057kla43PjRCn3yBuUiZgIxuA0hTUamY= github.com/filecoin-project/go-indexer-core v0.2.9/go.mod h1:u03I3HB6ZnqCc3cm8Tq+QkTWBbfKOvNxM8K6Ny/IHRw=
github.com/filecoin-project/go-jsonrpc v0.1.5 h1:ckxqZ09ivBAVf5CSmxxrqqNHC7PJm3GYGtYKiNQ+vGk= github.com/filecoin-project/go-jsonrpc v0.1.5 h1:ckxqZ09ivBAVf5CSmxxrqqNHC7PJm3GYGtYKiNQ+vGk=
github.com/filecoin-project/go-jsonrpc v0.1.5/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4= github.com/filecoin-project/go-jsonrpc v0.1.5/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/filecoin-project/go-legs v0.3.7/go.mod h1:pgekGm8/gKY5zCtQ/qGAoSjGP92wTLFqpO3GPHeu8YU=
github.com/filecoin-project/go-legs v0.3.10 h1:B14z78do63gkxf5Br7rPnxZsZk/m9PR3Mx5aOf2WTIs= github.com/filecoin-project/go-legs v0.3.10 h1:B14z78do63gkxf5Br7rPnxZsZk/m9PR3Mx5aOf2WTIs=
github.com/filecoin-project/go-legs v0.3.10/go.mod h1:5psVRe2nRQDa3PDtcd+2Ud4CirxOr2DI5VsDVMq7sIk= github.com/filecoin-project/go-legs v0.3.10/go.mod h1:5psVRe2nRQDa3PDtcd+2Ud4CirxOr2DI5VsDVMq7sIk=
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak= github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20/go.mod h1:mPn+LRRd5gEKNAtc+r3ScpW2JRU/pj4NBKdADYWHiak=
@ -370,12 +370,11 @@ 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.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.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.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.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.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= github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.9 h1:7ffQu+arDAiW5dphWTl8WdgWTo9Kt3BsjGcNYr99crI= github.com/filecoin-project/go-state-types v0.1.10 h1:YrrJWWh2fU4VPhwHyPlDK5I4mB7bqgnRd3HCm9IOwIU=
github.com/filecoin-project/go-state-types v0.1.9/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= github.com/filecoin-project/go-statemachine v1.0.2-0.20220322104818-27f8fbb86dfd/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc= github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
@ -385,8 +384,8 @@ github.com/filecoin-project/go-statestore v0.2.0 h1:cRRO0aPLrxKQCZ2UOQbzFGn4WDNd
github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo= github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo=
github.com/filecoin-project/go-storedcounter v0.1.0 h1:Mui6wSUBC+cQGHbDUBcO7rfh5zQkWJM/CpAZa/uOuus= github.com/filecoin-project/go-storedcounter v0.1.0 h1:Mui6wSUBC+cQGHbDUBcO7rfh5zQkWJM/CpAZa/uOuus=
github.com/filecoin-project/go-storedcounter v0.1.0/go.mod h1:4ceukaXi4vFURIoxYMfKzaRF5Xv/Pinh2oTnoxpv+z8= github.com/filecoin-project/go-storedcounter v0.1.0/go.mod h1:4ceukaXi4vFURIoxYMfKzaRF5Xv/Pinh2oTnoxpv+z8=
github.com/filecoin-project/index-provider v0.5.0 h1:k2C1RFvOvxmA2i8bhmkb3b4qun7RDRDzzs/y25/TwQg= github.com/filecoin-project/index-provider v0.6.1 h1:yVpmtm1ASl2JZMNDC6H2Fe0neYo5akYgaJJB2wlcsMU=
github.com/filecoin-project/index-provider v0.5.0/go.mod h1:KHVrP2vU3YuScb+fawObwTFoR882up9U07kk0ZrfP0c= github.com/filecoin-project/index-provider v0.6.1/go.mod h1:iAbSQ6sUpKC4GqfUSheGnYwj9d9B+X8pPi4BV1PgwZA=
github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM= github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM=
github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg= github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg=
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
@ -415,10 +414,8 @@ 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/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 h1:4u0tIRJeT5G7F05lwLRIsDnsrN+bJ5Ixj6h49Q7uE2Y=
github.com/filecoin-project/specs-actors/v8 v8.0.1/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA= 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/storetheindex v0.4.0 h1:MPIDJYBknPbwBcVf+2/WEIK6LKxhZmfQGCrqKmvhFyU=
github.com/filecoin-project/specs-storage v0.4.1/go.mod h1:Z2eK6uMwAOSLjek6+sy0jNV2DSsMEENziMUz0GHRFBw= github.com/filecoin-project/storetheindex v0.4.0/go.mod h1:LIwqpXoKeGxOGEjmxPfdYVPQYoZOSI3oXMUd9XTCpjc=
github.com/filecoin-project/storetheindex v0.3.5 h1:KoS9TvjPm6zIZfUH8atAHJbVHOO7GTP1MdTG+v0eE+Q=
github.com/filecoin-project/storetheindex v0.3.5/go.mod h1:0r3d0kSpK63O6AvLr1CjAINLi+nWD49clzcnKV+GLpI=
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg= github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=
github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E= github.com/filecoin-project/test-vectors/schema v0.0.5/go.mod h1:iQ9QXLpYWL3m7warwvK1JC/pTri8mnfEmKygNDqqY6E=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
@ -610,6 +607,7 @@ github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
@ -930,7 +928,6 @@ github.com/ipfs/iptb-plugins v0.3.0/go.mod h1:5QtOvckeIw4bY86gSH4fgh3p3gCSMn3FmI
github.com/ipfs/tar-utils v0.0.2/go.mod h1:4qlnRWgTVljIMhSG2SqRYn66NT+3wrv/kZt9V+eqxDM= github.com/ipfs/tar-utils v0.0.2/go.mod h1:4qlnRWgTVljIMhSG2SqRYn66NT+3wrv/kZt9V+eqxDM=
github.com/ipld/go-car v0.1.0/go.mod h1:RCWzaUh2i4mOEkB3W45Vc+9jnS/M6Qay5ooytiBHl3g= github.com/ipld/go-car v0.1.0/go.mod h1:RCWzaUh2i4mOEkB3W45Vc+9jnS/M6Qay5ooytiBHl3g=
github.com/ipld/go-car v0.3.2/go.mod h1:WEjynkVt04dr0GwJhry0KlaTeSDEiEYyMPOxDBQ17KE= github.com/ipld/go-car v0.3.2/go.mod h1:WEjynkVt04dr0GwJhry0KlaTeSDEiEYyMPOxDBQ17KE=
github.com/ipld/go-car v0.3.3-0.20211210032800-e6f244225a16/go.mod h1:/wkKF4908ULT4dFIFIUZYcfjAnj+KFnJvlh8Hsz1FbQ=
github.com/ipld/go-car v0.3.3 h1:D6y+jvg9h2ZSv7GLUMWUwg5VTLy1E7Ak+uQw5orOg3I= github.com/ipld/go-car v0.3.3 h1:D6y+jvg9h2ZSv7GLUMWUwg5VTLy1E7Ak+uQw5orOg3I=
github.com/ipld/go-car v0.3.3/go.mod h1:/wkKF4908ULT4dFIFIUZYcfjAnj+KFnJvlh8Hsz1FbQ= github.com/ipld/go-car v0.3.3/go.mod h1:/wkKF4908ULT4dFIFIUZYcfjAnj+KFnJvlh8Hsz1FbQ=
github.com/ipld/go-car/v2 v2.1.1 h1:saaKz4nC0AdfCGHLYKeXLGn8ivoPC54fyS55uyOLKwA= github.com/ipld/go-car/v2 v2.1.1 h1:saaKz4nC0AdfCGHLYKeXLGn8ivoPC54fyS55uyOLKwA=
@ -958,7 +955,7 @@ github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd73/go.mod h1:2PJ0JgxyB08t0b2WKrcuqI3di0V+5n6RS/LTUJhkoxY= github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20211210234204-ce2a1c70cd73/go.mod h1:2PJ0JgxyB08t0b2WKrcuqI3di0V+5n6RS/LTUJhkoxY=
github.com/ipld/go-ipld-selector-text-lite v0.0.1 h1:lNqFsQpBHc3p5xHob2KvEg/iM5dIFn6iw4L/Hh+kS1Y= github.com/ipld/go-ipld-selector-text-lite v0.0.1 h1:lNqFsQpBHc3p5xHob2KvEg/iM5dIFn6iw4L/Hh+kS1Y=
github.com/ipld/go-ipld-selector-text-lite v0.0.1/go.mod h1:U2CQmFb+uWzfIEF3I1arrDa5rwtj00PrpiwwCO+k1RM= github.com/ipld/go-ipld-selector-text-lite v0.0.1/go.mod h1:U2CQmFb+uWzfIEF3I1arrDa5rwtj00PrpiwwCO+k1RM=
github.com/ipld/go-storethehash v0.0.1/go.mod h1:w8cQfWInks8lvvbQTiKbCPusU9v0sqiViBihTHbavpQ= github.com/ipld/go-storethehash v0.0.2/go.mod h1:w8cQfWInks8lvvbQTiKbCPusU9v0sqiViBihTHbavpQ=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c= github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4= github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4=
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
@ -1096,7 +1093,6 @@ github.com/libp2p/go-libp2p v0.14.4/go.mod h1:EIRU0Of4J5S8rkockZM7eJp2S0UrCyi55m
github.com/libp2p/go-libp2p v0.16.0/go.mod h1:ump42BsirwAWxKzsCiFnTtN1Yc+DuPu76fyMX364/O4= github.com/libp2p/go-libp2p v0.16.0/go.mod h1:ump42BsirwAWxKzsCiFnTtN1Yc+DuPu76fyMX364/O4=
github.com/libp2p/go-libp2p v0.17.0/go.mod h1:Fkin50rsGdv5mm5BshBUtPRZknt9esfmYXBOYcwOTgw= github.com/libp2p/go-libp2p v0.17.0/go.mod h1:Fkin50rsGdv5mm5BshBUtPRZknt9esfmYXBOYcwOTgw=
github.com/libp2p/go-libp2p v0.18.0-rc1/go.mod h1:RgYlH7IIWHXREimC92bw5Lg1V2R5XmSzuLHb5fTnr+8= github.com/libp2p/go-libp2p v0.18.0-rc1/go.mod h1:RgYlH7IIWHXREimC92bw5Lg1V2R5XmSzuLHb5fTnr+8=
github.com/libp2p/go-libp2p v0.18.0-rc3/go.mod h1:WYL+Xw1iuwi6rdfzw5VIEpD+HqzYucHZ6fcUuumbI3M=
github.com/libp2p/go-libp2p v0.18.0-rc5/go.mod h1:aZPS5l84bDvCvP4jkyEUT/J6YOpUq33Fgqrs3K59mpI= github.com/libp2p/go-libp2p v0.18.0-rc5/go.mod h1:aZPS5l84bDvCvP4jkyEUT/J6YOpUq33Fgqrs3K59mpI=
github.com/libp2p/go-libp2p v0.19.4 h1:50YL0YwPhWKDd+qbZQDEdnsmVAAkaCQrWUjpdHv4hNA= github.com/libp2p/go-libp2p v0.19.4 h1:50YL0YwPhWKDd+qbZQDEdnsmVAAkaCQrWUjpdHv4hNA=
github.com/libp2p/go-libp2p v0.19.4/go.mod h1:MIt8y481VDhUe4ErWi1a4bvt/CjjFfOq6kZTothWIXY= github.com/libp2p/go-libp2p v0.19.4/go.mod h1:MIt8y481VDhUe4ErWi1a4bvt/CjjFfOq6kZTothWIXY=
@ -1299,7 +1295,6 @@ github.com/libp2p/go-libp2p-swarm v0.5.3/go.mod h1:NBn7eNW2lu568L7Ns9wdFrOhgRlkR
github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc= github.com/libp2p/go-libp2p-swarm v0.8.0/go.mod h1:sOMp6dPuqco0r0GHTzfVheVBh6UEL0L1lXUZ5ot2Fvc=
github.com/libp2p/go-libp2p-swarm v0.9.0/go.mod h1:2f8d8uxTJmpeqHF/1ujjdXZp+98nNIbujVOMEZxCbZ8= github.com/libp2p/go-libp2p-swarm v0.9.0/go.mod h1:2f8d8uxTJmpeqHF/1ujjdXZp+98nNIbujVOMEZxCbZ8=
github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA= github.com/libp2p/go-libp2p-swarm v0.10.0/go.mod h1:71ceMcV6Rg/0rIQ97rsZWMzto1l9LnNquef+efcRbmA=
github.com/libp2p/go-libp2p-swarm v0.10.1/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs=
github.com/libp2p/go-libp2p-swarm v0.10.2 h1:UaXf+CTq6Ns1N2V1EgqJ9Q3xaRsiN7ImVlDMpirMAWw= github.com/libp2p/go-libp2p-swarm v0.10.2 h1:UaXf+CTq6Ns1N2V1EgqJ9Q3xaRsiN7ImVlDMpirMAWw=
github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs= github.com/libp2p/go-libp2p-swarm v0.10.2/go.mod h1:Pdkq0QU5a+qu+oyqIV3bknMsnzk9lnNyKvB9acJ5aZs=
github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E= github.com/libp2p/go-libp2p-testing v0.0.1/go.mod h1:gvchhf3FQOtBdr+eFUABet5a4MBLK8jM3V4Zghvmi+E=
@ -1991,7 +1986,6 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200826160007-0b9f6c5fb163/go.mod h1:f
github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210118024343-169e9d70c0c2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20210303213153-67a261a1d291/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20220224212727-7a699437a831/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20220302191723-37c43cae8e14/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20220302191723-37c43cae8e14/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 h1:DOOT2B85S0tHoLGTzV+FakaSSihgRCVwZkjqKQP5L/w= github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799 h1:DOOT2B85S0tHoLGTzV+FakaSSihgRCVwZkjqKQP5L/w=
github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ= github.com/whyrusleeping/cbor-gen v0.0.0-20220323183124-98fa8256a799/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=

View File

@ -57,8 +57,8 @@ import (
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/paths"
sectorstorage "github.com/filecoin-project/lotus/storage/sealer" sectorstorage "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/mock" "github.com/filecoin-project/lotus/storage/sealer/mock"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
func init() { func init() {
@ -363,8 +363,8 @@ func (n *Ensemble) Start() *Ensemble {
// Are we mocking proofs? // Are we mocking proofs?
if n.options.mockProofs { if n.options.mockProofs {
opts = append(opts, opts = append(opts,
node.Override(new(ffiwrapper.Verifier), mock.MockVerifier), node.Override(new(storiface.Verifier), mock.MockVerifier),
node.Override(new(ffiwrapper.Prover), mock.MockProver), 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.Unsealer), node.From(new(*mock.SectorMgr))),
node.Override(new(sectorstorage.PieceProvider), 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(storiface.Verifier), mock.MockVerifier),
node.Override(new(ffiwrapper.Prover), mock.MockProver), node.Override(new(storiface.Prover), mock.MockProver),
node.Unset(new(*sectorstorage.Manager)), node.Unset(new(*sectorstorage.Manager)),
) )
} }

View File

@ -2,9 +2,27 @@
package itests package itests
import ( import (
"bytes"
"context"
"testing" "testing"
"time" "time"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/stretchr/testify/require"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
inittypes "github.com/filecoin-project/go-state-types/builtin/v8/init"
multisigtypes "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
"github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
lmultisig "github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/itests/multisig" "github.com/filecoin-project/lotus/itests/multisig"
) )
@ -18,6 +36,7 @@ func TestMultisig(t *testing.T) {
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001 //stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
kit.QuietMiningLogs() kit.QuietMiningLogs()
vm.EnableDetailedTracing = true
blockTime := 5 * time.Millisecond blockTime := 5 * time.Millisecond
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC()) client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
@ -25,3 +44,106 @@ func TestMultisig(t *testing.T) {
multisig.RunMultisigTests(t, client) multisig.RunMultisigTests(t, client)
} }
// TestMultisigReentrant sends an infinitely recursive message to a multisig.
func TestMultisigReentrant(t *testing.T) {
tracing := vm.EnableDetailedTracing
vm.EnableDetailedTracing = true
//stm: @CHAIN_SYNCER_LOAD_GENESIS_001, @CHAIN_SYNCER_FETCH_TIPSET_001,
//stm: @CHAIN_SYNCER_START_001, @CHAIN_SYNCER_SYNC_001, @BLOCKCHAIN_BEACON_VALIDATE_BLOCK_VALUES_01
//stm: @CHAIN_SYNCER_COLLECT_CHAIN_001, @CHAIN_SYNCER_COLLECT_HEADERS_001, @CHAIN_SYNCER_VALIDATE_TIPSET_001
//stm: @CHAIN_SYNCER_NEW_PEER_HEAD_001, @CHAIN_SYNCER_VALIDATE_MESSAGE_META_001, @CHAIN_SYNCER_STOP_001
//stm: @CHAIN_INCOMING_HANDLE_INCOMING_BLOCKS_001, @CHAIN_INCOMING_VALIDATE_BLOCK_PUBSUB_001, @CHAIN_INCOMING_VALIDATE_MESSAGE_PUBSUB_001
kit.QuietMiningLogs()
ctx := context.Background()
blockTime := 5 * time.Millisecond
client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC())
ens.InterconnectAll().BeginMining(blockTime)
store := adt.WrapStore(ctx, cbor.NewCborStore(blockstore.NewAPIBlockstore(client)))
signer := client.DefaultKey.Address
// Create the multisig
cp, err := client.MsigCreate(ctx, 1, []address.Address{signer}, 0, big.Zero(), signer, big.Zero())
require.NoError(t, err, "failed to create multisig (MsigCreate)")
cm, err := client.MpoolPushMessage(ctx, &cp.Message, nil)
require.NoError(t, err, "failed to create multisig (MpooPushMessage)")
ml, err := client.StateWaitMsg(ctx, cm.Cid(), 5, 100, false)
require.NoError(t, err, "failed to create multisig (StateWaitMsg)")
require.Equal(t, ml.Receipt.ExitCode, exitcode.Ok)
var execreturn inittypes.ExecReturn
err = execreturn.UnmarshalCBOR(bytes.NewReader(ml.Receipt.Return))
require.NoError(t, err, "failed to decode multisig create return")
multisigAddress := execreturn.IDAddress
// Add the multisig itself as a signer, do NOT increase the threshold
ap, err := client.MsigAddPropose(ctx, multisigAddress, signer, multisigAddress, false)
require.NoError(t, err, "failed to add multisig as signer (MsigAddPropose)")
am, err := client.MpoolPushMessage(ctx, &ap.Message, nil)
require.NoError(t, err, "failed to add multisig as signer (MpooPushMessage)")
al, err := client.StateWaitMsg(ctx, am.Cid(), 5, 100, false)
require.NoError(t, err, "failed to add multisig as signer (StateWaitMsg)")
require.Equal(t, al.Receipt.ExitCode, exitcode.Ok)
var propReturn multisigtypes.ProposeReturn
err = propReturn.UnmarshalCBOR(bytes.NewReader(al.Receipt.Return))
require.NoError(t, err, "failed to decode multisig propose return")
require.True(t, propReturn.Applied, "expected proposal to apply the message")
head, err := client.ChainHead(ctx)
require.NoError(t, err)
multisigActor, err := client.StateGetActor(ctx, multisigAddress, head.Key())
require.NoError(t, err)
mstate, err := lmultisig.Load(store, multisigActor)
require.NoError(t, err)
signers, err := mstate.Signers()
require.NoError(t, err)
require.Equal(t, 2, len(signers))
require.Equal(t, multisigAddress, signers[1])
// Send the reentrant tx -- it will try to approve itself (expects to be txid 1)
approveParams, err := actors.SerializeParams(&multisigtypes.TxnIDParams{ID: 1})
require.NoError(t, err)
pp, err := client.MsigPropose(ctx, multisigAddress, multisigAddress, big.Zero(), signer, uint64(builtin.MethodsMultisig.Approve), approveParams)
require.NoError(t, err)
pm, err := client.MpoolPushMessage(ctx, &pp.Message, nil)
require.NoError(t, err, "failed to send reentrant propose message (MpooPushMessage)")
pl, err := client.StateWaitMsg(ctx, pm.Cid(), 5, 100, false)
require.NoError(t, err, "failed to send reentrant propose message (StateWaitMsg)")
require.Equal(t, pl.Receipt.ExitCode, exitcode.Ok)
err = propReturn.UnmarshalCBOR(bytes.NewReader(pl.Receipt.Return))
require.NoError(t, err, "failed to decode multisig propose return")
require.True(t, propReturn.Applied, "expected proposal to apply the message")
require.Equal(t, exitcode.Ok, propReturn.Code)
sl, err := client.StateReplay(ctx, types.EmptyTSK, pm.Cid())
require.NoError(t, err, "failed to replay reentrant propose message (StateWaitMsg)")
require.Equal(t, 1025, countDepth(sl.ExecutionTrace))
vm.EnableDetailedTracing = tracing
}
func countDepth(trace types.ExecutionTrace) int {
if len(trace.Subcalls) == 0 {
return 0
}
return countDepth(trace.Subcalls[0]) + 1
}

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "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"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -21,6 +20,7 @@ import (
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/node/impl"
"github.com/filecoin-project/lotus/storage/sealer/mock" "github.com/filecoin-project/lotus/storage/sealer/mock"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
func TestWindowedPost(t *testing.T) { func TestWindowedPost(t *testing.T) {
@ -105,7 +105,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
// Drop the partition // Drop the partition
err = secs.ForEach(func(sid uint64) error { 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{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(sid), Number: abi.SectorNumber(sid),
@ -115,7 +115,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int,
require.NoError(t, err) require.NoError(t, err)
} }
var s storage.SectorRef var s storiface.SectorRef
// Drop 1 sectors from deadline 3 partition 0 // 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) require.NoError(t, err)
t.Log("the sectors", all) t.Log("the sectors", all)
s = storage.SectorRef{ s = storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(sn), Number: abi.SectorNumber(sn),

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "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/build"
"github.com/filecoin-project/lotus/chain/types" "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) 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{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: abi.SectorNumber(sid), Number: abi.SectorNumber(sid),

View File

@ -12,7 +12,6 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-state-types/abi" "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"
"github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/api/v1api"
@ -55,7 +54,7 @@ func (sa *sectorAccessor) UnsealSectorAt(ctx context.Context, sectorID abi.Secto
return nil, err return nil, err
} }
ref := specstorage.SectorRef{ ref := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: sectorID, Number: sectorID,
@ -90,7 +89,7 @@ func (sa *sectorAccessor) IsUnsealed(ctx context.Context, sectorID abi.SectorNum
return false, err return false, err
} }
ref := specstorage.SectorRef{ ref := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: sectorID, Number: sectorID,

View File

@ -28,7 +28,7 @@ type eventsCalledAPI interface {
} }
type dealInfoAPI 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 { type diffPreCommitsAPI interface {
@ -41,9 +41,9 @@ type SectorCommittedManager struct {
dpc diffPreCommitsAPI 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{ dim := &pipeline.CurrentDealInfoManager{
CDAPI: &pipeline.CurrentDealInfoAPIAdapter{CurrentDealInfoTskAPI: tskAPI}, CDAPI: tskAPI,
} }
return newSectorCommittedManager(ev, dim, dpcAPI) 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 // when the client node was down after the deal was published, and when
// the precommit containing it landed on chain) // the precommit containing it landed on chain)
publishTs, err := types.TipSetKeyFromBytes(dealInfo.PublishMsgTipSet) diff, err := mgr.dpc.diffPreCommits(ctx, provider, dealInfo.PublishMsgTipSet, ts.Key())
if err != nil {
return false, false, err
}
diff, err := mgr.dpc.diffPreCommits(ctx, provider, publishTs, ts.Key())
if err != nil { if err != nil {
return false, false, err 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 // When there is a reorg, the deal ID may change, so get the
// current deal ID from the publish message CID // 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 { if err != nil {
return false, err return false, err
} }
@ -250,7 +245,7 @@ func (mgr *SectorCommittedManager) OnDealSectorCommitted(ctx context.Context, pr
} }
// Get the deal info // 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 { if err != nil {
return false, xerrors.Errorf("failed to look up deal on chain: %w", err) 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) { 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 { if err != nil {
// TODO: This may be fine for some errors // TODO: This may be fine for some errors
return res, false, xerrors.Errorf("failed to look up deal on chain: %w", err) return res, false, xerrors.Errorf("failed to look up deal on chain: %w", err)

View File

@ -159,7 +159,7 @@ func TestOnDealSectorPreCommitted(t *testing.T) {
currentDealInfo: pipeline.CurrentDealInfo{ currentDealInfo: pipeline.CurrentDealInfo{
DealID: dealID, DealID: dealID,
MarketDeal: slashedDeal, MarketDeal: slashedDeal,
PublishMsgTipSet: nil, PublishMsgTipSet: types.EmptyTSK,
}, },
expectedCBCallCount: 0, expectedCBCallCount: 0,
expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch), expectedError: xerrors.Errorf("failed to set up called handler: deal %d was slashed at epoch %d", dealID, slashedDeal.State.SlashEpoch),
@ -574,7 +574,7 @@ type mockDealInfoAPI struct {
Err2 error 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++ m.count++
if m.count == 2 { if m.count == 2 {
return m.CurrentDealInfo2, m.Err2 return m.CurrentDealInfo2, m.Err2

View File

@ -327,7 +327,7 @@ func (n *ProviderNodeAdapter) WaitForPublishDeals(ctx context.Context, publishCi
return nil, xerrors.Errorf("WaitForPublishDeals failed to get chain head: %w", err) 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 { if err != nil {
return nil, xerrors.Errorf("WaitForPublishDeals getting deal info errored: %w", err) return nil, xerrors.Errorf("WaitForPublishDeals getting deal info errored: %w", err)
} }

View File

@ -40,6 +40,7 @@ import (
"github.com/filecoin-project/lotus/paychmgr" "github.com/filecoin-project/lotus/paychmgr"
"github.com/filecoin-project/lotus/paychmgr/settler" "github.com/filecoin-project/lotus/paychmgr/settler"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "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 // 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), Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap),
// Consensus: crypto dependencies // Consensus: crypto dependencies
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier), Override(new(storiface.Verifier), ffiwrapper.ProofVerifier),
Override(new(ffiwrapper.Prover), ffiwrapper.ProofProver), Override(new(storiface.Prover), ffiwrapper.ProofProver),
// Consensus: LegacyVM // Consensus: LegacyVM
Override(new(vm.SyscallBuilder), vm.Syscalls), Override(new(vm.SyscallBuilder), vm.Syscalls),

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket/impl/storedask" "github.com/filecoin-project/go-fil-markets/storagemarket/impl/storedask"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
provider "github.com/filecoin-project/index-provider" 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/api"
"github.com/filecoin-project/lotus/build" "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"))), If(!cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
// Sector storage: Proofs // Sector storage: Proofs
Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier), Override(new(storiface.Verifier), ffiwrapper.ProofVerifier),
Override(new(ffiwrapper.Prover), ffiwrapper.ProofProver), Override(new(storiface.Prover), ffiwrapper.ProofProver),
Override(new(storage2.Prover), From(new(sectorstorage.SectorManager))), Override(new(storiface.ProverPoSt), From(new(sectorstorage.SectorManager))),
// Sealing (todo should be under EnableSealing, but storagefsm is currently bundled with storage.Miner) // Sealing (todo should be under EnableSealing, but storagefsm is currently bundled with storage.Miner)
Override(new(sealing.SectorIDCounter), modules.SectorIDCounter), Override(new(sealing.SectorIDCounter), modules.SectorIDCounter),

View File

@ -9,6 +9,7 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
cbg "github.com/whyrusleeping/cbor-gen"
"go.uber.org/fx" "go.uber.org/fx"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -21,9 +22,12 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network" "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/api"
"github.com/filecoin-project/lotus/build" "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"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "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/vm"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
"github.com/filecoin-project/lotus/node/modules/dtypes" "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 { type StateModuleAPI interface {
@ -89,7 +93,7 @@ type StateAPI struct {
StateModuleAPI StateModuleAPI
ProofVerifier ffiwrapper.Verifier ProofVerifier storiface.Verifier
StateManager *stmgr.StateManager StateManager *stmgr.StateManager
Chain *store.ChainStore Chain *store.ChainStore
Beacon beacon.Schedule 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) 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) { func (a *StateAPI) StateChangedActors(ctx context.Context, old cid.Cid, new cid.Cid) (map[string]types.Actor, error) {
store := a.Chain.ActorStore(ctx) 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 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) ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil { 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) pci, err := stmgr.PreCommitInfo(ctx, a.StateManager, maddr, n, ts)
if err != nil { if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err return nil, err
} else if pci == nil {
return minertypes.SectorPreCommitOnChainInfo{}, xerrors.Errorf("precommit info is not exists")
} }
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) { func (m *StateModule) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) {

View File

@ -34,7 +34,6 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner" minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
sto "github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types" 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 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) so, err := sm.Miner.SectorAddPieceToAny(ctx, size, r, d)
if err != nil { if err != nil {
// jsonrpc doesn't support returning values with errors, make sure we never do that // 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 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) 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) 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) 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) 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 var rg storiface.RGetter
if expensive { if expensive {
rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) { rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) {

View File

@ -70,7 +70,7 @@ import (
sealing "github.com/filecoin-project/lotus/storage/pipeline" sealing "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface"
"github.com/filecoin-project/lotus/storage/wdpost" "github.com/filecoin-project/lotus/storage/wdpost"
) )
@ -211,8 +211,8 @@ type StorageMinerParams struct {
MetadataDS dtypes.MetadataDS MetadataDS dtypes.MetadataDS
Sealer sealer.SectorManager Sealer sealer.SectorManager
SectorIDCounter sealing.SectorIDCounter SectorIDCounter sealing.SectorIDCounter
Verifier ffiwrapper.Verifier Verifier storiface.Verifier
Prover ffiwrapper.Prover Prover storiface.Prover
GetSealingConfigFn dtypes.GetSealingConfigFunc GetSealingConfigFn dtypes.GetSealingConfigFunc
Journal journal.Journal Journal journal.Journal
AddrSel *ctladdr.AddressSelector AddrSel *ctladdr.AddressSelector

View File

@ -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)
}

View File

@ -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)
}

View File

@ -18,7 +18,6 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network" "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"
"github.com/filecoin-project/lotus/api/v1api" "github.com/filecoin-project/lotus/api/v1api"
@ -34,7 +33,7 @@ import (
"github.com/filecoin-project/lotus/storage/ctladdr" "github.com/filecoin-project/lotus/storage/ctladdr"
pipeline "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
var log = logging.Logger("storageminer") var log = logging.Logger("storageminer")
@ -53,8 +52,8 @@ type Miner struct {
sealer sealer.SectorManager sealer sealer.SectorManager
ds datastore.Batching ds datastore.Batching
sc pipeline.SectorIDCounter sc pipeline.SectorIDCounter
verif ffiwrapper.Verifier verif storiface.Verifier
prover ffiwrapper.Prover prover storiface.Prover
addrSel *ctladdr.AddressSelector addrSel *ctladdr.AddressSelector
maddr address.Address maddr address.Address
@ -82,7 +81,7 @@ type fullNodeFilteredAPI interface {
// Call a read only method on actors (no interaction with the chain required) // Call a read only method on actors (no interaction with the chain required)
StateCall(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error) StateCall(context.Context, *types.Message, types.TipSetKey) (*api.InvocResult, error)
StateMinerSectors(context.Context, address.Address, *bitfield.BitField, types.TipSetKey) ([]*miner.SectorOnChainInfo, 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) 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) 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) 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) StateMinerRecoveries(context.Context, address.Address, types.TipSetKey) (bitfield.BitField, error)
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error) StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
StateNetworkVersion(context.Context, types.TipSetKey) (network.Version, 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) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
@ -135,8 +135,8 @@ func NewMiner(api fullNodeFilteredAPI,
ds datastore.Batching, ds datastore.Batching,
sealer sealer.SectorManager, sealer sealer.SectorManager,
sc pipeline.SectorIDCounter, sc pipeline.SectorIDCounter,
verif ffiwrapper.Verifier, verif storiface.Verifier,
prover ffiwrapper.Prover, prover storiface.Prover,
gsd dtypes.GetSealingConfigFunc, gsd dtypes.GetSealingConfigFunc,
feeCfg config.MinerFeeConfig, feeCfg config.MinerFeeConfig,
journal journal.Journal, journal journal.Journal,
@ -176,19 +176,12 @@ func (m *Miner) Run(ctx context.Context) error {
if err != nil { if err != nil {
return xerrors.Errorf("failed to subscribe to events: %w", err) 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. // Instantiate a precommit policy.
cfg := pipeline.GetSealingConfigFunc(m.getSealConfig) cfg := pipeline.GetSealingConfigFunc(m.getSealConfig)
provingBuffer := md.WPoStProvingPeriod * 2 provingBuffer := md.WPoStProvingPeriod * 2
pcp := pipeline.NewBasicPreCommitPolicy(adaptedAPI, cfg, provingBuffer) pcp := pipeline.NewBasicPreCommitPolicy(m.api, cfg, provingBuffer)
// address selector. // address selector.
as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) { as := func(ctx context.Context, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
@ -196,7 +189,7 @@ func (m *Miner) Run(ctx context.Context) error {
} }
// Instantiate the sealing FSM. // 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. // Run the sealing FSM.
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function
@ -246,13 +239,13 @@ func (m *Miner) runPreflightChecks(ctx context.Context) error {
} }
type StorageWpp struct { type StorageWpp struct {
prover storage.Prover prover storiface.ProverPoSt
verifier ffiwrapper.Verifier verifier storiface.Verifier
miner abi.ActorID miner abi.ActorID
winnRpt abi.RegisteredPoStProof 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)) ma, err := address.NewIDAddress(uint64(miner))
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -9,11 +9,11 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
pipeline "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
"github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/sectorblocks"
) )
@ -31,7 +31,7 @@ func (m *Miner) ListSectors() ([]pipeline.SectorInfo, error) {
return m.sealing.ListSectors() 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) return m.sealing.PledgeSector(ctx)
} }
@ -86,7 +86,7 @@ func (m *Miner) SectorAbortUpgrade(sectorNum abi.SectorNumber) error {
return m.sealing.AbortUpgrade(sectorNum) 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) return m.sealing.SectorAddPieceToAny(ctx, size, r, d)
} }

View File

@ -13,7 +13,6 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi" "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/partialfile"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "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 // The caller has a lock on this sector already, no need to get one here
// passing 0 spt because we don't allocate anything // passing 0 spt because we don't allocate anything
si := storage.SectorRef{ si := storiface.SectorRef{
ID: id, ID: id,
ProofType: 0, 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 // The caller has a lock on this sector already, no need to get one here
// passing 0 spt because we don't allocate anything // passing 0 spt because we don't allocate anything
si := storage.SectorRef{ si := storiface.SectorRef{
ID: id, ID: id,
ProofType: 0, ProofType: 0,
} }

View File

@ -14,7 +14,6 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi" "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"
"github.com/filecoin-project/lotus/storage/paths/mocks" "github.com/filecoin-project/lotus/storage/paths/mocks"
@ -26,7 +25,7 @@ func TestRemoteGetAllocated(t *testing.T) {
emptyPartialFile := &partialfile.PartialFile{} emptyPartialFile := &partialfile.PartialFile{}
pfPath := "path" pfPath := "path"
expectedSectorRef := storage.SectorRef{ expectedSectorRef := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: 123, Miner: 123,
Number: 123, Number: 123,
@ -255,7 +254,7 @@ func TestRemoteGetSector(t *testing.T) {
validSectorName := fmt.Sprintf("s-t0%d-%d", 123, 123) validSectorName := fmt.Sprintf("s-t0%d-%d", 123, 123)
validSectorFileType := storiface.FTUnsealed.String() validSectorFileType := storiface.FTUnsealed.String()
expectedSectorRef := storage.SectorRef{ expectedSectorRef := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: 123, Miner: 123,
Number: 123, Number: 123,

View File

@ -5,7 +5,6 @@ import (
"os" "os"
"github.com/filecoin-project/go-state-types/abi" "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/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/partialfile" "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 //go:generate go run github.com/golang/mock/mockgen -destination=mocks/store.go -package=mocks . Store
type Store interface { 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 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 // 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 RemoveCopies(ctx context.Context, s abi.SectorID, types storiface.SectorFileType) error
// move sectors into storage // 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) 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) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error)
} }

View File

@ -16,7 +16,6 @@ import (
ffi "github.com/filecoin-project/filecoin-ffi" ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/proof" "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/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "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() ssize, err := sid.ProofType.SectorSize()
if err != nil { if err != nil {
return nil, err return nil, err
@ -430,7 +429,7 @@ func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storifac
return done, nil 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 { if existing|allocate != existing^allocate {
return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector") 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 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) dest, destIds, err := st.AcquireSector(ctx, s, storiface.FTNone, types, storiface.PathStorage, storiface.AcquireMove)
if err != nil { if err != nil {
return xerrors.Errorf("acquire dest storage: %w", err) 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) { 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{ ID: abi.SectorID{
Miner: minerID, Miner: minerID,
Number: si.SectorNumber, Number: si.SectorNumber,

View File

@ -11,7 +11,6 @@ import (
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
abi "github.com/filecoin-project/go-state-types/abi" 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" fsutil "github.com/filecoin-project/lotus/storage/sealer/fsutil"
storiface "github.com/filecoin-project/lotus/storage/sealer/storiface" storiface "github.com/filecoin-project/lotus/storage/sealer/storiface"
@ -41,7 +40,7 @@ func (m *MockStore) EXPECT() *MockStoreMockRecorder {
} }
// AcquireSector mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AcquireSector", arg0, arg1, arg2, arg3, arg4, arg5) ret := m.ctrl.Call(m, "AcquireSector", arg0, arg1, arg2, arg3, arg4, arg5)
ret0, _ := ret[0].(storiface.SectorPaths) ret0, _ := ret[0].(storiface.SectorPaths)
@ -87,7 +86,7 @@ func (mr *MockStoreMockRecorder) GenerateSingleVanillaProof(arg0, arg1, arg2, ar
} }
// MoveStorage mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "MoveStorage", arg0, arg1, arg2) ret := m.ctrl.Call(m, "MoveStorage", arg0, arg1, arg2)
ret0, _ := ret[0].(error) ret0, _ := ret[0].(error)
@ -129,7 +128,7 @@ func (mr *MockStoreMockRecorder) RemoveCopies(arg0, arg1, arg2 interface{}) *gom
} }
// Reserve mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Reserve", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "Reserve", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(func()) ret0, _ := ret[0].(func())

View File

@ -21,7 +21,6 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi" "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/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "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 { if existing|allocate != existing^allocate {
return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector") 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 // Make sure we have the data local
_, _, err := r.AcquireSector(ctx, s, types, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove) _, _, err := r.AcquireSector(ctx, s, types, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove)
if err != nil { 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 // 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. // either locally or on any of the workers.
// Returns true if we have the unsealed piece, false otherwise. // 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 ft := storiface.FTUnsealed
paths, _, err := r.local.AcquireSector(ctx, s, ft, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove) 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 // 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. // 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. // 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 ft := storiface.FTUnsealed
// check if we have the unsealed sector file locally // 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 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) log.Warnf("reserve called on remote store, sectorID: %v", sid.ID)
return func() { return func() {

View File

@ -21,7 +21,6 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/abi" "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/node/repo"
"github.com/filecoin-project/lotus/storage/paths" "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 // add a sealed replica file to the sealing (non-shared) path
s1ref := storage.SectorRef{ s1ref := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: 12, Miner: 12,
Number: 1, Number: 1,
@ -162,7 +161,7 @@ func TestReader(t *testing.T) {
ft := storiface.FTUnsealed ft := storiface.FTUnsealed
sectorRef := storage.SectorRef{ sectorRef := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: 123, Miner: 123,
Number: 123, Number: 123,
@ -519,7 +518,7 @@ func TestCheckIsUnsealed(t *testing.T) {
ft := storiface.FTUnsealed ft := storiface.FTUnsealed
emptyPartialFile := &partialfile.PartialFile{} emptyPartialFile := &partialfile.PartialFile{}
sectorRef := storage.SectorRef{ sectorRef := storiface.SectorRef{
ID: abi.SectorID{ ID: abi.SectorID{
Miner: 123, Miner: 123,
Number: 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, l.EXPECT().AcquireSector(gomock.Any(), sectorRef, storiface.FTUnsealed,
storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{ storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{
Unsealed: pfPath, Unsealed: pfPath,

View File

@ -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 { if len("PreCommit1Out") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long") 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 { if len("PreCommitTipSet") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long") return xerrors.Errorf("Value in field \"PreCommitTipSet\" was too long")
} }
@ -470,15 +470,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error {
return err return err
} }
if len(t.PreCommitTipSet) > cbg.ByteArrayMaxLen { if err := t.PreCommitTipSet.MarshalCBOR(cw); err != nil {
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 {
return err 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 { if len("ReplicaUpdateProof") > cbg.MaxLength {
return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long") 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.TicketEpoch = abi.ChainEpoch(extraI)
} }
// t.PreCommit1Out (storage.PreCommit1Out) (slice) // t.PreCommit1Out (storiface.PreCommit1Out) (slice)
case "PreCommit1Out": case "PreCommit1Out":
maj, extra, err = cr.ReadHeader() 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": case "PreCommitTipSet":
maj, extra, err = cr.ReadHeader() {
if err != nil {
return err if err := t.PreCommitTipSet.UnmarshalCBOR(cr); err != nil {
return xerrors.Errorf("unmarshaling t.PreCommitTipSet: %w", 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 extra > 0 {
t.PreCommitTipSet = make([]uint8, extra)
}
if _, err := io.ReadFull(cr, t.PreCommitTipSet[:]); err != nil {
return err
} }
// t.PreCommit2Fails (uint64) (uint64) // t.PreCommit2Fails (uint64) (uint64)
case "PreCommit2Fails": 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": case "ReplicaUpdateProof":
maj, extra, err = cr.ReadHeader() maj, extra, err = cr.ReadHeader()

View File

@ -13,6 +13,7 @@ import (
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/lotus/chain/actors/policy" "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 // 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 } type ErrBadPR struct{ error }
func checkPieces(ctx context.Context, maddr address.Address, si SectorInfo, api SealingAPI, mustHaveDeals bool) 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 { if err != nil {
return &ErrApi{xerrors.Errorf("getting chain head: %w", err)} 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++ dealCount++
proposal, err := api.StateMarketStorageDealProposal(ctx, p.DealInfo.DealID, tok) deal, err := api.StateMarketStorageDeal(ctx, p.DealInfo.DealID, ts.Key())
if err != nil { if err != nil {
return &ErrInvalidDeals{xerrors.Errorf("getting deal %d for piece %d: %w", p.DealInfo.DealID, i, err)} return &ErrInvalidDeals{xerrors.Errorf("getting deal %d for piece %d: %w", p.DealInfo.DealID, i, err)}
} }
if 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, 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 { 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, proposal.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 { 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, 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 { 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, proposal.StartEpoch, height)} 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 // checkPrecommit checks that data commitment generated in the sealing process
// matches pieces, and that the seal ticket isn't expired // 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 { if err := checkPieces(ctx, maddr, si, api, false); err != nil {
return err 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 { if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)} 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)} 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 != 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)} 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")} 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 //never commit P2 message before, check ticket expiration
ticketEarliest := height - policy.MaxPreCommitRandomnessLookback ticketEarliest := height - policy.MaxPreCommitRandomnessLookback
@ -130,13 +136,22 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return nil 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 { if si.SeedEpoch == 0 {
return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")} return &ErrBadSeed{xerrors.Errorf("seed epoch was not set")}
} }
pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tok) pci, err := m.Api.StateSectorPreCommitInfo(ctx, m.maddr, si.SectorNumber, tsk)
if err == ErrSectorAllocated { 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, // not much more we can check here, basically try to wait for commit,
// and hope that this will work // and hope that this will work
@ -144,13 +159,9 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
return &ErrCommitWaitFailed{err} return &ErrCommitWaitFailed{err}
} }
return err return xerrors.Errorf("sector %d is allocated, but PreCommit info wasn't found on chain", si.SectorNumber)
}
if err != nil {
return xerrors.Errorf("getting precommit info: %w", err)
} }
if pci == nil {
return &ErrNoPrecommit{xerrors.Errorf("precommit info not found on-chain")} 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 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 { if err != nil {
return &ErrApi{xerrors.Errorf("failed to get randomness for computing seal proof: %w", err)} 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 // 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 { if err := checkPieces(ctx, maddr, si, api, true); err != nil {
return err 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") 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 { if err != nil {
return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)} return &ErrApi{xerrors.Errorf("calling StateComputeDataCommitment: %w", err)}
} }

View File

@ -26,7 +26,7 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "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) 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 //go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_commit_batcher.go -package=mocks . CommitBatcherApi
type CommitBatcherApi interface { type CommitBatcherApi interface {
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) ChainHead(ctx context.Context) (*types.TipSet, error)
ChainBaseFee(context.Context, TipSetToken) (abi.TokenAmount, error)
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error) StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
} }
type AggregateInput struct { type AggregateInput struct {
@ -59,7 +58,7 @@ type CommitBatcher struct {
addrSel AddrSel addrSel AddrSel
feeCfg config.MinerFeeConfig feeCfg config.MinerFeeConfig
getConfig GetSealingConfigFunc getConfig GetSealingConfigFunc
prover ffiwrapper.Prover prover storiface.Prover
cutoffs map[abi.SectorNumber]time.Time cutoffs map[abi.SectorNumber]time.Time
todo map[abi.SectorNumber]AggregateInput todo map[abi.SectorNumber]AggregateInput
@ -70,7 +69,7 @@ type CommitBatcher struct {
lk sync.Mutex 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{ b := &CommitBatcher{
api: api, api: api,
maddr: maddr, maddr: maddr,
@ -204,14 +203,14 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
var res []sealiface.CommitBatchRes var res []sealiface.CommitBatchRes
tok, h, err := b.api.ChainHead(b.mctx) ts, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
blackedOut := func() bool { blackedOut := func() bool {
const nv16BlackoutWindow = abi.ChainEpoch(20) // a magik number 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 true
} }
return false return false
@ -220,13 +219,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut() individual := (total < cfg.MinCommitBatch) || (total < miner.MinAggregatedSectors) || blackedOut()
if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) { if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) {
if ts.MinTicketBlock().ParentBaseFee.LessThan(cfg.AggregateAboveBaseFee) {
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) {
individual = true individual = true
} }
} }
@ -265,7 +258,7 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,
} }
func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBatchRes, error) { 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 { if err != nil {
return nil, err return nil, err
} }
@ -292,7 +285,7 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
res.Sectors = append(res.Sectors, id) res.Sectors = append(res.Sectors, id)
sc, err := b.getSectorCollateral(id, tok) sc, err := b.getSectorCollateral(id, ts.Key())
if err != nil { if err != nil {
res.FailedSectors[id] = err.Error() res.FailedSectors[id] = err.Error()
continue 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) 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 { if err != nil {
log.Errorf("getting network version: %s", err) log.Errorf("getting network version: %s", err)
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting network version: %s", err) return []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) 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 { if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err)
} }
maxFee := b.feeCfg.MaxCommitBatchGasFee.FeeForSectors(len(infos)) maxFee := b.feeCfg.MaxCommitBatchGasFee.FeeForSectors(len(infos))
bf, err := b.api.ChainBaseFee(b.mctx, tok) aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), ts.MinTicketBlock().ParentBaseFee)
if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("couldn't get base fee: %w", err)
}
aggFeeRaw, err := policy.AggregateProveCommitNetworkFee(nv, len(infos), bf)
if err != nil { if err != nil {
log.Errorf("getting aggregate commit network fee: %s", err) log.Errorf("getting aggregate commit network fee: %s", err)
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting aggregate commit network fee: %s", err) return []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) 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 { if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) 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) { 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 { if err != nil {
return nil, xerrors.Errorf("couldn't get miner info: %w", err) return nil, xerrors.Errorf("couldn't get miner info: %w", err)
} }
@ -401,7 +389,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
avail := types.TotalFilecoinInt avail := types.TotalFilecoinInt
if cfg.CollateralFromMinerBalance && !cfg.DisableCollateralFallback { 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 { if err != nil {
return nil, xerrors.Errorf("getting available miner balance: %w", err) 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 { if err != nil {
return nil, err return nil, err
} }
@ -425,7 +413,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
FailedSectors: map[abi.SectorNumber]string{}, 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 { if err != nil {
log.Errorf("process single error: %+v", err) // todo: return to user log.Errorf("process single error: %+v", err) // todo: return to user
r.FailedSectors[sn] = err.Error() r.FailedSectors[sn] = err.Error()
@ -439,7 +427,7 @@ func (b *CommitBatcher) processIndividually(cfg sealiface.Config) ([]sealiface.C
return res, nil return res, nil
} }
func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tok TipSetToken) (cid.Cid, error) { func (b *CommitBatcher) processSingle(cfg sealiface.Config, mi api.MinerInfo, avail *abi.TokenAmount, sn abi.SectorNumber, info AggregateInput, tsk types.TipSetKey) (cid.Cid, error) {
enc := new(bytes.Buffer) enc := new(bytes.Buffer)
params := &miner.ProveCommitSectorParams{ params := &miner.ProveCommitSectorParams{
SectorNumber: sn, 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) 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 { if err != nil {
return cid.Undef, err 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) 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 { if err != nil {
return cid.Undef, xerrors.Errorf("pushing message to mpool: %w", err) 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 // TODO: If this returned epochs, it would make testing much easier
func (b *CommitBatcher) getCommitCutoff(si SectorInfo) (time.Time, error) { 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 { if err != nil {
return time.Now(), xerrors.Errorf("getting chain head: %s", err) 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 { if err != nil {
log.Errorf("getting network version: %s", err) log.Errorf("getting network version: %s", err)
return time.Now(), xerrors.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 { if err != nil {
log.Errorf("getting precommit info: %s", err) log.Errorf("getting precommit info: %s", err)
return time.Now(), 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(), 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) { func (b *CommitBatcher) getSectorCollateral(sn abi.SectorNumber, tsk types.TipSetKey) (abi.TokenAmount, error) {
pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tok) pci, err := b.api.StateSectorPreCommitInfo(b.mctx, b.maddr, sn, tsk)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("getting precommit info: %w", err) 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") 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 { if err != nil {
return big.Zero(), xerrors.Errorf("getting initial pledge collateral: %w", err) return big.Zero(), xerrors.Errorf("getting initial pledge collateral: %w", err)
} }

View File

@ -10,12 +10,14 @@ import (
"time" "time"
"github.com/golang/mock/gomock" "github.com/golang/mock/gomock"
"github.com/ipfs/go-cid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner" 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" "github.com/filecoin-project/go-state-types/network"
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
@ -25,7 +27,7 @@ import (
pipeline "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/mocks" "github.com/filecoin-project/lotus/storage/pipeline/mocks"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "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) { 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 { return func(t *testing.T, s *mocks.MockCommitBatcherApi, pcb *pipeline.CommitBatcher) promise {
var pcres sealiface.CommitBatchRes var pcres sealiface.CommitBatchRes
var pcerr error var pcerr error
@ -105,7 +107,12 @@ func TestCommitBatcher(t *testing.T) {
SectorNumber: sn, 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().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version13, nil)
s.EXPECT().StateSectorPreCommitInfo(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&minertypes.SectorPreCommitOnChainInfo{ s.EXPECT().StateSectorPreCommitInfo(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&minertypes.SectorPreCommitOnChainInfo{
PreCommitDeposit: big.Zero(), 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)) as := make([]action, len(sectors))
for i, sector := range sectors { for i, sector := range sectors {
as[i] = addSector(sector) as[i] = addSector(sector, aboveBalancer)
} }
return actions(as...) return actions(as...)
} }
@ -166,17 +173,17 @@ func TestCommitBatcher(t *testing.T) {
basefee = types.NanoFil basefee = types.NanoFil
} }
s.EXPECT().ChainHead(gomock.Any()).Return(nil, abi.ChainEpoch(1), nil) s.EXPECT().ChainHead(gomock.Any()).Return(makeBFTs(t, basefee, 1), nil)
if batch { /*if batch {
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(basefee, nil) s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(basefee, nil)
} }*/
if !aboveBalancer { if !aboveBalancer {
batch = false batch = false
ti = len(expect) 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) pciC := len(expect)
if failOnePCI { if failOnePCI {
@ -193,14 +200,14 @@ func TestCommitBatcher(t *testing.T) {
if batch { if batch {
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version13, nil) 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 { s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
b := i.([]byte) b := i.(*types.Message)
if batch { if batch {
var params miner5.ProveCommitAggregateParams 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 { for _, number := range expect {
set, err := params.SectorNumbers.IsSet(uint64(number)) set, err := params.SectorNumbers.IsSet(uint64(number))
require.NoError(t, err) require.NoError(t, err)
@ -208,10 +215,10 @@ func TestCommitBatcher(t *testing.T) {
} }
} else { } else {
var params miner5.ProveCommitSectorParams var params miner5.ProveCommitSectorParams
require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b))) require.NoError(t, params.UnmarshalCBOR(bytes.NewReader(b.Params)))
} }
return true return true
})).Times(ti) }), gomock.Any()).Return(dummySmsg, nil).Times(ti)
return nil return nil
} }
} }
@ -276,21 +283,21 @@ func TestCommitBatcher(t *testing.T) {
}{ }{
"addSingle-aboveBalancer": { "addSingle-aboveBalancer": {
actions: []action{ actions: []action{
addSector(0), addSector(0, true),
waitPending(1), waitPending(1),
flush([]abi.SectorNumber{0}, true, false), flush([]abi.SectorNumber{0}, true, false),
}, },
}, },
"addTwo-aboveBalancer": { "addTwo-aboveBalancer": {
actions: []action{ actions: []action{
addSectors(getSectors(2)), addSectors(getSectors(2), true),
waitPending(2), waitPending(2),
flush(getSectors(2), true, false), flush(getSectors(2), true, false),
}, },
}, },
"addAte-aboveBalancer": { "addAte-aboveBalancer": {
actions: []action{ actions: []action{
addSectors(getSectors(8)), addSectors(getSectors(8), true),
waitPending(8), waitPending(8),
flush(getSectors(8), true, false), flush(getSectors(8), true, false),
}, },
@ -298,26 +305,26 @@ func TestCommitBatcher(t *testing.T) {
"addMax-aboveBalancer": { "addMax-aboveBalancer": {
actions: []action{ actions: []action{
expectSend(getSectors(maxBatch), true, false), expectSend(getSectors(maxBatch), true, false),
addSectors(getSectors(maxBatch)), addSectors(getSectors(maxBatch), true),
}, },
}, },
"addSingle-belowBalancer": { "addSingle-belowBalancer": {
actions: []action{ actions: []action{
addSector(0), addSector(0, false),
waitPending(1), waitPending(1),
flush([]abi.SectorNumber{0}, false, false), flush([]abi.SectorNumber{0}, false, false),
}, },
}, },
"addTwo-belowBalancer": { "addTwo-belowBalancer": {
actions: []action{ actions: []action{
addSectors(getSectors(2)), addSectors(getSectors(2), false),
waitPending(2), waitPending(2),
flush(getSectors(2), false, false), flush(getSectors(2), false, false),
}, },
}, },
"addAte-belowBalancer": { "addAte-belowBalancer": {
actions: []action{ actions: []action{
addSectors(getSectors(8)), addSectors(getSectors(8), false),
waitPending(8), waitPending(8),
flush(getSectors(8), false, false), flush(getSectors(8), false, false),
}, },
@ -325,20 +332,20 @@ func TestCommitBatcher(t *testing.T) {
"addMax-belowBalancer": { "addMax-belowBalancer": {
actions: []action{ actions: []action{
expectSend(getSectors(maxBatch), false, false), expectSend(getSectors(maxBatch), false, false),
addSectors(getSectors(maxBatch)), addSectors(getSectors(maxBatch), false),
}, },
}, },
"addAte-aboveBalancer-failOne": { "addAte-aboveBalancer-failOne": {
actions: []action{ actions: []action{
addSectors(getSectors(8)), addSectors(getSectors(8), true),
waitPending(8), waitPending(8),
flush(getSectors(8), true, true), flush(getSectors(8), true, true),
}, },
}, },
"addAte-belowBalancer-failOne": { "addAte-belowBalancer-failOne": {
actions: []action{ actions: []action{
addSectors(getSectors(8)), addSectors(getSectors(8), false),
waitPending(8), waitPending(8),
flush(getSectors(8), false, true), 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 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},
}

View File

@ -21,16 +21,16 @@ import (
type CurrentDealInfoAPI interface { type CurrentDealInfoAPI interface {
ChainGetMessage(context.Context, cid.Cid) (*types.Message, error) ChainGetMessage(context.Context, cid.Cid) (*types.Message, error)
StateLookupID(context.Context, address.Address, TipSetToken) (address.Address, error) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (*api.MarketDeal, error) StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
} }
type CurrentDealInfo struct { type CurrentDealInfo struct {
DealID abi.DealID DealID abi.DealID
MarketDeal *api.MarketDeal MarketDeal *api.MarketDeal
PublishMsgTipSet TipSetToken PublishMsgTipSet types.TipSetKey
} }
type CurrentDealInfoManager struct { type CurrentDealInfoManager struct {
@ -40,19 +40,19 @@ type CurrentDealInfoManager struct {
// GetCurrentDealInfo gets the current deal state and deal ID. // GetCurrentDealInfo gets the current deal state and deal ID.
// Note that the deal ID is assigned when the deal is published, so it may // 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. // 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 // Lookup the deal ID by comparing the deal proposal to the proposals in
// the publish deals message, and indexing into the message return value // 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 { if err != nil {
return CurrentDealInfo{}, err return CurrentDealInfo{}, err
} }
// Lookup the deal state by deal ID // 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 { if err == nil && proposal != nil {
// Make sure the retrieved deal proposal matches the target proposal // 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 { if err != nil {
return CurrentDealInfo{}, err 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 // dealIDFromPublishDealsMsg looks up the publish deals message by cid, and finds the deal ID
// by looking at the message return value // 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) dealID := abi.DealID(0)
// Get the return value of the publish deals message // 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 { 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 { 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 { 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 { 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) retval, err := market.DecodePublishStorageDealsReturn(lookup.Receipt.Return, nv)
if err != nil { 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() dealIDs, err := retval.DealIDs()
if err != nil { 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 // 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. // in the message.
if proposal == nil { if proposal == nil {
if len(dealIDs) > 1 { if len(dealIDs) > 1 {
return dealID, nil, xerrors.Errorf( return dealID, types.EmptyTSK, xerrors.Errorf(
"getting deal ID from publish deal message %s: "+ "getting deal ID from publish deal message %s: "+
"no deal proposal supplied but message return value has more than one deal (%d deals)", "no deal proposal supplied but message return value has more than one deal (%d deals)",
publishCid, len(dealIDs)) 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 // There is a single deal in this publish message and no deal proposal
// was supplied, so we have nothing to compare against. Just assume // was supplied, so we have nothing to compare against. Just assume
// the deal ID is correct and that it was valid // 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 // Get the parameters to the publish deals message
pubmsg, err := mgr.CDAPI.ChainGetMessage(ctx, publishCid) pubmsg, err := mgr.CDAPI.ChainGetMessage(ctx, publishCid)
if err != nil { 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 var pubDealsParams market8.PublishStorageDealsParams
if err := pubDealsParams.UnmarshalCBOR(bytes.NewReader(pubmsg.Params)); err != nil { 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 // Scan through the deal proposals in the message parameters to find the
// index of the target deal proposal // index of the target deal proposal
dealIdx := -1 dealIdx := -1
for i, paramDeal := range pubDealsParams.Deals { 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 { 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 { if eq {
dealIdx = i dealIdx = i
@ -143,38 +143,38 @@ func (mgr *CurrentDealInfoManager) dealIDFromPublishDealsMsg(ctx context.Context
fmt.Printf("found dealIdx %d\n", dealIdx) fmt.Printf("found dealIdx %d\n", dealIdx)
if dealIdx == -1 { 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) { 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", "deal index %d out of bounds of deal proposals (len %d) in publish deals message %s",
dealIdx, len(dealIDs), publishCid) dealIdx, len(dealIDs), publishCid)
} }
valid, outIdx, err := retval.IsDealValid(uint64(dealIdx)) valid, outIdx, err := retval.IsDealValid(uint64(dealIdx))
if err != nil { 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 { 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 // final check against for invalid return value output
// should not be reachable from onchain output, only pathological test cases // should not be reachable from onchain output, only pathological test cases
if outIdx >= len(dealIDs) { 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) { func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tsk types.TipSetKey, p1, p2 market.DealProposal) (bool, error) {
p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tok) p1ClientID, err := mgr.CDAPI.StateLookupID(ctx, p1.Client, tsk)
if err != nil { if err != nil {
return false, err return false, err
} }
p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tok) p2ClientID, err := mgr.CDAPI.StateLookupID(ctx, p2.Client, tsk)
if err != nil { if err != nil {
return false, err return false, err
} }
@ -190,65 +190,3 @@ func (mgr *CurrentDealInfoManager) CheckDealEquality(ctx context.Context, tok Ti
p1.Provider == p2.Provider && p1.Provider == p2.Provider &&
p1ClientID == p2ClientID, nil 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)

View File

@ -101,7 +101,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
} }
type testCaseData struct { type testCaseData struct {
searchMessageLookup *MsgLookup searchMessageLookup *api.MsgLookup
searchMessageErr error searchMessageErr error
marketDeals map[abi.DealID]*api.MarketDeal marketDeals map[abi.DealID]*api.MarketDeal
publishCid cid.Cid publishCid cid.Cid
@ -114,8 +114,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
testCases := map[string]testCaseData{ testCases := map[string]testCaseData{
"deal lookup succeeds": { "deal lookup succeeds": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{successDealID}), Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{successDealID}),
}, },
@ -129,8 +129,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
}, },
"deal lookup succeeds two return values": { "deal lookup succeeds two return values": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}), Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}),
}, },
@ -145,8 +145,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
}, },
"deal lookup fails proposal mis-match": { "deal lookup fails proposal mis-match": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID}), 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": { "deal lookup handles invalid actor output with mismatched count of deals and return values": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID}), 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": { "deal lookup fails when deal was not valid and index exceeds output array": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturn(t, []abi.DealID{earlierDealID}, []uint64{0}), 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": { "deal lookup succeeds when theres a separate deal failure": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturn(t, []abi.DealID{anotherDealID, successDealID}, []uint64{0, 2}), 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": { "deal lookup succeeds, target proposal nil, single deal in message": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{successDealID}), 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": { "deal lookup fails, multiple deals in return value but target proposal nil": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}), Return: makePublishDealsReturnBytesOldVersion(t, []abi.DealID{earlierDealID, successDealID}),
}, },
@ -258,8 +258,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
}, },
"return code not ok": { "return code not ok": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.ErrIllegalState, ExitCode: exitcode.ErrIllegalState,
}, },
}, },
@ -269,8 +269,8 @@ func TestGetCurrentDealInfo(t *testing.T) {
}, },
"unable to unmarshal params": { "unable to unmarshal params": {
publishCid: dummyCid, publishCid: dummyCid,
searchMessageLookup: &MsgLookup{ searchMessageLookup: &api.MsgLookup{
Receipt: MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: []byte("applesauce"), Return: []byte("applesauce"),
}, },
@ -298,7 +298,7 @@ func TestGetCurrentDealInfo(t *testing.T) {
} }
dealInfoMgr := CurrentDealInfoManager{mockApi} 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.expectedDealID, res.DealID)
require.Equal(t, data.expectedMarketDeal, res.MarketDeal) require.Equal(t, data.expectedMarketDeal, res.MarketDeal)
if data.expectedError == nil { if data.expectedError == nil {
@ -319,7 +319,7 @@ type marketDealKey struct {
} }
type CurrentDealInfoMockAPI struct { type CurrentDealInfoMockAPI struct {
SearchMessageLookup *MsgLookup SearchMessageLookup *api.MsgLookup
SearchMessageErr error SearchMessageErr error
MarketDeals map[marketDealKey]*api.MarketDeal MarketDeals map[marketDealKey]*api.MarketDeal
@ -359,15 +359,11 @@ func (mapi *CurrentDealInfoMockAPI) ChainGetMessage(ctx context.Context, c cid.C
}, nil }, 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 return addr, nil
} }
func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tok TipSetToken) (*api.MarketDeal, error) { func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error) {
tsk, err := types.TipSetKeyFromBytes(tok)
if err != nil {
return nil, err
}
deal, ok := mapi.MarketDeals[marketDealKey{dealID, tsk}] deal, ok := mapi.MarketDeals[marketDealKey{dealID, tsk}]
if !ok { if !ok {
return nil, errNotFound return nil, errNotFound
@ -375,7 +371,7 @@ func (mapi *CurrentDealInfoMockAPI) StateMarketStorageDeal(ctx context.Context,
return deal, nil 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 { if mapi.SearchMessageLookup == nil {
return mapi.SearchMessageLookup, mapi.SearchMessageErr return mapi.SearchMessageLookup, mapi.SearchMessageErr
} }
@ -383,7 +379,7 @@ func (mapi *CurrentDealInfoMockAPI) StateSearchMsg(ctx context.Context, c cid.Ci
return mapi.SearchMessageLookup, mapi.SearchMessageErr 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 return mapi.Version, nil
} }

View File

@ -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
}

View File

@ -9,7 +9,9 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v8/miner" "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 { type mutator interface {
@ -133,7 +135,7 @@ type SectorOldTicket struct{}
func (evt SectorOldTicket) apply(*SectorInfo) {} func (evt SectorOldTicket) apply(*SectorInfo) {}
type SectorPreCommit1 struct { type SectorPreCommit1 struct {
PreCommit1Out storage.PreCommit1Out PreCommit1Out storiface.PreCommit1Out
} }
func (evt SectorPreCommit1) apply(state *SectorInfo) { func (evt SectorPreCommit1) apply(state *SectorInfo) {
@ -166,7 +168,7 @@ func (evt SectorPreCommitBatchSent) apply(state *SectorInfo) {
} }
type SectorPreCommitLanded struct { type SectorPreCommitLanded struct {
TipSet TipSetToken TipSet types.TipSetKey
} }
func (evt SectorPreCommitLanded) apply(si *SectorInfo) { func (evt SectorPreCommitLanded) apply(si *SectorInfo) {
@ -314,7 +316,7 @@ func (evt SectorStartCCUpdate) apply(state *SectorInfo) {
} }
type SectorReplicaUpdate struct { type SectorReplicaUpdate struct {
Out storage.ReplicaUpdateOut Out storiface.ReplicaUpdateOut
} }
func (evt SectorReplicaUpdate) apply(state *SectorInfo) { func (evt SectorReplicaUpdate) apply(state *SectorInfo) {
@ -323,7 +325,7 @@ func (evt SectorReplicaUpdate) apply(state *SectorInfo) {
} }
type SectorProveReplicaUpdate struct { type SectorProveReplicaUpdate struct {
Proof storage.ReplicaUpdateProof Proof storiface.ReplicaUpdateProof
} }
func (evt SectorProveReplicaUpdate) apply(state *SectorInfo) { func (evt SectorProveReplicaUpdate) apply(state *SectorInfo) {

View File

@ -5,10 +5,10 @@ import (
"golang.org/x/xerrors" "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.startupWait.Wait()
m.inputLk.Lock() m.inputLk.Lock()
@ -16,23 +16,23 @@ func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) {
cfg, err := m.getConfig() cfg, err := m.getConfig()
if err != nil { 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 cfg.MaxSealingSectors > 0 {
if m.stats.curSealing() >= cfg.MaxSealingSectors { 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) spt, err := m.currentSealProof(ctx)
if err != nil { 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) sid, err := m.createSector(ctx, cfg, spt)
if err != nil { if err != nil {
return storage.SectorRef{}, err return storiface.SectorRef{}, err
} }
log.Infof("Creating CC sector %d", sid) log.Infof("Creating CC sector %d", sid)

View File

@ -13,7 +13,6 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "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/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error { 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) sealTime := time.Unix(sector.CreationTime, 0).Add(cfg.WaitDealsDelay)
// check deal age, start sealing when the deal closest to starting is within slack time // 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) blockTime := time.Second * time.Duration(build.BlockDelaySecs)
if err != nil { if err != nil {
return false, xerrors.Errorf("API error getting head: %w", err) return false, xerrors.Errorf("API error getting head: %w", err)
@ -134,7 +134,7 @@ func (m *Sealing) maybeStartSealing(ctx statemachine.Context, sector SectorInfo,
continue continue
} }
dealSafeSealEpoch := piece.DealInfo.DealProposal.StartEpoch - cfg.StartEpochSealingBuffer 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) { if dealSafeSealTime.Before(sealTime) {
sealTime = dealSafeSealTime sealTime = dealSafeSealTime
} }
@ -274,7 +274,7 @@ func (m *Sealing) handleAddPieceFailed(ctx statemachine.Context, sector SectorIn
return ctx.Send(SectorRetryWaitDeals{}) 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) log.Infof("Adding piece for deal %d (publish msg: %s)", deal.DealID, deal.PublishCid)
if (padreader.PaddedSize(uint64(size))) != size { if (padreader.PaddedSize(uint64(size))) != size {
return api.SectorOffset{}, xerrors.Errorf("cannot allocate unpadded piece") 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) return api.SectorOffset{}, xerrors.Errorf("getting config: %w", err)
} }
_, head, err := m.Api.ChainHead(ctx) ts, err := m.Api.ChainHead(ctx)
if err != nil { if err != nil {
return api.SectorOffset{}, xerrors.Errorf("couldnt get chain head: %w", err) 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( return api.SectorOffset{}, xerrors.Errorf(
"cannot add piece for deal with piece CID %s: current epoch %d has passed deal proposal start epoch %d", "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() 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! // 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{}) doneCh := make(chan struct{})
pp := &pendingPiece{ pp := &pendingPiece{
doneCh: doneCh, doneCh: doneCh,
@ -399,7 +399,7 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e
if e, ok := memo[sn]; ok { if e, ok := memo[sn]; ok {
return e.e, e.p, nil 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 { if err != nil {
return 0, big.Zero(), err 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 { if err != nil {
return 0, 0, xerrors.Errorf("getting current epoch: %w", err) return 0, 0, xerrors.Errorf("getting current epoch: %w", err)
} }
minDur, maxDur := policy.DealDurationBounds(0) 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) { 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 { slowChecks := func(sid abi.SectorNumber) bool {
active, err := m.sectorActive(ctx, TipSetToken{}, sid) active, err := m.sectorActive(ctx, types.TipSetKey{}, sid)
if err != nil { if err != nil {
log.Errorw("checking sector active", "error", err) log.Errorw("checking sector active", "error", err)
return false return false

View File

@ -12,18 +12,16 @@ import (
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
address "github.com/filecoin-project/go-address" address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
abi "github.com/filecoin-project/go-state-types/abi" abi "github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big" 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" miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
crypto "github.com/filecoin-project/go-state-types/crypto" crypto "github.com/filecoin-project/go-state-types/crypto"
dline "github.com/filecoin-project/go-state-types/dline" dline "github.com/filecoin-project/go-state-types/dline"
network "github.com/filecoin-project/go-state-types/network" network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api" api "github.com/filecoin-project/lotus/api"
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
types "github.com/filecoin-project/lotus/chain/types" types "github.com/filecoin-project/lotus/chain/types"
sealing "github.com/filecoin-project/lotus/storage/pipeline"
) )
// MockSealingAPI is a mock of SealingAPI interface. // MockSealingAPI is a mock of SealingAPI interface.
@ -49,21 +47,6 @@ func (m *MockSealingAPI) EXPECT() *MockSealingAPIMockRecorder {
return m.recorder 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. // ChainGetMessage mocks base method.
func (m *MockSealingAPI) ChainGetMessage(arg0 context.Context, arg1 cid.Cid) (*types.Message, error) { func (m *MockSealingAPI) ChainGetMessage(arg0 context.Context, arg1 cid.Cid) (*types.Message, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
@ -80,13 +63,12 @@ func (mr *MockSealingAPIMockRecorder) ChainGetMessage(arg0, arg1 interface{}) *g
} }
// ChainHead mocks base method. // ChainHead mocks base method.
func (m *MockSealingAPI) ChainHead(arg0 context.Context) (sealing.TipSetToken, abi.ChainEpoch, error) { func (m *MockSealingAPI) ChainHead(arg0 context.Context) (*types.TipSet, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainHead", arg0) ret := m.ctrl.Call(m, "ChainHead", arg0)
ret0, _ := ret[0].(sealing.TipSetToken) ret0, _ := ret[0].(*types.TipSet)
ret1, _ := ret[1].(abi.ChainEpoch) ret1, _ := ret[1].(error)
ret2, _ := ret[2].(error) return ret0, ret1
return ret0, ret1, ret2
} }
// ChainHead indicates an expected call of ChainHead. // 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) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainReadObj", reflect.TypeOf((*MockSealingAPI)(nil).ChainReadObj), arg0, arg1)
} }
// SendMsg mocks base method. // MpoolPushMessage 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) { func (m *MockSealingAPI) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
m.ctrl.T.Helper() 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) ret0, _ := ret[0].(cid.Cid)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// SendMsg indicates an expected call of SendMsg. // StateComputeDataCID indicates an expected call of StateComputeDataCID.
func (mr *MockSealingAPIMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { func (mr *MockSealingAPIMockRecorder) StateComputeDataCID(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() 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) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StateComputeDataCID", reflect.TypeOf((*MockSealingAPI)(nil).StateComputeDataCID), arg0, arg1, arg2, arg3, arg4)
}
// 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)
} }
// StateGetRandomnessFromBeacon mocks base method. // StateGetRandomnessFromBeacon mocks base method.
func (m *MockSealingAPI) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing.TipSetToken) (abi.Randomness, error) { func (m *MockSealingAPI) StateGetRandomnessFromBeacon(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 types.TipSetKey) (abi.Randomness, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "StateGetRandomnessFromBeacon", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(abi.Randomness) ret0, _ := ret[0].(abi.Randomness)
@ -156,7 +138,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromBeacon(arg0, arg1, a
} }
// StateGetRandomnessFromTickets mocks base method. // StateGetRandomnessFromTickets mocks base method.
func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 sealing.TipSetToken) (abi.Randomness, error) { func (m *MockSealingAPI) StateGetRandomnessFromTickets(arg0 context.Context, arg1 crypto.DomainSeparationTag, arg2 abi.ChainEpoch, arg3 []byte, arg4 types.TipSetKey) (abi.Randomness, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4) ret := m.ctrl.Call(m, "StateGetRandomnessFromTickets", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(abi.Randomness) ret0, _ := ret[0].(abi.Randomness)
@ -171,7 +153,7 @@ func (mr *MockSealingAPIMockRecorder) StateGetRandomnessFromTickets(arg0, arg1,
} }
// StateLookupID mocks base method. // StateLookupID mocks base method.
func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (address.Address, error) { func (m *MockSealingAPI) StateLookupID(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (address.Address, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateLookupID", arg0, arg1, arg2)
ret0, _ := ret[0].(address.Address) ret0, _ := ret[0].(address.Address)
@ -186,7 +168,7 @@ func (mr *MockSealingAPIMockRecorder) StateLookupID(arg0, arg1, arg2 interface{}
} }
// StateMarketStorageDeal mocks base method. // StateMarketStorageDeal mocks base method.
func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 sealing.TipSetToken) (*api.MarketDeal, error) { func (m *MockSealingAPI) StateMarketStorageDeal(arg0 context.Context, arg1 abi.DealID, arg2 types.TipSetKey) (*api.MarketDeal, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMarketStorageDeal", arg0, arg1, arg2)
ret0, _ := ret[0].(*api.MarketDeal) ret0, _ := ret[0].(*api.MarketDeal)
@ -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) 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -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) 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
ret0, _ := ret[0].(api.MinerInfo) ret0, _ := ret[0].(api.MinerInfo)
@ -261,7 +228,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{
} }
// StateMinerInitialPledgeCollateral mocks base method. // StateMinerInitialPledgeCollateral mocks base method.
func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) { func (m *MockSealingAPI) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -276,7 +243,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerInitialPledgeCollateral(arg0, ar
} }
// StateMinerPartitions mocks base method. // StateMinerPartitions mocks base method.
func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 sealing.TipSetToken) ([]api.Partition, error) { func (m *MockSealingAPI) StateMinerPartitions(arg0 context.Context, arg1 address.Address, arg2 uint64, arg3 types.TipSetKey) ([]api.Partition, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerPartitions", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].([]api.Partition) ret0, _ := ret[0].([]api.Partition)
@ -291,7 +258,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPartitions(arg0, arg1, arg2, arg
} }
// StateMinerPreCommitDepositForPower mocks base method. // StateMinerPreCommitDepositForPower mocks base method.
func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 sealing.TipSetToken) (big.Int, error) { func (m *MockSealingAPI) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -306,7 +273,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerPreCommitDepositForPower(arg0, a
} }
// StateMinerProvingDeadline mocks base method. // StateMinerProvingDeadline mocks base method.
func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 sealing.TipSetToken) (*dline.Info, error) { func (m *MockSealingAPI) StateMinerProvingDeadline(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (*dline.Info, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerProvingDeadline", arg0, arg1, arg2)
ret0, _ := ret[0].(*dline.Info) ret0, _ := ret[0].(*dline.Info)
@ -321,7 +288,7 @@ func (mr *MockSealingAPIMockRecorder) StateMinerProvingDeadline(arg0, arg1, arg2
} }
// StateMinerSectorAllocated mocks base method. // StateMinerSectorAllocated mocks base method.
func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (bool, error) { func (m *MockSealingAPI) StateMinerSectorAllocated(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (bool, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerSectorAllocated", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(bool) ret0, _ := ret[0].(bool)
@ -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) 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1) ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
ret0, _ := ret[0].(network.Version) ret0, _ := ret[0].(network.Version)
@ -381,22 +318,22 @@ func (mr *MockSealingAPIMockRecorder) StateNetworkVersion(arg0, arg1 interface{}
} }
// StateSearchMsg mocks base method. // StateSearchMsg mocks base method.
func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 cid.Cid) (*sealing.MsgLookup, error) { func (m *MockSealingAPI) StateSearchMsg(arg0 context.Context, arg1 types.TipSetKey, arg2 cid.Cid, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1) ret := m.ctrl.Call(m, "StateSearchMsg", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(*sealing.MsgLookup) ret0, _ := ret[0].(*api.MsgLookup)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// StateSearchMsg indicates an expected call of StateSearchMsg. // 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() 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorGetInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*miner.SectorOnChainInfo) ret0, _ := ret[0].(*miner.SectorOnChainInfo)
@ -411,10 +348,10 @@ func (mr *MockSealingAPIMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3
} }
// StateSectorPartition mocks base method. // StateSectorPartition mocks base method.
func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*sealing.SectorLocation, error) { func (m *MockSealingAPI) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorLocation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*sealing.SectorLocation) ret0, _ := ret[0].(*miner0.SectorLocation)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -426,7 +363,7 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPartition(arg0, arg1, arg2, arg
} }
// StateSectorPreCommitInfo mocks base method. // StateSectorPreCommitInfo mocks base method.
func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 sealing.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) { func (m *MockSealingAPI) StateSectorPreCommitInfo(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo) ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)
@ -441,16 +378,16 @@ func (mr *MockSealingAPIMockRecorder) StateSectorPreCommitInfo(arg0, arg1, arg2,
} }
// StateWaitMsg mocks base method. // StateWaitMsg mocks base method.
func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid) (sealing.MsgLookup, error) { func (m *MockSealingAPI) StateWaitMsg(arg0 context.Context, arg1 cid.Cid, arg2 uint64, arg3 abi.ChainEpoch, arg4 bool) (*api.MsgLookup, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1) ret := m.ctrl.Call(m, "StateWaitMsg", arg0, arg1, arg2, arg3, arg4)
ret0, _ := ret[0].(sealing.MsgLookup) ret0, _ := ret[0].(*api.MsgLookup)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// StateWaitMsg indicates an expected call of StateWaitMsg. // 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() 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)
} }

View File

@ -9,7 +9,6 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
cid "github.com/ipfs/go-cid"
address "github.com/filecoin-project/go-address" address "github.com/filecoin-project/go-address"
abi "github.com/filecoin-project/go-state-types/abi" abi "github.com/filecoin-project/go-state-types/abi"
@ -18,7 +17,7 @@ import (
network "github.com/filecoin-project/go-state-types/network" network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api" api "github.com/filecoin-project/lotus/api"
sealing "github.com/filecoin-project/lotus/storage/pipeline" types "github.com/filecoin-project/lotus/chain/types"
) )
// MockCommitBatcherApi is a mock of CommitBatcherApi interface. // MockCommitBatcherApi is a mock of CommitBatcherApi interface.
@ -44,29 +43,13 @@ func (m *MockCommitBatcherApi) EXPECT() *MockCommitBatcherApiMockRecorder {
return m.recorder 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainHead", arg0) ret := m.ctrl.Call(m, "ChainHead", arg0)
ret0, _ := ret[0].(sealing.TipSetToken) ret0, _ := ret[0].(*types.TipSet)
ret1, _ := ret[1].(abi.ChainEpoch) ret1, _ := ret[1].(error)
ret2, _ := ret[2].(error) return ret0, ret1
return ret0, ret1, ret2
} }
// ChainHead indicates an expected call of ChainHead. // 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) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainHead", reflect.TypeOf((*MockCommitBatcherApi)(nil).ChainHead), arg0)
} }
// SendMsg mocks base method. // MpoolPushMessage 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) { func (m *MockCommitBatcherApi) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
m.ctrl.T.Helper() 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].(cid.Cid) ret0, _ := ret[0].(*types.SignedMessage)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// SendMsg indicates an expected call of SendMsg. // MpoolPushMessage indicates an expected call of MpoolPushMessage.
func (mr *MockCommitBatcherApiMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { func (mr *MockCommitBatcherApiMockRecorder) MpoolPushMessage(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -106,7 +89,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerAvailableBalance(arg0, arg
} }
// StateMinerInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
ret0, _ := ret[0].(api.MinerInfo) ret0, _ := ret[0].(api.MinerInfo)
@ -121,7 +104,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerInfo(arg0, arg1, arg2 inte
} }
// StateMinerInitialPledgeCollateral mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -136,7 +119,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateMinerInitialPledgeCollateral(ar
} }
// StateNetworkVersion mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1) ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
ret0, _ := ret[0].(network.Version) ret0, _ := ret[0].(network.Version)
@ -151,7 +134,7 @@ func (mr *MockCommitBatcherApiMockRecorder) StateNetworkVersion(arg0, arg1 inter
} }
// StateSectorPreCommitInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3) ret := m.ctrl.Call(m, "StateSectorPreCommitInfo", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo) ret0, _ := ret[0].(*miner.SectorPreCommitOnChainInfo)

View File

@ -9,15 +9,13 @@ import (
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
cid "github.com/ipfs/go-cid"
address "github.com/filecoin-project/go-address" 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" big "github.com/filecoin-project/go-state-types/big"
network "github.com/filecoin-project/go-state-types/network" network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api" api "github.com/filecoin-project/lotus/api"
sealing "github.com/filecoin-project/lotus/storage/pipeline" types "github.com/filecoin-project/lotus/chain/types"
) )
// MockPreCommitBatcherApi is a mock of PreCommitBatcherApi interface. // MockPreCommitBatcherApi is a mock of PreCommitBatcherApi interface.
@ -43,29 +41,13 @@ func (m *MockPreCommitBatcherApi) EXPECT() *MockPreCommitBatcherApiMockRecorder
return m.recorder 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ChainHead", arg0) ret := m.ctrl.Call(m, "ChainHead", arg0)
ret0, _ := ret[0].(sealing.TipSetToken) ret0, _ := ret[0].(*types.TipSet)
ret1, _ := ret[1].(abi.ChainEpoch) ret1, _ := ret[1].(error)
ret2, _ := ret[2].(error) return ret0, ret1
return ret0, ret1, ret2
} }
// ChainHead indicates an expected call of ChainHead. // 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) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainHead", reflect.TypeOf((*MockPreCommitBatcherApi)(nil).ChainHead), arg0)
} }
// SendMsg mocks base method. // MpoolPushMessage 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) { func (m *MockPreCommitBatcherApi) MpoolPushMessage(arg0 context.Context, arg1 *types.Message, arg2 *api.MessageSendSpec) (*types.SignedMessage, error) {
m.ctrl.T.Helper() 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].(cid.Cid) ret0, _ := ret[0].(*types.SignedMessage)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// SendMsg indicates an expected call of SendMsg. // MpoolPushMessage indicates an expected call of MpoolPushMessage.
func (mr *MockPreCommitBatcherApiMockRecorder) SendMsg(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { func (mr *MockPreCommitBatcherApiMockRecorder) MpoolPushMessage(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() 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. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerAvailableBalance", arg0, arg1, arg2)
ret0, _ := ret[0].(big.Int) ret0, _ := ret[0].(big.Int)
@ -105,7 +87,7 @@ func (mr *MockPreCommitBatcherApiMockRecorder) StateMinerAvailableBalance(arg0,
} }
// StateMinerInfo mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2) ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
ret0, _ := ret[0].(api.MinerInfo) ret0, _ := ret[0].(api.MinerInfo)
@ -120,7 +102,7 @@ func (mr *MockPreCommitBatcherApiMockRecorder) StateMinerInfo(arg0, arg1, arg2 i
} }
// StateNetworkVersion mocks base method. // 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() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1) ret := m.ctrl.Call(m, "StateNetworkVersion", arg0, arg1)
ret0, _ := ret[0].(network.Version) ret0, _ := ret[0].(network.Version)

View File

@ -28,12 +28,11 @@ import (
//go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_precommit_batcher.go -package=mocks . PreCommitBatcherApi //go:generate go run github.com/golang/mock/mockgen -destination=mocks/mock_precommit_batcher.go -package=mocks . PreCommitBatcherApi
type PreCommitBatcherApi interface { type PreCommitBatcherApi interface {
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) ChainHead(ctx context.Context) (*types.TipSet, error)
ChainBaseFee(context.Context, TipSetToken) (abi.TokenAmount, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error)
} }
type preCommitEntry struct { type preCommitEntry struct {
@ -188,31 +187,26 @@ func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBat
return nil, nil return nil, nil
} }
tok, _, err := b.api.ChainHead(b.mctx) ts, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
return nil, err 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 // 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 { if err != nil {
return nil, xerrors.Errorf("couldn't get network version: %w", err) return nil, xerrors.Errorf("couldn't get network version: %w", err)
} }
individual := false 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 individual = true
} }
// todo support multiple batches // todo support multiple batches
var res []sealiface.PreCommitBatchRes var res []sealiface.PreCommitBatchRes
if !individual { if !individual {
res, err = b.processBatch(cfg, tok, bf, nv) res, err = b.processBatch(cfg, ts.Key(), ts.MinTicketBlock().ParentBaseFee, nv)
} else { } else {
res, err = b.processIndividually(cfg) 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) { 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 { if err != nil {
return nil, xerrors.Errorf("couldn't get miner info: %w", err) return nil, xerrors.Errorf("couldn't get miner info: %w", err)
} }
@ -248,7 +242,7 @@ func (b *PreCommitBatcher) processIndividually(cfg sealiface.Config) ([]sealifac
avail := types.TotalFilecoinInt avail := types.TotalFilecoinInt
if cfg.CollateralFromMinerBalance && !cfg.DisableCollateralFallback { 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 { if err != nil {
return nil, xerrors.Errorf("getting available miner balance: %w", err) 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) 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 { if err != nil {
return cid.Undef, xerrors.Errorf("pushing message to mpool: %w", err) 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 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{} params := miner.PreCommitSectorBatchParams{}
deposit := big.Zero() deposit := big.Zero()
var res sealiface.PreCommitBatchRes 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) 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 { if err != nil {
return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("couldn't get miner info: %w", err) 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) 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 { if err != nil {
return []sealiface.PreCommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) 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 // register PreCommit, wait for batch message, return message CID
func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, deposit abi.TokenAmount, in *miner.SectorPreCommitInfo) (res sealiface.PreCommitBatchRes, err error) { func (b *PreCommitBatcher) AddPreCommit(ctx context.Context, s SectorInfo, deposit abi.TokenAmount, in *miner.SectorPreCommitInfo) (res sealiface.PreCommitBatchRes, err error) {
_, curEpoch, err := b.api.ChainHead(b.mctx) ts, err := b.api.ChainHead(b.mctx)
if err != nil { if err != nil {
log.Errorf("getting chain head: %s", err) log.Errorf("getting chain head: %s", err)
return sealiface.PreCommitBatchRes{}, err return sealiface.PreCommitBatchRes{}, err
} }
cutoff, err := getPreCommitCutoff(curEpoch, s) cutoff, err := getPreCommitCutoff(ts.Height(), s)
if err != nil { if err != nil {
return sealiface.PreCommitBatchRes{}, xerrors.Errorf("failed to calculate cutoff: %w", err) return sealiface.PreCommitBatchRes{}, xerrors.Errorf("failed to calculate cutoff: %w", err)
} }

View File

@ -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 { return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise {
var pcres sealiface.PreCommitBatchRes var pcres sealiface.PreCommitBatchRes
var pcerr error var pcerr error
@ -109,7 +109,12 @@ func TestPrecommitBatcher(t *testing.T) {
SectorNumber: sn, 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() { go func() {
defer done.Unlock() 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)) as := make([]action, len(sectors))
for i, sector := range sectors { for i, sector := range sectors {
as[i] = addSector(sector) as[i] = addSector(sector, aboveBalancer)
} }
return actions(as...) return actions(as...)
} }
@ -153,20 +158,19 @@ func TestPrecommitBatcher(t *testing.T) {
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001 //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSend := func(expect []abi.SectorNumber) action { expectSend := func(expect []abi.SectorNumber) action {
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise { 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().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(10001), 1), nil)
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(10001), nil)
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) 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().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 { s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
b := i.([]byte) b := i.(*types.Message)
var params miner6.PreCommitSectorBatchParams 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 { for s, number := range expect {
require.Equal(t, number, params.Sectors[s].SectorNumber) require.Equal(t, number, params.Sectors[s].SectorNumber)
} }
return true return true
})) }), gomock.Any()).Return(dummySmsg, nil)
return nil return nil
} }
} }
@ -174,20 +178,19 @@ func TestPrecommitBatcher(t *testing.T) {
//stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001 //stm: @CHAIN_STATE_MINER_INFO_001, @CHAIN_STATE_NETWORK_VERSION_001
expectSendsSingle := func(expect []abi.SectorNumber) action { expectSendsSingle := func(expect []abi.SectorNumber) action {
return func(t *testing.T, s *mocks.MockPreCommitBatcherApi, pcb *pipeline.PreCommitBatcher) promise { 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().ChainHead(gomock.Any()).Return(makeBFTs(t, big.NewInt(9999), 1), nil)
s.EXPECT().ChainBaseFee(gomock.Any(), gomock.Any()).Return(big.NewInt(9999), nil)
s.EXPECT().StateNetworkVersion(gomock.Any(), gomock.Any()).Return(network.Version14, nil) 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().StateMinerInfo(gomock.Any(), gomock.Any(), gomock.Any()).Return(api.MinerInfo{Owner: t0123, Worker: t0123}, nil)
for _, number := range expect { for _, number := range expect {
numClone := number numClone := number
s.EXPECT().SendMsg(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), funMatcher(func(i interface{}) bool { s.EXPECT().MpoolPushMessage(gomock.Any(), funMatcher(func(i interface{}) bool {
b := i.([]byte) b := i.(*types.Message)
var params miner6.PreCommitSectorParams 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) require.Equal(t, numClone, params.SectorNumber)
return true return true
})) }), gomock.Any()).Return(dummySmsg, nil)
} }
return nil return nil
} }
@ -223,14 +226,14 @@ func TestPrecommitBatcher(t *testing.T) {
}{ }{
"addSingle": { "addSingle": {
actions: []action{ actions: []action{
addSector(0), addSector(0, false),
waitPending(1), waitPending(1),
flush([]abi.SectorNumber{0}), flush([]abi.SectorNumber{0}),
}, },
}, },
"addTwo": { "addTwo": {
actions: []action{ actions: []action{
addSectors(getSectors(2)), addSectors(getSectors(2), false),
waitPending(2), waitPending(2),
flush(getSectors(2)), flush(getSectors(2)),
}, },
@ -238,13 +241,13 @@ func TestPrecommitBatcher(t *testing.T) {
"addMax": { "addMax": {
actions: []action{ actions: []action{
expectSend(getSectors(maxBatch)), expectSend(getSectors(maxBatch)),
addSectors(getSectors(maxBatch)), addSectors(getSectors(maxBatch), true),
}, },
}, },
"addMax-belowBaseFee": { "addMax-belowBaseFee": {
actions: []action{ actions: []action{
expectSendsSingle(getSectors(maxBatch)), expectSendsSingle(getSectors(maxBatch)),
addSectors(getSectors(maxBatch)), addSectors(getSectors(maxBatch), false),
}, },
}, },
} }

View File

@ -11,6 +11,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
) )
type PreCommitPolicy interface { type PreCommitPolicy interface {
@ -18,8 +19,8 @@ type PreCommitPolicy interface {
} }
type Chain interface { type Chain interface {
ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) ChainHead(context.Context) (*types.TipSet, error)
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
} }
// BasicPreCommitPolicy satisfies PreCommitPolicy. It has two modes: // 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 // Expiration produces the pre-commit sector expiration epoch for an encoded
// replica containing the provided enumeration of pieces and deals. // replica containing the provided enumeration of pieces and deals.
func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi.ChainEpoch, error) { 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 { if err != nil {
return 0, err return 0, err
} }
@ -70,8 +71,8 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
continue continue
} }
if p.DealInfo.DealSchedule.EndEpoch < epoch { if p.DealInfo.DealSchedule.EndEpoch < ts.Height() {
log.Warnf("piece schedule %+v ended before current epoch %d", p, epoch) log.Warnf("piece schedule %+v ended before current epoch %d", p, ts.Height())
continue continue
} }
@ -88,13 +89,13 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
return 0, err return 0, err
} }
tmp := epoch + expirationDuration tmp := ts.Height() + expirationDuration
end = &tmp end = &tmp
} }
// Ensure there is at least one day for the PC message to land without falling below min sector lifetime // 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 // 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 { if *end < minExp {
end = &minExp end = &minExp
} }

View File

@ -17,6 +17,7 @@ import (
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
pipeline "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "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 return build.NewestNetworkVersion, nil
} }
func (f *fakeChain) ChainHead(ctx context.Context) (pipeline.TipSetToken, abi.ChainEpoch, error) { func (f *fakeChain) ChainHead(ctx context.Context) (*types.TipSet, error) {
return []byte{1, 2, 3}, f.h, nil return makeTs(nil, f.h), nil
} }
func fakePieceCid(t *testing.T) cid.Cid { func fakePieceCid(t *testing.T) cid.Cid {

View File

@ -2,7 +2,6 @@ package sealing
import ( import (
"context" "context"
"errors"
"sync" "sync"
"time" "time"
@ -13,7 +12,6 @@ import (
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "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/abi"
"github.com/filecoin-project/go-state-types/big" "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/builtin/v8/miner"
@ -21,16 +19,15 @@ import (
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "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" 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/chain/types"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer"
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
const SectorStorePrefix = "/sectors" const SectorStorePrefix = "/sectors"
@ -39,44 +36,32 @@ var ErrTooManySectorsSealing = xerrors.New("too many sectors sealing")
var log = logging.Logger("sectors") 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 //go:generate go run github.com/golang/mock/mockgen -destination=mocks/api.go -package=mocks . SealingAPI
type SealingAPI interface { type SealingAPI interface {
StateWaitMsg(context.Context, cid.Cid) (MsgLookup, error) StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error) StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*api.MsgLookup, error)
StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok TipSetToken) (cid.Cid, 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, tsk types.TipSetKey) (*miner.SectorPreCommitOnChainInfo, error)
StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*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, tok TipSetToken) (*miner.SectorOnChainInfo, 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, tok TipSetToken) (*SectorLocation, error) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
StateLookupID(context.Context, address.Address, TipSetToken) (address.Address, error) StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
StateMinerSectorSize(context.Context, address.Address, TipSetToken) (abi.SectorSize, error) StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok TipSetToken) (address.Address, error) StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, types.TipSetKey) (big.Int, error)
StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error) StateMinerAvailableBalance(context.Context, address.Address, types.TipSetKey) (big.Int, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error) StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (bool, error)
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error) StateMarketStorageDeal(context.Context, abi.DealID, types.TipSetKey) (*api.MarketDeal, error)
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, TipSetToken) (bool, error) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error)
StateMinerActiveSectors(context.Context, address.Address, TipSetToken) (bitfield.BitField, error) StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (*api.MarketDeal, error) StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error)
StateMarketStorageDealProposal(context.Context, abi.DealID, TipSetToken) (market.DealProposal, error) StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
StateMinerProvingDeadline(context.Context, address.Address, TipSetToken) (*dline.Info, error) ChainHead(ctx context.Context) (*types.TipSet, 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)
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, 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) 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, tok TipSetToken) (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) 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 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 { type Sealing struct {
Api SealingAPI Api SealingAPI
DealInfo *CurrentDealInfoManager DealInfo *CurrentDealInfoManager
@ -98,7 +87,7 @@ type Sealing struct {
sealer sealer.SectorManager sealer sealer.SectorManager
sectors *statemachine.StateGroup sectors *statemachine.StateGroup
sc SectorIDCounter sc SectorIDCounter
verif ffiwrapper.Verifier verif storiface.Verifier
pcp PreCommitPolicy pcp PreCommitPolicy
inputLk sync.Mutex inputLk sync.Mutex
@ -154,13 +143,13 @@ type pendingPiece struct {
size abi.UnpaddedPieceSize size abi.UnpaddedPieceSize
deal api.PieceDealInfo deal api.PieceDealInfo
data storage.Data data storiface.Data
assigned bool // assigned to a sector? assigned bool // assigned to a sector?
accepted func(abi.SectorNumber, abi.UnpaddedPieceSize, error) 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{ s := &Sealing{
Api: api, Api: api,
DealInfo: &CurrentDealInfoManager{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) { 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 { if err != nil {
return 0, err return 0, err
} }
ver, err := m.Api.StateNetworkVersion(ctx, nil) ver, err := m.Api.StateNetworkVersion(ctx, types.EmptyTSK)
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -272,8 +261,8 @@ func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof
return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType) return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType)
} }
func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storage.SectorRef { func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storiface.SectorRef {
return storage.SectorRef{ return storiface.SectorRef{
ID: m.minerSectorID(num), ID: m.minerSectorID(num),
ProofType: spt, ProofType: spt,
} }

View File

@ -14,7 +14,9 @@ import (
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-statemachine" "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/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types"
) )
const minRetryTime = 1 * time.Minute 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) { 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 { if err != nil {
log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err) log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err)
return nil, false 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 { if err != nil {
log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err) log.Errorf("handleSealPrecommit1Failed(%d): temp error: %+v", sector.SectorNumber, err)
return nil, false 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 { 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 { if err != nil {
log.Errorf("handlePreCommitFailed: api error, not proceeding: %+v", err) log.Errorf("handlePreCommitFailed: api error, not proceeding: %+v", err)
return nil return nil
} }
if sector.PreCommitMessage != 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 { if err != nil {
// API error // API error
if err := failedCooldown(ctx, sector); err != nil { 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) { switch err.(type) {
case *ErrApi: case *ErrApi:
log.Errorf("handlePreCommitFailed: api error, not proceeding: %+v", err) 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 pci, is := m.checkPreCommitted(ctx, sector); is && pci != nil {
if sector.PreCommitMessage == nil { if sector.PreCommitMessage == nil {
log.Warnf("sector %d is precommitted on chain, but we don't have precommit message", sector.SectorNumber) 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 { if pci.Info.SealedCID != *sector.CommR {
@ -188,7 +190,7 @@ func (m *Sealing) handleSubmitReplicaUpdateFailed(ctx statemachine.Context, sect
} }
if sector.ReplicaUpdateMessage != nil { 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 { if err != nil {
// API error // API error
return ctx.Send(SectorRetrySubmitReplicaUpdateWait{}) 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err) log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err)
return nil 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) { switch err.(type) {
case *ErrApi: case *ErrApi:
log.Errorf("handleSubmitReplicaUpdateFailed: api error, not proceeding: %+v", err) 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 // 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 { if err != nil {
log.Errorf("sector active check: api error, not proceeding: %+v", err) log.Errorf("sector active check: api error, not proceeding: %+v", err)
return nil return nil
@ -261,14 +263,14 @@ func (m *Sealing) handleReleaseSectorKeyFailed(ctx statemachine.Context, sector
} }
func (m *Sealing) handleCommitFailed(ctx statemachine.Context, sector SectorInfo) error { 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 { if err != nil {
log.Errorf("handleCommitting: api error, not proceeding: %+v", err) log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
return nil return nil
} }
if sector.CommitMessage != 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 { if err != nil {
// API error // API error
if err := failedCooldown(ctx, sector); err != nil { 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) { switch err.(type) {
case *ErrApi: case *ErrApi:
log.Errorf("handleCommitFailed: api error, not proceeding: %+v", err) 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 // 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 // the Terminating state after cooldown. If the API is still failing, well get back to here
// with the error in SectorInfo log. // 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 { if pci != nil {
return nil // pause the fsm, needs manual user action 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 { func (m *Sealing) handleDealsExpired(ctx statemachine.Context, sector SectorInfo) error {
// First make vary sure the sector isn't committed // 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 { if err != nil {
return xerrors.Errorf("getting sector info: %w", err) return xerrors.Errorf("getting sector info: %w", err)
} }
@ -435,7 +437,7 @@ func (m *Sealing) handleRecoverDealIDsOrFailWith(ctx statemachine.Context, secto
if err != nil { if err != nil {
return err return err
} }
tok, _, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
return err return err
} }
@ -457,7 +459,7 @@ func (m *Sealing) handleRecoverDealIDsOrFailWith(ctx statemachine.Context, secto
mdp := *p.DealInfo.DealProposal mdp := *p.DealInfo.DealProposal
dp = &mdp 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 { if err != nil {
failed[i] = xerrors.Errorf("getting current deal info for piece %d: %w", i, err) failed[i] = xerrors.Errorf("getting current deal info for piece %d: %w", i, err)
continue 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) { 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 { if err != nil {
return nil, 0, xerrors.Errorf("getting chain head: %w", err) return nil, 0, xerrors.Errorf("getting chain head: %w", err)
} }
@ -528,35 +530,35 @@ func recoveryPiecesToFix(ctx context.Context, api SealingAPI, sector SectorInfo,
continue continue
} }
proposal, err := api.StateMarketStorageDealProposal(ctx, p.DealInfo.DealID, tok) deal, err := api.StateMarketStorageDeal(ctx, p.DealInfo.DealID, ts.Key())
if err != nil { if err != nil {
log.Warnf("getting deal %d for piece %d: %+v", p.DealInfo.DealID, i, err) log.Warnf("getting deal %d for piece %d: %+v", p.DealInfo.DealID, i, err)
toFix = append(toFix, i) toFix = append(toFix, i)
continue continue
} }
if 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, 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) toFix = append(toFix, i)
continue continue
} }
if proposal.PieceCID != p.Piece.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, proposal.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) toFix = append(toFix, i)
continue continue
} }
if 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, 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) toFix = append(toFix, i)
continue 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 // 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) // (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())
} }
} }

View File

@ -20,6 +20,7 @@ import (
api2 "github.com/filecoin-project/lotus/api" api2 "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types"
pipeline "github.com/filecoin-project/lotus/storage/pipeline" pipeline "github.com/filecoin-project/lotus/storage/pipeline"
"github.com/filecoin-project/lotus/storage/pipeline/mocks" "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 //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") pc := idCid("publishCID")
// expect GetCurrentDealInfo // expect GetCurrentDealInfo
{ {
api.EXPECT().StateSearchMsg(ctx, pc).Return(&pipeline.MsgLookup{ api.EXPECT().StateSearchMsg(ctx, gomock.Any(), pc, gomock.Any(), gomock.Any()).Return(&api2.MsgLookup{
Receipt: pipeline.MessageReceipt{ Receipt: types.MessageReceipt{
ExitCode: exitcode.Ok, ExitCode: exitcode.Ok,
Return: cborRet(&market0.PublishStorageDealsReturn{ Return: cborRet(&market0.PublishStorageDealsReturn{
IDs: []abi.DealID{dealId}, IDs: []abi.DealID{dealId},

View File

@ -8,8 +8,10 @@ import (
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
) )
func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) error { 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") 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 { if err != nil {
return xerrors.Errorf("failed to wait for fault declaration: %w", err) 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 // * Check for correct termination
// * wait for expiration (+winning lookback?) // * 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 { if err != nil {
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting sector info: %w", err)}) 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 { if si == nil {
// either already terminated or not committed yet // 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 { if err != nil {
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("checking precommit presence: %w", err)}) 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") 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 { if err != nil {
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("waiting for terminate message to land on chain: %w", err)}) 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 { func (m *Sealing) handleTerminateFinality(ctx statemachine.Context, sector SectorInfo) error {
for { for {
tok, epoch, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting chain head: %w", err)}) 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 { if err != nil {
return ctx.Send(SectorTerminateFailed{xerrors.Errorf("getting network version: %w", err)}) 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{}) 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 { select {
case <-time.After(toWait): case <-time.After(toWait):
continue continue

View File

@ -15,7 +15,9 @@ import (
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/lotus/api" "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/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
) )
func (m *Sealing) handleReplicaUpdate(ctx statemachine.Context, sector SectorInfo) error { 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) return xerrors.Errorf("invalid sector %d with nil CommR", sector.SectorNumber)
} }
// Abort upgrade for sectors that went faulty since being marked for upgrade // 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 { if err != nil {
log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleProveReplicaUpdate: api error, not proceeding: %+v", err)
return nil return nil
} }
active, err := m.sectorActive(ctx.Context(), tok, sector.SectorNumber) active, err := m.sectorActive(ctx.Context(), ts.Key(), sector.SectorNumber)
if err != nil { if err != nil {
log.Errorf("sector active check: api error, not proceeding: %+v", err) log.Errorf("sector active check: api error, not proceeding: %+v", err)
return nil 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 { 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
return nil 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{}) 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
return nil return nil
@ -119,7 +121,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
return xerrors.Errorf("getting config: %w", err) 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
return nil return nil
@ -142,7 +144,7 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec
//ReplaceSectorNumber: 0, //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 { if err != nil {
return xerrors.Errorf("getting initial pledge collateral: %w", err) 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)) 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err)
return nil 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) log.Errorf("no good address to send replica update message from: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) 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 { if err != nil {
log.Errorf("handleSubmitReplicaUpdate: error sending message: %+v", err) log.Errorf("handleSubmitReplicaUpdate: error sending message: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) return ctx.Send(SectorSubmitReplicaUpdateFailed{})
@ -186,7 +188,7 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) 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 { if err != nil {
log.Errorf("handleReplicaUpdateWait: failed to wait for message: %+v", err) log.Errorf("handleReplicaUpdateWait: failed to wait for message: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) return ctx.Send(SectorSubmitReplicaUpdateFailed{})
@ -203,7 +205,7 @@ func (m *Sealing) handleReplicaUpdateWait(ctx statemachine.Context, sector Secto
default: default:
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) 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 { if err != nil {
log.Errorf("api err failed to get sector info: %+v", err) log.Errorf("api err failed to get sector info: %+v", err)
return ctx.Send(SectorSubmitReplicaUpdateFailed{}) 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 { func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector SectorInfo) error {
try := func() 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 { if err != nil {
return err return err
} }
tok, _, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
return err return err
} }
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok) nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
if err != nil { if err != nil {
return err return err
} }
@ -253,9 +255,9 @@ func (m *Sealing) handleUpdateActivating(ctx statemachine.Context, sector Sector
targetHeight := mw.Height + lb + InteractivePoRepConfidence 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{}) return ctx.Send(SectorUpdateActive{})
}, func(ctx context.Context, ts TipSetToken) error { }, func(ctx context.Context, ts *types.TipSet) error {
log.Warn("revert in handleUpdateActivating") log.Warn("revert in handleUpdateActivating")
return nil return nil
}, InteractivePoRepConfidence, targetHeight) }, InteractivePoRepConfidence, targetHeight)

View File

@ -17,12 +17,14 @@ import (
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api" "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"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
var DealSectorPriority = 1024 var DealSectorPriority = 1024
@ -82,7 +84,7 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err
return ctx.Send(SectorPacked{FillerPieces: fillerPieces}) 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 { if len(sizes) == 0 {
return nil, nil 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) { 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 { if err != nil {
log.Errorf("getTicket: api error, not proceeding: %+v", err) log.Errorf("getTicket: api error, not proceeding: %+v", err)
return nil, 0, false, nil 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, // 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 // 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 { if aerr != nil {
log.Errorf("getTicket: api error, checking if sector is allocated: %+v", aerr) log.Errorf("getTicket: api error, checking if sector is allocated: %+v", aerr)
return nil, 0, false, nil return nil, 0, false, nil
} }
ticketEpoch := epoch - policy.SealRandomnessLookback ticketEpoch := ts.Height() - policy.SealRandomnessLookback
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
if err := m.maddr.MarshalCBOR(buf); err != nil { if err := m.maddr.MarshalCBOR(buf); err != nil {
return nil, 0, allocated, err 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 { if err != nil {
return nil, 0, allocated, xerrors.Errorf("getting precommit info: %w", err) 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 { if pci != nil {
ticketEpoch = pci.Info.SealRandEpoch ticketEpoch = pci.Info.SealRandEpoch
nv, err := m.Api.StateNetworkVersion(ctx.Context(), tok) nv, err := m.Api.StateNetworkVersion(ctx.Context(), ts.Key())
if err != nil { if err != nil {
return nil, 0, allocated, xerrors.Errorf("getTicket: StateNetworkVersion: api error, not proceeding: %+v", err) 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) 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") 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) 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 { if err != nil {
return nil, 0, allocated, err 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 { if err != nil {
log.Errorf("handlePreCommit1: api error, not proceeding: %+v", err) log.Errorf("handlePreCommit1: api error, not proceeding: %+v", err)
return nil return nil
} }
if checkTicketExpired(sector.TicketEpoch, height) { if checkTicketExpired(sector.TicketEpoch, ts.Height()) {
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 { if err != nil {
log.Errorf("handlePreCommit1: StateSectorPreCommitInfo: api error, not proceeding: %+v", err) log.Errorf("handlePreCommit1: StateSectorPreCommitInfo: api error, not proceeding: %+v", err)
return nil return nil
@ -232,7 +234,7 @@ func (m *Sealing) handlePreCommit1(ctx statemachine.Context, sector SectorInfo)
return ctx.Send(SectorOldTicket{}) // go get new ticket 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 { if err != nil {
log.Errorf("handlePreCommit1: StateNetworkVersion: api error, not proceeding: %+v", err) log.Errorf("handlePreCommit1: StateNetworkVersion: api error, not proceeding: %+v", err)
return nil 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 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 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) { func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (*miner.SectorPreCommitInfo, big.Int, types.TipSetKey, error) {
tok, height, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err) 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) { switch err := err.(type) {
case *ErrApi: case *ErrApi:
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err) 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) 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: 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: 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: case *ErrInvalidDeals:
log.Warnf("invalid deals in sector %d: %v", sector.SectorNumber, err) 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: 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: 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: case *ErrSectorNumberAllocated:
log.Errorf("handlePreCommitFailed: sector number already allocated, not proceeding: %+v", err) 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) // 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: 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...) expiration, err := m.pcp.Expiration(ctx.Context(), sector.Pieces...)
if err != nil { 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 { 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) av, err := actors.VersionForNetwork(nv)
if err != nil { 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) msd, err := policy.GetMaxProveCommitDuration(av, sector.SectorType)
if err != nil { 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 { 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 // 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 { if expiration > maxExpiration {
expiration = maxExpiration expiration = maxExpiration
} }
@ -354,12 +356,12 @@ func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (
DealIDs: sector.dealIDs(), 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 { 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 { 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 { if cfg.BatchPreCommits {
nv, err := m.Api.StateNetworkVersion(ctx.Context(), nil) nv, err := m.Api.StateNetworkVersion(ctx.Context(), types.EmptyTSK)
if err != nil { if err != nil {
return xerrors.Errorf("getting network version: %w", err) 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 { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("preCommitParams: %w", err)}) 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)}) 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 { if err != nil {
log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err) log.Errorf("handlePreCommitting: api error, not proceeding: %+v", err)
return nil 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) 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 { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) 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 // 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) 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 { if err != nil {
return ctx.Send(SectorChainPreCommitFailed{err}) 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) 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 { 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 { if err != nil {
log.Errorf("handleWaitSeed: api error, not proceeding: %+v", err) log.Errorf("handleWaitSeed: api error, not proceeding: %+v", err)
return nil 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 { if err != nil {
return xerrors.Errorf("getting precommit info: %w", err) 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() 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 // in case of null blocks the randomness can land after the tipset we
// get from the events API // get from the events API
tok, _, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
log.Errorf("handleCommitting: api error, not proceeding: %+v", err) log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
return nil return nil
@ -509,9 +511,9 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er
if err := m.maddr.MarshalCBOR(buf); err != nil { if err := m.maddr.MarshalCBOR(buf); err != nil {
return err 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 { 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}) _ = ctx.Send(SectorChainPreCommitFailed{error: err})
return 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}) _ = ctx.Send(SectorSeedReady{SeedValue: abi.InteractiveSealRandomness(rand), SeedEpoch: randHeight})
return nil 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") log.Warn("revert in interactive commit sector step")
// TODO: need to cancel running process and restart... // TODO: need to cancel running process and restart...
return nil return nil
@ -536,7 +538,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
if sector.CommitMessage != nil { if sector.CommitMessage != nil {
log.Warnf("sector %d entered committing state with a commit message cid", sector.SectorNumber) 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 { if err != nil {
log.Warnf("sector %d searching existing commit message %s: %+v", sector.SectorNumber, *sector.CommitMessage, err) 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")}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")})
} }
cids := storage.SectorCids{ cids := storiface.SectorCids{
Unsealed: *sector.CommD, Unsealed: *sector.CommD,
Sealed: *sector.CommR, 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 { if err != nil {
log.Errorf("handleCommitting: api error, not proceeding: %+v", err) log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
return nil 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)}) 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 { if cfg.AggregateCommits {
nv, err := m.Api.StateNetworkVersion(ctx.Context(), nil) nv, err := m.Api.StateNetworkVersion(ctx.Context(), types.EmptyTSK)
if err != nil { if err != nil {
return xerrors.Errorf("getting network version: %w", err) 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 { if err != nil {
log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err) log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err)
return nil 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)}) 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)}) 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 { if err != nil {
log.Errorf("handleCommitting: api error, not proceeding: %+v", err) log.Errorf("handleCommitting: api error, not proceeding: %+v", err)
return nil 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 { if err != nil {
return xerrors.Errorf("getting precommit info: %w", err) 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")}) 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 { if err != nil {
return xerrors.Errorf("getting initial pledge collateral: %w", err) 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 // 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 { if err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) 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 != "" { if err != nil || res.Error != "" {
tok, _, err := m.Api.ChainHead(ctx.Context()) ts, err := m.Api.ChainHead(ctx.Context())
if err != nil { if err != nil {
log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err) log.Errorf("handleSubmitCommit: api error, not proceeding: %+v", err)
return nil 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)}) 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")}) 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 { if err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("failed to wait for porep inclusion: %w", err)}) 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)}) 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 { if err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("proof validation failed, calling StateSectorGetInfo: %w", err)}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("proof validation failed, calling StateSectorGetInfo: %w", err)})
} }

View File

@ -19,15 +19,17 @@ import (
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/api" "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" "github.com/filecoin-project/lotus/node/config"
) )
type TerminateBatcherApi interface { type TerminateBatcherApi interface {
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*SectorLocation, error) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk types.TipSetKey) (*lminer.SectorLocation, error)
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (api.MinerInfo, error) StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error)
StateMinerProvingDeadline(context.Context, address.Address, TipSetToken) (*dline.Info, error) StateMinerProvingDeadline(context.Context, address.Address, types.TipSetKey) (*dline.Info, error)
StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tok TipSetToken) ([]api.Partition, error) StateMinerPartitions(ctx context.Context, m address.Address, dlIdx uint64, tsk types.TipSetKey) ([]api.Partition, error)
} }
type TerminateBatcher struct { type TerminateBatcher struct {
@ -38,7 +40,7 @@ type TerminateBatcher struct {
feeCfg config.MinerFeeConfig feeCfg config.MinerFeeConfig
getConfig GetSealingConfigFunc getConfig GetSealingConfigFunc
todo map[SectorLocation]*bitfield.BitField // MinerSectorLocation -> BitField todo map[lminer.SectorLocation]*bitfield.BitField // MinerSectorLocation -> BitField
waiting map[abi.SectorNumber][]chan cid.Cid waiting map[abi.SectorNumber][]chan cid.Cid
@ -56,7 +58,7 @@ func NewTerminationBatcher(mctx context.Context, maddr address.Address, api Term
feeCfg: feeCfg, feeCfg: feeCfg,
getConfig: getConfig, getConfig: getConfig,
todo: map[SectorLocation]*bitfield.BitField{}, todo: map[lminer.SectorLocation]*bitfield.BitField{},
waiting: map[abi.SectorNumber][]chan cid.Cid{}, waiting: map[abi.SectorNumber][]chan cid.Cid{},
notify: make(chan struct{}, 1), notify: make(chan struct{}, 1),
@ -107,7 +109,7 @@ func (b *TerminateBatcher) run() {
} }
func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) { 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 { if err != nil {
return nil, xerrors.Errorf("getting proving deadline info failed: %w", err) 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 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 { if err != nil {
log.Warnw("TerminateBatcher: getting miner partitions", "deadline", loc.Deadline, "partition", loc.Partition, "error", err) log.Warnw("TerminateBatcher: getting miner partitions", "deadline", loc.Deadline, "partition", loc.Partition, "error", err)
continue 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) 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 { if err != nil {
return nil, xerrors.Errorf("couldn't get miner info: %w", err) return nil, xerrors.Errorf("couldn't get miner info: %w", err)
} }
@ -220,14 +222,14 @@ func (b *TerminateBatcher) processBatch(notif, after bool) (*cid.Cid, error) {
return nil, xerrors.Errorf("no good address found: %w", err) 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 { if err != nil {
return nil, xerrors.Errorf("sending message failed: %w", err) return nil, xerrors.Errorf("sending message failed: %w", err)
} }
log.Infow("Sent TerminateSectors message", "cid", mcid, "from", from, "terminations", len(params.Terminations)) log.Infow("Sent TerminateSectors message", "cid", mcid, "from", from, "terminations", len(params.Terminations))
for _, t := range params.Terminations { for _, t := range params.Terminations {
delete(b.todo, SectorLocation{ delete(b.todo, lminer.SectorLocation{
Deadline: t.Deadline, Deadline: t.Deadline,
Partition: t.Partition, Partition: t.Partition,
}) })
@ -256,7 +258,7 @@ func (b *TerminateBatcher) AddTermination(ctx context.Context, s abi.SectorID) (
return cid.Undef, false, err 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 { if err != nil {
return cid.Undef, false, xerrors.Errorf("getting sector location: %w", err) 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 // 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 { if err != nil {
return cid.Cid{}, false, xerrors.Errorf("getting partitions: %w", err) return cid.Cid{}, false, xerrors.Errorf("getting partitions: %w", err)
} }

View File

@ -1,7 +1,6 @@
package sealing package sealing
import ( import (
"bytes"
"context" "context"
"github.com/ipfs/go-cid" "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/abi"
"github.com/filecoin-project/go-state-types/big" "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/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/api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/pipeline/sealiface"
"github.com/filecoin-project/lotus/storage/sealer" "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 //go:generate go run github.com/golang/mock/mockgen -destination=mocks/statemachine.go -package=mocks . Context
@ -69,7 +68,7 @@ type SectorInfo struct {
// PreCommit1 // PreCommit1
TicketValue abi.SealRandomness TicketValue abi.SealRandomness
TicketEpoch abi.ChainEpoch TicketEpoch abi.ChainEpoch
PreCommit1Out storage.PreCommit1Out PreCommit1Out storiface.PreCommit1Out
// PreCommit2 // PreCommit2
CommD *cid.Cid CommD *cid.Cid
@ -79,7 +78,7 @@ type SectorInfo struct {
PreCommitInfo *miner.SectorPreCommitInfo PreCommitInfo *miner.SectorPreCommitInfo
PreCommitDeposit big.Int PreCommitDeposit big.Int
PreCommitMessage *cid.Cid PreCommitMessage *cid.Cid
PreCommitTipSet TipSetToken PreCommitTipSet types.TipSetKey
PreCommit2Fails uint64 PreCommit2Fails uint64
@ -96,7 +95,7 @@ type SectorInfo struct {
CCPieces []Piece CCPieces []Piece
UpdateSealed *cid.Cid UpdateSealed *cid.Cid
UpdateUnsealed *cid.Cid UpdateUnsealed *cid.Cid
ReplicaUpdateProof storage.ReplicaUpdateProof ReplicaUpdateProof storiface.ReplicaUpdateProof
ReplicaUpdateMessage *cid.Cid ReplicaUpdateMessage *cid.Cid
// Faults // 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 // Returns list of offset/length tuples of sector data ranges which clients
// requested to keep unsealed // requested to keep unsealed
func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storage.Range { func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storiface.Range {
var out []storage.Range var out []storiface.Range
var at abi.UnpaddedPieceSize var at abi.UnpaddedPieceSize
for _, piece := range pieces { for _, piece := range pieces {
@ -183,7 +182,7 @@ func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool)
continue continue
} }
out = append(out, storage.Range{ out = append(out, storiface.Range{
Offset: at - psize, Offset: at - psize,
Size: psize, Size: psize,
}) })
@ -196,22 +195,4 @@ type SectorIDCounter interface {
Next() (abi.SectorNumber, error) 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) 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
}

View File

@ -7,6 +7,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" 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 { 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") 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 { if err != nil {
return xerrors.Errorf("couldnt get chain head: %w", err) 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 { if err != nil {
return xerrors.Errorf("failed to read sector on chain info: %w", err) 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 { if err != nil {
return xerrors.Errorf("failed to check if sector is active") 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") 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."+ 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) "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{}) return m.sectors.Send(uint64(id), SectorMarkForUpdate{})
} }
func (m *Sealing) sectorActive(ctx context.Context, tok TipSetToken, sector abi.SectorNumber) (bool, error) { func (m *Sealing) sectorActive(ctx context.Context, tsk types.TipSetKey, sector abi.SectorNumber) (bool, error) {
active, err := m.Api.StateMinerActiveSectors(ctx, m.maddr, tok) dls, err := m.Api.StateMinerDeadlines(ctx, m.maddr, tsk)
if err != nil { 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
} }

View File

@ -4,12 +4,15 @@ import (
"context" "context"
"math/bits" "math/bits"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/storage/pipeline/sealiface" "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 { 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) { }, maddr address.Address, cfg sealiface.Config, collateral abi.TokenAmount) (abi.TokenAmount, error) {
if cfg.CollateralFromMinerBalance { if cfg.CollateralFromMinerBalance {
if cfg.DisableCollateralFallback { if cfg.DisableCollateralFallback {
return big.Zero(), nil return big.Zero(), nil
} }
avail, err := api.StateMinerAvailableBalance(ctx, maddr, nil) avail, err := api.StateMinerAvailableBalance(ctx, maddr, types.EmptyTSK)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("getting available miner balance: %w", err) 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 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
}

View File

@ -11,7 +11,6 @@ import (
ffi "github.com/filecoin-project/filecoin-ffi" ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
@ -20,11 +19,11 @@ var PostCheckTimeout = 160 * time.Second
// FaultTracker TODO: Track things more actively // FaultTracker TODO: Track things more actively
type FaultTracker interface { 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 // 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) ctx, cancel := context.WithCancel(ctx)
defer cancel() defer cancel()
@ -61,7 +60,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof,
return nil, ctx.Err() return nil, ctx.Err()
} }
go func(sector storage.SectorRef) { go func(sector storiface.SectorRef) {
defer wg.Done() defer wg.Done()
defer func() { defer func() {
<-throttle <-throttle

View File

@ -7,7 +7,6 @@ import (
"sync" "sync"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
@ -24,7 +23,7 @@ type Provider struct {
waitSector map[sectorFile]chan 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 if err := os.Mkdir(filepath.Join(b.Root, storiface.FTUnsealed.String()), 0755); err != nil && !os.IsExist(err) { // nolint
return storiface.SectorPaths{}, nil, err return storiface.SectorPaths{}, nil, err
} }

View File

@ -6,11 +6,13 @@ package ffiwrapper
import ( import (
ffi "github.com/filecoin-project/filecoin-ffi" ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
var ProofProver = proofProver{} var ProofProver = proofProver{}
var _ Prover = ProofProver var _ storiface.Prover = ProofProver
type proofProver struct{} type proofProver struct{}

View File

@ -26,7 +26,6 @@ import (
commcid "github.com/filecoin-project/go-fil-commcid" commcid "github.com/filecoin-project/go-fil-commcid"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/lib/nullreader" "github.com/filecoin-project/lotus/lib/nullreader"
nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader"
@ -35,7 +34,7 @@ import (
"github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
var _ Storage = &Sealer{} var _ storiface.Storage = &Sealer{}
func New(sectors SectorProvider) (*Sealer, error) { func New(sectors SectorProvider) (*Sealer, error) {
sb := &Sealer{ sb := &Sealer{
@ -47,13 +46,13 @@ func New(sectors SectorProvider) (*Sealer, error) {
return sb, nil 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 // TODO: Allocate the sector here instead of in addpiece
return nil 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 = io.LimitReader(io.MultiReader(
pieceData, pieceData,
nullreader.Reader{}, nullreader.Reader{},
@ -173,7 +172,7 @@ func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize,
}, nil }, 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: // TODO: allow tuning those:
chunk := abi.PaddedPieceSize(4 << 20) chunk := abi.PaddedPieceSize(4 << 20)
parallel := runtime.NumCPU() parallel := runtime.NumCPU()
@ -377,7 +376,7 @@ func (sb *Sealer) pieceCid(spt abi.RegisteredSealProof, in []byte) (cid.Cid, err
return pieceCID, werr() 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) replicaPath, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage)
if xerrors.Is(err, storiface.ErrSectorNotFound) { if xerrors.Is(err, storiface.ErrSectorNotFound) {
return false, nil 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) 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage)
if err == nil { if err == nil {
return paths, done, err 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) 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() ssize, err := sector.ProofType.SectorSize()
if err != nil { if err != nil {
return err return err
@ -605,7 +604,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, off
return nil 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) path, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTNone, storiface.PathStorage)
if err != nil { if err != nil {
return false, xerrors.Errorf("acquire unsealed sector path: %w", err) 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 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache, storiface.FTSealed, storiface.PathSealing)
if err != nil { if err != nil {
return xerrors.Errorf("acquiring sector paths: %w", err) return xerrors.Errorf("acquiring sector paths: %w", err)
@ -706,7 +705,7 @@ func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storage.Sector
return nil 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTSealed|storiface.FTCache, storiface.PathSealing)
if err != nil { if err != nil {
return nil, xerrors.Errorf("acquiring sector paths: %w", err) 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 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing)
if err != nil { 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() defer done()
sealedCID, unsealedCID, err := ffi.SealPreCommitPhase2(phase1Out, paths.Cache, paths.Sealed) sealedCID, unsealedCID, err := ffi.SealPreCommitPhase2(phase1Out, paths.Cache, paths.Sealed)
if err != nil { 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() ssize, err := sector.ProofType.SectorSize()
if err != nil { 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{}{} p1odec := map[string]interface{}{}
if err := json.Unmarshal(phase1Out, &p1odec); err != nil { 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 var ticket abi.SealRandomness
@ -805,7 +804,7 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef,
if found { if found {
ticket, err = base64.StdEncoding.DecodeString(ti.(string)) ticket, err = base64.StdEncoding.DecodeString(ti.(string))
if err != nil { 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++ { 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.Warn("checking PreCommit failed: ", err)
log.Warnf("num:%d tkt:%v seed:%v sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sd[:], sealedCID, unsealedCID) 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, Unsealed: unsealedCID,
Sealed: sealedCID, Sealed: sealedCID,
}, nil }, 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing)
if err != nil { if err != nil {
return nil, xerrors.Errorf("acquire sector paths: %w", err) 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 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) 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) { func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) {
empty := storage.ReplicaUpdateOut{} empty := storiface.ReplicaUpdateOut{}
paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing)
if err != nil { if err != nil {
return empty, xerrors.Errorf("failed to acquire sector paths: %w", err) 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 { if err != nil {
return empty, xerrors.Errorf("failed to update replica %d with new deal data: %w", sector.ID.Number, err) 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathSealing)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to acquire sector paths: %w", err) 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 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 updateProofType := abi.SealProofInfos[sector.ProofType].UpdateProof
return ffi.SectorUpdate.GenerateUpdateProofWithVanilla(updateProofType, sectorKey, newSealed, newUnsealed, vanillaProofs) 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) paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTSealed, storiface.PathSealing)
defer done() defer done()
if err != nil { 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) 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") 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() ssize, err := sector.ProofType.SectorSize()
if err != nil { if err != nil {
return err return err
@ -1040,7 +1039,7 @@ func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, ke
return nil 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() ssize, err := sector.ProofType.SectorSize()
if err != nil { if err != nil {
return err return err
@ -1059,7 +1058,7 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef,
return ffi.ClearCache(uint64(ssize), paths.Cache) 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() ssize, err := sector.ProofType.SectorSize()
if err != nil { if err != nil {
return err return err
@ -1096,7 +1095,7 @@ func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect
return nil 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 // 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 // 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 // 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") 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") 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") 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 return xerrors.Errorf("not supported at this layer") // happens in localworker
} }

View File

@ -26,7 +26,6 @@ import (
"github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
prooftypes "github.com/filecoin-project/go-state-types/proof" prooftypes "github.com/filecoin-project/go-state-types/proof"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" "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} 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 { type seal struct {
ref storage.SectorRef ref storiface.SectorRef
cids storage.SectorCids cids storiface.SectorCids
pi abi.PieceInfo pi abi.PieceInfo
ticket abi.SealRandomness 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() defer done()
dlen := abi.PaddedPieceSize(sectorSize).Unpadded() 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} 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() defer done()
pc1, err := sb.SealCommit1(context.TODO(), s.ref, s.ticket, seed, []abi.PieceInfo{s.pi}, s.cids) 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 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() defer done()
var b bytes.Buffer 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) paths, done, err := sealer.sectors.AcquireSector(context.Background(), id, storiface.FTSealed, 0, storiface.PathStorage)
require.NoError(t, err) require.NoError(t, err)
defer done() defer done()
@ -306,7 +305,7 @@ func TestSealAndVerify(t *testing.T) {
} }
}) })
si := storage.SectorRef{ si := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 1}, ID: abi.SectorID{Miner: miner, Number: 1},
ProofType: sealProofType, ProofType: sealProofType,
} }
@ -379,7 +378,7 @@ func TestSealPoStNoCommit(t *testing.T) {
} }
}) })
si := storage.SectorRef{ si := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 1}, ID: abi.SectorID{Miner: miner, Number: 1},
ProofType: sealProofType, ProofType: sealProofType,
} }
@ -441,15 +440,15 @@ func TestSealAndVerify3(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
si1 := storage.SectorRef{ si1 := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 1}, ID: abi.SectorID{Miner: miner, Number: 1},
ProofType: sealProofType, ProofType: sealProofType,
} }
si2 := storage.SectorRef{ si2 := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 2}, ID: abi.SectorID{Miner: miner, Number: 2},
ProofType: sealProofType, ProofType: sealProofType,
} }
si3 := storage.SectorRef{ si3 := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 3}, ID: abi.SectorID{Miner: miner, Number: 3},
ProofType: sealProofType, ProofType: sealProofType,
} }
@ -529,7 +528,7 @@ func TestSealAndVerifyAggregate(t *testing.T) {
toAggregate := make([][]byte, numAgg) toAggregate := make([][]byte, numAgg)
for i := 0; i < numAgg; i++ { for i := 0; i < numAgg; i++ {
si := storage.SectorRef{ si := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: abi.SectorNumber(i + 1)}, ID: abi.SectorID{Miner: miner, Number: abi.SectorNumber(i + 1)},
ProofType: sealProofType, ProofType: sealProofType,
} }
@ -763,7 +762,7 @@ func TestAddPiece512M(t *testing.T) {
r := rand.New(rand.NewSource(0x7e5)) 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{ ID: abi.SectorID{
Miner: miner, Miner: miner,
Number: 0, Number: 0,
@ -806,7 +805,7 @@ func BenchmarkAddPiece512M(b *testing.B) {
b.Cleanup(cleanup) b.Cleanup(cleanup)
for i := 0; i < b.N; i++ { 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{ ID: abi.SectorID{
Miner: miner, Miner: miner,
Number: abi.SectorNumber(i), Number: abi.SectorNumber(i),
@ -849,7 +848,7 @@ func TestAddPiece512MPadded(t *testing.T) {
r := rand.New(rand.NewSource(0x7e5)) 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{ ID: abi.SectorID{
Miner: miner, Miner: miner,
Number: 0, Number: 0,
@ -917,7 +916,7 @@ func TestMulticoreSDR(t *testing.T) {
} }
}) })
si := storage.SectorRef{ si := storiface.SectorRef{
ID: abi.SectorID{Miner: miner, Number: 1}, ID: abi.SectorID{Miner: miner, Number: 1},
ProofType: sealProofType, ProofType: sealProofType,
} }

View File

@ -2,57 +2,15 @@ package ffiwrapper
import ( import (
"context" "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/ffiwrapper/basicfs"
"github.com/filecoin-project/lotus/storage/sealer/storiface" "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 { type SectorProvider interface {
// * returns storiface.ErrSectorNotFound if a requested existing sector doesn't exist // * 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 // * 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{} var _ SectorProvider = &basicfs.Provider{}

View File

@ -12,7 +12,6 @@ import (
ffi "github.com/filecoin-project/filecoin-ffi" ffi "github.com/filecoin-project/filecoin-ffi"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" "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" "github.com/filecoin-project/lotus/storage/sealer/storiface"
) )
@ -76,7 +75,7 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
continue continue
} }
sid := storage.SectorRef{ sid := storiface.SectorRef{
ID: abi.SectorID{Miner: mid, Number: s.SectorNumber}, ID: abi.SectorID{Miner: mid, Number: s.SectorNumber},
ProofType: s.SealProof, ProofType: s.SealProof,
} }
@ -129,7 +128,7 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID,
return ffi.NewSortedPrivateSectorInfo(out...), skipped, done, nil return ffi.NewSortedPrivateSectorInfo(out...), skipped, done, nil
} }
var _ Verifier = ProofVerifier var _ storiface.Verifier = ProofVerifier
type proofVerifier struct{} type proofVerifier struct{}

Some files were not shown because too many files have changed in this diff Show More