diff --git a/extern/sector-storage/ffiwrapper/sealer_cgo.go b/extern/sector-storage/ffiwrapper/sealer_cgo.go index 92a893437..5783a3547 100644 --- a/extern/sector-storage/ffiwrapper/sealer_cgo.go +++ b/extern/sector-storage/ffiwrapper/sealer_cgo.go @@ -10,14 +10,13 @@ import ( "crypto/rand" "encoding/base64" "encoding/json" + "github.com/ipfs/go-cid" + "golang.org/x/xerrors" "io" "math/bits" "os" "runtime" - "github.com/ipfs/go-cid" - "golang.org/x/xerrors" - ffi "github.com/filecoin-project/filecoin-ffi" rlepluslazy "github.com/filecoin-project/go-bitfield/rle" commcid "github.com/filecoin-project/go-fil-commcid" diff --git a/extern/sector-storage/manager_post.go b/extern/sector-storage/manager_post.go index 55b6168e8..2a9cf10bc 100644 --- a/extern/sector-storage/manager_post.go +++ b/extern/sector-storage/manager_post.go @@ -134,6 +134,10 @@ func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, s return nil, nil, xerrors.Errorf("generating fallback challenges: %v", err) } + sort.Slice(postChallenges.Sectors, func(i, j int) bool { + return postChallenges.Sectors[i] < postChallenges.Sectors[j] + }) + proofList := make([]ffi.PartitionProof, partitionCount) var wg sync.WaitGroup wg.Add(int(partitionCount)) @@ -162,16 +166,17 @@ func (m *Manager) generateWindowPoSt(ctx context.Context, minerID abi.ActorID, s } p, sk, err := m.generatePartitionWindowPost(cctx, spt, ppt, minerID, int(partIdx), sectors, randomness) - if len(sk) > 0 { - log.Errorf("generateWindowPost part:%d, skipped:%d, err: %+v", partIdx, len(sk), err) + if err != nil || len(sk) > 0 { + log.Errorf("generateWindowPost part:%d, skipped:%d, sectors: %d, err: %+v", partIdx, len(sk), len(sectors), err) flk.Lock() skipped = append(skipped, sk...) + + if err != nil { + retErr = multierror.Append(retErr, xerrors.Errorf("partitionCount:%d err:%+v", partIdx, err)) + return + } flk.Unlock() } - if err != nil { - retErr = multierror.Append(retErr, xerrors.Errorf("partitionCount:%d err:%+v", partIdx, err)) - return - } proofList[partIdx] = ffi.PartitionProof(p) }(partIdx) diff --git a/extern/sector-storage/worker_local.go b/extern/sector-storage/worker_local.go index c82c5f4db..9079c9d18 100644 --- a/extern/sector-storage/worker_local.go +++ b/extern/sector-storage/worker_local.go @@ -568,21 +568,32 @@ func (l *LocalWorker) GenerateWindowPoSt(ctx context.Context, ppt abi.Registered // todo context with tighter deadline (+config) vanilla, err := l.storage.GenerateSingleVanillaProof(ctx, mid, s, ppt) + slk.Lock() + defer slk.Unlock() + if err != nil || vanilla == nil { - slk.Lock() skipped = append(skipped, abi.SectorID{ Miner: mid, Number: s.SectorNumber, }) - slk.Unlock() log.Errorf("get sector: %d, vanilla: %s, err: %s", s.SectorNumber, vanilla, err) return } + vproofs[i] = vanilla }(i, s) } wg.Wait() + var at = 0 + for i := range vproofs { + if vproofs[i] != nil { + vproofs[at] = vproofs[i] + at++ + } + } + vproofs = vproofs[:at] + res, err := sb.GenerateWindowPoStWithVanilla(ctx, ppt, mid, randomness, vproofs, partitionIdx) return storiface.WindowPoStResult{