fix precommit ticket expiration handling

This commit is contained in:
He Weidong 2021-02-04 16:42:02 +08:00
parent ba571794dc
commit 0e2e1125d3
3 changed files with 7 additions and 13 deletions

View File

@ -25,9 +25,10 @@ import (
)
const (
ChainFinality = miner3.ChainFinality
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych3.SettleDelay
ChainFinality = miner3.ChainFinality
SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych3.SettleDelay
MaxPreCommitRandomnessLookback = builtin3.EpochsInDay + SealRandomnessLookback
)
// SetSupportedProofTypes sets supported proof types, across all actor versions.

View File

@ -4,7 +4,6 @@ import (
"bytes"
"context"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
@ -94,14 +93,9 @@ 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)}
}
nv, err := api.StateNetworkVersion(ctx, tok)
if err != nil {
return &ErrApi{xerrors.Errorf("calling StateNetworkVersion: %w", err)}
}
ticketEarliest := height - policy.MaxPreCommitRandomnessLookback
msd := policy.GetMaxProveCommitDuration(actors.VersionForNetwork(nv), si.SectorType)
if height-(si.TicketEpoch+policy.SealRandomnessLookback) > msd {
if si.TicketEpoch < ticketEarliest {
return &ErrExpiredTicket{xerrors.Errorf("ticket expired: seal height: %d, head: %d", si.TicketEpoch+policy.SealRandomnessLookback, height)}
}

View File

@ -12,7 +12,6 @@ import (
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-statemachine"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/api"
@ -22,7 +21,7 @@ import (
)
var DealSectorPriority = 1024
var MaxTicketAge = abi.ChainEpoch(builtin0.EpochsInDay * 2)
var MaxTicketAge = policy.MaxPreCommitRandomnessLookback
func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) error {
log.Infow("performing filling up rest of the sector...", "sector", sector.SectorNumber)