Unbreak tests
This commit is contained in:
parent
886d9cd5eb
commit
baf91f08a1
26
extern/storage-sealing/fsm_test.go
vendored
26
extern/storage-sealing/fsm_test.go
vendored
@ -3,6 +3,8 @@ package sealing
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
@ -25,8 +27,14 @@ type test struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHappyPath(t *testing.T) {
|
func TestHappyPath(t *testing.T) {
|
||||||
|
ma, _ := address.NewIDAddress(55151)
|
||||||
m := test{
|
m := test{
|
||||||
s: &Sealing{},
|
s: &Sealing{
|
||||||
|
maddr: ma,
|
||||||
|
stats: SectorStats{
|
||||||
|
bySector: map[abi.SectorID]statSectorState{},
|
||||||
|
},
|
||||||
|
},
|
||||||
t: t,
|
t: t,
|
||||||
state: &SectorInfo{State: Packing},
|
state: &SectorInfo{State: Packing},
|
||||||
}
|
}
|
||||||
@ -60,8 +68,14 @@ func TestHappyPath(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSeedRevert(t *testing.T) {
|
func TestSeedRevert(t *testing.T) {
|
||||||
|
ma, _ := address.NewIDAddress(55151)
|
||||||
m := test{
|
m := test{
|
||||||
s: &Sealing{},
|
s: &Sealing{
|
||||||
|
maddr: ma,
|
||||||
|
stats: SectorStats{
|
||||||
|
bySector: map[abi.SectorID]statSectorState{},
|
||||||
|
},
|
||||||
|
},
|
||||||
t: t,
|
t: t,
|
||||||
state: &SectorInfo{State: Packing},
|
state: &SectorInfo{State: Packing},
|
||||||
}
|
}
|
||||||
@ -101,8 +115,14 @@ func TestSeedRevert(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {
|
func TestPlanCommittingHandlesSectorCommitFailed(t *testing.T) {
|
||||||
|
ma, _ := address.NewIDAddress(55151)
|
||||||
m := test{
|
m := test{
|
||||||
s: &Sealing{},
|
s: &Sealing{
|
||||||
|
maddr: ma,
|
||||||
|
stats: SectorStats{
|
||||||
|
bySector: map[abi.SectorID]statSectorState{},
|
||||||
|
},
|
||||||
|
},
|
||||||
t: t,
|
t: t,
|
||||||
state: &SectorInfo{State: Committing},
|
state: &SectorInfo{State: Committing},
|
||||||
}
|
}
|
||||||
|
16
extern/storage-sealing/sealiface/config.go
vendored
Normal file
16
extern/storage-sealing/sealiface/config.go
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package sealiface
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
// this has to be in a separate package to not make lotus API depend on filecoin-ffi
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
// 0 = no limit
|
||||||
|
MaxWaitDealsSectors uint64
|
||||||
|
|
||||||
|
// includes failed, 0 = no limit
|
||||||
|
MaxSealingSectors uint64
|
||||||
|
|
||||||
|
WaitDealsDelay time.Duration
|
||||||
|
}
|
||||||
|
|
10
extern/storage-sealing/sealing.go
vendored
10
extern/storage-sealing/sealing.go
vendored
@ -35,16 +35,6 @@ type SectorLocation struct {
|
|||||||
Partition uint64
|
Partition uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
// 0 = no limit
|
|
||||||
MaxWaitDealsSectors uint64
|
|
||||||
|
|
||||||
// includes failed, 0 = no limit
|
|
||||||
MaxSealingSectors uint64
|
|
||||||
|
|
||||||
WaitDealsDelay time.Duration
|
|
||||||
}
|
|
||||||
|
|
||||||
var ErrSectorAllocated = errors.New("sectorNumber is allocated, but PreCommit info wasn't found on chain")
|
var ErrSectorAllocated = errors.New("sectorNumber is allocated, but PreCommit info wasn't found on chain")
|
||||||
|
|
||||||
type SealingAPI interface {
|
type SealingAPI interface {
|
||||||
|
3
extern/storage-sealing/types.go
vendored
3
extern/storage-sealing/types.go
vendored
@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
|
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Piece is a tuple of piece and deal info
|
// Piece is a tuple of piece and deal info
|
||||||
@ -186,7 +187,7 @@ type MessageReceipt struct {
|
|||||||
GasUsed int64
|
GasUsed int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetSealingConfigFunc func() (Config, error)
|
type GetSealingConfigFunc func() (sealiface.Config, error)
|
||||||
|
|
||||||
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
|
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
|
||||||
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
|
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
|
||||||
|
@ -8,8 +8,9 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MinerAddress address.Address
|
type MinerAddress address.Address
|
||||||
@ -57,10 +58,10 @@ type ConsiderOfflineRetrievalDealsConfigFunc func() (bool, error)
|
|||||||
type SetConsiderOfflineRetrievalDealsConfigFunc func(bool) error
|
type SetConsiderOfflineRetrievalDealsConfigFunc func(bool) error
|
||||||
|
|
||||||
// SetSealingDelay sets how long a sector waits for more deals before sealing begins.
|
// SetSealingDelay sets how long a sector waits for more deals before sealing begins.
|
||||||
type SetSealingConfigFunc func(sealing.Config) error
|
type SetSealingConfigFunc func(sealiface.Config) error
|
||||||
|
|
||||||
// GetSealingDelay returns how long a sector waits for more deals before sealing begins.
|
// GetSealingDelay returns how long a sector waits for more deals before sealing begins.
|
||||||
type GetSealingConfigFunc func() (sealing.Config, error)
|
type GetSealingConfigFunc func() (sealiface.Config, error)
|
||||||
|
|
||||||
// SetExpectedSealDurationFunc is a function which is used to set how long sealing is expected to take.
|
// SetExpectedSealDurationFunc is a function which is used to set how long sealing is expected to take.
|
||||||
// Deals that would need to start earlier than this duration will be rejected.
|
// Deals that would need to start earlier than this duration will be rejected.
|
||||||
|
@ -48,6 +48,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
|
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
|
||||||
|
|
||||||
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"
|
||||||
@ -594,7 +595,7 @@ func NewSetConsiderOfflineRetrievalDealsConfigFunc(r repo.LockedRepo) (dtypes.Se
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error) {
|
func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error) {
|
||||||
return func(cfg sealing.Config) (err error) {
|
return func(cfg sealiface.Config) (err error) {
|
||||||
err = mutateCfg(r, func(c *config.StorageMiner) {
|
err = mutateCfg(r, func(c *config.StorageMiner) {
|
||||||
c.Sealing = config.SealingConfig{
|
c.Sealing = config.SealingConfig{
|
||||||
MaxWaitDealsSectors: cfg.MaxWaitDealsSectors,
|
MaxWaitDealsSectors: cfg.MaxWaitDealsSectors,
|
||||||
@ -607,9 +608,9 @@ func NewSetSealConfigFunc(r repo.LockedRepo) (dtypes.SetSealingConfigFunc, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewGetSealConfigFunc(r repo.LockedRepo) (dtypes.GetSealingConfigFunc, error) {
|
func NewGetSealConfigFunc(r repo.LockedRepo) (dtypes.GetSealingConfigFunc, error) {
|
||||||
return func() (out sealing.Config, err error) {
|
return func() (out sealiface.Config, err error) {
|
||||||
err = readCfg(r, func(cfg *config.StorageMiner) {
|
err = readCfg(r, func(cfg *config.StorageMiner) {
|
||||||
out = sealing.Config{
|
out = sealiface.Config{
|
||||||
MaxWaitDealsSectors: cfg.Sealing.MaxWaitDealsSectors,
|
MaxWaitDealsSectors: cfg.Sealing.MaxWaitDealsSectors,
|
||||||
MaxSealingSectors: cfg.Sealing.MaxSealingSectors,
|
MaxSealingSectors: cfg.Sealing.MaxSealingSectors,
|
||||||
WaitDealsDelay: time.Duration(cfg.Sealing.WaitDealsDelay),
|
WaitDealsDelay: time.Duration(cfg.Sealing.WaitDealsDelay),
|
||||||
|
Loading…
Reference in New Issue
Block a user