Remove ChainCommitEpoch from wdpost params, split MaxSealDuration into MaxProveCommitDuration and MaxPreCommitRandomnessLookback

This commit is contained in:
Aayush Rajasekaran 2020-09-03 00:00:51 -04:00
parent 9fcbaa72cc
commit 179dd0d89f
4 changed files with 6 additions and 8 deletions

View File

@ -91,7 +91,7 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
return &ErrBadCommD{xerrors.Errorf("on chain CommD differs from sector: %s != %s", commD, si.CommD)}
}
if height-(si.TicketEpoch+SealRandomnessLookback) > SealRandomnessLookbackLimit(si.SectorType) {
if height-(si.TicketEpoch+SealRandomnessLookback) > SealRandomnessLookbackLimit() {
return &ErrExpiredTicket{xerrors.Errorf("ticket expired: seal height: %d, head: %d", si.TicketEpoch+SealRandomnessLookback, height)}
}

View File

@ -9,8 +9,8 @@ import (
const SealRandomnessLookback = miner.ChainFinality
// Epochs
func SealRandomnessLookbackLimit(spt abi.RegisteredSealProof) abi.ChainEpoch {
return miner.MaxSealDuration[spt]
func SealRandomnessLookbackLimit() abi.ChainEpoch {
return miner.MaxPreCommitRandomnessLookback
}
// Epochs

View File

@ -178,9 +178,9 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
return ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)})
}
// Sectors must last _at least_ MinSectorExpiration + MaxSealDuration.
// Sectors must last _at least_ MinSectorExpiration + MaxProveCommitDuration.
// TODO: The "+10" allows the pre-commit to take 10 blocks to be accepted.
if minExpiration := height + miner.MaxSealDuration[sector.SectorType] + miner.MinSectorExpiration + 10; expiration < minExpiration {
if minExpiration := height + miner.MaxProveCommitDuration[sector.SectorType] + miner.MinSectorExpiration + 10; expiration < minExpiration {
expiration = minExpiration
}
// TODO: enforce a reasonable _maximum_ sector lifetime?

View File

@ -421,12 +421,10 @@ 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)
commRand, err := s.api.ChainGetRandomnessFromTickets(ctx, ts.Key(), crypto.DomainSeparationTag_PoStChainCommit, di.Challenge, 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)