diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go index af823d83c..75badf36d 100644 --- a/chain/actors/policy/policy.go +++ b/chain/actors/policy/policy.go @@ -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. diff --git a/extern/storage-sealing/checks.go b/extern/storage-sealing/checks.go index db2e87d0e..5ee39e58f 100644 --- a/extern/storage-sealing/checks.go +++ b/extern/storage-sealing/checks.go @@ -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)} } diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index f5bb4cae6..e371ab33f 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -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 { m.inputLk.Lock()