Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do post earlier in tricky way #3828

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,27 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty

params.Proofs = postOut

// waitting head for committing
var head *types.TipSet
ticker := time.NewTicker(time.Duration(5) * time.Second)
wait:
for {
select {
case <-ticker.C:
head, err = s.api.ChainHead(ctx)
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness for windowPost (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}
if head.Height() > di.Open+StartConfidence {
break wait
}
case <-ctx.Done():
return nil, nil
}
}

commEpoch := di.Open
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, commEpoch, nil)
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, head.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)
}
Expand Down
17 changes: 12 additions & 5 deletions storage/wdpost_sched.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"

"golang.org/x/xerrors"

Expand Down Expand Up @@ -181,22 +182,28 @@ func (s *WindowPoStScheduler) update(ctx context.Context, new *types.TipSet) err
if err != nil {
return err
}
if di.Index == miner.WPoStPeriodDeadlines-1 {
di = miner.NewDeadlineInfo(di.NextPeriodStart(), 0, di.CurrentEpoch)
} else {
di = miner.NewDeadlineInfo(di.PeriodStart, di.Index+1, di.Open)
}

if deadlineEquals(s.activeDeadline, di) {
return nil // already working on this deadline
}

if !di.PeriodStarted() {
return nil // not proving anything yet
}
// when next deadline in next period, it will be failed here
// if !di.PeriodStarted() {
// return nil // not proving anything yet
// }

s.abortActivePoSt()

// 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())
if di.Challenge+StartConfidence >= new.Height() {
log.Info("not starting windowPost yet, waiting for startconfidence", di.Challenge, di.Challenge+StartConfidence, new.Height())
return nil
}

Expand Down