From fafaf0d7af0c14a74a83da65b539ac5810bc8346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 4 Jan 2024 12:47:30 +0100 Subject: [PATCH] fix: wdpost: fix vanilla proof indexes --- storage/sealer/worker_local.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/storage/sealer/worker_local.go b/storage/sealer/worker_local.go index 9f2f2efdc..7fc494955 100644 --- a/storage/sealer/worker_local.go +++ b/storage/sealer/worker_local.go @@ -664,7 +664,7 @@ func (l *LocalWorker) GenerateWindowPoStAdv(ctx context.Context, ppt abi.Registe var wg sync.WaitGroup wg.Add(len(sectors)) - vproofs := make([][]byte, 0, len(sectors)) + vproofs := make([][]byte, len(sectors)) for i, s := range sectors { if l.challengeThrottle != nil { @@ -702,8 +702,7 @@ func (l *LocalWorker) GenerateWindowPoStAdv(ctx context.Context, ppt abi.Registe return } - //vproofs[i] = vanilla // todo substitutes?? - vproofs = append(vproofs, vanilla) + vproofs[i] = vanilla }(i, s) } wg.Wait() @@ -717,6 +716,22 @@ func (l *LocalWorker) GenerateWindowPoStAdv(ctx context.Context, ppt abi.Registe return storiface.WindowPoStResult{Skipped: skipped}, nil } + // compact skipped sectors + var skippedSoFar int + for i := range vproofs { + if len(vproofs[i]) == 0 { + skippedSoFar++ + continue + } + + if skippedSoFar > 0 { + vproofs[i-skippedSoFar] = vproofs[i] + } + } + + vproofs = vproofs[:len(vproofs)-skippedSoFar] + + // compute the PoSt! res, err := sb.GenerateWindowPoStWithVanilla(ctx, ppt, mid, randomness, vproofs, partitionIdx) r := storiface.WindowPoStResult{ PoStProofs: res,