Skip to content

Commit

Permalink
Merge pull request #6099 from filcloud/min-max-exp
Browse files Browse the repository at this point in the history
reasonable max value for initial sector expiration
  • Loading branch information
Stebalien authored Jul 30, 2021
2 parents b584f44 + 4273fb0 commit ff734ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions extern/storage-sealing/states_sealing.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@ func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("handlePreCommitting: failed to compute pre-commit expiry: %w", err)})
}

// Sectors must last _at least_ MinSectorExpiration + MaxSealDuration.
// TODO: The "+10" allows the pre-commit to take 10 blocks to be accepted.
nv, err := m.api.StateNetworkVersion(ctx.Context(), tok)
if err != nil {
return nil, big.Zero(), nil, ctx.Send(SectorSealPreCommit1Failed{xerrors.Errorf("failed to get network version: %w", err)})
Expand All @@ -316,7 +314,12 @@ func (m *Sealing) preCommitParams(ctx statemachine.Context, sector SectorInfo) (
if minExpiration := sector.TicketEpoch + policy.MaxPreCommitRandomnessLookback + msd + miner.MinSectorExpiration; expiration < minExpiration {
expiration = minExpiration
}
// TODO: enforce a reasonable _maximum_ sector lifetime?

// Assume: both precommit msg & commit msg land on chain as early as possible
maxExpiration := height + policy.GetPreCommitChallengeDelay() + policy.GetMaxSectorExpirationExtension()
if expiration > maxExpiration {
expiration = maxExpiration
}

params := &miner.SectorPreCommitInfo{
Expiration: expiration,
Expand Down

0 comments on commit ff734ed

Please sign in to comment.