From 25cb3a15e786e5869133fbdb83bf694f421f1178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 14 Aug 2020 21:03:20 +0200 Subject: [PATCH] wdpost: Wait for the correct confidence --- storage/wdpost_run.go | 17 +++++++++-------- storage/wdpost_sched.go | 7 +++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/storage/wdpost_run.go b/storage/wdpost_run.go index e9e626533..13f5547eb 100644 --- a/storage/wdpost_run.go +++ b/storage/wdpost_run.go @@ -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) } - 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()) if err != nil { 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, Partitions: make([]miner.PoStPartition, 0, len(partitions)), Proofs: nil, - ChainCommitEpoch: commEpoch, - ChainCommitRand: commRand, } var sinfos []abi.SectorInfo @@ -425,6 +417,15 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo } 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) return params, nil diff --git a/storage/wdpost_sched.go b/storage/wdpost_sched.go index 8adfe2f76..2bf7799d9 100644 --- a/storage/wdpost_sched.go +++ b/storage/wdpost_sched.go @@ -190,8 +190,11 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err s.abortActivePoSt() - if di.Challenge+StartConfidence >= new.Height() { - log.Info("not starting windowPost yet, waiting for startconfidence", di.Challenge, di.Challenge+StartConfidence, new.Height()) + // TODO: wait for di.Challenge here, will give us ~10min more to compute windowpost + // (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 }