use non-faulty sectors, instead of active, in post proof

In actors v2, active doesn't include "new" (unproven) sectors.
This commit is contained in:
Steven Allen 2020-09-30 17:33:20 -07:00
parent 47a83b422e
commit 196bf39574

View File

@ -327,17 +327,22 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
} }
for partIdx, partition := range partitions { for partIdx, partition := range partitions {
good, err := s.checkSectors(ctx, partition.ActiveSectors) nonFaulty, err := bitfield.SubtractBitField(partition.LiveSectors, partition.FaultySectors)
if err != nil {
return nil, nil, xerrors.Errorf("determining non faulty sectors: %w", err)
}
good, err := s.checkSectors(ctx, nonFaulty)
if err != nil { if err != nil {
return nil, nil, xerrors.Errorf("checking sectors: %w", err) return nil, nil, xerrors.Errorf("checking sectors: %w", err)
} }
faulty, err := bitfield.SubtractBitField(partition.ActiveSectors, good) newFaulty, err := bitfield.SubtractBitField(nonFaulty, good)
if err != nil { if err != nil {
return nil, nil, xerrors.Errorf("calculating faulty sector set: %w", err) return nil, nil, xerrors.Errorf("calculating faulty sector set: %w", err)
} }
c, err := faulty.Count() c, err := newFaulty.Count()
if err != nil { if err != nil {
return nil, nil, xerrors.Errorf("counting faulty sectors: %w", err) return nil, nil, xerrors.Errorf("counting faulty sectors: %w", err)
} }
@ -351,7 +356,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
params.Faults = append(params.Faults, miner.FaultDeclaration{ params.Faults = append(params.Faults, miner.FaultDeclaration{
Deadline: dlIdx, Deadline: dlIdx,
Partition: uint64(partIdx), Partition: uint64(partIdx),
Sectors: faulty, Sectors: newFaulty,
}) })
} }
@ -509,7 +514,11 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
var sinfos []proof.SectorInfo var sinfos []proof.SectorInfo
for partIdx, partition := range batch { for partIdx, partition := range batch {
// TODO: Can do this in parallel // TODO: Can do this in parallel
toProve, err := bitfield.MergeBitFields(partition.ActiveSectors, partition.RecoveringSectors) toProve, err := bitfield.SubtractBitField(partition.LiveSectors, partition.FaultySectors)
if err != nil {
return nil, xerrors.Errorf("removing faults from set of sectors to prove: %w", err)
}
toProve, err = bitfield.MergeBitFields(toProve, partition.RecoveringSectors)
if err != nil { if err != nil {
return nil, xerrors.Errorf("adding recoveries to set of sectors to prove: %w", err) return nil, xerrors.Errorf("adding recoveries to set of sectors to prove: %w", err)
} }