wdpost: Wait for the correct confidence

This commit is contained in:
Łukasz Magiera 2020-08-14 21:03:20 +02:00
parent 4d204d2c25
commit 25cb3a15e7
2 changed files with 14 additions and 10 deletions

View File

@ -317,12 +317,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err) return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err)
} }
commEpoch := di.Open
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil)
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}
partitions, err := s.api.StateMinerPartitions(ctx, s.actor, di.Index, ts.Key()) partitions, err := s.api.StateMinerPartitions(ctx, s.actor, di.Index, ts.Key())
if err != nil { if err != nil {
return nil, xerrors.Errorf("getting partitions: %w", err) return nil, xerrors.Errorf("getting partitions: %w", err)
@ -332,8 +326,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
Deadline: di.Index, Deadline: di.Index,
Partitions: make([]miner.PoStPartition, 0, len(partitions)), Partitions: make([]miner.PoStPartition, 0, len(partitions)),
Proofs: nil, Proofs: nil,
ChainCommitEpoch: commEpoch,
ChainCommitRand: commRand,
} }
var sinfos []abi.SectorInfo var sinfos []abi.SectorInfo
@ -425,6 +417,15 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
} }
elapsed := time.Since(tsStart) elapsed := time.Since(tsStart)
commEpoch := di.Open
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil)
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}
params.ChainCommitEpoch = commEpoch
params.ChainCommitRand = commRand
log.Infow("submitting window PoSt", "elapsed", elapsed) log.Infow("submitting window PoSt", "elapsed", elapsed)
return params, nil return params, nil

View File

@ -190,8 +190,11 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err
s.abortActivePoSt() s.abortActivePoSt()
if di.Challenge+StartConfidence >= new.Height() { // TODO: wait for di.Challenge here, will give us ~10min more to compute windowpost
log.Info("not starting windowPost yet, waiting for startconfidence", di.Challenge, di.Challenge+StartConfidence, new.Height()) // (Need to get correct deadline above, which is tricky)
if di.Open+StartConfidence >= new.Height() {
log.Info("not starting windowPost yet, waiting for startconfidence", di.Open, di.Open+StartConfidence, new.Height())
return nil return nil
} }