Skip to content

Commit

Permalink
Merge pull request #5774 from filecoin-project/fix/post-fresh-rand
Browse files Browse the repository at this point in the history
wdpost: Always use head tipset to get randomness
  • Loading branch information
magik6k authored Mar 11, 2021
2 parents 097c65d + 728d86c commit edccf24
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion storage/wdpost_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err)
}

rand, err := s.api.ChainGetRandomnessFromBeacon(ctx, ts.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, di.Challenge, buf.Bytes())
headTs, err := s.api.ChainHead(ctx)
if err != nil {
return nil, xerrors.Errorf("getting current head: %w", err)
}

rand, err := s.api.ChainGetRandomnessFromBeacon(ctx, headTs.Key(), crypto.DomainSeparationTag_WindowedPoStChallengeSeed, di.Challenge, buf.Bytes())
if err != nil {
return nil, xerrors.Errorf("failed to get chain randomness from beacon for window post (ts=%d; deadline=%d): %w", ts.Height(), di, err)
}
Expand Down

0 comments on commit edccf24

Please sign in to comment.