Merge pull request #37 from filecoin-project/feat/veryverysimplefaultchecks

Very simple fault check function
This commit is contained in:
Łukasz Magiera 2020-05-16 23:22:31 +02:00 committed by GitHub
commit e620df4c43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 3 deletions

48
faults.go Normal file
View File

@ -0,0 +1,48 @@
package sectorstorage
import (
"context"
"golang.org/x/xerrors"
"github.com/filecoin-project/sector-storage/stores"
"github.com/filecoin-project/specs-actors/actors/abi"
)
// TODO: Track things more actively
type FaultTracker interface {
CheckProvable(ctx context.Context, spt abi.RegisteredProof, sectors []abi.SectorID) ([]abi.SectorID, error)
}
// Returns unprovable sectors
func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredProof, sectors []abi.SectorID) ([]abi.SectorID, error) {
var bad []abi.SectorID
// TODO: More better checks
for _, sector := range sectors {
err := func() error {
lp, _, done, err := m.localStore.AcquireSector(ctx, sector, spt, stores.FTSealed|stores.FTCache, stores.FTNone, false)
if err != nil {
return xerrors.Errorf("acquire sector in checkProvable: %w", err)
}
defer done()
if lp.Sealed == "" || lp.Cache == "" {
log.Warnw("CheckProvable Sector FAULT: cache an/or sealed paths not found", "sector", sector, "sealed", lp.Sealed, "cache", lp.Cache)
bad = append(bad, sector)
return nil
}
// must be fine
return nil
}()
if err != nil {
return nil, err
}
}
return bad, nil
}
var _ FaultTracker = &Manager{}

View File

@ -50,6 +50,7 @@ type SectorManager interface {
ffiwrapper.StorageSealer ffiwrapper.StorageSealer
storage.Prover storage.Prover
FaultTracker
} }
type WorkerID uint64 type WorkerID uint64

View File

@ -288,6 +288,10 @@ func (mgr *SectorMgr) FinalizeSector(context.Context, abi.SectorID) error {
return nil return nil
} }
func (mgr *SectorMgr) CheckProvable(context.Context, abi.RegisteredProof, []abi.SectorID) ([]abi.SectorID, error) {
return nil, nil
}
func (m mockVerif) VerifySeal(svi abi.SealVerifyInfo) (bool, error) { func (m mockVerif) VerifySeal(svi abi.SealVerifyInfo) (bool, error) {
if len(svi.OnChain.Proof) != 32 { // Real ones are longer, but this should be fine if len(svi.OnChain.Proof) != 32 { // Real ones are longer, but this should be fine
return false, nil return false, nil

View File

@ -201,16 +201,16 @@ var ResourceTable = map[sealtasks.TaskType]map[abi.RegisteredProof]Resources{
Threads: -1, Threads: -1,
CanGPU: true, CanGPU: true,
BaseMinMemory: 128 << 30, // params BaseMinMemory: 64 << 30, // params
}, },
abi.RegisteredProof_StackedDRG32GiBSeal: Resources{ abi.RegisteredProof_StackedDRG32GiBSeal: Resources{
MaxMemory: 130 << 30, MaxMemory: 150 << 30, // TODO: ~30G of this should really be BaseMaxMemory
MinMemory: 30 << 30, MinMemory: 30 << 30,
Threads: -1, Threads: -1,
CanGPU: true, CanGPU: true,
BaseMinMemory: 64 << 30, // params BaseMinMemory: 32 << 30, // params
}, },
abi.RegisteredProof_StackedDRG512MiBSeal: Resources{ abi.RegisteredProof_StackedDRG512MiBSeal: Resources{
MaxMemory: 3 << 29, // 1.5G MaxMemory: 3 << 29, // 1.5G